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" + > + + + + + +