diff --git a/src/api/qms/inspectionPlan/index.ts b/src/api/qms/inspectionPlan/index.ts new file mode 100644 index 000000000..1c07a30d3 --- /dev/null +++ b/src/api/qms/inspectionPlan/index.ts @@ -0,0 +1,30 @@ +import request from '@/config/axios' + + + +// 查询采样过程列表 +export const getListByTempleteCode = async (code) => { + return await request.get({ url: `/qms/inspection-process/getListByTempleteCode?code=`+code}) +} +// 新增 +export const inspectionTemplateCreat = async (data) => { + return await request.post({ url: `/qms/programme-template/create`,data}) +} +// 编辑 +export const inspectionTemplateUpdate = async (data) => { + return await request.put({ url: `/qms/programme-template/update`,data}) +} +// 删除 +export const inspectionTemplateDelete = async (id) => { + return await request.delete({ url: `/qms/programme-template/delete?id=`+id}) +} +// 列表 +export const inspectionTemplatePage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return request.post({ url: '/wms/accountcalendar/senior', data }) + } else { + return await request.get({ url: `/qms/programme-template/page`, params }) + } +} \ No newline at end of file diff --git a/src/views/qms/basicDataManage/inspectionPlan/addForm.vue b/src/views/qms/basicDataManage/inspectionPlan/addForm.vue new file mode 100644 index 000000000..d20c0ba3d --- /dev/null +++ b/src/views/qms/basicDataManage/inspectionPlan/addForm.vue @@ -0,0 +1,864 @@ + + + + + diff --git a/src/views/qms/basicDataManage/inspectionPlan/index.vue b/src/views/qms/basicDataManage/inspectionPlan/index.vue new file mode 100644 index 000000000..743b7b659 --- /dev/null +++ b/src/views/qms/basicDataManage/inspectionPlan/index.vue @@ -0,0 +1,197 @@ + + + +./inspectionPlan.data \ No newline at end of file diff --git a/src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts b/src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts new file mode 100644 index 000000000..62e6c9f7c --- /dev/null +++ b/src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts @@ -0,0 +1,287 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 + +export const InspectionTemplateRules = reactive({ + description: [ + { required: true , message: '请填写描述', trigger: 'blur' } + ], + version: [ + { required: true , message: '请填写版本', trigger: 'blur' } + ], + inspectionCode: [ + { required: true, message: '请选择检验方案模板编码', trigger: 'blur' } + ], + sequenceCode: [ + { required: true, message: '请填写顺序号', trigger: 'blur' } + ], + inspectionCharCode: [ + { required: true, message: '请选择检验特性编码', trigger: 'blur' } + ], + describe: [ + { required: true, message: '请填写描述', trigger: 'blur' } + ], + inspectionMethodCode: [ + { required: true, message: '请选择检验方法编码', trigger: 'blur' } + ], + dynamicUpdateCode: [ + { required: true, message: '请选择采样过程编码', trigger: 'blur' } + ], + inspectionMethod: [ + { required: true, message: '请选择动态修改规则编码', trigger: 'blur' } + ], + isCanUpdate: [ + { required: true, message: '请选择是否允许修改特征值', trigger: 'blur' } + ], + isDestructionInspection: [ + { required: true, message: '请选择是否破坏性检验', trigger: 'blur' } + ], + resultEntryMethod: [ + { required: true, message: '请选择结果录入方式', trigger: 'blur' } + ], + featureType: [ + { required: true, message: '请选择特征类型', trigger: 'blur' } + ], + quantifyIsCapping: [ + { required: true, message: '请选择是否设定上限', trigger: 'blur' } + ], + quantifyIsLowlimit: [ + { required: true, message: '请选择是否设定下限', trigger: 'blur' } + ], + quantifyTarget: [ + { required: true, message: '请输入目标值', trigger: 'blur' } + ], + quantifyCapping: [ + { required: true, message: '请输入上限值', trigger: 'blur' } + ], + quantifyLowlimit: [ + { required: true, message: '请输入下限值', trigger: 'blur' } + ], + quantifyquantifyUomLowlimit: [ + { required: true, message: '请选择计量单位', trigger: 'blur' } + ], + quantifyDecimal: [ + { required: true, message: '请输入小数位', trigger: 'blur' } + ], + quantifyQuantifyCode: [ + { required: true, message: '请输入选择集编码', trigger: 'blur' } + ], +}) +export const InspectionTemplateMain = useCrudSchemas(reactive([ + { + label: '编码', + field: 'code', + sort: 'custom', + form:{ + componentProps:{ + disabled:true, + placeholder:'系统自动获取' + } + } + }, + { + label: '描述', + field: 'description', + sort: 'custom', + },{ + label: '版本', + field: 'version', + sort: 'custom', + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) +export const InspectionTemplateProcess = useCrudSchemas(reactive([ + { + label: '编码', + field: 'code', + sort: 'custom', + form:{ + componentProps:{ + disabled:true, + placeholder:'系统自动获取' + } + } + }, + { + label: '描述', + field: 'description', + sort: 'custom', + isForm:false + },{ + label: '检验方案模板编码', + field: 'inspectionCode', + sort: 'custom', + },{ + label: '顺序号', + field: 'sequenceCode', + },{ + label: '检验特性编码', + field: 'inspectionCharCode', + sort: 'custom', + } +])) +export const InspectionTemplateFeatures= useCrudSchemas(reactive([ + { + label: '编码', + field: 'code', + sort: 'custom', + form:{ + componentProps:{ + disabled:true, + placeholder:'系统自动获取' + } + } + }, + { + label: '描述', + field: 'describe', + sort: 'custom', + },{ + label: '检验方法编码', + field: 'inspectionMethodCode', + sort: 'custom', + },{ + label: '采样过程编码', + field: 'dynamicUpdateCode', + sort: 'custom', + },{ + label: '动态修改规则编码', + field: 'inspectionMethod', + sort: 'custom', + },{ + label: '是否允许修改特征值', + field: 'isCanUpdate', + sort: 'custom', + + form:{ + component:'Select', + api: () => [{ + value:0, + label:'是' + },{ + value:1, + label:'否' + }], + componentProps:{ + optionsAlias: { + labelField: 'label', + valueField: 'value' + } + } + } + },{ + label: '是否破坏性检验', + field: 'isDestructionInspection', + sort: 'custom', + form:{ + component:'Select', + api: () => [{ + value:0, + label:'是' + },{ + value:1, + label:'否' + }], + componentProps:{ + optionsAlias: { + labelField: 'label', + valueField: 'value' + } + } + } + },{ + label: '结果录入方式', + field: 'resultEntryMethod', + sort: 'custom', + dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY, + dictClass: 'string', + table: { + width: 150 + }, + },{ + label: '特征类型', + field: 'featureType', + sort: 'custom', + dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE, + dictClass: 'string', + table: { + width: 150 + }, + },{ + label: '是否设定上限', + field: 'quantifyIsCapping', + sort: 'custom', + form:{ + component:'Select', + api: () => [{ + value:0, + label:'是' + },{ + value:1, + label:'否' + }], + componentProps:{ + optionsAlias: { + labelField: 'label', + valueField: 'value' + } + } + } + },{ + label: '是否设定下限', + field: 'quantifyIsLowlimit', + sort: 'custom', + form:{ + component:'Select', + api: () => [{ + value:0, + label:'是' + },{ + value:1, + label:'否' + }], + componentProps:{ + optionsAlias: { + labelField: 'label', + valueField: 'value' + } + } + } + },{ + label: '目标值', + field: 'quantifyTarget', + sort: 'custom', + },{ + label: '上限值', + field: 'quantifyCapping', + sort: 'custom', + },{ + label: '下限值', + field: 'quantifyLowlimit', + sort: 'custom', + },{ + label: '计量单位', + field: 'quantifyUom', + sort: 'custom', + },{ + label: '小数位', + field: 'quantifyDecimal', + sort: 'custom', + },{ + label: '选择集编码', + field: 'quantifyQuantifyCode', + sort: 'custom', + form:{ + component:'Select' + } + } +])) \ No newline at end of file diff --git a/src/views/qms/basicDataManage/inspectionTemplate/addForm.vue b/src/views/qms/basicDataManage/inspectionTemplate/addForm.vue index d20c0ba3d..555761be5 100644 --- a/src/views/qms/basicDataManage/inspectionTemplate/addForm.vue +++ b/src/views/qms/basicDataManage/inspectionTemplate/addForm.vue @@ -576,10 +576,28 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any formType.value = type if (row) { data.value = row + let list = await InspectionProcessPageApi.getListByTempleteCode(row.code) list.forEach((item, index) => { editableTabsValue.value = index + 1 item.name = index + 1 + // 编辑判断上限下限目标值是否必填 + if(item.quantifyIsCapping){ + rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true + }else{ + rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false + } + if(item.quantifyIsLowlimit){ + rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true + }else{ + rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false + } + if(item.quantifyIsTarget){ + rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true + }else{ + rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false + } + }) data.value.process = list } else { @@ -645,6 +663,7 @@ const buttonBaseClick1 = (val) => { featureType: '', quantifyIsCapping: '', quantifyIsLowlimit: '', + quantifyIsTarget: '', quantifyTarget: '', quantifyCapping: '', quantifyLowlimit: '', @@ -691,6 +710,7 @@ const validateForm = (formRef) => { return false }) } + const submitForm = async () => { try { const validateForm1 = await validateForm(formProcessRef.value) @@ -706,6 +726,13 @@ const submitForm = async () => { message.error(`模板中有检验工序和检验特性未填写完全`) return; } + const arr = data.value.process.filter(item=>(!item.inspectionCharacteristicsBaseVO.quantifyIsCapping&&!item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit&&!item.inspectionCharacteristicsBaseVO.quantifyIsTarget&&item.inspectionCharacteristicsBaseVO.featureType == 0)) + console.log(arr) + if(arr&&arr.length>0){ + const str = arr.map(item=>item.description).join(',') + message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`) + return; + } if (formType.value == 'create') { // 主子表——提交请求 emit('submitForm', formType.value, data) @@ -730,6 +757,11 @@ if (props.footButttondata) { // 选择特征类型 const changeFeatureType = (e) => { console.log(e) + // if (e) { + // rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true + // } else { + // rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = false + // } } const searchTableRef = ref() const opensearchTable = ( diff --git a/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts b/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts index e361ed36b..62e6c9f7c 100644 --- a/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts +++ b/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts @@ -1,6 +1,5 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' -import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate' // 表单校验