质检详情优化
This commit is contained in:
parent
4fa317f7a4
commit
3a7ffef12f
@ -392,20 +392,41 @@ const detailIsCollapse = ref(true)
|
||||
const submitDetailModalVisible = ref(false)
|
||||
const traceCodeShow = ref(false)
|
||||
|
||||
const customOrderKeys = [
|
||||
'materialCode',
|
||||
'materialName',
|
||||
'materialQty',
|
||||
'processCode',
|
||||
'processName',
|
||||
'processQty',
|
||||
'assingCode',
|
||||
'workerName',
|
||||
'assingQty',
|
||||
'qcNo',
|
||||
'sourceType',
|
||||
'totalQty',
|
||||
'status',
|
||||
'inspector',
|
||||
'inspectTime',
|
||||
'traceType'
|
||||
]
|
||||
|
||||
const infoDataMapping = {
|
||||
id: '质检单编号',
|
||||
qcNo: '质检单编号',
|
||||
|
||||
materialCode: '物料编码',
|
||||
materialName: '物料名称',
|
||||
materialQty: '物料数量',
|
||||
processCode:'工序编号',
|
||||
processName:'工序名称',
|
||||
processQty:'生产总数',
|
||||
assingCode:'派工编号',
|
||||
workerName:'派工人',
|
||||
assingQty:'派工数量',
|
||||
qcNo: '质检单编号',
|
||||
sourceType: '来源类型',
|
||||
sourceId: '来源编号',
|
||||
orderId: '订单编号',
|
||||
processId: '工序编号',
|
||||
totalQty: '报检总数',
|
||||
status: '质检状态',
|
||||
inspectorId: '质检员编号',
|
||||
inspector: '质检员',
|
||||
inspectTime: '质检时间',
|
||||
traceType: '追溯类型'
|
||||
}
|
||||
@ -851,18 +872,28 @@ async function handleDetail(row: QualityTesting) {
|
||||
detailVisible.value = true
|
||||
const data = await qualityTestingApi.detail(row.id!)
|
||||
|
||||
// 映射后的数据
|
||||
mappedInfoList.value = Object.entries(data.info)
|
||||
.filter(([key]) => infoDataMap.has(key)) // 只保留配置里有的字段
|
||||
.map(([key, value]) => ({
|
||||
label: infoDataMap.get(key) || key, // 中文标签
|
||||
key, // 原字段名
|
||||
value // 原始值
|
||||
}))
|
||||
// // 映射后的数据
|
||||
// mappedInfoList.value = Object.entries(data.info)
|
||||
// .filter(([key]) => infoDataMap.has(key)) // 只保留配置里有的字段
|
||||
// .map(([key, value]) => ({
|
||||
// label: infoDataMap.get(key) || key, // 中文标签
|
||||
// key, // 原字段名
|
||||
// value // 原始值
|
||||
// }))
|
||||
setMappedInfoList(data.info)
|
||||
|
||||
detailTableData.value = data.detail
|
||||
}
|
||||
|
||||
// 组装列表时按上面自定义顺序循环
|
||||
function setMappedInfoList(rawData: Record<string, any>) {
|
||||
mappedInfoList.value = customOrderKeys.map(key => ({
|
||||
key,
|
||||
label: infoDataMapping[key as keyof typeof infoDataMapping],
|
||||
value: rawData[key]
|
||||
}))
|
||||
}
|
||||
|
||||
function formatDisplayValue(key: string, value: any): string {
|
||||
if (value === null || value === undefined) return '-'
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user