From 3354462b7592de1a76aed206972717817566abb7 Mon Sep 17 00:00:00 2001 From: gexinzhineng/gxzn27 <1348660141@qq.com> Date: Thu, 9 Mar 2023 18:50:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E6=89=80?= =?UTF-8?q?=E6=8F=90bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/sms/smsChannel/sms.channel.data.ts | 17 +++- src/views/system/sms/smsLog/index.vue | 3 +- src/views/system/sms/smsLog/sms.log.data.ts | 17 +++- src/views/system/tenant/tenant.data.ts | 37 ++++++- src/views/system/tenantPackage/index.vue | 96 +++++++++---------- src/views/system/user/user.data.ts | 17 +++- 6 files changed, 129 insertions(+), 58 deletions(-) diff --git a/src/views/system/sms/smsChannel/sms.channel.data.ts b/src/views/system/sms/smsChannel/sms.channel.data.ts index d3a807ed..71b096e5 100644 --- a/src/views/system/sms/smsChannel/sms.channel.data.ts +++ b/src/views/system/sms/smsChannel/sms.channel.data.ts @@ -1,6 +1,10 @@ import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' +import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' + const { t } = useI18n() // 国际化 +const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE) + // 表单校验 export const rules = reactive({ signature: [required], @@ -24,8 +28,17 @@ const crudSchemas = reactive({ { title: '渠道编码', field: 'code', - dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, - isSearch: true + // dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, + // dictClass: 'string', + isSearch: true, + form: { + component: 'Select', + componentProps: { + options: authorizedGrantOptions, + multiple: false, + filterable: true + } + } }, { title: t('common.status'), diff --git a/src/views/system/sms/smsLog/index.vue b/src/views/system/sms/smsLog/index.vue index 93d1315f..7099e1a8 100644 --- a/src/views/system/sms/smsLog/index.vue +++ b/src/views/system/sms/smsLog/index.vue @@ -44,12 +44,13 @@ const [registerTable, { exportList }] = useXTable({ // 弹窗相关的变量 const dialogVisible = ref(false) // 是否显示弹出层 -const dialogTitle = ref('edit') // 弹出层标题 +const dialogTitle = ref('详情') // 弹出层标题 const actionType = ref('') // 操作按钮的类型 // ========== 详情相关 ========== const detailData = ref() // 详情 Ref const handleDetail = (row: SmsLoglApi.SmsLogVO) => { // 设置数据 + actionType.value = 'detail' detailData.value = row dialogVisible.value = true } diff --git a/src/views/system/sms/smsLog/sms.log.data.ts b/src/views/system/sms/smsLog/sms.log.data.ts index 4610ee62..c975bb0f 100644 --- a/src/views/system/sms/smsLog/sms.log.data.ts +++ b/src/views/system/sms/smsLog/sms.log.data.ts @@ -1,6 +1,9 @@ import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' +import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' + const { t } = useI18n() // 国际化 +const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE) // CrudSchema const crudSchemas = reactive({ primaryKey: 'id', @@ -25,9 +28,17 @@ const crudSchemas = reactive({ { title: '短信渠道', field: 'channelId', - dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, - dictClass: 'number', - isSearch: true + // dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, + // dictClass: 'number', + isSearch: true, + // table: { + // component: 'Select', + componentProps: { + options: authorizedGrantOptions + // multiple: false, + // filterable: true + } + // } }, { title: '发送状态', diff --git a/src/views/system/tenant/tenant.data.ts b/src/views/system/tenant/tenant.data.ts index 2aab1b90..1137b44a 100644 --- a/src/views/system/tenant/tenant.data.ts +++ b/src/views/system/tenant/tenant.data.ts @@ -19,12 +19,44 @@ const getTenantPackageOptions = async () => { } getTenantPackageOptions() +const validateName = (rule: any, value: any, callback: any) => { + const reg = /^[a-zA-Z0-9]{4,30}$/ + if (value === '') { + callback(new Error('请输入用户名称')) + } else { + console.log(reg.test(rule), 'reg.test(rule)') + if (!reg.test(value)) { + callback(new Error('用户名称由 数字、字母 组成')) + } else { + callback() + } + } +} +const validateMobile = (rule: any, value: any, callback: any) => { + const reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/ + if (value === '') { + callback(new Error('请输入联系手机')) + } else { + if (!reg.test(value)) { + callback(new Error('请输入正确的手机号')) + } else { + callback() + } + } +} + // 表单校验 export const rules = reactive({ name: [required], packageId: [required], contactName: [required], - contactMobile: [required], + contactMobile: [ + required, + { + validator: validateMobile, + trigger: 'blur' + } + ], accountCount: [required], expireTime: [required], username: [ @@ -34,7 +66,8 @@ export const rules = reactive({ max: 30, trigger: 'blur', message: '用户名称长度为 4-30 个字符' - } + }, + { validator: validateName, trigger: 'blur' } ], password: [ required, diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue index 9222365b..c8f5756a 100644 --- a/src/views/system/tenantPackage/index.vue +++ b/src/views/system/tenantPackage/index.vue @@ -15,54 +15,54 @@ - - - -
- -
- - -
+ :schema="allSchemas.formSchema" + :rules="rules" + ref="formRef" + > + + + + + +