Browse Source

更改字段名

master_hella_20240701
liuchen864 7 months ago
parent
commit
0eb89d88cd
  1. 56
      src/views/qms/samplingProcess/index.vue
  2. 4
      src/views/qms/samplingProcess/samplingProcess.data.ts

56
src/views/qms/samplingProcess/index.vue

@ -256,47 +256,47 @@ const importSuccess = () => {
} }
const updateFormFields = (sampleType, formRef) => { const updateFormFields = (sampleType, formRef) => {
let sampleSizeLabel = ''; let sampleQtyLabel = '';
let sampleSizeDisabled = false; let sampleQtyDisabled = false;
let sampleProgCodeDisabled = true; let sampleProgCodeDisabled = true;
let sampleSizeRequired = false; let sampleQtyRequired = false;
let sampleProgCodeRequired = false; let sampleProgCodeRequired = false;
switch (sampleType) { switch (sampleType) {
case '1': case '1':
sampleSizeLabel = '样品份数'; sampleQtyLabel = '样品份数';
sampleSizeDisabled = true; sampleQtyDisabled = true;
sampleSizeRequired = false; sampleQtyRequired = false;
if( SamplingProcessRules.sampleSize.length==3){ if( SamplingProcessRules.sampleQty.length==3){
SamplingProcessRules.sampleSize.pop() SamplingProcessRules.sampleQty.pop()
} }
break; break;
case '2': case '2':
sampleSizeLabel = '样品份数(%)'; sampleQtyLabel = '样品份数(%)';
sampleSizeDisabled = false; sampleQtyDisabled = false;
sampleSizeRequired = false; sampleQtyRequired = true;
if( SamplingProcessRules.sampleSize.length==2){ if( SamplingProcessRules.sampleQty.length==2){
SamplingProcessRules.sampleSize.push({ SamplingProcessRules.sampleQty.push({
validator:validatePercent, message: '百分比范围 0 ~ 100', trigger: 'blur' validator:validatePercent, message: '百分比范围 0 ~ 100', trigger: 'blur'
}) })
} }
break; break;
case '3': case '3':
sampleSizeLabel = '样品份数'; sampleQtyLabel = '样品份数';
sampleSizeDisabled = false; sampleQtyDisabled = false;
sampleSizeRequired = true; sampleQtyRequired = true;
if( SamplingProcessRules.sampleSize.length==3){ if( SamplingProcessRules.sampleQty.length==3){
SamplingProcessRules.sampleSize.pop() SamplingProcessRules.sampleQty.pop()
} }
break; break;
case '4': case '4':
sampleSizeLabel = '样品份数'; sampleQtyLabel = '样品份数';
sampleSizeDisabled = true; sampleQtyDisabled = true;
sampleSizeRequired = false; sampleQtyRequired = false;
sampleProgCodeDisabled = false; sampleProgCodeDisabled = false;
sampleProgCodeRequired = true; sampleProgCodeRequired = true;
if( SamplingProcessRules.sampleSize.length==3){ if( SamplingProcessRules.sampleQty.length==3){
SamplingProcessRules.sampleSize.pop() SamplingProcessRules.sampleQty.pop()
} }
break; break;
default: default:
@ -304,20 +304,20 @@ const updateFormFields = (sampleType, formRef) => {
} }
SamplingProcess.allSchemas.formSchema.forEach(item => { SamplingProcess.allSchemas.formSchema.forEach(item => {
if (item.field === 'sampleSize') { if (item.field === 'sampleQty') {
item.label = sampleSizeLabel; item.label = sampleQtyLabel;
item.componentProps.disabled = sampleSizeDisabled; item.componentProps.disabled = sampleQtyDisabled;
} }
if (item.field === 'sampleProgCode') { if (item.field === 'sampleProgCode') {
item.componentProps.disabled = sampleProgCodeDisabled; item.componentProps.disabled = sampleProgCodeDisabled;
} }
}); });
SamplingProcessRules.sampleSize[0].required = sampleSizeRequired; SamplingProcessRules.sampleQty[0].required = sampleQtyRequired;
SamplingProcessRules.sampleProgCode[0].required = sampleProgCodeRequired; SamplingProcessRules.sampleProgCode[0].required = sampleProgCodeRequired;
formRef.value.setValues({ formRef.value.setValues({
sampleSize: '', sampleQty: '',
sampleProgCode: '', sampleProgCode: '',
}); });
}; };

4
src/views/qms/samplingProcess/samplingProcess.data.ts

@ -8,7 +8,7 @@ export const SamplingProcessRules = reactive({
sampleType: [required], sampleType: [required],
evaluationMode: [required], evaluationMode: [required],
description: [required], description: [required],
sampleSize:ref([{ required: true, message: '该项为必填项', trigger: 'blur' },{validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}]), sampleQty:ref([{ required: true, message: '该项为必填项', trigger: 'blur' },{validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}]),
sampleProgCode:ref([{ required: true, message: '该项为必填项', trigger: 'blur' }]), sampleProgCode:ref([{ required: true, message: '该项为必填项', trigger: 'blur' }]),
inspectionQty: [required, {validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}] inspectionQty: [required, {validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}]
}) })
@ -63,7 +63,7 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
}, },
{ {
label: '样品份数', label: '样品份数',
field: 'sampleSize', field: 'sampleQty',
sort: 'custom', sort: 'custom',
table: { table: {
width: 140 width: 140

Loading…
Cancel
Save