提交
This commit is contained in:
1 parent
64219a68c7
commit
9a73e87ce8
102 files changed
+16756
-6670
No files matched your search
@@ -56,8 +56,8 @@
|
||||
<el-table-column label="批号" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号" min-width="120" align="center" header-align="center">
|
||||
<template #default="{ row }">{{ row.specModel || '—' }}</template>
|
||||
<el-table-column label="领用人" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">{{ row.receiverName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用量" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
@@ -96,7 +96,6 @@
|
||||
fetchQcTaskMaterialUsages,
|
||||
type QcTaskMaterialUsageItem
|
||||
} from '@/api/qc-task-result'
|
||||
import { fetchQcMaterialBatchOptions, type QcMaterialBatchOption } from '@/api/qc-material'
|
||||
import {
|
||||
taskTypeLabel,
|
||||
taskStatusLabel,
|
||||
@@ -127,11 +126,10 @@
|
||||
})
|
||||
|
||||
type ViewMaterialUsageRow = {
|
||||
batchId: string
|
||||
stockInNo: string
|
||||
materialName: string
|
||||
specModel: string
|
||||
batchNo: string
|
||||
receiverName: string
|
||||
unit: string
|
||||
qty: number | undefined
|
||||
remark: string
|
||||
@@ -144,32 +142,18 @@
|
||||
|
||||
function materialRowsFromApi(items: QcTaskMaterialUsageItem[]): ViewMaterialUsageRow[] {
|
||||
return (items || [])
|
||||
.filter((u) => (u.batchId || '').trim())
|
||||
.filter((u) => (u.requisitionUsageId || u.parentUsageId || '').trim())
|
||||
.map((u) => ({
|
||||
batchId: u.batchId,
|
||||
stockInNo: u.stockInNo || '',
|
||||
materialName: u.materialName || '',
|
||||
specModel: '',
|
||||
batchNo: u.batchNo || '',
|
||||
unit: '',
|
||||
receiverName: u.requisitionReceiverName || u.receiverName || '',
|
||||
unit: (u.usageUnit || '').trim(),
|
||||
qty: Math.abs(Number(u.changeQty) || 0) || undefined,
|
||||
remark: u.remark || ''
|
||||
}))
|
||||
}
|
||||
|
||||
function enrichMaterialUsageRows(rows: ViewMaterialUsageRow[], options: QcMaterialBatchOption[]) {
|
||||
for (const row of rows) {
|
||||
const opt = options.find((o) => o.id === row.batchId)
|
||||
if (opt) {
|
||||
row.stockInNo = opt.stockInNo || row.stockInNo
|
||||
row.materialName = opt.materialName || row.materialName
|
||||
row.specModel = opt.specModel || ''
|
||||
row.batchNo = opt.batchNo || row.batchNo
|
||||
row.unit = opt.unit || ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.taskId] as const,
|
||||
async ([vis, id]) => {
|
||||
@@ -190,13 +174,10 @@
|
||||
viewMaterialUsages.value = []
|
||||
if (detail.taskType !== 'dsfjc') {
|
||||
try {
|
||||
const [savedUsages, opts] = await Promise.all([
|
||||
fetchQcTaskMaterialUsages(id).catch(() => [] as QcTaskMaterialUsageItem[]),
|
||||
fetchQcMaterialBatchOptions().catch(() => [] as QcMaterialBatchOption[])
|
||||
])
|
||||
const rows = materialRowsFromApi(savedUsages || [])
|
||||
enrichMaterialUsageRows(rows, opts || [])
|
||||
viewMaterialUsages.value = rows
|
||||
const savedUsages = await fetchQcTaskMaterialUsages(id).catch(
|
||||
() => [] as QcTaskMaterialUsageItem[]
|
||||
)
|
||||
viewMaterialUsages.value = materialRowsFromApi(savedUsages || [])
|
||||
} catch {
|
||||
viewMaterialUsages.value = []
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user