Browse Source

其它校验修改

master
李胜楠 1 year ago
parent
commit
4b3f95eb22
  1. 33
      src/views/wms/basicDataManage/orderManage/carrier/carrier.data.ts
  2. 26
      src/views/wms/basicDataManage/orderManage/carrier/index.vue
  3. 26
      src/views/wms/basicDataManage/orderManage/owner/index.vue
  4. 36
      src/views/wms/basicDataManage/orderManage/owner/owner.data.ts
  5. 26
      src/views/wms/basicDataManage/orderManage/shift/index.vue
  6. 9
      src/views/wms/basicDataManage/orderManage/shift/shift.data.ts
  7. 26
      src/views/wms/basicDataManage/orderManage/team/index.vue
  8. 12
      src/views/wms/basicDataManage/orderManage/team/team.data.ts

33
src/views/wms/basicDataManage/orderManage/carrier/carrier.data.ts

@ -258,9 +258,40 @@ export const CarrierRules = reactive({
{ required: true, message: '请输入代码', trigger: 'blur' }
],
shortName: [
{ required: true, message: '请输入简称', trigger: 'blur' }
{ required: true, message: '请输入简称', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
name: [
{ 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' }
],
})

26
src/views/wms/basicDataManage/orderManage/carrier/index.vue

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

26
src/views/wms/basicDataManage/orderManage/owner/index.vue

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

36
src/views/wms/basicDataManage/orderManage/owner/owner.data.ts

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

26
src/views/wms/basicDataManage/orderManage/shift/index.vue

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

9
src/views/wms/basicDataManage/orderManage/shift/shift.data.ts

@ -209,7 +209,14 @@ export const Shift = useCrudSchemas(reactive<CrudSchema[]>([
//表单校验
export const ShiftRules = 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' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
beginTime: [
{ required: true, message: '请输入开始时间', trigger: 'blur' }

26
src/views/wms/basicDataManage/orderManage/team/index.vue

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

12
src/views/wms/basicDataManage/orderManage/team/team.data.ts

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

Loading…
Cancel
Save