From 2cd5839cc3957b9443453409fc84402e11bbdfdf Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Sat, 12 Apr 2025 17:30:23 +0800
Subject: [PATCH] feat: 整理样式代码:table表格,分页,查看按钮

---
 src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetailsDialog.vue |  267 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 231 insertions(+), 36 deletions(-)

diff --git a/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetailsDialog.vue b/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetailsDialog.vue
index 0a9c5a6..5732667 100644
--- a/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetailsDialog.vue
+++ b/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetailsDialog.vue
@@ -1,12 +1,18 @@
  <!--  巡检任务情况-详情 -->
 <template>
 	<el-dialog
+		class="inspection-rask-details-dialog"
 		v-model="isShowDetailsDialog"
-		title="巡检任务详情"
 		:width="pxToRem(1000)"
 		:close-on-click-modal="false"
 		:destroy-on-close="true"
 	>
+		<template #header="{ titleId, titleClass }">
+			<div class="my-header">
+				<img src="/src/assets/images/home/homeLeft/inspection-union.png" alt="" />
+				<span :id="titleId" :class="titleClass">巡检任务详情</span>
+			</div>
+		</template>
 		<!-- 搜索 -->
 		<el-form :model="searchForm" inline>
 			<div class="search-row">
@@ -47,37 +53,75 @@
 					/>
 				</el-form-item>
 				<el-form-item>
-					<el-button @click="handleReset">重置</el-button>
-					<el-button type="primary" @click="handleSearch">查询</el-button>
+					<div class="reset" @click="handleReset"></div>
+					<div class="searchs" @click="handleSearch"></div>
 				</el-form-item>
 			</div>
 		</el-form>
 		<!-- 表格 -->
-		<el-table :data="taskDetailData" style="width: 100%">
-			<el-table-column label="序号" width="60">
-				<template #default="scope">
-					{{ (taskDetailParams.page - 1) * taskDetailParams.limit + scope.$index + 1 }}
-				</template>
-			</el-table-column>
-			<el-table-column prop="job_info_num" label="任务编号" />
-			<el-table-column prop="name" label="任务名称" />
-			<el-table-column prop="device_names" label="所属机巢" />
-			<el-table-column prop="ai_type_str" label="关联算法" />
-			<el-table-column prop="status" label="任务状态" />
-			<el-table-column prop="industry_type_str" label="任务类型" />
-			<el-table-column prop="begin_time" label="任务时间" />
-			<el-table-column prop="name" label="关联事件" />
-			<el-table-column label="操作"> <el-button link type="primary" size="small">查看</el-button></el-table-column>
-		</el-table>
+		<div class="tabledata ztzf-table">
+			<el-table
+				:data="taskDetailData"
+				:row-class-name="tableRowClassName"
+				:row-style="{ height: '54px', fontSize: '14px', 'text-align': 'center' }"
+				:header-cell-style="{ 'text-align': 'center', height: '36px', fontSize: '14px' }"
+			>
+				<el-table-column label="序号" type="index" width="60">
+					<template #default="{ $index }">
+						{{ ($index + 1).toString().padStart(2, '0') }}
+					</template>
+				</el-table-column>
+				<el-table-column show-overflow-tooltip prop="job_info_num" label="任务编号" />
+				<el-table-column prop="name" show-overflow-tooltip label="任务名称" />
+				<el-table-column prop="device_names" show-overflow-tooltip label="所属机巢" />
+				<el-table-column show-overflow-tooltip prop="ai_type_str" label="关联算法" />
+				<el-table-column prop="status" label="任务状态">
+					<template #default="scope">
+						<span
+							:class="
+								scope.row.status == 1
+									? 'pending '
+									: scope.row.status == 2
+									? 'distributed'
+									: scope.row.status == 3
+									? 'finish '
+									: scope.row.status == 4
+									? 'cancel '
+									: 'fail '
+							"
+						>
+							{{
+								scope.row.status == 1
+									? '待执行'
+									: scope.row.status == 2
+									? '执行中'
+									: scope.row.status == 3
+									? '完成'
+									: scope.row.status == 4
+									? '取消'
+									: '失败'
+							}}
+						</span>
+					</template>
+				</el-table-column>
+				<el-table-column show-overflow-tooltip prop="industry_type_str" label="任务类型" />
+				<el-table-column prop="begin_time" label="任务时间" width="150" />
+				<el-table-column prop="event_number" label="关联事件">
+					<template #default="scope">
+						<span>{{ scope.row.event_number ? scope.row.event_number : '/' }}</span>
+					</template>
+				</el-table-column>
+				<el-table-column label="操作" width="80"><div class="ztzf-view ">查看</div></el-table-column>
+			</el-table>
+		</div>
 		<!-- 分页 -->
-		<div class="pagination">
+		<div class="pagination ztzf-pagination">
 			<el-pagination
-				v-model:current-page="pageParams.page"
-				v-model:page-size="pageParams.limit"
+				v-model:current-page="pageParams.current"
+				v-model:page-size="pageParams.size"
 				:page-sizes="[10, 20, 30, 50]"
 				background
-				:disabled="disabled"
-				layout="total, sizes, prev, pager, next, jumper"
+				layout=" prev, pager, next, jumper"
 				:total="total"
 				@size-change="handleSizeChange"
 				@current-change="handleCurrentChange"
@@ -120,16 +164,16 @@
 const taskDetailData = ref([])
 // 表格参数
 const taskDetailParams = reactive({
-	page: 1,
-	limit: 10,
+	current: 1,
+	size: 10,
 	searchParams: {},
 })
 // 分页
 const total = ref(0)
 // 分页参数
 let pageParams = reactive({
-	page: 1,
-	limit: 10,
+	current: 1,
+	size: 10,
 })
 // 日期选择
 const changeselect = () => {
@@ -154,20 +198,19 @@
 }
 // 查询
 const handleSearch = () => {
-	taskDetailParams.page = 1
-	taskDetailParams.limit = 10
+	taskDetailParams.current = 1
+	taskDetailParams.size = 10
 	taskDetailParams.searchParams = searchForm
-	console.log('taskDetailParams.value', taskDetailParams)
 	getJobList()
 }
 // 分页大小改变
 const handleSizeChange = val => {
-	pageParams.limit = val
+	taskDetailParams.size = val
 	getJobList()
 }
 // 页码改变
 const handleCurrentChange = val => {
-	pageParams.page = val
+	taskDetailParams.current = val
 	getJobList()
 }
 // 获取任务列表
@@ -200,6 +243,13 @@
 const algorithmChange = val => {
 	searchForm.ai_types = val
 }
+const tableRowClassName = ({ row, rowIndex }) => {
+	if (rowIndex % 2 === 1) {
+		return 'warning-row'
+	} else {
+		return 'success-row'
+	}
+}
 onMounted(() => {
 	requestDictionary()
 	getJobList()
@@ -211,6 +261,7 @@
 	display: flex;
 	justify-content: space-between;
 	align-items: center;
+	margin: 0 37px;
 	.el-form-item {
 		flex: 1;
 	}
@@ -218,7 +269,6 @@
 :deep(.el-form) {
 	.el-form-item {
 		margin-bottom: 0;
-		margin-right: 20px;
 		.el-form-item__label {
 			color: #fff;
 		}
@@ -241,8 +291,153 @@
 		height: var(--el-input-height, var(--el-component-size));
 		width: 0 !important;
 	}
+	.el-select__wrapper {
+		background: #012a50;
+		height: 100%;
+		padding-left: 20px;
+		border: 1px solid #51a8ff;
+		box-shadow: none !important;
+	}
+
+	.el-select__selected-item {
+		font-family: Source Han Sans CN, Source Han Sans CN, serif;
+
+		line-height: 18px;
+		font-weight: 400;
+		font-size: 16px;
+		color: #296aca;
+	}
+	.el-input__wrapper {
+		background: #012a50 !important;
+		box-shadow: none !important;
+		border: 1px solid #178bff;
+	}
+	.el-input__inner::placeholder {
+		color: #296aca;
+	}
+	.el-form-item__label {
+		font-family: Segoe UI, Segoe UI;
+		font-weight: 400;
+		font-size: 16px;
+		color: #ffffff;
+	}
+	.el-date-editor .el-range-separator {
+		color: #ffffff !important;
+	}
 }
-.pagination {
-	margin-top: 20px;
+:deep(.el-pagination) {
+	display: flex;
+	justify-content: center;
+	margin-top: 10px;
+}
+:deep(.el-pagination button) {
+	background: center center no-repeat none !important;
+	color: #8eb8ea !important;
+}
+
+.el-table__body {
+	border-collapse: collapse;
+}
+
+.my-header {
+	display: inline-block;
+	vertical-align: middle;
+	margin-left: 12px;
+}
+.reset {
+	width: 137px;
+	height: 32px;
+	cursor: pointer;
+	background: url('/src/assets/images/home/homeLeft/‌inspection-reset.png') no-repeat center;
+	background-size: 100% 100%;
+}
+.searchs {
+	margin-left: 23px;
+	cursor: pointer;
+	width: 137px;
+	height: 32px;
+	background: url('/src/assets/images/home/homeLeft/in‌spection-select.png') no-repeat center;
+	background-size: 100% 100%;
+}
+.tabledata {
+	padding: 0 16px;
+	overflow: hidden;
+	height: 640px;
+	overflow-y: scroll !important;
+}
+
+// 任务状态颜色
+.pending {
+	color: #e36913;
+}
+.distributed {
+	color: #ffc398;
+}
+.finish {
+	color: #afd9fb;
+}
+.cancel {
+	color: #11c4ff;
+}
+.fail {
+	color: #8cfea7;
 }
 </style>
+<style lang="scss">
+.inspection-rask-details-dialog {
+	width: 1270px;
+	height: 856px;
+	background: #0f1929;
+	box-shadow: inset 0px -50px 50px 0px rgba(27, 148, 255, 0.13);
+	border-radius: 20px 0px 0px 0px;
+	border: 2px solid;
+	padding: 0 !important;
+
+	border-image: linear-gradient(
+			180deg,
+			rgba(81, 168, 255, 0),
+			rgba(48, 111, 202, 1),
+			rgba(255, 255, 255, 1),
+			rgba(27, 148, 255, 1)
+		)
+		2 2;
+	/* 头部 */
+	.el-dialog__header {
+		width: 1270px;
+		height: 47px;
+		margin-bottom: 14px;
+		background: url('/src/assets/images/home/homeLeft/inspection-vector.png') no-repeat center;
+		background-size: 100% 100%;
+		font-weight: bold;
+		font-size: 16px;
+		line-height: 47px;
+	}
+
+	.el-dialog .el-dialog__header {
+		/* margin: 0px !important; */
+		padding: 0px !important;
+		padding-left: 0px !important;
+	}
+	/* 头部 */
+	.el-dialog__title {
+		width: 112px;
+		height: 19px;
+		font-family: Segoe UI, Segoe UI;
+		font-weight: bold;
+		font-size: 16px;
+		line-height: 16px;
+		text-shadow: 0px 0px 5px rgba(154, 218, 255, 0.6);
+		text-align: left;
+		font-style: normal;
+		text-transform: none;
+		background: linear-gradient(90deg, #fbfdff 0%, #86d4ff 100%);
+		margin-left: 16px;
+		-webkit-background-clip: text; /* 背景被裁剪成文字的前景色 */
+		-webkit-text-fill-color: transparent; /* 文字填充颜色变透明 */
+	}
+	
+	.el-scrollbar__thumb {
+		background: #13c6ff !important;
+	}
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3