diff --git a/src/locales/en.ts b/src/locales/en.ts index 95bc39b1..4c9e1ede 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -2591,7 +2591,8 @@ export default { replaceNetRemark: 'Remark', placeholderReplaceNetRemark: 'Please input remark', moldInfo: 'Mold Info', - maintainInfo: 'Maintain Info' + maintainInfo: 'Maintain Info', + inspectionResult: 'Inspection Result' }, MoldBrandDetail: { diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index c4819fa3..3d78c23a 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -2074,7 +2074,8 @@ export default { replaceNetRemark: '备注', placeholderReplaceNetRemark: '请输入备注', moldInfo: '模具信息', - maintainInfo: '维护信息' + maintainInfo: '维护信息', + inspectionResult: '检验结果' }, MoldBrandDetail: { diff --git a/src/views/erp/mold/components/MoldMaintainView.vue b/src/views/erp/mold/components/MoldMaintainView.vue index d84c0230..97b82088 100644 --- a/src/views/erp/mold/components/MoldMaintainView.vue +++ b/src/views/erp/mold/components/MoldMaintainView.vue @@ -75,20 +75,123 @@ - - - - - - + + + + + + + + {{ t('common.select') }} + + + + {{ t('MoldManagement.MoldBrandPage.inspectionResult') }} + + + + + {{ ticketResultEditable ? '停止编辑' : '编辑' }} + + + + + + + + + + + + + + 待检测 + 通过 + 不通过 + - + + + + + + + - + + + + + + + + + + + - + + + + + + + 通过 + 不通过 + + - + + + + + - {{ t('common.select') }} - + @@ -505,6 +608,17 @@ const selectedProjectFormId = ref('') // 已确认选中的 id const selectedProjectFormName = ref('') // 已确认选中的名称 const subjectListMap = ref>({}) const subjectLoadingMap = ref>({}) +const ticketResultList = ref([]) +const ticketResultEditable = ref(false) +const ticketResultPageNo = ref(1) +const ticketResultPageSize = 5 +const ticketResultPageData = computed(() => { + const start = (ticketResultPageNo.value - 1) * ticketResultPageSize + return ticketResultList.value.slice(start, start + ticketResultPageSize) +}) +const handleTicketResultPageChange = () => { + // 分页切换,数据由 computed 自动计算 +} const projectFormPageParams = reactive({ pageNo: 1, @@ -541,11 +655,18 @@ const handleProjectFormRadioChange = (row: any) => { tempSelectedProjectForm.value = row } -const confirmProjectFormSelection = () => { +const confirmProjectFormSelection = async () => { if (!tempSelectedProjectForm.value) return selectedProjectFormId.value = String(tempSelectedProjectForm.value.id) selectedProjectFormName.value = tempSelectedProjectForm.value.planName ?? String(tempSelectedProjectForm.value.id) taskFormData.projectForm = selectedProjectFormId.value + if (Array.isArray(tempSelectedProjectForm.value.subjectList)) { + subjectListMap.value[selectedProjectFormId.value] = tempSelectedProjectForm.value.subjectList + } else { + await ensureSubjectListLoaded(selectedProjectFormId.value) + } + setTicketResultList(subjectListMap.value[selectedProjectFormId.value] ?? []) + ticketResultEditable.value = false projectFormDialogVisible.value = false } @@ -563,6 +684,36 @@ const ensureSubjectListLoaded = async (planId: number | string) => { } } +const setTicketResultList = (subjectList: any[]) => { + ticketResultList.value = (subjectList ?? []).map((item: any, index: number) => ({ + id: item.id, + subjectId: item.id, + inspectionItemName: item.subjectName ?? item.inspectionItemName ?? '', + inspectionMethod: item.inspectionMethod ?? '', + judgmentCriteria: item.judgmentCriteria ?? item.subjectStandard ?? '', + valueType: item.valueType ?? '', + textInput: item.textInput ?? '', + inspectionResult: item.inspectionResult ?? '0', + images: item.images ?? '', + remark: item.remark ?? '', + sort: index + 1 + })) + ticketResultPageNo.value = 1 +} + +const parseImages = (value: any): string[] => { + if (!value) return [] + if (Array.isArray(value)) return value.map(String).filter(Boolean) + return String(value) + .split(',') + .map((v) => v.trim()) + .filter(Boolean) +} + +const parseFirstImage = (value: any): string => { + return parseImages(value)[0] || '' +} + const handleProjectFormExpandChange = async (row: any, expandedRows: any[]) => { const isExpanded = expandedRows.some((r) => String(r.id) === String(row.id)) if (!isExpanded) return @@ -649,7 +800,8 @@ const submitForm = async () => { name: taskFormData.name, taskType: String(taskFormData.taskType), moldList: props.mold?.id ? String(props.mold.id) : undefined, - projectForm: taskFormData.projectForm + projectForm: taskFormData.projectForm, + ticketResultsList: ticketResultList.value.map((item: any) => ({ ...item })) }) message.success(t('common.createSuccess')) // 清空已提交的表单数据 @@ -657,6 +809,8 @@ const submitForm = async () => { taskFormData.projectForm = '' selectedProjectFormId.value = '' selectedProjectFormName.value = '' + ticketResultList.value = [] + ticketResultEditable.value = false } else if (isRepair.value) { // 提交维修单 const payload: any = { @@ -847,6 +1001,46 @@ defineExpose({ open }) white-space: nowrap; } +.mold-maintain-inspect-layout { + display: flex; + flex-direction: column; + gap: 20px; + align-items: stretch; +} + +.mold-maintain-inspect-layout__form { + min-width: 0; +} + +.mold-maintain-ticket-results { + min-width: 0; + padding: 14px; + border: 1px solid var(--el-border-color-lighter); + border-radius: 8px; + background: #fafafa; +} + +.mold-maintain-ticket-results__header { + display: flex; + align-items: center; + justify-content: flex-end; + gap: 12px; + margin-bottom: 12px; +} + +.mold-maintain-ticket-results__title { + font-size: 14px; + font-weight: 600; + color: var(--el-text-color-primary); +} + +.mold-maintain-ticket-results :deep(.el-upload) { + margin: 0 auto; +} + +@media (max-width: 1400px) { +} + .mold-maintain-page__form-actions { display: flex; justify-content: flex-end;