From 90839ac8191503b8706c97e607f69bfcb2dcb7a3 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 20 十月 2026 15:36:57 +0800
Subject: [PATCH] feat: 设备保养和巡检优化,项目拆分

---
 src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue |  226 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 159 insertions(+), 67 deletions(-)

diff --git a/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue b/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue
index 074628c..3c60c3a 100644
--- a/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue
+++ b/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue
@@ -1,99 +1,191 @@
 <template>
-	<FormDialog
-		v-model="dialogVisitable"
-		title="淇濆吇璁板綍璇︽儏"
-		width="800px"
-		operation-type="detail"
-		@close="cancel"
-	>
-		<el-descriptions border :column="2">
-			<el-descriptions-item label="璁惧鍚嶇О">
-				{{ detailData.deviceName || '--' }}
-			</el-descriptions-item>
-			<el-descriptions-item label="瑙勬牸鍨嬪彿">
-				{{ detailData.deviceModel || '--' }}
-			</el-descriptions-item>
-			<el-descriptions-item label="璁″垝淇濆吇鏃ユ湡">
-				{{ formatDate(detailData.maintenancePlanTime) }}
-			</el-descriptions-item>
-			<el-descriptions-item label="褰曞叆浜�">
-				{{ detailData.createUserName || '--' }}
-			</el-descriptions-item>
-			<el-descriptions-item label="淇濆吇椤圭洰" :span="2">
-				{{ detailData.machineryCategory || '--' }}
-			</el-descriptions-item>
-			<el-descriptions-item label="瀹為檯淇濆吇浜�">
-				{{ detailData.maintenanceActuallyName || '--' }}
-			</el-descriptions-item>
-			<el-descriptions-item label="瀹為檯淇濆吇鏃ユ湡">
-				{{ formatDate(detailData.maintenanceActuallyTime) }}
-			</el-descriptions-item>
-			<el-descriptions-item label="淇濆吇缁撴灉" :span="2">
-				{{ detailData.maintenanceResult || '--' }}
-			</el-descriptions-item>
-			<el-descriptions-item label="鐘舵��" :span="2">
-				<el-tag v-if="detailData.status === 2" type="danger">澶辫触</el-tag>
-				<el-tag v-else-if="detailData.status === 1" type="success">瀹岀粨</el-tag>
-				<el-tag v-else type="warning">寰呬繚鍏�</el-tag>
-			</el-descriptions-item>
-		</el-descriptions>
+  <FormDialog
+    v-model="dialogVisitable"
+    title="淇濆吇璁板綍璇︽儏"
+    width="860px"
+    operation-type="detail"
+    @close="cancel"
+  >
+    <el-descriptions border :column="2" label-width="110px">
+      <el-descriptions-item label="璁惧鍚嶇О">
+        {{ detailData.deviceName || "--" }}
+      </el-descriptions-item>
+      <el-descriptions-item label="瑙勬牸鍨嬪彿">
+        {{ detailData.deviceModel || "--" }}
+      </el-descriptions-item>
+      <el-descriptions-item label="璁″垝淇濆吇鏃ユ湡">
+        {{ formatDate(detailData.maintenancePlanTime) }}
+      </el-descriptions-item>
+      <el-descriptions-item label="褰曞叆浜�">
+        {{ detailData.createUserName || "--" }}
+      </el-descriptions-item>
+      <el-descriptions-item label="瀹為檯淇濆吇浜�">
+        {{ detailData.maintenanceActuallyName || "--" }}
+      </el-descriptions-item>
+      <el-descriptions-item label="瀹為檯淇濆吇鏃ユ湡">
+        {{ formatDate(detailData.maintenanceActuallyTime) }}
+      </el-descriptions-item>
+      <el-descriptions-item label="淇濆吇缁撴灉" :span="2">
+        {{ detailData.maintenanceResult || "--" }}
+      </el-descriptions-item>
+      <el-descriptions-item label="鐘舵��" :span="2">
+        <el-tag v-if="detailData.status === 2" type="danger" size="small">澶辫触</el-tag>
+        <el-tag v-else-if="detailData.status === 1" type="success" size="small">瀹岀粨</el-tag>
+        <el-tag v-else type="warning" size="small">寰呬繚鍏�</el-tag>
+      </el-descriptions-item>
+    </el-descriptions>
 
-		<div v-if="fileList && fileList.length > 0" class="image-section">
-			<div class="image-title">淇濆吇闄勪欢(鍥剧墖)锛�</div>
-			<AttachmentUploadImage
-				v-model:fileList="fileList"
-				:disabled="true"
-			/>
-		</div>
-	</FormDialog>
+    <div class="detail-section">
+      <div class="section-title">
+        <span>淇濆吇鍐呭</span>
+        <span class="section-count">鍏� {{ itemCount }} 椤癸紝宸插畬鎴� {{ doneCount }} 椤�</span>
+      </div>
+      <div v-if="itemCount" class="item-list">
+        <div
+          v-for="(item, index) in detailData.maintenanceItems"
+          :key="item.id || index"
+          class="item-row"
+        >
+          <span class="item-index">{{ index + 1 }}</span>
+          <div class="item-body">
+            <div class="item-head">
+              <span class="item-project">{{ item.itemProject || "鏈~鍐欎繚鍏婚」鐩�" }}</span>
+              <el-tag size="small" effect="light" :type="statusMeta(item.itemStatus).type">{{
+                statusMeta(item.itemStatus).label
+              }}</el-tag>
+            </div>
+            <div class="item-content">{{ item.itemName }}</div>
+          </div>
+        </div>
+      </div>
+      <el-empty v-else :image-size="48" description="鏆傛棤淇濆吇鍐呭" />
+    </div>
+
+    <div v-if="fileList && fileList.length > 0" class="image-section">
+      <div class="image-title">淇濆吇闄勪欢(鍥剧墖)锛�</div>
+      <AttachmentUploadImage v-model:fileList="fileList" :disabled="true" />
+    </div>
+  </FormDialog>
 </template>
 
 <script setup>
 import FormDialog from "@/components/Dialog/FormDialog.vue";
-import { ref } from "vue";
+import { computed, ref } from "vue";
 import dayjs from "dayjs";
 import { attachmentList } from "@/api/basicData/storageAttachment.js";
-import AttachmentUploadImage from '@/components/AttachmentUpload/image/index.vue';
+import AttachmentUploadImage from "@/components/AttachmentUpload/image/index.vue";
 
 const dialogVisitable = ref(false);
 const detailData = ref({});
 const fileList = ref([]);
+const itemCount = computed(() => detailData.value.maintenanceItems?.length || 0);
+const doneCount = computed(
+  () => (detailData.value.maintenanceItems || []).filter((item) => item.itemStatus === 1).length
+);
 
 const formatDate = (date) => {
-	return date ? dayjs(date).format("YYYY-MM-DD") : "--";
+  return date ? dayjs(date).format("YYYY-MM-DD") : "--";
+};
+
+const statusMeta = (status) => {
+  if (status === 1) return { label: "宸插畬鎴�", type: "success" };
+  if (status === 2) return { label: "寮傚父", type: "danger" };
+  if (Number(detailData.value.status) === 1) return { label: "鏈畬鎴�", type: "warning" };
+  return { label: "寰呭畬鎴�", type: "info" };
 };
 
 const openDialog = (row) => {
-	dialogVisitable.value = true;
-	detailData.value = { ...row };
-	fileList.value = [];
+  dialogVisitable.value = true;
+  detailData.value = { ...row };
+  fileList.value = [];
 
-	if (row.id) {
-		attachmentList({
-			recordType: 'device_maintenance',
-			recordId: row.id,
-		}).then(res => {
-			if (res && res.data) {
-				fileList.value = res.data || [];
-			}
-		});
-	}
+  if (row.id) {
+    attachmentList({
+      recordType: "device_maintenance",
+      recordId: row.id,
+    }).then((res) => {
+      if (res && res.data) {
+        fileList.value = res.data || [];
+      }
+    });
+  }
 };
 
 const cancel = () => {
-	dialogVisitable.value = false;
+  dialogVisitable.value = false;
 };
 
 defineExpose({ openDialog });
 </script>
 
 <style scoped>
+.detail-section {
+  margin-top: 16px;
+}
+.section-title {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 10px;
+  font-weight: 600;
+  color: #303133;
+}
+.section-count {
+  font-size: 12px;
+  font-weight: normal;
+  color: #909399;
+}
+.item-list {
+  border: 1px solid #ebeef5;
+  border-radius: 4px;
+  overflow: hidden;
+}
+.item-row {
+  display: flex;
+  gap: 12px;
+  padding: 12px 14px;
+  border-bottom: 1px solid #ebeef5;
+}
+.item-row:last-child {
+  border-bottom: none;
+}
+.item-index {
+  flex-shrink: 0;
+  width: 24px;
+  height: 24px;
+  line-height: 24px;
+  text-align: center;
+  border-radius: 50%;
+  background: #ecf5ff;
+  color: #409eff;
+  font-size: 12px;
+}
+.item-body {
+  flex: 1;
+  min-width: 0;
+}
+.item-head {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  margin-bottom: 4px;
+}
+.item-project {
+  font-weight: 600;
+  color: #303133;
+}
+.item-content {
+  line-height: 1.6;
+  color: #606266;
+  white-space: pre-wrap;
+  word-break: break-all;
+}
 .image-section {
-	margin-top: 20px;
+  margin-top: 20px;
 }
 .image-title {
-	font-weight: bold;
-	margin-bottom: 10px;
-	color: #606266;
+  font-weight: bold;
+  margin-bottom: 10px;
+  color: #606266;
 }
 </style>

--
Gitblit v1.9.3