diff --git a/src/views/qms/samplingProcess/index.vue b/src/views/qms/samplingProcess/index.vue index 8577435cb..65d0a24b5 100644 --- a/src/views/qms/samplingProcess/index.vue +++ b/src/views/qms/samplingProcess/index.vue @@ -149,6 +149,9 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const basicFormRef = ref() +const rules = ref({ + sampleSize: [{ required: true, message: '请填写描述', trigger: 'blur' }] +}) const openForm = async (type: string, row?: any) => { basicFormRef.value.open(type, row) SamplingProcess.allSchemas.formSchema.forEach(item=>{ @@ -290,6 +293,9 @@ const onChange =async (field,value, formRef)=>{ }) setV["sampleSize"] = '' setV["sampleProgCode"] = '' + + SamplingProcessRules.sampleSize[0].required = false; + SamplingProcessRules.sampleProgCode[0].required = false; }else if(field == 'sampleType'&& value == '2'){ SamplingProcess.allSchemas.formSchema.forEach(item=>{ if(item.field == "sampleSize"){ @@ -302,6 +308,8 @@ const onChange =async (field,value, formRef)=>{ } }) setV["sampleProgCode"] = '' + SamplingProcessRules.sampleSize[0].required = true; + SamplingProcessRules.sampleProgCode[0].required = false; }else if(field == 'sampleType'&& value == '3'){ SamplingProcess.allSchemas.formSchema.forEach(item=>{ if(item.field == "sampleSize"){ @@ -314,6 +322,8 @@ const onChange =async (field,value, formRef)=>{ } }) setV["sampleProgCode"] = '' + SamplingProcessRules.sampleSize[0].required = true; + SamplingProcessRules.sampleProgCode[0].required = false; }else if(field == 'sampleType'&& value == '4'){ SamplingProcess.allSchemas.formSchema.forEach(item=>{ if(item.field == "sampleSize"){ @@ -325,6 +335,8 @@ const onChange =async (field,value, formRef)=>{ } }) setV["sampleSize"] = '' + SamplingProcessRules.sampleSize[0].required = false; + SamplingProcessRules.sampleProgCode[0].required = true; } nextTick(() => { formRef.value.setValues(setV); diff --git a/src/views/qms/samplingProcess/samplingProcess.data.ts b/src/views/qms/samplingProcess/samplingProcess.data.ts index 8ee0c907c..d9c69e379 100644 --- a/src/views/qms/samplingProcess/samplingProcess.data.ts +++ b/src/views/qms/samplingProcess/samplingProcess.data.ts @@ -8,6 +8,8 @@ export const SamplingProcessRules = reactive({ sampleType: [required], evaluationMode: [required], description: [required], + sampleSize:ref([{ required: true, message: '该项为必填项', trigger: 'blur' }]), + sampleProgCode:ref([{ required: true, message: '该项为必填项', trigger: 'blur' }]), inspectionQty: [required, {validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}] }) const samplingSchemeList = await getSamplingScheme()