修改测试所提bug

This commit is contained in:
gexinzhineng/gxzn27 2023-03-09 18:50:19 +08:00
parent 1f2af1fce0
commit 3354462b75
6 changed files with 129 additions and 58 deletions

View File

@ -1,6 +1,10 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE)
// 表单校验 // 表单校验
export const rules = reactive({ export const rules = reactive({
signature: [required], signature: [required],
@ -24,8 +28,17 @@ const crudSchemas = reactive<VxeCrudSchema>({
{ {
title: '渠道编码', title: '渠道编码',
field: 'code', field: 'code',
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, // dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
isSearch: true // dictClass: 'string',
isSearch: true,
form: {
component: 'Select',
componentProps: {
options: authorizedGrantOptions,
multiple: false,
filterable: true
}
}
}, },
{ {
title: t('common.status'), title: t('common.status'),

View File

@ -44,12 +44,13 @@ const [registerTable, { exportList }] = useXTable({
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('详情') //
const actionType = ref('') // const actionType = ref('') //
// ========== ========== // ========== ==========
const detailData = ref() // Ref const detailData = ref() // Ref
const handleDetail = (row: SmsLoglApi.SmsLogVO) => { const handleDetail = (row: SmsLoglApi.SmsLogVO) => {
// //
actionType.value = 'detail'
detailData.value = row detailData.value = row
dialogVisible.value = true dialogVisible.value = true
} }

View File

@ -1,6 +1,9 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
const authorizedGrantOptions = getStrDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE)
// CrudSchema // CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({ const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id', primaryKey: 'id',
@ -25,9 +28,17 @@ const crudSchemas = reactive<VxeCrudSchema>({
{ {
title: '短信渠道', title: '短信渠道',
field: 'channelId', field: 'channelId',
dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, // dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE,
dictClass: 'number', // dictClass: 'number',
isSearch: true isSearch: true,
// table: {
// component: 'Select',
componentProps: {
options: authorizedGrantOptions
// multiple: false,
// filterable: true
}
// }
}, },
{ {
title: '发送状态', title: '发送状态',

View File

@ -19,12 +19,44 @@ const getTenantPackageOptions = async () => {
} }
getTenantPackageOptions() 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({ export const rules = reactive({
name: [required], name: [required],
packageId: [required], packageId: [required],
contactName: [required], contactName: [required],
contactMobile: [required], contactMobile: [
required,
{
validator: validateMobile,
trigger: 'blur'
}
],
accountCount: [required], accountCount: [required],
expireTime: [required], expireTime: [required],
username: [ username: [
@ -34,7 +66,8 @@ export const rules = reactive({
max: 30, max: 30,
trigger: 'blur', trigger: 'blur',
message: '用户名称长度为 4-30 个字符' message: '用户名称长度为 4-30 个字符'
} },
{ validator: validateName, trigger: 'blur' }
], ],
password: [ password: [
required, required,

View File

@ -15,54 +15,54 @@
<XTextButton preIcon="ep:delete" :title="t('action.del')" @click="deleteData(row.id)" /> <XTextButton preIcon="ep:delete" :title="t('action.del')" @click="deleteData(row.id)" />
</template> </template>
</XTable> </XTable>
</ContentWrap> <XModal v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle"> <!-- 对话框(添加 / 修改) -->
<!-- 对话框(添加 / 修改) --> <Form
<Form
v-if="['create', 'update'].includes(actionType)"
:schema="allSchemas.formSchema"
:rules="rules"
ref="formRef"
>
<template #menuIds>
<el-card>
<template #header>
<div class="card-header">
全选/全不选:
<el-switch
v-model="treeNodeAll"
inline-prompt
active-text="是"
inactive-text="否"
@change="handleCheckedTreeNodeAll()"
/>
</div>
</template>
<el-tree
ref="treeRef"
node-key="id"
show-checkbox
:props="defaultProps"
:data="menuOptions"
empty-text="加载中,请稍后"
/>
</el-card>
</template>
</Form>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
v-if="['create', 'update'].includes(actionType)" v-if="['create', 'update'].includes(actionType)"
type="primary" :schema="allSchemas.formSchema"
:title="t('action.save')" :rules="rules"
:loading="loading" ref="formRef"
@click="submitForm()" >
/> <template #menuIds>
<!-- 按钮关闭 --> <el-card class="cardHeight">
<XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" /> <template #header>
</template> <div class="card-header">
</XModal> 全选/全不选:
<el-switch
v-model="treeNodeAll"
inline-prompt
active-text="是"
inactive-text="否"
@change="handleCheckedTreeNodeAll()"
/>
</div>
</template>
<el-tree
ref="treeRef"
node-key="id"
show-checkbox
:props="defaultProps"
:data="menuOptions"
empty-text="加载中,请稍候"
/>
</el-card>
</template>
</Form>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
v-if="['create', 'update'].includes(actionType)"
type="primary"
:title="t('action.save')"
:loading="loading"
@click="submitForm()"
/>
<!-- 按钮关闭 -->
<XButton :loading="loading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</XModal>
</ContentWrap>
</template> </template>
<script setup lang="ts" name="TenantPackage"> <script setup lang="ts" name="TenantPackage">
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
@ -179,7 +179,7 @@ onMounted(async () => {
// getList() // getList()
</script> </script>
<style scoped> <style scoped>
.el-card { .cardHeight {
width: 100%; width: 100%;
max-height: 400px; max-height: 400px;
overflow-y: scroll; overflow-y: scroll;

View File

@ -1,6 +1,18 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// 国际化 // 国际化
const { t } = useI18n() const { t } = useI18n()
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({ export const rules = reactive({
username: [required], username: [required],
@ -17,12 +29,13 @@ export const rules = reactive({
], ],
status: [required], status: [required],
mobile: [ mobile: [
required,
{ {
required: true,
len: 11, len: 11,
trigger: 'blur', trigger: 'blur',
message: '请输入正确的手机号码' message: '请输入正确的手机号码'
} },
{ validator: validateMobile, trigger: 'blur' }
] ]
}) })
// crudSchemas // crudSchemas