|
|
|
|
@ -207,6 +207,8 @@ import { DICT_TYPE, getDictLabel, initAllDict } from '@/utils/dict'
|
|
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const moldId = ref(undefined)
|
|
|
|
|
const moldCode = ref(undefined)
|
|
|
|
|
const moldType = ref(undefined)
|
|
|
|
|
const detailData = ref(null)
|
|
|
|
|
const inspectionList = ref([])
|
|
|
|
|
const maintainList = ref([])
|
|
|
|
|
@ -312,24 +314,30 @@ function handleTabChange(e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onLoad((query) => {
|
|
|
|
|
const rawId = query && (query.id !== undefined ? query.id : query.code)
|
|
|
|
|
const rawId = query && query.id
|
|
|
|
|
const decoded = rawId ? decodeURIComponent(String(rawId)) : ''
|
|
|
|
|
moldId.value = decoded ? decoded : undefined
|
|
|
|
|
moldType.value = query && query.type
|
|
|
|
|
moldCode.value = query && query.code
|
|
|
|
|
fetchAll()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function fetchAll() {
|
|
|
|
|
if (!moldId.value) {
|
|
|
|
|
if (!moldId.value && !moldCode.value) {
|
|
|
|
|
uni.showToast({ title: '缺少模具ID', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const isScan = moldType.value === 'scan'
|
|
|
|
|
const idParam = isScan ? { id: moldId.value } : { code: moldCode.value }
|
|
|
|
|
const moldIdParam = isScan ? { moldId: moldId.value } : { code: moldCode.value }
|
|
|
|
|
|
|
|
|
|
const [detailRes, inspectionRes, maintainRes, repairRes] = await Promise.all([
|
|
|
|
|
getMoldDetail(moldId.value),
|
|
|
|
|
getMoldInspectionByMoldId(moldId.value),
|
|
|
|
|
getMoldMaintenanceByMoldId(moldId.value),
|
|
|
|
|
getMoldRepairListByMoldId(moldId.value)
|
|
|
|
|
getMoldDetail(moldId.value, idParam),
|
|
|
|
|
getMoldInspectionByMoldId(moldId.value, moldIdParam),
|
|
|
|
|
getMoldMaintenanceByMoldId(moldId.value, moldIdParam),
|
|
|
|
|
getMoldRepairListByMoldId(moldId.value, moldIdParam)
|
|
|
|
|
])
|
|
|
|
|
detailData.value = detailRes.data
|
|
|
|
|
inspectionList.value = normalizeList(inspectionRes)
|
|
|
|
|
|