Browse Source

客户管理校验

master
李胜楠 1 year ago
parent
commit
6b8b816fbc
  1. 36
      src/views/wms/basicDataManage/customerManage/customer/customer.data.ts
  2. 26
      src/views/wms/basicDataManage/customerManage/customer/index.vue
  3. 24
      src/views/wms/basicDataManage/customerManage/customerdock/customerdock.data.ts
  4. 26
      src/views/wms/basicDataManage/customerManage/customerdock/index.vue
  5. 6
      src/views/wms/basicDataManage/customerManage/customeritem/customeritem.data.ts
  6. 26
      src/views/wms/basicDataManage/customerManage/customeritem/index.vue
  7. 26
      src/views/wms/basicDataManage/customerManage/project/index.vue
  8. 9
      src/views/wms/basicDataManage/customerManage/project/project.data.ts
  9. 26
      src/views/wms/basicDataManage/customerManage/saleprice/index.vue
  10. 3
      src/views/wms/basicDataManage/customerManage/saleprice/saleprice.data.ts

36
src/views/wms/basicDataManage/customerManage/customer/customer.data.ts

@ -254,10 +254,42 @@ export const Customer = useCrudSchemas(reactive<CrudSchema[]>([
//表单校验 //表单校验
export const CustomerRules = reactive({ export const CustomerRules = reactive({
code: [ 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: [ 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' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
available: [ available: [
{ required: true, message: '请选择是否可用', trigger: 'change' } { required: true, message: '请选择是否可用', trigger: 'change' }

26
src/views/wms/basicDataManage/customerManage/customer/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="CustomerRules" :rules="CustomerRules"
:formAllSchemas="Customer.allSchemas" :formAllSchemas="Customer.allSchemas"
:searchTableAllSchemas="Itembasic.allSchemas" :searchTableAllSchemas="Itembasic.allSchemas"
@ -146,6 +146,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form
const formsSuccess = async (formType,data) => {
var isHave =Customer.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 CustomerApi.createCustomer(data)
message.success(t('common.createSuccess'))
} else {
await CustomerApi.updateCustomer(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {

24
src/views/wms/basicDataManage/customerManage/customerdock/customerdock.data.ts

@ -211,7 +211,29 @@ export const Customerdock = useCrudSchemas(reactive<CrudSchema[]>([
//表单校验 //表单校验
export const CustomerdockRules = reactive({ export const CustomerdockRules = reactive({
code: [ code: [
{ required: true, message: '请输入代码', trigger: 'blur' } { required: true, message: '请输入代码', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
name: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
description: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
city: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
address: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contactPerson: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contactPhone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
customerCode: [ customerCode: [
{ required: true, message: '请输入客户代码', trigger: 'blur' } { required: true, message: '请输入客户代码', trigger: 'blur' }

26
src/views/wms/basicDataManage/customerManage/customerdock/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="CustomerdockRules" :rules="CustomerdockRules"
:formAllSchemas="Customerdock.allSchemas" :formAllSchemas="Customerdock.allSchemas"
:searchTableParams="searchTableParams" :searchTableParams="searchTableParams"
@ -170,6 +170,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form
const formsSuccess = async (formType,data) => {
var isHave =Customerdock.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 CustomerdockApi.createCustomerdock(data)
message.success(t('common.createSuccess'))
} else {
await CustomerdockApi.updateCustomerdock(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {

6
src/views/wms/basicDataManage/customerManage/customeritem/customeritem.data.ts

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

26
src/views/wms/basicDataManage/customerManage/customeritem/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="CustomeritemRules" :rules="CustomeritemRules"
:formAllSchemas="Customeritem.allSchemas" :formAllSchemas="Customeritem.allSchemas"
:searchTableParams="searchTableParams" :searchTableParams="searchTableParams"
@ -163,6 +163,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form
const formsSuccess = async (formType,data) => {
var isHave =Customeritem.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 CustomeritemApi.createCustomeritem(data)
message.success(t('common.createSuccess'))
} else {
await CustomeritemApi.updateCustomeritem(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {

26
src/views/wms/basicDataManage/customerManage/project/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="ProjectRules" :rules="ProjectRules"
:formAllSchemas="Project.allSchemas" :formAllSchemas="Project.allSchemas"
:searchTableParams="searchTableParams" :searchTableParams="searchTableParams"
@ -156,6 +156,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form
const formsSuccess = async (formType,data) => {
var isHave =Project.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 ProjectApi.createProject(data)
message.success(t('common.createSuccess'))
} else {
await ProjectApi.updateProject(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {

9
src/views/wms/basicDataManage/customerManage/project/project.data.ts

@ -154,7 +154,14 @@ export const Project = useCrudSchemas(reactive<CrudSchema[]>([
//表单校验 //表单校验
export const ProjectRules = reactive({ export const ProjectRules = reactive({
code: [ code: [
{ required: true, message: '请输入代码', trigger: 'blur' } { required: true, message: '请输入代码', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
name: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
available: [ available: [
{ required: true, message: '请选择是否可用', trigger: 'change' } { required: true, message: '请选择是否可用', trigger: 'change' }

26
src/views/wms/basicDataManage/customerManage/saleprice/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="SalepriceRules" :rules="SalepriceRules"
:formAllSchemas="Saleprice.allSchemas" :formAllSchemas="Saleprice.allSchemas"
:searchTableParams="searchTableParams" :searchTableParams="searchTableParams"
@ -163,6 +163,30 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form
const formsSuccess = async (formType,data) => {
var isHave =Saleprice.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 SalepriceApi.createSaleprice(data)
message.success(t('common.createSuccess'))
} else {
await SalepriceApi.updateSaleprice(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {

3
src/views/wms/basicDataManage/customerManage/saleprice/saleprice.data.ts

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