diff --git a/src/views/qms/inspectionRecord/index.vue b/src/views/qms/inspectionRecord/index.vue index b0f04af46..2d9930416 100644 --- a/src/views/qms/inspectionRecord/index.vue +++ b/src/views/qms/inspectionRecord/index.vue @@ -36,16 +36,7 @@ :formAllSchemas="InspectionRecordMain.allSchemas" @submitForm="submitForm" /> - - + { diff --git a/src/views/qms/inspectionRecord/addForm.vue b/src/views/qms/inspectionRecordFirst/addForm.vue similarity index 93% rename from src/views/qms/inspectionRecord/addForm.vue rename to src/views/qms/inspectionRecordFirst/addForm.vue index d804838f6..c424f330b 100644 --- a/src/views/qms/inspectionRecord/addForm.vue +++ b/src/views/qms/inspectionRecordFirst/addForm.vue @@ -570,8 +570,7 @@ import { getCurrentInstance } from 'vue' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail' import { SearchTable } from '@/components/SearchTable' -import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain' -import * as InspectionJobPackageApi from '@/api/qms/inspectionJob/InspectionJobPackage/InspectionJobPackage' +import * as InspectionRecordDetail from '@/api/qms/inspectionRecord/inspectionRecordDetail' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' @@ -730,9 +729,11 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any allSamplePieceSize.value = 0 //打开时候归0 if (row) { data.value = JSON.parse(JSON.stringify(row)) - nextTick(() => { - formMainRef.value.setValues(row) - }) + // nextTick(() => { + // formMainRef.value.setValues(row) + // }) + let list = await InspectionRecordDetail.getInspectionRecordDetailList(data.value.id) + await processList( data.value,list) } else { data.value = { code: '', @@ -751,6 +752,85 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any dialogVisible.value = true tabIndex = data.value.subList.length + 1 } + +// 渲染工序列表 +const processList =async (InspectionSchemeObj,list) => { + editableTabsValue.value = 1 + list.forEach((item, index) => { + item.name = index + 1 + item.inspectionJobCharacteristicsUpdateReqVO = item.inspectionJobCharacteristicsRespVO + item.isPass = '' //判断是否显示对号错误图标 + // 总数量值是 样品份数 乘 每份样品量 + allSamplePieceSize.value += parseFloat( + ( + parseFloat(item.samplingProcessRespVO.sampleQty) * + parseFloat(InspectionSchemeObj.samplePieceSize) + ).toFixed(6) + ) + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true + if (!item?.inspectionJobCharacteristicsUpdateReqVO?.recordInspectionQuantifyList) { + // 单个录入时 + if (item?.inspectionJobCharacteristicsUpdateReqVO?.resultEntryMethod == 2) { + // rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true + item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList = [] + for ( + let i = 0; + i < parseInt(item.samplingProcessRespVO.sampleQty); + i++ + ) { + item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.push({ + inspectionValue: '', //检验值 + qualitativeCode: '', //定性字典项值 + defectLevel: '', //缺陷级别 + qualifiedQuantity: '', //合格数量 + unqualifiedQuantity: '' //不合格数量 + }) + } + } else { + // 汇总录入时 + console.log(2333,item.inspectionJobCharacteristicsUpdateReqVO) + item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList = [] + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = false + item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.push({ + inspectionValue: '', //检验值 + qualitativeCode: '', //定性字典项值 + defectLevel: '', //缺陷级别 + qualifiedQuantity: parseFloat( + ( + parseFloat(item.samplingProcessRespVO.sampleQty) * + parseFloat(InspectionSchemeObj.samplePieceSize) + ).toFixed(6) + ), //合格数量 + unqualifiedQuantity: '0' //不合格数量 + }) + } + } + + // 编辑判断上限下限目标值是否必填 + if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsCapping) { + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true + } else { + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = false + } + if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsLowlimit) { + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyLowlimit'][0].required = true + } else { + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyLowlimit'][0].required = false + } + if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsTarget) { + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyTarget'][0].required = true + } else { + rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyTarget'][0].required = false + } + if (item.samplingProcessRespVO.evaluationMode == 1) { + rules.value['inspectionJobCharacteristicsUpdateReqVO.estimateCode'][0].required = true + } else { + rules.value['inspectionJobCharacteristicsUpdateReqVO.estimateCode'][0].required = false + } + }) + + data.value.subList = list +} defineExpose({ open, dialogVisible, formLoading }) // 提供 open 方法,用于打开弹窗 import type { TabPaneName } from 'element-plus' diff --git a/src/views/qms/inspectionRecordFirst/detail.vue b/src/views/qms/inspectionRecordFirst/detail.vue new file mode 100644 index 000000000..857ac62bd --- /dev/null +++ b/src/views/qms/inspectionRecordFirst/detail.vue @@ -0,0 +1,390 @@ + + + + + + {{ titleValueRef }} {{ titleNameRef }} + + + + + + + + + 检验工序 + + + + + + + + + + + + + + + + + + + + 检验特性 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/qms/inspectionRecordFirst/index.vue b/src/views/qms/inspectionRecordFirst/index.vue new file mode 100644 index 000000000..d2b7ecee3 --- /dev/null +++ b/src/views/qms/inspectionRecordFirst/index.vue @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + {{ row.number }} + + + + + + + + + + + + + + + + diff --git a/src/views/qms/inspectionRecordFirst/inspectionRecordFirstMain.data.ts b/src/views/qms/inspectionRecordFirst/inspectionRecordFirstMain.data.ts new file mode 100644 index 000000000..90947001d --- /dev/null +++ b/src/views/qms/inspectionRecordFirst/inspectionRecordFirstMain.data.ts @@ -0,0 +1,467 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter2 } from '@/utils/formatTime' +import { validateHanset, validateEmail } from '@/utils/validator' +import { dateFormatter } from '@/utils/formatTime' +import { validateTwoNum, validateSixNum } from '@/utils/validator' +const { t } = useI18n() // 国际化 + +/** + * @returns {Array} 检验任务主表 + */ +export const InspectionRecordMain = useCrudSchemas( + reactive([ + { + label: '记录编码', + field: 'number', + sort: 'custom', + isSearch: true, + isForm: false, + table: { + width: 200, + fixed: 'left' + } + }, + + { + label: '物料编码', + field: 'itemCode', + sort: 'custom', + isSearch: false, + isForm: false, + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + } + }, + { + label: '物料名称', + field: 'itemName', + sort: 'custom', + isSearch: false, + isForm: false, + table: { + width: 200 + }, + form: { + componentProps: { + disabled: true + } + } + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + isSearch: false, + isForm: false, + table: { + width: 150 + } + }, + { + label: '检验批次', + field: 'inspectionBatch', + sort: 'custom', + isSearch: false, + isForm: false, + table: { + width: 150 + } + }, + { + label: '检验批数量', + field: 'inspectionBatchAmount', + sort: 'custom', + isSearch: false, + isForm: false, + table: { + width: 150 + } + }, + { + label: '检验方案编码', + field: 'inspectionSchemeCode', + sort: 'custom', + isSearch: false, + isForm: false, + table: { + width: 200 + } + }, + + + { + label: '检验人', + field: 'creator', + table: { + width: 130 + }, + isForm: false, + isTable: true + }, + { + label: '检验时间', + field: 'updateTime', + sort: 'custom', + isDetail: true, + isForm: false, + isTable: false, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + style: { width: '100%' }, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x' + } + } + }, + { + label: '最后更新者', + field: 'updater', + isDetail: true, + isForm: false, + isTable: false, + table: { + width: 150 + } + }, + { + label: '操作', + field: 'action', + isForm: false, + isDetail: false, + table: { + width: 200, + fixed: 'right' + } + } + ]) +) + +//表单校验 +export const InspectionRecordMainRules = reactive({ + useDecision: [required], + +}) + +/** + * @returns {Array} 检验任务子表 + */ +export const InspectionRecordDetail = useCrudSchemas(reactive([ + { + label: 'id', + field: 'id', + sort: 'custom', + isTable: false, + isSearch: false, + isForm: false, + }, + { + label: '记录编码', + field: 'recordCode', + sort: 'custom', + isSearch: false, + }, + { + label: '工序编码', + field: 'processCode', + sort: 'custom', + isSearch: false, + }, + { + label: '工序描述', + field: 'processDescribe', + sort: 'custom', + isSearch: false, + }, + { + label: '顺序号', + field: 'sequenceCode', + sort: 'custom', + isSearch: false, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '是否破坏性检验', + field: 'isDestroyInspection', + sort: 'custom', + isSearch: false, + form: { + component: 'Radio' + }, + }, + { + label: '检验开始时间', + field: 'inspectionStartTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '检验结束时间', + field: 'inspectionEndTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '检验人', + field: 'inspectionOperator', + sort: 'custom', + isSearch: false, + }, + { + label: '检验特性编码', + field: 'inspectionFeaturesCode', + sort: 'custom', + isSearch: false, + }, + // { + // label: '是否可用', + // field: 'available', + // sort: 'custom', + // isSearch: false, + // }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + isForm: false, + }, + + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 150, + fixed: 'right' + }, + isTableForm: false, + } +])) + +//表单校验 +export const InspectionRecordDetailRules = reactive({ + recordCode: [required], + processCode: [required], + sequenceCode: [required], + isDestroyInspection: [required], + available: [required], +}) + +/** + * @returns {Array} 检验记录包装 + */ +export const InspectionRecordPackage = useCrudSchemas(reactive([ + { + label: '编码', + field: 'number', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:200 + }, + table:{ + width:150 + } + }, + { + label: '包装号', + field: 'packageCode', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:160 + }, + table:{ + width:150 + } + }, + { + label: '包装规格', + field: 'packageSpecificationCode', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:150 + }, + table:{ + width:150 + } + }, + { + label: '数量', + field: 'amount', + sort: 'custom', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + }, + tableForm:{ + disabled:true, + width:120 + }, + table:{ + width:150 + } + }, + { + label: '计量单位', + field: 'measuringUnit', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:120 + }, + table:{ + width:150 + } + }, + { + label: '采样数量', + field: 'sampleAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:100 + }, + table:{ + width:150 + } + }, + { + label: '合格数量', + field: 'qualifiedAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:100 + }, + table:{ + width:150 + } + }, + { + label: '不合格数量', + field: 'noQualifiedAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:100 + }, + table:{ + width:150 + } + }, + { + label: '破坏数量', + field: 'destroyAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:100 + }, + table:{ + width:150 + } + }, + { + label: '冻结数量', + field: 'frozenAmount', + sort: 'custom', + isSearch: true, + tableForm:{ + disabled:true, + width:100 + }, + table:{ + width:150 + } + } +])) + +//表单校验 +export const InspectionRecordPackageRules = reactive({ + qualifiedAmount: [ + required, + { validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'} + ], + frozenAmount: [ + required, + { validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'} + ], + destroyAmount: [ + required, + { validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'} + ], + noQualifiedAmount: [ + required, + { validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'} + ], +}) diff --git a/src/views/qms/inspectionRecordFirst/useAddForm.vue b/src/views/qms/inspectionRecordFirst/useAddForm.vue new file mode 100644 index 000000000..c430495c8 --- /dev/null +++ b/src/views/qms/inspectionRecordFirst/useAddForm.vue @@ -0,0 +1,312 @@ + + + + + + 包装列表 + + + + + + + + + + + + + + +