From d06ed9fd3a475bdb81cef4718c6d30aa5d6555fc Mon Sep 17 00:00:00 2001 From: hwj Date: Sat, 10 Jan 2026 19:07:16 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=AE=BE=E5=A4=87=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6-=E8=AF=A6=E6=83=85-=E5=AF=B9=E6=8E=A5=E7=82=B9?= =?UTF-8?q?=E6=A3=80=E5=B1=A5=E5=8E=86/=E4=BF=9D=E5=85=BB=E5=B1=A5?= =?UTF-8?q?=E5=8E=86/=E7=BB=B4=E4=BF=AE=E5=B1=A5=E5=8E=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/deviceledger/index.vue | 303 ++++++++++++++++++++++++++- 1 file changed, 294 insertions(+), 9 deletions(-) diff --git a/src/views/mes/deviceledger/index.vue b/src/views/mes/deviceledger/index.vue index b529ff5b..f63a0912 100644 --- a/src/views/mes/deviceledger/index.vue +++ b/src/views/mes/deviceledger/index.vue @@ -160,8 +160,47 @@ link type="danger" @click="handleDelete(scope.row.id)" @@ -181,8 +220,47 @@ link type="danger" @click="handleDelete(scope.row.id)" @@ -190,7 +268,70 @@ link type="danger" @click="handleDelete(scope.row.id)" - + + + + +
+
+
+ {{ row.subjectCode ?? '-' }} + {{ row.subjectName ?? '-' }} +
+
+
+ 维修单ID + {{ row.repairId ?? '-' }} +
+
+ 项目内容 + {{ row.subjectContent ?? '-' }} +
+
+ 判定标准 + {{ row.subjectStandard ?? '-' }} +
+
+ 故障描述 + {{ row.malfunction ?? '-' }} +
+
+ 维修描述 + {{ row.repairDes ?? '-' }} +
+
+ 备注 + {{ row.remark ?? '-' }} +
+
+ 创建时间 + {{ formatHistoryTime(row.createTime) }} +
+
+ + + +
+
+
+
+
+
@@ -276,7 +417,17 @@ const getResultTagType = (value: any) => { return 'info' } -type HistoryStepItem = { key: string; name: string; result: any } +type HistoryStepItem = { + key: string + name: string + result: any + method?: any + criteria?: any + images?: string[] + remark?: any + inspectionTime?: any + createTime?: any +} type HistoryStepGroup = { key: string; time: string; operator: string; items: HistoryStepItem[] } const buildStepGroups = (rows: any[], options: { timeField: string; nameFieldCandidates: string[]; resultFieldCandidates: string[] }) => { @@ -295,7 +446,13 @@ const buildStepGroups = (rows: any[], options: { timeField: string; nameFieldCan const item: HistoryStepItem = { key: String(row?.id ?? `${groupKey}__${String(name)}`), name: String(name), - result + result, + method: row?.inspectionMethod, + criteria: row?.judgmentCriteria, + images: parseImages(row?.images), + remark: row?.remark, + inspectionTime: row?.inspectionTime, + createTime: row?.createTime } if (!groups.has(groupKey)) { @@ -318,12 +475,57 @@ const inspectionStepGroups = computed(() => { const maintainStepGroups = computed(() => { return buildStepGroups(maintainHistory.value, { - timeField: 'maintainTime', + timeField: 'inspectionTime', nameFieldCandidates: ['maintainItemName', 'inspectionItemName', 'name'], resultFieldCandidates: ['maintainResult', 'inspectionResult'] }) }) +type RepairHistoryRow = { + id?: any + repairId?: any + subjectId?: any + subjectCode?: any + subjectName?: any + subjectContent?: any + subjectStandard?: any + malfunction?: any + malfunctionUrl?: any + repairDes?: any + remark?: any + createTime?: any + malfunctionImages?: string[] +} + +type RepairHistoryGroup = { key: string; name: string; items: RepairHistoryRow[] } + +const repairActiveNames = ref([]) + +const repairGroups = computed(() => { + const raw = (detailData.value as any)?.repairList + if (!raw || typeof raw !== 'object') return [] + const entries = Object.entries(raw as Record) + const groups = entries + .map(([name, rows]) => { + const list = Array.isArray(rows) ? rows : [] + return { + key: String(name), + name: String(name), + items: list.map((row: any) => ({ + ...row, + malfunctionImages: parseImages(row?.malfunctionUrl) + })) + } as RepairHistoryGroup + }) + .filter((g) => g.items.length) + + return groups.sort((a, b) => { + const at = formatHistoryTime(a.items?.[0]?.createTime) + const bt = formatHistoryTime(b.items?.[0]?.createTime) + return String(bt).localeCompare(String(at)) + }) +}) + const tzStatusOptions = computed(() => { if (!dictReady.value) return [] const options = getIntDictOptions('mes_tz_status') @@ -414,7 +616,8 @@ const formatDetailDate = (value: any) => { const parseImages = (value: any): string[] => { if (!value) return [] if (Array.isArray(value)) return value.map(String).filter(Boolean) - return String(value) + const cleaned = String(value).replace(/[`'\"]/g, '').trim() + return cleaned .split(',') .map((v) => v.trim()) .filter(Boolean) @@ -435,6 +638,8 @@ const handleDetail = async (id: number) => { detailLoading.value = true try { detailData.value = await DeviceLedgerApi.getDeviceLedger(id) + const keys = Object.keys(((detailData.value as any)?.repairList ?? {}) as any) + repairActiveNames.value = keys.length ? [keys[0]] : [] } finally { detailLoading.value = false } @@ -594,11 +799,91 @@ onMounted(async () => { } .device-ledger-history-item { + display: flex; + flex-direction: column; + gap: 8px; + padding: 10px; + border: 1px solid var(--el-border-color-lighter); + border-radius: 8px; + background: var(--el-fill-color-blank); +} + +.device-ledger-history-item-head { display: flex; align-items: center; gap: 10px; } +.device-ledger-history-item-body { + display: flex; + flex-direction: column; + gap: 6px; + width: 100%; +} + +.device-ledger-history-item-row { + display: flex; + gap: 10px; +} + +.device-ledger-history-item-label { + width: 70px; + flex: 0 0 70px; + color: var(--el-text-color-secondary); +} + +.device-ledger-history-item-value { + flex: 1; + color: var(--el-text-color-regular); + word-break: break-word; +} + +.device-ledger-history-item-images { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-top: 4px; +} + +.device-ledger-history-item-image { + width: 76px; + height: 76px; + border-radius: 6px; + overflow: hidden; +} + +.device-ledger-history-image-error { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; + color: var(--el-text-color-secondary); + background: var(--el-fill-color); +} + +.device-ledger-repair-collapse { + padding: 8px 8px 0; +} + +.device-ledger-repair-title { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; +} + +.device-ledger-repair-name { + font-weight: 600; + color: var(--el-text-color-primary); +} + +.device-ledger-repair-meta { + color: var(--el-text-color-secondary); + font-size: 12px; +} + .device-ledger-history-item-text { color: var(--el-text-color-regular); }