Browse Source

校验修改

master
李胜楠 1 year ago
parent
commit
88547f1262
  1. 11
      src/views/wms/basicDataManage/customerManage/customer/customer.data.ts
  2. 5
      src/views/wms/basicDataManage/customerManage/customerdock/customerdock.data.ts
  3. 5
      src/views/wms/basicDataManage/factoryModeling/dock/dock.data.ts
  4. 11
      src/views/wms/basicDataManage/orderManage/carrier/carrier.data.ts
  5. 11
      src/views/wms/basicDataManage/supplierManage/supplier/supplier.data.ts
  6. 26
      src/views/wms/basicDataManage/systemSetting/currencyexchange/index.vue
  7. 26
      src/views/wms/basicDataManage/systemSetting/systemcalendar/index.vue

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

@ -2,6 +2,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
import {validateHanset,validateFax,validatePostCode} from '@/utils/validator'
/** /**
* @returns {Array} * @returns {Array}
*/ */
@ -274,13 +276,16 @@ export const CustomerRules = reactive({
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
phone: [ phone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
], ],
fax: [ fax: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateFax, message: '请输入正确的传真', trigger: 'blur'}
], ],
postId: [ postId: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validatePostCode, message: '请输入正确的邮编', trigger: 'blur'}
], ],
contacts: [ contacts: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }

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

@ -2,6 +2,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
import {validateHanset} from '@/utils/validator'
/** /**
* @returns {Array} * @returns {Array}
*/ */
@ -230,7 +232,8 @@ export const CustomerdockRules = reactive({
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
contactPhone: [ contactPhone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
], ],
remark: [ remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }

5
src/views/wms/basicDataManage/factoryModeling/dock/dock.data.ts

@ -7,6 +7,8 @@ import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse
import * as LocationApi from '@/api/wms/location' import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import {validateHanset} from '@/utils/validator'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
/** /**
@ -250,7 +252,8 @@ export const DockRules = reactive({
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
contactPhone: [ contactPhone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
], ],
type: [ type: [
{ required: true, message: '请输入类型', trigger: 'change' } { required: true, message: '请输入类型', trigger: 'change' }

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

@ -2,6 +2,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
import {validateHanset,validateFax,validatePostCode} from '@/utils/validator'
/** /**
* @returns {Array} * @returns {Array}
*/ */
@ -277,13 +279,16 @@ export const CarrierRules = reactive({
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
phone: [ phone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
], ],
fax: [ fax: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateFax, message: '请输入正确的传真', trigger: 'blur'}
], ],
postId: [ postId: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validatePostCode, message: '请输入正确的邮编', trigger: 'blur'}
], ],
contacts: [ contacts: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }

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

@ -2,6 +2,8 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
import {validateHanset,validateFax,validatePostCode} from '@/utils/validator'
/** /**
* @returns {Array} * @returns {Array}
*/ */
@ -270,13 +272,16 @@ export const SupplierRules = reactive({
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
phone: [ phone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
], ],
fax: [ fax: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateFax, message: '请输入正确的传真', trigger: 'blur'}
], ],
postId: [ postId: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validatePostCode, message: '请输入正确的邮编', trigger: 'blur'}
], ],
contacts: [ contacts: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }

26
src/views/wms/basicDataManage/systemSetting/currencyexchange/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="CurrencyexchangeRules" :rules="CurrencyexchangeRules"
:formAllSchemas="Currencyexchange.allSchemas" :formAllSchemas="Currencyexchange.allSchemas"
:apiUpdate="CurrencyexchangeApi.updateCurrencyexchange" :apiUpdate="CurrencyexchangeApi.updateCurrencyexchange"
@ -145,6 +145,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 =Currencyexchange.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 CurrencyexchangeApi.createCurrencyexchange(data)
message.success(t('common.createSuccess'))
} else {
await CurrencyexchangeApi.updateCurrencyexchange(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) => {

26
src/views/wms/basicDataManage/systemSetting/systemcalendar/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="SystemcalendarRules" :rules="SystemcalendarRules"
:formAllSchemas="Systemcalendar.allSchemas" :formAllSchemas="Systemcalendar.allSchemas"
:apiUpdate="SystemcalendarApi.updateSystemcalendar" :apiUpdate="SystemcalendarApi.updateSystemcalendar"
@ -144,6 +144,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 =Systemcalendar.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 SystemcalendarApi.createSystemcalendar(data)
message.success(t('common.createSuccess'))
} else {
await SystemcalendarApi.updateSystemcalendar(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) => {

Loading…
Cancel
Save