Browse Source

YT-1019采购件标签新增中数量为0时,不应该可以保存

intex
zhaoyiran 1 week ago
parent
commit
e2120a1b42
  1. 10
      src/utils/validator.ts
  2. 4
      src/views/wms/basicDataManage/labelManage/purchasePackage/purchasePackage.data.ts

10
src/utils/validator.ts

@ -814,6 +814,16 @@ export function validateSampleCode(rule, value, callback){
} }
} }
// 校验正数
export function validatePositiveNumber(rule, value, callback){
const numericValue = Number(value);
if (numericValue > 0) {
callback();
} else {
callback(new Error('必须是一个正数'));
}
}
export default { export default {
validateCode, validateCode,
validateEmail, validateEmail,

4
src/views/wms/basicDataManage/labelManage/purchasePackage/purchasePackage.data.ts

@ -11,6 +11,7 @@ import { SupplierdeliverRecordMain } from "@/views/wms/purchasereceiptManage/sup
import * as SupplierdeliverRecordMainApi from "@/api/wms/supplierdeliverRecordMain"; import * as SupplierdeliverRecordMainApi from "@/api/wms/supplierdeliverRecordMain";
import * as ItemPackageApi from "@/api/wms/itempackage"; import * as ItemPackageApi from "@/api/wms/itempackage";
import {Itempackaging} from "@/views/wms/basicDataManage/itemManage/itempackage/itempackage.data"; import {Itempackaging} from "@/views/wms/basicDataManage/itemManage/itempackage/itempackage.data";
import {validatePositiveNumber} from "@/utils/validator";
// 表单校验 // 表单校验
export const PackageRules = reactive({ export const PackageRules = reactive({
@ -610,7 +611,8 @@ export const PackageRulesInventor = reactive({
{ required: true, message: '请选择物料代码', trigger: 'change' } { required: true, message: '请选择物料代码', trigger: 'change' }
], ],
qty: [ qty: [
{ required: true, message: '请输入数量', trigger: 'blur' } { required: true, message: '请输入数量', trigger: 'blur' },
{ validator:validatePositiveNumber, message: '必须是一个正数', trigger: 'change'}
], ],
toDockCode: [ toDockCode: [
{ required: true, message: '请选择月台代码', trigger: 'change' } { required: true, message: '请选择月台代码', trigger: 'change' }

Loading…
Cancel
Save