diff --git a/src/views/qms/inspectionJob/detail.vue b/src/views/qms/inspectionJob/detail.vue index a345b6424..3dc132caf 100644 --- a/src/views/qms/inspectionJob/detail.vue +++ b/src/views/qms/inspectionJob/detail.vue @@ -70,7 +70,7 @@
- +
diff --git a/src/views/qms/samplingProcess/index.vue b/src/views/qms/samplingProcess/index.vue index 53b7a0b2e..48762bd6f 100644 --- a/src/views/qms/samplingProcess/index.vue +++ b/src/views/qms/samplingProcess/index.vue @@ -66,7 +66,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import Detail from '@/components/Detail/src/Detail.vue' -import {validatePercent } from '@/utils/validator' +import {validatePercent, validateInteger, validateTwoNum } from '@/utils/validator' defineOptions({ name: 'SamplingProcess' }) @@ -267,27 +267,21 @@ const updateFormFields = (sampleType, formRef) => { sampleQtyLabel = '样品份数'; sampleQtyDisabled = true; sampleQtyRequired = false; - if( SamplingProcessRules.sampleQty.length==3){ - SamplingProcessRules.sampleQty.pop() - } + SamplingProcessRules.sampleQty = [{ required: false, message: '该项为必填项', trigger: 'blur'}] break; case '2': sampleQtyLabel = '样品份数(%)'; sampleQtyDisabled = false; sampleQtyRequired = true; - if( SamplingProcessRules.sampleQty.length==2){ - SamplingProcessRules.sampleQty.push({ - validator:validatePercent, message: '百分比范围 0 ~ 100', trigger: 'blur' - }) - } + SamplingProcessRules.sampleQty = [{ required: true, message: '该项为必填项', trigger: 'blur' },{validator:validatePercent, message: '百分比范围 0 ~ 100', trigger: 'blur'},{validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}] + break; case '3': sampleQtyLabel = '样品份数'; sampleQtyDisabled = false; sampleQtyRequired = true; - if( SamplingProcessRules.sampleQty.length==3){ - SamplingProcessRules.sampleQty.pop() - } + SamplingProcessRules.sampleQty = [{ required: true, message: '该项为必填项', trigger: 'blur' },{validator:validateInteger, message: '样品份数必须为正整数', trigger: 'blur'}] + break; case '4': sampleQtyLabel = '样品份数'; @@ -295,9 +289,7 @@ const updateFormFields = (sampleType, formRef) => { sampleQtyRequired = false; sampleProgCodeDisabled = false; sampleProgCodeRequired = true; - if( SamplingProcessRules.sampleQty.length==3){ - SamplingProcessRules.sampleQty.pop() - } + SamplingProcessRules.sampleQty = [{ required: false, message: '该项为必填项', trigger: 'blur'}] break; default: break; diff --git a/src/views/qms/samplingProcess/samplingProcess.data.ts b/src/views/qms/samplingProcess/samplingProcess.data.ts index 5e1f5e608..e8d087169 100644 --- a/src/views/qms/samplingProcess/samplingProcess.data.ts +++ b/src/views/qms/samplingProcess/samplingProcess.data.ts @@ -8,8 +8,8 @@ export const SamplingProcessRules = reactive({ sampleType: [required], evaluationMode: [required], description: [required], - sampleQty:ref([{ required: true, message: '该项为必填项', trigger: 'blur' },{validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}]), - sampleProgCode:ref([{ required: true, message: '该项为必填项', trigger: 'blur' }]), + sampleQty:[{ required: true, message: '该项为必填项', trigger: 'blur' },{validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}], + sampleProgCode:[{ required: true, message: '该项为必填项', trigger: 'blur' }], inspectionQty: [required, {validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}] }) const samplingSchemeList = await getSamplingScheme()