Skip to content

Commit 3354462

Browse files
committed
修改测试所提bug
1 parent 1f2af1f commit 3354462

File tree

6 files changed

+129
-58
lines changed

6 files changed

+129
-58
lines changed

src/views/system/sms/smsChannel/sms.channel.data.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
2+
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
3+
24
const { t } = useI18n() // 国际化
35

6+
const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE)
7+
48
// 表单校验
59
export const rules = reactive({
610
signature: [required],
@@ -24,8 +28,17 @@ const crudSchemas = reactive<VxeCrudSchema>({
2428
{
2529
title: '渠道编码',
2630
field: 'code',
27-
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
28-
isSearch: true
31+
// dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
32+
// dictClass: 'string',
33+
isSearch: true,
34+
form: {
35+
component: 'Select',
36+
componentProps: {
37+
options: authorizedGrantOptions,
38+
multiple: false,
39+
filterable: true
40+
}
41+
}
2942
},
3043
{
3144
title: t('common.status'),

src/views/system/sms/smsLog/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ const [registerTable, { exportList }] = useXTable({
4444
4545
// 弹窗相关的变量
4646
const dialogVisible = ref(false) // 是否显示弹出层
47-
const dialogTitle = ref('edit') // 弹出层标题
47+
const dialogTitle = ref('详情') // 弹出层标题
4848
const actionType = ref('') // 操作按钮的类型
4949
// ========== 详情相关 ==========
5050
const detailData = ref() // 详情 Ref
5151
const handleDetail = (row: SmsLoglApi.SmsLogVO) => {
5252
// 设置数据
53+
actionType.value = 'detail'
5354
detailData.value = row
5455
dialogVisible.value = true
5556
}

src/views/system/sms/smsLog/sms.log.data.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
2+
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
3+
24
const { t } = useI18n() // 国际化
35

6+
const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE)
47
// CrudSchema
58
const crudSchemas = reactive<VxeCrudSchema>({
69
primaryKey: 'id',
@@ -25,9 +28,17 @@ const crudSchemas = reactive<VxeCrudSchema>({
2528
{
2629
title: '短信渠道',
2730
field: 'channelId',
28-
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
29-
dictClass: 'number',
30-
isSearch: true
31+
// dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
32+
// dictClass: 'number',
33+
isSearch: true,
34+
// table: {
35+
// component: 'Select',
36+
componentProps: {
37+
options: authorizedGrantOptions
38+
// multiple: false,
39+
// filterable: true
40+
}
41+
// }
3142
},
3243
{
3344
title: '发送状态',

src/views/system/tenant/tenant.data.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,44 @@ const getTenantPackageOptions = async () => {
1919
}
2020
getTenantPackageOptions()
2121

22+
const validateName = (rule: any, value: any, callback: any) => {
23+
const reg = /^[a-zA-Z0-9]{4,30}$/
24+
if (value === '') {
25+
callback(new Error('请输入用户名称'))
26+
} else {
27+
console.log(reg.test(rule), 'reg.test(rule)')
28+
if (!reg.test(value)) {
29+
callback(new Error('用户名称由 数字、字母 组成'))
30+
} else {
31+
callback()
32+
}
33+
}
34+
}
35+
const validateMobile = (rule: any, value: any, callback: any) => {
36+
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}$/
37+
if (value === '') {
38+
callback(new Error('请输入联系手机'))
39+
} else {
40+
if (!reg.test(value)) {
41+
callback(new Error('请输入正确的手机号'))
42+
} else {
43+
callback()
44+
}
45+
}
46+
}
47+
2248
// 表单校验
2349
export const rules = reactive({
2450
name: [required],
2551
packageId: [required],
2652
contactName: [required],
27-
contactMobile: [required],
53+
contactMobile: [
54+
required,
55+
{
56+
validator: validateMobile,
57+
trigger: 'blur'
58+
}
59+
],
2860
accountCount: [required],
2961
expireTime: [required],
3062
username: [
@@ -34,7 +66,8 @@ export const rules = reactive({
3466
max: 30,
3567
trigger: 'blur',
3668
message: '用户名称长度为 4-30 个字符'
37-
}
69+
},
70+
{ validator: validateName, trigger: 'blur' }
3871
],
3972
password: [
4073
required,

src/views/system/tenantPackage/index.vue

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,54 @@
1515
<XTextButton preIcon="ep:delete" :title="t('action.del')" @click="deleteData(row.id)" />
1616
</template>
1717
</XTable>
18-
</ContentWrap>
19-
<XModal v-model="dialogVisible" :title="dialogTitle">
20-
<!-- 对话框(添加 / 修改) -->
21-
<Form
22-
v-if="['create', 'update'].includes(actionType)"
23-
:schema="allSchemas.formSchema"
24-
:rules="rules"
25-
ref="formRef"
26-
>
27-
<template #menuIds>
28-
<el-card>
29-
<template #header>
30-
<div class="card-header">
31-
全选/全不选:
32-
<el-switch
33-
v-model="treeNodeAll"
34-
inline-prompt
35-
active-text=""
36-
inactive-text=""
37-
@change="handleCheckedTreeNodeAll()"
38-
/>
39-
</div>
40-
</template>
41-
<el-tree
42-
ref="treeRef"
43-
node-key="id"
44-
show-checkbox
45-
:props="defaultProps"
46-
:data="menuOptions"
47-
empty-text="加载中,请稍后"
48-
/>
49-
</el-card>
50-
</template>
51-
</Form>
52-
<!-- 操作按钮 -->
53-
<template #footer>
54-
<!-- 按钮:保存 -->
55-
<XButton
18+
<XModal v-model="dialogVisible" :title="dialogTitle">
19+
<!-- 对话框(添加 / 修改) -->
20+
<Form
5621
v-if="['create', 'update'].includes(actionType)"
57-
type="primary"
58-
:title="t('action.save')"
59-
:loading="loading"
60-
@click="submitForm()"
61-
/>
62-
<!-- 按钮:关闭 -->
63-
<XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" />
64-
</template>
65-
</XModal>
22+
:schema="allSchemas.formSchema"
23+
:rules="rules"
24+
ref="formRef"
25+
>
26+
<template #menuIds>
27+
<el-card class="cardHeight">
28+
<template #header>
29+
<div class="card-header">
30+
全选/全不选:
31+
<el-switch
32+
v-model="treeNodeAll"
33+
inline-prompt
34+
active-text=""
35+
inactive-text=""
36+
@change="handleCheckedTreeNodeAll()"
37+
/>
38+
</div>
39+
</template>
40+
<el-tree
41+
ref="treeRef"
42+
node-key="id"
43+
show-checkbox
44+
:props="defaultProps"
45+
:data="menuOptions"
46+
empty-text="加载中,请稍候"
47+
/>
48+
</el-card>
49+
</template>
50+
</Form>
51+
<!-- 操作按钮 -->
52+
<template #footer>
53+
<!-- 按钮:保存 -->
54+
<XButton
55+
v-if="['create', 'update'].includes(actionType)"
56+
type="primary"
57+
:title="t('action.save')"
58+
:loading="loading"
59+
@click="submitForm()"
60+
/>
61+
<!-- 按钮:关闭 -->
62+
<XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" />
63+
</template>
64+
</XModal>
65+
</ContentWrap>
6666
</template>
6767
<script setup lang="ts" name="TenantPackage">
6868
import { handleTree, defaultProps } from '@/utils/tree'
@@ -179,7 +179,7 @@ onMounted(async () => {
179179
// getList()
180180
</script>
181181
<style scoped>
182-
.el-card {
182+
.cardHeight {
183183
width: 100%;
184184
max-height: 400px;
185185
overflow-y: scroll;

src/views/system/user/user.data.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
22
// 国际化
33
const { t } = useI18n()
4+
const validateMobile = (rule: any, value: any, callback: any) => {
5+
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}$/
6+
if (value === '') {
7+
callback(new Error('请输入联系手机'))
8+
} else {
9+
if (!reg.test(value)) {
10+
callback(new Error('请输入正确的手机号'))
11+
} else {
12+
callback()
13+
}
14+
}
15+
}
416
// 表单校验
517
export const rules = reactive({
618
username: [required],
@@ -17,12 +29,13 @@ export const rules = reactive({
1729
],
1830
status: [required],
1931
mobile: [
32+
required,
2033
{
21-
required: true,
2234
len: 11,
2335
trigger: 'blur',
2436
message: '请输入正确的手机号码'
25-
}
37+
},
38+
{ validator: validateMobile, trigger: 'blur' }
2639
]
2740
})
2841
// crudSchemas

0 commit comments

Comments
 (0)