From 80fb147a2e3a1546f423e43331142009f690a589 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Tue, 9 Jul 2024 10:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processproductionRequestMain.data.ts | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/views/wms/productionManage/processproduction/processproductionRequest/processproductionRequestMain.data.ts b/src/views/wms/productionManage/processproduction/processproductionRequest/processproductionRequestMain.data.ts index 171aa15d8..2a63f139b 100644 --- a/src/views/wms/productionManage/processproduction/processproductionRequest/processproductionRequestMain.data.ts +++ b/src/views/wms/productionManage/processproduction/processproductionRequest/processproductionRequestMain.data.ts @@ -265,12 +265,32 @@ export const ProcessproductionRequestMain = useCrudSchemas(reactive { + 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' } + ], })