From 26e0f4997558b60eda9dcb8979b777b47b31675e Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期六, 19 七月 2025 17:14:43 +0800 Subject: [PATCH] 优化巡检管理显示及数据处理 --- src/views/procureMent/index.vue | 4 + src/views/inspectionUpload/index.vue | 2 src/views/inspectionManagement/index.vue | 59 ++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/views/inspectionManagement/index.vue b/src/views/inspectionManagement/index.vue index 9af25ca..7e5edc0 100644 --- a/src/views/inspectionManagement/index.vue +++ b/src/views/inspectionManagement/index.vue @@ -56,7 +56,26 @@ @edit="handleAdd" @viewFile="viewFile" v-if="tabName === 'task'" - ></ETable> + > + <template #inspector="{ row }"> + <div class="person-tags"> + <!-- 璋冭瘯淇℃伅锛屼笂绾挎椂鍒犻櫎 --> + <!-- {{ console.log('inspector data:', row.inspector) }} --> + <template v-if="row.inspector && row.inspector.length > 0"> + <el-tag + v-for="(person, index) in row.inspector" + :key="index" + size="small" + type="primary" + class="person-tag" + > + {{ person }} + </el-tag> + </template> + <span v-else class="no-data">--</span> + </div> + </template> + </ETable> <el-table ref="table" :data="tableData" height="480" v-loading="tableLoading" border v-else style="width: 100%;height: calc(100vh - 25em)"> <el-table-column label="搴忓彿" type="index" width="60" align="center" /> <el-table-column prop="deviceName" label="璁惧鍚嶇О" :show-overflow-tooltip="true"> @@ -162,7 +181,7 @@ { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 160 }, { prop: "inspectionLocation", label: "鍦扮偣", minWidth: 120 }, { prop: "remarks", label: "澶囨敞", minWidth: 150 }, - { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150 }, + { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150, slot: "inspector" }, { prop: "frequencyType", label: "棰戞", @@ -269,7 +288,27 @@ } apiCall.then(res => { - tableData.value = res.data.records || []; + const rawData = res.data.records || []; + // 澶勭悊 inspector 瀛楁锛屽皢瀛楃涓茶浆鎹负鏁扮粍锛堥�傜敤浜庢墍鏈夋儏鍐碉級 + tableData.value = rawData.map(item => { + const processedItem = { ...item }; + + // 澶勭悊 inspector 瀛楁 + if (processedItem.inspector) { + if (typeof processedItem.inspector === 'string') { + // 瀛楃涓叉寜閫楀彿鍒嗗壊 + processedItem.inspector = processedItem.inspector.split(',').map(s => s.trim()).filter(s => s); + } else if (!Array.isArray(processedItem.inspector)) { + // 闈炴暟缁勮浆涓烘暟缁� + processedItem.inspector = [processedItem.inspector]; + } + } else { + // 绌哄�艰涓虹┖鏁扮粍 + processedItem.inspector = []; + } + + return processedItem; + }); total.value = res.data.total || 0; }).finally(() => { tableLoading.value = false; @@ -334,5 +373,19 @@ </script> <style scoped> +.person-tags { + display: flex; + flex-wrap: wrap; + gap: 4px; +} +.person-tag { + margin-right: 4px; + margin-bottom: 2px; +} + +.no-data { + color: #909399; + font-size: 14px; +} </style> \ No newline at end of file diff --git a/src/views/inspectionUpload/index.vue b/src/views/inspectionUpload/index.vue index 12bb8c8..29f6c38 100644 --- a/src/views/inspectionUpload/index.vue +++ b/src/views/inspectionUpload/index.vue @@ -57,7 +57,7 @@ <el-table ref="table" :data="tableData" height="480" v-loading="tableLoading" v-if="activeTab !== 'qrCode'" border style="width: 100%;height: calc(100vh - 20em)"> <el-table-column label="搴忓彿" type="index" width="60" align="center" /> <el-table-column prop="taskName" label="宸℃浠诲姟鍚嶇О" :show-overflow-tooltip="true"></el-table-column> - <el-table-column prop="port" label="鍦扮偣" :show-overflow-tooltip="true"></el-table-column> + <el-table-column prop="inspectionLocation" label="鍦扮偣" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="remarks" label="澶囨敞"></el-table-column> <el-table-column prop="inspector" label="鎵ц宸℃浜�"></el-table-column> <el-table-column fixed="right" label="鎿嶄綔"> diff --git a/src/views/procureMent/index.vue b/src/views/procureMent/index.vue index ee9d5c5..38dcbe5 100644 --- a/src/views/procureMent/index.vue +++ b/src/views/procureMent/index.vue @@ -85,7 +85,9 @@ // 寮曞叆瀛楀吀鏁版嵁 const { proxy } = getCurrentInstance(); const dialogFormVisible = ref(false); -const form = ref({}); +const form = ref({ + taxRate: "13" +}); const title = ref(""); // 鐘舵�佸彉閲� const loading = ref(false); -- Gitblit v1.9.3