From 3d2a1e5bc593cd137a7923407d593fdeadacea17 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期六, 20 六月 2026 09:32:03 +0800
Subject: [PATCH] feat: 保养任务与记录详情查看

---
 src/views/equipmentManagement/upkeep/index.vue                |   40 +++++++
 src/views/equipmentManagement/upkeep/Form/detailDia.vue       |  118 +++++++++++++++++++++++
 src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue |   99 +++++++++++++++++++
 3 files changed, 254 insertions(+), 3 deletions(-)

diff --git a/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue b/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue
new file mode 100644
index 0000000..074628c
--- /dev/null
+++ b/src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue
@@ -0,0 +1,99 @@
+<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>
+
+		<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 dayjs from "dayjs";
+import { attachmentList } from "@/api/basicData/storageAttachment.js";
+import AttachmentUploadImage from '@/components/AttachmentUpload/image/index.vue';
+
+const dialogVisitable = ref(false);
+const detailData = ref({});
+const fileList = ref([]);
+
+const formatDate = (date) => {
+	return date ? dayjs(date).format("YYYY-MM-DD") : "--";
+};
+
+const openDialog = (row) => {
+	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 || [];
+			}
+		});
+	}
+};
+
+const cancel = () => {
+	dialogVisitable.value = false;
+};
+
+defineExpose({ openDialog });
+</script>
+
+<style scoped>
+.image-section {
+	margin-top: 20px;
+}
+.image-title {
+	font-weight: bold;
+	margin-bottom: 10px;
+	color: #606266;
+}
+</style>
diff --git a/src/views/equipmentManagement/upkeep/Form/detailDia.vue b/src/views/equipmentManagement/upkeep/Form/detailDia.vue
new file mode 100644
index 0000000..c80691a
--- /dev/null
+++ b/src/views/equipmentManagement/upkeep/Form/detailDia.vue
@@ -0,0 +1,118 @@
+<template>
+	<FormDialog
+		v-model="dialogVisitable"
+		title="淇濆吇浠诲姟璇︽儏"
+		width="800px"
+		operation-type="detail"
+		@close="cancel"
+	>
+		<el-descriptions border :column="2">
+			<el-descriptions-item label="璁惧鍚嶇О">
+				{{ detailData.taskName || '--' }}
+			</el-descriptions-item>
+			<el-descriptions-item label="瑙勬牸鍨嬪彿">
+				{{ detailData.deviceModel || '--' }}
+			</el-descriptions-item>
+			<el-descriptions-item label="褰曞叆浜�">
+				{{ detailData.registrant || '--' }}
+			</el-descriptions-item>
+			<el-descriptions-item label="鐧昏鏃堕棿">
+				{{ detailData.registrationDate || '--' }}
+			</el-descriptions-item>
+			<el-descriptions-item label="淇濆吇椤圭洰" :span="2">
+				{{ detailData.machineryCategory || '--' }}
+			</el-descriptions-item>
+			<el-descriptions-item label="淇濆吇浜�">
+				{{ detailData.maintenancePerson || '--' }}
+			</el-descriptions-item>
+			<el-descriptions-item label="浠诲姟棰戠巼">
+				{{ formatFrequencyType(detailData.frequencyType) }}
+			</el-descriptions-item>
+			<el-descriptions-item label="鎵ц鏃堕棿">
+				{{ formatFrequencyDetail(detailData.frequencyDetail) }}
+			</el-descriptions-item>
+			<el-descriptions-item label="瀹氭椂浠诲姟">
+				<el-tag :type="detailData.isActive === 1 ? 'success' : 'info'">
+					{{ detailData.isActive === 1 ? '寮�鍚�' : '鍏抽棴' }}
+				</el-tag>
+			</el-descriptions-item>
+			<el-descriptions-item label="澶囨敞" :span="2">
+				{{ detailData.remarks || '--' }}
+			</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>
+</template>
+
+<script setup>
+import FormDialog from "@/components/Dialog/FormDialog.vue";
+import { ref } from "vue";
+import { getLedgerById } from "@/api/equipmentManagement/ledger";
+import AttachmentUploadImage from '@/components/AttachmentUpload/image/index.vue';
+
+const dialogVisitable = ref(false);
+const detailData = ref({});
+const fileList = ref([]);
+
+const formatFrequencyType = (type) => {
+	const map = {
+		DAILY: "姣忔棩",
+		WEEKLY: "姣忓懆",
+		MONTHLY: "姣忔湀",
+		QUARTERLY: "瀛e害",
+	};
+	return map[type] || "--";
+};
+
+const formatFrequencyDetail = (detail) => {
+	if (!detail) return "--";
+	const replacements = {
+		MON: "鍛ㄤ竴",
+		TUE: "鍛ㄤ簩",
+		WED: "鍛ㄤ笁",
+		THU: "鍛ㄥ洓",
+		FRI: "鍛ㄤ簲",
+		SAT: "鍛ㄥ叚",
+		SUN: "鍛ㄦ棩",
+	};
+	return detail.replace(/MON|TUE|WED|THU|FRI|SAT|SUN/g, match => replacements[match]);
+};
+
+const openDialog = (row) => {
+	dialogVisitable.value = true;
+	detailData.value = { ...row };
+	fileList.value = [];
+
+	if (row.taskId) {
+		getLedgerById(row.taskId).then(res => {
+			if (res.code === 200 && res.data) {
+				fileList.value = res.data.storageBlobVOs || [];
+			}
+		});
+	}
+};
+
+const cancel = () => {
+	dialogVisitable.value = false;
+};
+
+defineExpose({ openDialog });
+</script>
+
+<style scoped>
+.image-section {
+	margin-top: 20px;
+}
+.image-title {
+	font-weight: bold;
+	margin-bottom: 10px;
+	color: #606266;
+}
+</style>
diff --git a/src/views/equipmentManagement/upkeep/index.vue b/src/views/equipmentManagement/upkeep/index.vue
index 52ad842..cd1adff 100644
--- a/src/views/equipmentManagement/upkeep/index.vue
+++ b/src/views/equipmentManagement/upkeep/index.vue
@@ -78,6 +78,11 @@
             <template #operation="{ row }">
               <el-button type="primary"
                          link
+                         @click="handleDetail(row)">
+                璇︽儏
+              </el-button>
+              <el-button type="primary"
+                         link
                          @click="editScheduledTask(row)">
                 缂栬緫
               </el-button>
@@ -177,6 +182,11 @@
                       type="warning">寰呬繚鍏�</el-tag>
             </template>
             <template #operation="{ row }">
+              <el-button type="primary"
+                         link
+                         @click="handleRecordDetail(row)">
+                璇︽儏
+              </el-button>
               <!-- 杩欎釜鍔熻兘璺熸柊澧炰繚鍏诲姛鑳戒竴妯′竴鏍凤紝鏈夊暐鎰忎箟锛� -->
               <!-- <el-button
               type="primary"
@@ -219,6 +229,8 @@
                       @ok="getTableData" />
     <FormDia ref="formDiaRef"
              @closeDia="getScheduledTableData" />
+    <DetailDia ref="detailDiaRef" />
+    <RecordDetailDia ref="recordDetailDiaRef" />
     <FileList v-if="fileDialogVisible"
               v-model:visible="fileDialogVisible"
               :record-type="'device_maintenance'"
@@ -241,6 +253,8 @@
   import PlanModal from "./Form/PlanModal.vue";
   import MaintenanceModal from "./Form/MaintenanceModal.vue";
   import FormDia from "./Form/formDia.vue";
+  import DetailDia from "./Form/detailDia.vue";
+  import RecordDetailDia from "./Form/RecordDetailDia.vue";
   import {
     getUpkeepPage,
     delUpkeep,
@@ -263,6 +277,10 @@
   const maintainModalRef = ref();
   // 瀹氭椂浠诲姟寮圭獥鎺у埗鍣�
   const formDiaRef = ref();
+  // 瀹氭椂浠诲姟璇︽儏寮圭獥鎺у埗鍣�
+  const detailDiaRef = ref();
+  // 淇濆吇璁板綍璇︽儏寮圭獥鎺у埗鍣�
+  const recordDetailDiaRef = ref();
   // 闄勪欢寮圭獥
   const fileListDialogRef = ref(null);
   const fileDialogVisible = ref(false);
@@ -314,7 +332,7 @@
     {
       prop: "frequencyType",
       label: "棰戞",
-      minWidth: 50,
+      minWidth: 80,
       // PIMTable 浣跨敤鐨勬槸 formatData锛岃�屼笉鏄� Element-Plus 鐨� formatter
       formatData: cell =>
         ({
@@ -371,7 +389,7 @@
       dataType: "slot",
       slot: "operation",
       align: "center",
-      width: "150px",
+      width: "160px",
     },
   ]);
 
@@ -445,7 +463,7 @@
       dataType: "slot",
       slot: "operation",
       align: "center",
-      width: "350px",
+      width: "250px",
     },
   ]);
 
@@ -503,6 +521,14 @@
     if (row) {
       nextTick(() => {
         formDiaRef.value?.openDialog("edit", row);
+      });
+    }
+  };
+
+  const handleDetail = row => {
+    if (row) {
+      nextTick(() => {
+        detailDiaRef.value?.openDialog(row);
       });
     }
   };
@@ -578,6 +604,14 @@
     maintainModalRef.value.open(row.id, row);
   };
 
+  const handleRecordDetail = row => {
+    if (row) {
+      nextTick(() => {
+        recordDetailDiaRef.value?.openDialog(row);
+      });
+    }
+  };
+
   const addPlan = () => {
     planModalRef.value.openModal();
   };

--
Gitblit v1.9.3