Browse Source

添加校验

hella_online_20240829
wangyufei 4 months ago
parent
commit
80fb147a2e
  1. 26
      src/views/wms/productionManage/processproduction/processproductionRequest/processproductionRequestMain.data.ts

26
src/views/wms/productionManage/processproduction/processproductionRequest/processproductionRequestMain.data.ts

@ -265,12 +265,32 @@ export const ProcessproductionRequestMain = useCrudSchemas(reactive<CrudSchema[]
}
}
]))
// 完工数量校验
const validateCompletedQuantity= (rule: any, value: any, callback: any) => {
if (Number(value)>0) {
callback();
} else {
callback(new Error('完工数量不能为0'));
}
}
// 报废数量校验
const validateScrapQuantity= (rule: any, value: any, callback: any) => {
if (Number(value)>0) {
callback();
} else {
callback(new Error('完工数量不能为0'));
}
}
// 表单校验
export const ProcessproductionRequestMainRules = reactive({
itemCode: [{ required: true, message: '物料代码不能为空', trigger: 'change' }],
completedQuantity: [{ required: true, message: '完工数量不能为空', trigger: 'change' }],
scrapQuantity: [{ required: true, message: '报废数量不能为空', trigger: 'change' }],
completedQuantity: [
{ required: true, message: '完工数量不能为空', trigger: 'change' },
{ validator: validateCompletedQuantity, trigger: 'change' }
],
scrapQuantity: [{ required: true, message: '报废数量不能为空', trigger: 'change' },
{ validator: validateScrapQuantity, trigger: 'change' }
],
})

Loading…
Cancel
Save