Browse Source

供应商管理校验

master
李胜楠 1 year ago
parent
commit
474fe032d8
  1. 26
      src/views/wms/basicDataManage/supplierManage/purchaseprice/index.vue
  2. 3
      src/views/wms/basicDataManage/supplierManage/purchaseprice/purchaseprice.data.ts
  3. 33
      src/views/wms/basicDataManage/supplierManage/supplier/supplier.data.ts
  4. 26
      src/views/wms/basicDataManage/supplierManage/supplieritem/index.vue
  5. 6
      src/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data.ts

26
src/views/wms/basicDataManage/supplierManage/purchaseprice/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
@success="formsSuccess"
:rules="PurchasepriceRules"
:formAllSchemas="Purchaseprice.allSchemas"
:apiUpdate="PurchasepriceApi.updatePurchaseprice"
@ -145,6 +145,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Purchaseprice.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await PurchasepriceApi.createPurchaseprice(data)
message.success(t('common.createSuccess'))
} else {
await PurchasepriceApi.updatePurchaseprice(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {

3
src/views/wms/basicDataManage/supplierManage/purchaseprice/purchaseprice.data.ts

@ -215,4 +215,7 @@ export const PurchasepriceRules = reactive({
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})

33
src/views/wms/basicDataManage/supplierManage/supplier/supplier.data.ts

@ -250,10 +250,39 @@ export const Supplier = useCrudSchemas(reactive<CrudSchema[]>([
//表单校验
export const SupplierRules = reactive({
code: [
{ required: true, message: '请输入代码', trigger: 'blur' }
{ required: true, message: '请输入代码', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
name: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
shortName: [
{ required: true, message: '请输入简称', trigger: 'blur' }
{ required: true, message: '请输入简称', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
address: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
country: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
city: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
phone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
fax: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
postId: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contacts: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
bank: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }

26
src/views/wms/basicDataManage/supplierManage/supplieritem/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
@success="formsSuccess"
:rules="SupplieritemRules"
:formAllSchemas="Supplieritem.allSchemas"
:apiUpdate="SupplieritemApi.updateSupplieritem"
@ -145,6 +145,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Supplieritem.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await SupplieritemApi.createSupplieritem(data)
message.success(t('common.createSuccess'))
} else {
await SupplieritemApi.updateSupplieritem(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {

6
src/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data.ts

@ -335,6 +335,9 @@ export const SupplieritemRules = reactive({
itemCode: [
{ required: true, message: '请输入物料代码', trigger: 'change' }
],
supplierItemCode: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
packUnit: [
{ required: true, message: '请选择供应商包装单位', trigger: 'change' }
],
@ -347,4 +350,7 @@ export const SupplieritemRules = reactive({
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
Loading…
Cancel
Save