Commit 88244ae542ded48c8e40e53186b3a36aa0b5ba55
1 parent
0e1f79ab
fix:检查修复了之前字段有些验证失效问题,修复了账号管理的租户管理员用户名需要显示已经存在问题,修复组织管理默认展开,修复了消息模板邮件里面的有些字段为数组问题
Showing
35 changed files
with
254 additions
and
797 deletions
| ... | ... | @@ -41,6 +41,8 @@ export interface TenantPageRequestParams extends BaseQueryParams { | 
| 41 | 41 | export interface TenantAdminPageRequestParams extends BaseQueryParams { | 
| 42 | 42 | realName?: string; | 
| 43 | 43 | tenantCode: string; | 
| 44 | + tenantId?: string; | |
| 45 | + roleType?: string; | |
| 44 | 46 | } | 
| 45 | 47 | |
| 46 | 48 | export interface tenantProfileDTO { | ... | ... | 
| ... | ... | @@ -33,7 +33,7 @@ | 
| 33 | 33 | :before-upload="beforeUploadqrcodePic" | 
| 34 | 34 | > | 
| 35 | 35 | <img | 
| 36 | - style="text-align: center; border-radius: 50%; width: 10vw; height: 15vh" | |
| 36 | + style="text-align: center; border-radius: 50%; width: 8vw; height: 15vh" | |
| 37 | 37 | v-if="peresonalPic" | 
| 38 | 38 | :src="peresonalPic" | 
| 39 | 39 | alt="avatar" | 
| ... | ... | @@ -92,6 +92,7 @@ | 
| 92 | 92 | import { Upload } from 'ant-design-vue'; | 
| 93 | 93 | import { PlusOutlined } from '@ant-design/icons-vue'; | 
| 94 | 94 | import type { FileItem } from '/@/components/Upload/src/typing'; | 
| 95 | + import { useUserStore } from '/@/store/modules/user'; | |
| 95 | 96 | |
| 96 | 97 | const schema: DescItem[] = [ | 
| 97 | 98 | { | 
| ... | ... | @@ -124,12 +125,16 @@ | 
| 124 | 125 | components: { BasicModal, BasicForm, Description, Upload, PlusOutlined }, | 
| 125 | 126 | emits: ['refreshPersonl', 'register'], | 
| 126 | 127 | setup(_, { emit }) { | 
| 128 | + // const userStore = useUserStore(); | |
| 127 | 129 | const userInfo = getAuthCache(USER_INFO_KEY); | 
| 128 | 130 | const { createMessage } = useMessage(); | 
| 129 | 131 | const getPersonalValue: any = ref({}); | 
| 130 | 132 | const getPersonalDetailValue: any = ref({}); | 
| 131 | 133 | const updatePersonalData: any = ref({}); | 
| 132 | 134 | const getBackendV: any = ref({}); | 
| 135 | + const getData: any = ref({}); | |
| 136 | + const updataPersonlData: any = ref({}); | |
| 137 | + // const getUpdateUserInfo: any = ref({}); | |
| 133 | 138 | const [registerDesc] = useDescription({ | 
| 134 | 139 | title: '个人详情', | 
| 135 | 140 | schema: schema, | 
| ... | ... | @@ -164,16 +169,37 @@ | 
| 164 | 169 | showActionButtonGroup: false, | 
| 165 | 170 | schemas: formSchema, | 
| 166 | 171 | }); | 
| 172 | + const refreshCacheGetData = () => { | |
| 173 | + const getItem = window.localStorage.getItem('updateUserInfo'); | |
| 174 | + const newItem = JSON.parse(getItem); | |
| 175 | + updataPersonlData.value = newItem; | |
| 176 | + }; | |
| 167 | 177 | |
| 168 | 178 | const [registerModal, { closeModal }] = useModalInner(async (data) => { | 
| 169 | - (peresonalPic.value = data.userInfo.avatar), | |
| 170 | - setFieldsValue({ | |
| 171 | - realName: data.userInfo.realName, | |
| 172 | - phoneNumber: data.userInfo.phoneNumber, | |
| 173 | - email: data.userInfo.email, | |
| 174 | - }); | |
| 175 | - if (data.userInfo) { | |
| 176 | - getPersonalDetailValue.value = data.userInfo; | |
| 179 | + refreshCacheGetData(); | |
| 180 | + console.log(updataPersonlData.value); | |
| 181 | + try { | |
| 182 | + if (updataPersonlData.value != null) { | |
| 183 | + (peresonalPic.value = updataPersonlData.value.avatar), | |
| 184 | + setFieldsValue({ | |
| 185 | + realName: updataPersonlData.value.realName, | |
| 186 | + phoneNumber: updataPersonlData.value.phoneNumber, | |
| 187 | + email: updataPersonlData.value.email, | |
| 188 | + }); | |
| 189 | + getPersonalDetailValue.value = updataPersonlData.value; | |
| 190 | + } else { | |
| 191 | + if (data.userInfo) { | |
| 192 | + getPersonalDetailValue.value = data.userInfo; | |
| 193 | + peresonalPic.value = data.userInfo.avatar; | |
| 194 | + setFieldsValue({ | |
| 195 | + realName: data.userInfo.realName, | |
| 196 | + phoneNumber: data.userInfo.phoneNumber, | |
| 197 | + email: data.userInfo.email, | |
| 198 | + }); | |
| 199 | + } | |
| 200 | + } | |
| 201 | + } catch (e) { | |
| 202 | + return e; | |
| 177 | 203 | } | 
| 178 | 204 | if (Object.keys(updatePersonalData.value).length != 0) { | 
| 179 | 205 | getPersonalDetailValue.value = updatePersonalData.value; | 
| ... | ... | @@ -191,9 +217,11 @@ | 
| 191 | 217 | getPersonalValue.value.id = getUserInfo.userId; | 
| 192 | 218 | getPersonalValue.value.username = getBackendV.value.username; | 
| 193 | 219 | getPersonalValue.value.avatar = peresonalPic.value; | 
| 194 | - const data = await personalPut(getPersonalValue.value); | |
| 195 | - updatePersonalData.value = data; | |
| 220 | + getData.value = await personalPut(getPersonalValue.value); | |
| 221 | + updatePersonalData.value = getData.value; | |
| 196 | 222 | createMessage.success('修改成功'); | 
| 223 | + const setUpdateUserInfo = JSON.stringify(getData.value); | |
| 224 | + window.localStorage.setItem('updateUserInfo', setUpdateUserInfo); | |
| 197 | 225 | closeModal(); | 
| 198 | 226 | resetFields(); | 
| 199 | 227 | emit('refreshPersonl', updatePersonalData.value); | 
| ... | ... | @@ -221,7 +249,7 @@ | 
| 221 | 249 | /deep/ .ant-upload-select-picture-card { | 
| 222 | 250 | display: inherit; | 
| 223 | 251 | float: none; | 
| 224 | - width: 10vw; | |
| 252 | + width: 8.6vw; | |
| 225 | 253 | height: 17vh; | 
| 226 | 254 | margin-right: 8px; | 
| 227 | 255 | margin-bottom: 8px; | ... | ... | 
| ... | ... | @@ -3,11 +3,23 @@ | 
| 3 | 3 | <span :class="[prefixCls, `${prefixCls}--${theme}`]" class="flex"> | 
| 4 | 4 | <img | 
| 5 | 5 | :class="`${prefixCls}__header`" | 
| 6 | - :src="refreshPersonlData.avatar ? refreshPersonlData.avatar : getUserInfo.avatar" | |
| 6 | + :src=" | |
| 7 | + refreshPersonlData.avatar | |
| 8 | + ? refreshPersonlData.avatar | |
| 9 | + : updataPersonlData.avatar | |
| 10 | + ? updataPersonlData.avatar | |
| 11 | + : getUserInfo.avatar | |
| 12 | + " | |
| 7 | 13 | /> | 
| 8 | 14 | <span :class="`${prefixCls}__info hidden md:block`"> | 
| 9 | 15 | <span :class="`${prefixCls}__name `" class="truncate"> | 
| 10 | - {{ refreshPersonlData.realName ? refreshPersonlData.realName : getUserInfo.realName }} | |
| 16 | + {{ | |
| 17 | + refreshPersonlData.realName | |
| 18 | + ? refreshPersonlData.realName | |
| 19 | + : updataPersonlData.realName | |
| 20 | + ? updataPersonlData.realName | |
| 21 | + : getUserInfo.realName | |
| 22 | + }} | |
| 11 | 23 | </span> | 
| 12 | 24 | </span> | 
| 13 | 25 | </span> | 
| ... | ... | @@ -78,6 +90,10 @@ | 
| 78 | 90 | avatar: '', | 
| 79 | 91 | realName: '', | 
| 80 | 92 | }); | 
| 93 | + const updataPersonlData = reactive({ | |
| 94 | + avatar: '', | |
| 95 | + realName: '', | |
| 96 | + }); | |
| 81 | 97 | const userInfo = getAuthCache(USER_INFO_KEY); | 
| 82 | 98 | const { proxy } = getCurrentInstance(); | 
| 83 | 99 | const personalRef = ref(null); | 
| ... | ... | @@ -132,6 +148,13 @@ | 
| 132 | 148 | }); | 
| 133 | 149 | }, 10); | 
| 134 | 150 | }; | 
| 151 | + const refreshCacheGetData = () => { | |
| 152 | + const getItem = window.localStorage.getItem('updateUserInfo'); | |
| 153 | + const newItem = JSON.parse(getItem); | |
| 154 | + updataPersonlData.avatar = newItem?.avatar; | |
| 155 | + updataPersonlData.realName = newItem?.realName; | |
| 156 | + }; | |
| 157 | + refreshCacheGetData(); | |
| 135 | 158 | |
| 136 | 159 | const refreshPersonlFunc = (v) => { | 
| 137 | 160 | refreshPersonlData.avatar = v.avatar; | 
| ... | ... | @@ -139,6 +162,7 @@ | 
| 139 | 162 | }; | 
| 140 | 163 | |
| 141 | 164 | return { | 
| 165 | + updataPersonlData, | |
| 142 | 166 | refreshPersonlData, | 
| 143 | 167 | refreshPersonlFunc, | 
| 144 | 168 | personalRef, | ... | ... | 
| 1 | -import type { UserInfo } from '/#/store'; | |
| 1 | +import type { UserInfo, UserUpdateInfo } from '/#/store'; | |
| 2 | 2 | import type { ErrorMessageMode } from '/#/axios'; | 
| 3 | 3 | import { defineStore } from 'pinia'; | 
| 4 | 4 | import { store } from '/@/store'; | 
| ... | ... | @@ -30,6 +30,7 @@ interface UserState { | 
| 30 | 30 | platInfo: any; | 
| 31 | 31 | enterPriseInfo: any; | 
| 32 | 32 | userInfo: Nullable<UserInfo>; | 
| 33 | + userUpdateInfo?: Nullable<UserUpdateInfo>; | |
| 33 | 34 | token?: string; | 
| 34 | 35 | roleList: RoleEnum[]; | 
| 35 | 36 | sessionTimeout?: boolean; | 
| ... | ... | @@ -47,6 +48,7 @@ export const useUserStore = defineStore({ | 
| 47 | 48 | enterPriseInfo: storage.get('enterPriseInfo') || null, | 
| 48 | 49 | // user info | 
| 49 | 50 | userInfo: null, | 
| 51 | + userUpdateInfo: null, | |
| 50 | 52 | // token | 
| 51 | 53 | jwtToken: undefined, | 
| 52 | 54 | //refresh Token | 
| ... | ... | @@ -66,6 +68,9 @@ export const useUserStore = defineStore({ | 
| 66 | 68 | getUserInfo(): UserInfo { | 
| 67 | 69 | return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {}; | 
| 68 | 70 | }, | 
| 71 | + getUserUpdateInfo(): UserUpdateInfo { | |
| 72 | + return this.userUpdateInfo || {}; | |
| 73 | + }, | |
| 69 | 74 | getJwtToken(): string { | 
| 70 | 75 | return this.jwtToken || getAuthCache<string>(JWT_TOKEN_KEY); | 
| 71 | 76 | }, | 
| ... | ... | @@ -108,6 +113,9 @@ export const useUserStore = defineStore({ | 
| 108 | 113 | this.lastUpdateTime = new Date().getTime(); | 
| 109 | 114 | setAuthCache(USER_INFO_KEY, info); | 
| 110 | 115 | }, | 
| 116 | + setUserUpdateInfo(info: UserUpdateInfo) { | |
| 117 | + this.userUpdateInfo = info; | |
| 118 | + }, | |
| 111 | 119 | setSessionTimeout(flag: boolean) { | 
| 112 | 120 | this.sessionTimeout = flag; | 
| 113 | 121 | }, | 
| ... | ... | @@ -194,6 +202,8 @@ export const useUserStore = defineStore({ | 
| 194 | 202 | // this.setSessionTimeout(false); | 
| 195 | 203 | // goLogin && router.push(PageEnum.BASE_LOGIN); | 
| 196 | 204 | await router.push(PageEnum.BASE_LOGIN); | 
| 205 | + window.localStorage.clear(); | |
| 206 | + window.localStorage.removeItem('updateUserInfo'); | |
| 197 | 207 | }, | 
| 198 | 208 | |
| 199 | 209 | async doRefresh() { | ... | ... | 
| ... | ... | @@ -57,6 +57,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 57 | 57 | colProps: { span: 6 }, | 
| 58 | 58 | componentProps: { | 
| 59 | 59 | placeholder: '请输入联系人姓名', | 
| 60 | + maxLength: 36, | |
| 60 | 61 | }, | 
| 61 | 62 | }, | 
| 62 | 63 | ]; | 
| ... | ... | @@ -128,6 +129,7 @@ export const formSchema: FormSchema[] = [ | 
| 128 | 129 | show: false, | 
| 129 | 130 | componentProps: { | 
| 130 | 131 | maxLength: 36, | 
| 132 | + placeholder: 'id', | |
| 131 | 133 | }, | 
| 132 | 134 | }, | 
| 133 | 135 | ]; | ... | ... | 
| 1 | 1 | <template> | 
| 2 | 2 | <div class="bg-white m-4 mr-0 overflow-hidden"> | 
| 3 | 3 | <BasicTree | 
| 4 | + v-if="treeData.length > 0" | |
| 4 | 5 | title="组织列表" | 
| 5 | 6 | toolbar | 
| 6 | 7 | search | 
| 7 | 8 | :clickRowToExpand="false" | 
| 8 | 9 | :treeData="treeData" | 
| 9 | 10 | :replaceFields="{ key: 'id', title: 'name' }" | 
| 11 | + v-model:expandedKeys="expandedKeys" | |
| 10 | 12 | v-model:selectedKeys="selectedKeys" | 
| 11 | 13 | @select="handleSelect" | 
| 14 | + :defaultExpandAll="true" | |
| 12 | 15 | /> | 
| 13 | 16 | </div> | 
| 14 | 17 | </template> | 
| ... | ... | @@ -24,8 +27,11 @@ | 
| 24 | 27 | |
| 25 | 28 | emits: ['select'], | 
| 26 | 29 | setup(_, { emit }) { | 
| 30 | + // const { proxy } = getCurrentInstance(); | |
| 31 | + const getTreeRef: any = ref(null); | |
| 27 | 32 | const treeData = ref<TreeItem[]>([]); | 
| 28 | 33 | const selectedKeys = ref<string[]>(); | 
| 34 | + const expandedKeys = ref<string[]>(); | |
| 29 | 35 | async function fetch() { | 
| 30 | 36 | treeData.value = (await getOrganizationList()) as unknown as TreeItem[]; | 
| 31 | 37 | } | 
| ... | ... | @@ -40,7 +46,14 @@ | 
| 40 | 46 | onMounted(() => { | 
| 41 | 47 | fetch(); | 
| 42 | 48 | }); | 
| 43 | - return { treeData, handleSelect, resetOrganization, selectedKeys }; | |
| 49 | + return { | |
| 50 | + treeData, | |
| 51 | + handleSelect, | |
| 52 | + resetOrganization, | |
| 53 | + selectedKeys, | |
| 54 | + expandedKeys, | |
| 55 | + getTreeRef, | |
| 56 | + }; | |
| 44 | 57 | }, | 
| 45 | 58 | }); | 
| 46 | 59 | </script> | ... | ... | 
| ... | ... | @@ -28,11 +28,9 @@ | 
| 28 | 28 | }); | 
| 29 | 29 | |
| 30 | 30 | const userInfo: any = getAuthCache(USER_INFO_KEY); | 
| 31 | - const role: string = userInfo.roles[0]; | |
| 31 | + const role: string = userInfo?.roles[0]; | |
| 32 | 32 | const loading = ref(true); | 
| 33 | 33 | |
| 34 | - console.log(role); | |
| 35 | - | |
| 36 | 34 | setTimeout(() => { | 
| 37 | 35 | loading.value = false; | 
| 38 | 36 | }, 1500); | ... | ... | 
| ... | ... | @@ -3,11 +3,6 @@ import { findDictItemByCode } from '/@/api/system/dict'; | 
| 3 | 3 | import { deviceProfile } from '/@/api/device/deviceManager'; | 
| 4 | 4 | import { getOrganizationList } from '/@/api/system/system'; | 
| 5 | 5 | import { copyTransFun } from '/@/utils/fnUtils'; | 
| 6 | -import { | |
| 7 | - DeviceNameMaxLength, | |
| 8 | - DeviceProfileIdMaxLength, | |
| 9 | - DeviceOrgIdMaxLength, | |
| 10 | -} from '/@/utils/rules'; | |
| 11 | 6 | |
| 12 | 7 | // 第一步的表单 | 
| 13 | 8 | export const step1Schemas: FormSchema[] = [ | 
| ... | ... | @@ -26,7 +21,6 @@ export const step1Schemas: FormSchema[] = [ | 
| 26 | 21 | placeholder: '设备名称', | 
| 27 | 22 | maxLength: 30, | 
| 28 | 23 | }, | 
| 29 | - rules: DeviceNameMaxLength, | |
| 30 | 24 | }, | 
| 31 | 25 | { | 
| 32 | 26 | field: 'deviceType', | 
| ... | ... | @@ -53,7 +47,6 @@ export const step1Schemas: FormSchema[] = [ | 
| 53 | 47 | labelField: 'name', | 
| 54 | 48 | valueField: 'id', | 
| 55 | 49 | }, | 
| 56 | - rules: DeviceProfileIdMaxLength, | |
| 57 | 50 | }, | 
| 58 | 51 | { | 
| 59 | 52 | field: 'organizationId', | 
| ... | ... | @@ -67,7 +60,6 @@ export const step1Schemas: FormSchema[] = [ | 
| 67 | 60 | return data; | 
| 68 | 61 | }, | 
| 69 | 62 | }, | 
| 70 | - rules: DeviceOrgIdMaxLength, | |
| 71 | 63 | }, | 
| 72 | 64 | { | 
| 73 | 65 | field: 'label', | 
| ... | ... | @@ -128,19 +120,6 @@ export const step1Schemas: FormSchema[] = [ | 
| 128 | 120 | maxLength: 36, | 
| 129 | 121 | placeholder: '请输入id', | 
| 130 | 122 | }, | 
| 131 | - dynamicRules: () => { | |
| 132 | - return [ | |
| 133 | - { | |
| 134 | - required: false, | |
| 135 | - validator: (_, value) => { | |
| 136 | - if (String(value).length > 36) { | |
| 137 | - return Promise.reject('字数不超过36个字'); | |
| 138 | - } | |
| 139 | - return Promise.resolve(); | |
| 140 | - }, | |
| 141 | - }, | |
| 142 | - ]; | |
| 143 | - }, | |
| 144 | 123 | }, | 
| 145 | 124 | { | 
| 146 | 125 | field: 'tenantId', | 
| ... | ... | @@ -174,19 +153,6 @@ export const step1Schemas: FormSchema[] = [ | 
| 174 | 153 | maxLength: 36, | 
| 175 | 154 | placeholder: '请输入tbDeviceId', | 
| 176 | 155 | }, | 
| 177 | - dynamicRules: () => { | |
| 178 | - return [ | |
| 179 | - { | |
| 180 | - required: false, | |
| 181 | - validator: (_, value) => { | |
| 182 | - if (String(value).length > 36) { | |
| 183 | - return Promise.reject('字数不超过36个字'); | |
| 184 | - } | |
| 185 | - return Promise.resolve(); | |
| 186 | - }, | |
| 187 | - }, | |
| 188 | - ]; | |
| 189 | - }, | |
| 190 | 156 | }, | 
| 191 | 157 | ]; | 
| 192 | 158 | |
| ... | ... | @@ -341,19 +307,6 @@ export const step2Schemas: FormSchema[] = [ | 
| 341 | 307 | maxLength: 36, | 
| 342 | 308 | placeholder: '请输入访问令牌', | 
| 343 | 309 | }, | 
| 344 | - dynamicRules: () => { | |
| 345 | - return [ | |
| 346 | - { | |
| 347 | - required: true, | |
| 348 | - validator: (_, value) => { | |
| 349 | - if (String(value).length > 36) { | |
| 350 | - return Promise.reject('字数不超过36个字'); | |
| 351 | - } | |
| 352 | - return Promise.resolve(); | |
| 353 | - }, | |
| 354 | - }, | |
| 355 | - ]; | |
| 356 | - }, | |
| 357 | 310 | }, | 
| 358 | 311 | { | 
| 359 | 312 | label: 'RSA公钥', | 
| ... | ... | @@ -365,19 +318,6 @@ export const step2Schemas: FormSchema[] = [ | 
| 365 | 318 | maxLength: 36, | 
| 366 | 319 | placeholder: '请输入RSA公钥', | 
| 367 | 320 | }, | 
| 368 | - dynamicRules: () => { | |
| 369 | - return [ | |
| 370 | - { | |
| 371 | - required: true, | |
| 372 | - validator: (_, value) => { | |
| 373 | - if (String(value).length > 36) { | |
| 374 | - return Promise.reject('字数不超过36个字'); | |
| 375 | - } | |
| 376 | - return Promise.resolve(); | |
| 377 | - }, | |
| 378 | - }, | |
| 379 | - ]; | |
| 380 | - }, | |
| 381 | 321 | }, | 
| 382 | 322 | { | 
| 383 | 323 | label: '客户端ID', | 
| ... | ... | @@ -389,19 +329,6 @@ export const step2Schemas: FormSchema[] = [ | 
| 389 | 329 | maxLength: 36, | 
| 390 | 330 | placeholder: '请输入客户端ID', | 
| 391 | 331 | }, | 
| 392 | - dynamicRules: () => { | |
| 393 | - return [ | |
| 394 | - { | |
| 395 | - required: true, | |
| 396 | - validator: (_, value) => { | |
| 397 | - if (String(value).length > 36) { | |
| 398 | - return Promise.reject('字数不超过36个字'); | |
| 399 | - } | |
| 400 | - return Promise.resolve(); | |
| 401 | - }, | |
| 402 | - }, | |
| 403 | - ]; | |
| 404 | - }, | |
| 405 | 332 | }, | 
| 406 | 333 | { | 
| 407 | 334 | label: '用户名', | 
| ... | ... | @@ -413,19 +340,6 @@ export const step2Schemas: FormSchema[] = [ | 
| 413 | 340 | maxLength: 255, | 
| 414 | 341 | placeholder: '请输入用户名', | 
| 415 | 342 | }, | 
| 416 | - dynamicRules: () => { | |
| 417 | - return [ | |
| 418 | - { | |
| 419 | - required: true, | |
| 420 | - validator: (_, value) => { | |
| 421 | - if (String(value).length > 255) { | |
| 422 | - return Promise.reject('字数不超过255个字'); | |
| 423 | - } | |
| 424 | - return Promise.resolve(); | |
| 425 | - }, | |
| 426 | - }, | |
| 427 | - ]; | |
| 428 | - }, | |
| 429 | 343 | }, | 
| 430 | 344 | { | 
| 431 | 345 | label: '密码', | 
| ... | ... | @@ -591,19 +505,6 @@ export const TokenSchemas: FormSchema[] = [ | 
| 591 | 505 | maxLength: 36, | 
| 592 | 506 | placeholder: '请输入访问令牌', | 
| 593 | 507 | }, | 
| 594 | - dynamicRules: () => { | |
| 595 | - return [ | |
| 596 | - { | |
| 597 | - required: false, | |
| 598 | - validator: (_, value) => { | |
| 599 | - if (String(value).length > 36) { | |
| 600 | - return Promise.reject('字数不超过36个字'); | |
| 601 | - } | |
| 602 | - return Promise.resolve(); | |
| 603 | - }, | |
| 604 | - }, | |
| 605 | - ]; | |
| 606 | - }, | |
| 607 | 508 | }, | 
| 608 | 509 | { | 
| 609 | 510 | label: 'RSA公钥', | 
| ... | ... | @@ -615,19 +516,6 @@ export const TokenSchemas: FormSchema[] = [ | 
| 615 | 516 | maxLength: 36, | 
| 616 | 517 | placeholder: '请输入RSA公钥', | 
| 617 | 518 | }, | 
| 618 | - dynamicRules: () => { | |
| 619 | - return [ | |
| 620 | - { | |
| 621 | - required: true, | |
| 622 | - validator: (_, value) => { | |
| 623 | - if (String(value).length > 36) { | |
| 624 | - return Promise.reject('字数不超过36个字'); | |
| 625 | - } | |
| 626 | - return Promise.resolve(); | |
| 627 | - }, | |
| 628 | - }, | |
| 629 | - ]; | |
| 630 | - }, | |
| 631 | 519 | }, | 
| 632 | 520 | { | 
| 633 | 521 | label: '客户端ID', | 
| ... | ... | @@ -639,19 +527,6 @@ export const TokenSchemas: FormSchema[] = [ | 
| 639 | 527 | maxLength: 36, | 
| 640 | 528 | placeholder: '请输入客户端ID', | 
| 641 | 529 | }, | 
| 642 | - dynamicRules: () => { | |
| 643 | - return [ | |
| 644 | - { | |
| 645 | - required: true, | |
| 646 | - validator: (_, value) => { | |
| 647 | - if (String(value).length > 36) { | |
| 648 | - return Promise.reject('字数不超过36个字'); | |
| 649 | - } | |
| 650 | - return Promise.resolve(); | |
| 651 | - }, | |
| 652 | - }, | |
| 653 | - ]; | |
| 654 | - }, | |
| 655 | 530 | }, | 
| 656 | 531 | { | 
| 657 | 532 | label: '用户名', | 
| ... | ... | @@ -663,19 +538,6 @@ export const TokenSchemas: FormSchema[] = [ | 
| 663 | 538 | maxLength: 255, | 
| 664 | 539 | placeholder: '请输入用户名', | 
| 665 | 540 | }, | 
| 666 | - dynamicRules: () => { | |
| 667 | - return [ | |
| 668 | - { | |
| 669 | - required: true, | |
| 670 | - validator: (_, value) => { | |
| 671 | - if (String(value).length > 255) { | |
| 672 | - return Promise.reject('字数不超过255个字'); | |
| 673 | - } | |
| 674 | - return Promise.resolve(); | |
| 675 | - }, | |
| 676 | - }, | |
| 677 | - ]; | |
| 678 | - }, | |
| 679 | 541 | }, | 
| 680 | 542 | { | 
| 681 | 543 | label: '密码', | 
| ... | ... | @@ -709,19 +571,6 @@ export const TokenSchemas: FormSchema[] = [ | 
| 709 | 571 | maxLength: 36, | 
| 710 | 572 | placeholder: '请输入id', | 
| 711 | 573 | }, | 
| 712 | - dynamicRules: () => { | |
| 713 | - return [ | |
| 714 | - { | |
| 715 | - required: false, | |
| 716 | - validator: (_, value) => { | |
| 717 | - if (String(value).length > 36) { | |
| 718 | - return Promise.reject('字数不超过36个字'); | |
| 719 | - } | |
| 720 | - return Promise.resolve(); | |
| 721 | - }, | |
| 722 | - }, | |
| 723 | - ]; | |
| 724 | - }, | |
| 725 | 574 | }, | 
| 726 | 575 | { | 
| 727 | 576 | label: 'tbDeviceId', | ... | ... | 
| ... | ... | @@ -90,6 +90,10 @@ export const alarmSearchSchemas: FormSchema[] = [ | 
| 90 | 90 | label: '告警类型', | 
| 91 | 91 | component: 'Input', | 
| 92 | 92 | colProps: { span: 6 }, | 
| 93 | + componentProps: { | |
| 94 | + placeholder: '请输入告警类型', | |
| 95 | + maxLength: 36, | |
| 96 | + }, | |
| 93 | 97 | }, | 
| 94 | 98 | { | 
| 95 | 99 | field: 'endTime', | 
| ... | ... | @@ -227,6 +231,7 @@ export const childDeviceSchemas: FormSchema[] = [ | 
| 227 | 231 | colProps: { span: 12 }, | 
| 228 | 232 | componentProps: { | 
| 229 | 233 | maxLength: 255, | 
| 234 | + placeholder: '请输入设备名称', | |
| 230 | 235 | }, | 
| 231 | 236 | }, | 
| 232 | 237 | ]; | ... | ... | 
| ... | ... | @@ -124,19 +124,7 @@ export const formSchema: FormSchema[] = [ | 
| 124 | 124 | maxLength: 36, | 
| 125 | 125 | placeholder: '请输入accessKeyId', | 
| 126 | 126 | }, | 
| 127 | - dynamicRules: () => { | |
| 128 | - return [ | |
| 129 | - { | |
| 130 | - required: true, | |
| 131 | - validator: (_, value) => { | |
| 132 | - if (String(value).length > 36) { | |
| 133 | - return Promise.reject('字数不超过36个字'); | |
| 134 | - } | |
| 135 | - return Promise.resolve(); | |
| 136 | - }, | |
| 137 | - }, | |
| 138 | - ]; | |
| 139 | - }, | |
| 127 | + | |
| 140 | 128 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 141 | 129 | }, | 
| 142 | 130 | { | 
| ... | ... | @@ -171,21 +159,9 @@ export const formSchema: FormSchema[] = [ | 
| 171 | 159 | component: 'Input', | 
| 172 | 160 | componentProps: { | 
| 173 | 161 | maxLength: 36, | 
| 174 | - placeholder: '请输入accessKeySecret', | |
| 175 | - }, | |
| 176 | - dynamicRules: () => { | |
| 177 | - return [ | |
| 178 | - { | |
| 179 | - required: true, | |
| 180 | - validator: (_, value) => { | |
| 181 | - if (String(value).length > 36) { | |
| 182 | - return Promise.reject('字数不超过36个字'); | |
| 183 | - } | |
| 184 | - return Promise.resolve(); | |
| 185 | - }, | |
| 186 | - }, | |
| 187 | - ]; | |
| 162 | + placeholder: '请输入服务器地址', | |
| 188 | 163 | }, | 
| 164 | + | |
| 189 | 165 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 
| 190 | 166 | }, | 
| 191 | 167 | { | 
| ... | ... | @@ -266,19 +242,6 @@ export const formSchema: FormSchema[] = [ | 
| 266 | 242 | maxLength: 36, | 
| 267 | 243 | placeholder: '请输入主键', | 
| 268 | 244 | }, | 
| 269 | - dynamicRules: () => { | |
| 270 | - return [ | |
| 271 | - { | |
| 272 | - required: false, | |
| 273 | - validator: (_, value) => { | |
| 274 | - if (String(value).length > 36) { | |
| 275 | - return Promise.reject('字数不超过36个字'); | |
| 276 | - } | |
| 277 | - return Promise.resolve(); | |
| 278 | - }, | |
| 279 | - }, | |
| 280 | - ]; | |
| 281 | - }, | |
| 282 | 245 | }, | 
| 283 | 246 | { | 
| 284 | 247 | field: 'status', | ... | ... | 
| ... | ... | @@ -11,18 +11,5 @@ export const formSchema: FormSchema[] = [ | 
| 11 | 11 | maxLength: 255, | 
| 12 | 12 | placeholder: '请输入报警详细信息', | 
| 13 | 13 | }, | 
| 14 | - dynamicRules: () => { | |
| 15 | - return [ | |
| 16 | - { | |
| 17 | - required: true, | |
| 18 | - validator: (_, value) => { | |
| 19 | - if (String(value).length > 255) { | |
| 20 | - return Promise.reject('字数不超过255个字'); | |
| 21 | - } | |
| 22 | - return Promise.resolve(); | |
| 23 | - }, | |
| 24 | - }, | |
| 25 | - ]; | |
| 26 | - }, | |
| 27 | 14 | }, | 
| 28 | 15 | ]; | ... | ... | 
| ... | ... | @@ -16,19 +16,6 @@ export const step1Schemas: FormSchema[] = [ | 
| 16 | 16 | maxLength: 255, | 
| 17 | 17 | placeholder: '请输入配置名称', | 
| 18 | 18 | }, | 
| 19 | - dynamicRules: () => { | |
| 20 | - return [ | |
| 21 | - { | |
| 22 | - required: true, | |
| 23 | - validator: (_, value) => { | |
| 24 | - if (String(value).length > 255) { | |
| 25 | - return Promise.reject('字数不超过255个字'); | |
| 26 | - } | |
| 27 | - return Promise.resolve(); | |
| 28 | - }, | |
| 29 | - }, | |
| 30 | - ]; | |
| 31 | - }, | |
| 32 | 19 | }, | 
| 33 | 20 | //规则链(string) | 
| 34 | 21 | { | ... | ... | 
| ... | ... | @@ -118,19 +118,6 @@ export const formSchema: FormSchema[] = [ | 
| 118 | 118 | maxLength: 30, | 
| 119 | 119 | placeholder: '请输入配置名称', | 
| 120 | 120 | }, | 
| 121 | - dynamicRules: () => { | |
| 122 | - return [ | |
| 123 | - { | |
| 124 | - required: true, | |
| 125 | - validator: (_, value) => { | |
| 126 | - if (String(value).length > 30) { | |
| 127 | - return Promise.reject('字数不超过30个字'); | |
| 128 | - } | |
| 129 | - return Promise.resolve(); | |
| 130 | - }, | |
| 131 | - }, | |
| 132 | - ]; | |
| 133 | - }, | |
| 134 | 121 | }, | 
| 135 | 122 | { | 
| 136 | 123 | field: 'messageType', | 
| ... | ... | @@ -170,19 +157,7 @@ export const formSchema: FormSchema[] = [ | 
| 170 | 157 | maxLength: 36, | 
| 171 | 158 | placeholder: '请输入accessKeyId', | 
| 172 | 159 | }, | 
| 173 | - dynamicRules: () => { | |
| 174 | - return [ | |
| 175 | - { | |
| 176 | - required: true, | |
| 177 | - validator: (_, value) => { | |
| 178 | - if (String(value).length > 36) { | |
| 179 | - return Promise.reject('字数不超过36个字'); | |
| 180 | - } | |
| 181 | - return Promise.resolve(); | |
| 182 | - }, | |
| 183 | - }, | |
| 184 | - ]; | |
| 185 | - }, | |
| 160 | + | |
| 186 | 161 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 187 | 162 | }, | 
| 188 | 163 | { | 
| ... | ... | @@ -193,19 +168,7 @@ export const formSchema: FormSchema[] = [ | 
| 193 | 168 | maxLength: 36, | 
| 194 | 169 | placeholder: '请输入accessKeySecret', | 
| 195 | 170 | }, | 
| 196 | - dynamicRules: () => { | |
| 197 | - return [ | |
| 198 | - { | |
| 199 | - required: true, | |
| 200 | - validator: (_, value) => { | |
| 201 | - if (String(value).length > 36) { | |
| 202 | - return Promise.reject('字数不超过36个字'); | |
| 203 | - } | |
| 204 | - return Promise.resolve(); | |
| 205 | - }, | |
| 206 | - }, | |
| 207 | - ]; | |
| 208 | - }, | |
| 171 | + | |
| 209 | 172 | component: 'Input', | 
| 210 | 173 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 211 | 174 | }, | 
| ... | ... | @@ -219,19 +182,7 @@ export const formSchema: FormSchema[] = [ | 
| 219 | 182 | maxLength: 36, | 
| 220 | 183 | placeholder: '请输入服务器地址', | 
| 221 | 184 | }, | 
| 222 | - dynamicRules: () => { | |
| 223 | - return [ | |
| 224 | - { | |
| 225 | - required: true, | |
| 226 | - validator: (_, value) => { | |
| 227 | - if (String(value).length > 36) { | |
| 228 | - return Promise.reject('字数不超过36个字'); | |
| 229 | - } | |
| 230 | - return Promise.resolve(); | |
| 231 | - }, | |
| 232 | - }, | |
| 233 | - ]; | |
| 234 | - }, | |
| 185 | + | |
| 235 | 186 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 
| 236 | 187 | }, | 
| 237 | 188 | { | 
| ... | ... | @@ -243,19 +194,7 @@ export const formSchema: FormSchema[] = [ | 
| 243 | 194 | maxLength: 36, | 
| 244 | 195 | placeholder: '请输入端口', | 
| 245 | 196 | }, | 
| 246 | - dynamicRules: () => { | |
| 247 | - return [ | |
| 248 | - { | |
| 249 | - required: true, | |
| 250 | - validator: (_, value) => { | |
| 251 | - if (String(value).length > 36) { | |
| 252 | - return Promise.reject('字数不超过36个字'); | |
| 253 | - } | |
| 254 | - return Promise.resolve(); | |
| 255 | - }, | |
| 256 | - }, | |
| 257 | - ]; | |
| 258 | - }, | |
| 197 | + | |
| 259 | 198 | component: 'InputNumber', | 
| 260 | 199 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 
| 261 | 200 | }, | 
| ... | ... | @@ -267,19 +206,6 @@ export const formSchema: FormSchema[] = [ | 
| 267 | 206 | maxLength: 255, | 
| 268 | 207 | placeholder: '请输入用户名', | 
| 269 | 208 | }, | 
| 270 | - dynamicRules: () => { | |
| 271 | - return [ | |
| 272 | - { | |
| 273 | - required: false, | |
| 274 | - validator: (_, value) => { | |
| 275 | - if (String(value).length > 255) { | |
| 276 | - return Promise.reject('字数不超过255个字'); | |
| 277 | - } | |
| 278 | - return Promise.resolve(); | |
| 279 | - }, | |
| 280 | - }, | |
| 281 | - ]; | |
| 282 | - }, | |
| 283 | 209 | |
| 284 | 210 | component: 'Input', | 
| 285 | 211 | ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 
| ... | ... | @@ -324,19 +250,6 @@ export const formSchema: FormSchema[] = [ | 
| 324 | 250 | maxLength: 36, | 
| 325 | 251 | placeholder: '请输入主键', | 
| 326 | 252 | }, | 
| 327 | - dynamicRules: () => { | |
| 328 | - return [ | |
| 329 | - { | |
| 330 | - required: false, | |
| 331 | - validator: (_, value) => { | |
| 332 | - if (String(value).length > 36) { | |
| 333 | - return Promise.reject('字数不超过255个字'); | |
| 334 | - } | |
| 335 | - return Promise.resolve(); | |
| 336 | - }, | |
| 337 | - }, | |
| 338 | - ]; | |
| 339 | - }, | |
| 340 | 253 | }, | 
| 341 | 254 | { | 
| 342 | 255 | field: 'status', | 
| ... | ... | @@ -382,18 +295,5 @@ export const formSchema: FormSchema[] = [ | 
| 382 | 295 | maxLength: 36, | 
| 383 | 296 | placeholder: '请输入租户ID', | 
| 384 | 297 | }, | 
| 385 | - dynamicRules: () => { | |
| 386 | - return [ | |
| 387 | - { | |
| 388 | - required: false, | |
| 389 | - validator: (_, value) => { | |
| 390 | - if (String(value).length > 36) { | |
| 391 | - return Promise.reject('字数不超过255个字'); | |
| 392 | - } | |
| 393 | - return Promise.resolve(); | |
| 394 | - }, | |
| 395 | - }, | |
| 396 | - ]; | |
| 397 | - }, | |
| 398 | 298 | }, | 
| 399 | 299 | ]; | ... | ... | 
| ... | ... | @@ -18,24 +18,38 @@ | 
| 18 | 18 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| 19 | 19 | import { Tinymce } from '/@/components/Tinymce'; | 
| 20 | 20 | import { sendEmail } from '/@/api/message/template'; | 
| 21 | + import { emailRule } from '/@/utils/rules'; | |
| 22 | + | |
| 21 | 23 | const schemas: FormSchema[] = [ | 
| 22 | 24 | { | 
| 23 | 25 | field: 'id', | 
| 24 | 26 | component: 'Input', | 
| 25 | 27 | label: 'id', | 
| 26 | 28 | show: false, | 
| 29 | + componentProps: { | |
| 30 | + maxLength: 36, | |
| 31 | + placeholder: '请输入id', | |
| 32 | + }, | |
| 27 | 33 | }, | 
| 28 | 34 | { | 
| 29 | 35 | field: 'templatePurpose', | 
| 30 | 36 | label: '用途', | 
| 31 | 37 | component: 'Input', | 
| 32 | 38 | show: false, | 
| 39 | + componentProps: { | |
| 40 | + maxLength: 255, | |
| 41 | + placeholder: '请输入用途', | |
| 42 | + }, | |
| 33 | 43 | }, | 
| 34 | 44 | { | 
| 35 | 45 | field: 'messageType', | 
| 36 | 46 | component: 'Input', | 
| 37 | 47 | label: 'messageType', | 
| 38 | 48 | show: false, | 
| 49 | + componentProps: { | |
| 50 | + maxLength: 255, | |
| 51 | + placeholder: '请输入messageType', | |
| 52 | + }, | |
| 39 | 53 | }, | 
| 40 | 54 | { | 
| 41 | 55 | field: 'subject', | 
| ... | ... | @@ -45,6 +59,10 @@ | 
| 45 | 59 | colProps: { | 
| 46 | 60 | span: 12, | 
| 47 | 61 | }, | 
| 62 | + componentProps: { | |
| 63 | + maxLength: 255, | |
| 64 | + placeholder: '请输入邮件主题', | |
| 65 | + }, | |
| 48 | 66 | }, | 
| 49 | 67 | { | 
| 50 | 68 | field: 'to', | 
| ... | ... | @@ -54,6 +72,11 @@ | 
| 54 | 72 | colProps: { | 
| 55 | 73 | span: 12, | 
| 56 | 74 | }, | 
| 75 | + rules: emailRule, | |
| 76 | + componentProps: { | |
| 77 | + maxLength: 255, | |
| 78 | + placeholder: '请输入主送', | |
| 79 | + }, | |
| 57 | 80 | }, | 
| 58 | 81 | { | 
| 59 | 82 | field: 'cc', | 
| ... | ... | @@ -62,6 +85,11 @@ | 
| 62 | 85 | colProps: { | 
| 63 | 86 | span: 12, | 
| 64 | 87 | }, | 
| 88 | + rules: emailRule, | |
| 89 | + componentProps: { | |
| 90 | + maxLength: 255, | |
| 91 | + placeholder: '请输入抄送', | |
| 92 | + }, | |
| 65 | 93 | }, | 
| 66 | 94 | { | 
| 67 | 95 | field: 'bcc', | 
| ... | ... | @@ -70,6 +98,11 @@ | 
| 70 | 98 | colProps: { | 
| 71 | 99 | span: 12, | 
| 72 | 100 | }, | 
| 101 | + rules: emailRule, | |
| 102 | + componentProps: { | |
| 103 | + maxLength: 255, | |
| 104 | + placeholder: '请输入密送', | |
| 105 | + }, | |
| 73 | 106 | }, | 
| 74 | 107 | { | 
| 75 | 108 | field: 'body', | 
| ... | ... | @@ -111,17 +144,14 @@ | 
| 111 | 144 | const cc = Reflect.get(values, 'cc'); | 
| 112 | 145 | const bcc = Reflect.get(values, 'bcc'); | 
| 113 | 146 | if (typeof cc != 'undefined') { | 
| 114 | - cc.split(','); | |
| 115 | - Reflect.set(values, 'cc', cc); | |
| 147 | + Reflect.set(values, 'cc', cc.split(',')); | |
| 116 | 148 | } | 
| 117 | 149 | if (typeof bcc != 'undefined') { | 
| 118 | - bcc.split(','); | |
| 119 | - Reflect.set(values, 'bcc', bcc); | |
| 150 | + Reflect.set(values, 'bcc', bcc.split(',')); | |
| 120 | 151 | } | 
| 121 | 152 | Reflect.set(values, 'to', to); | 
| 122 | 153 | Reflect.set(values, 'emailFormatEnum', 'HTML'); | 
| 123 | 154 | await sendEmail(values); | 
| 124 | - console.log(values, 'values'); | |
| 125 | 155 | closeModal(); | 
| 126 | 156 | createMessage.success('发送成功'); | 
| 127 | 157 | } | ... | ... | 
| ... | ... | @@ -148,19 +148,6 @@ export const formSchema: FormSchema[] = [ | 
| 148 | 148 | maxLength: 36, | 
| 149 | 149 | placeholder: '请输入主键', | 
| 150 | 150 | }, | 
| 151 | - dynamicRules: () => { | |
| 152 | - return [ | |
| 153 | - { | |
| 154 | - required: false, | |
| 155 | - validator: (_, value) => { | |
| 156 | - if (String(value).length > 36) { | |
| 157 | - return Promise.reject('字数不超过36个字'); | |
| 158 | - } | |
| 159 | - return Promise.resolve(); | |
| 160 | - }, | |
| 161 | - }, | |
| 162 | - ]; | |
| 163 | - }, | |
| 164 | 151 | }, | 
| 165 | 152 | { | 
| 166 | 153 | field: 'messageType', | 
| ... | ... | @@ -200,19 +187,6 @@ export const formSchema: FormSchema[] = [ | 
| 200 | 187 | maxLength: 32, | 
| 201 | 188 | placeholder: '请输入模板名称', | 
| 202 | 189 | }, | 
| 203 | - dynamicRules: () => { | |
| 204 | - return [ | |
| 205 | - { | |
| 206 | - required: false, | |
| 207 | - validator: (_, value) => { | |
| 208 | - if (String(value).length > 32) { | |
| 209 | - return Promise.reject('字数不超过32个字'); | |
| 210 | - } | |
| 211 | - return Promise.resolve(); | |
| 212 | - }, | |
| 213 | - }, | |
| 214 | - ]; | |
| 215 | - }, | |
| 216 | 190 | }, | 
| 217 | 191 | { | 
| 218 | 192 | field: 'templateCode', | 
| ... | ... | @@ -223,19 +197,7 @@ export const formSchema: FormSchema[] = [ | 
| 223 | 197 | maxLength: 20, | 
| 224 | 198 | placeholder: '请输入模板编号', | 
| 225 | 199 | }, | 
| 226 | - dynamicRules: () => { | |
| 227 | - return [ | |
| 228 | - { | |
| 229 | - required: false, | |
| 230 | - validator: (_, value) => { | |
| 231 | - if (String(value).length > 20) { | |
| 232 | - return Promise.reject('字数不超过20个字'); | |
| 233 | - } | |
| 234 | - return Promise.resolve(); | |
| 235 | - }, | |
| 236 | - }, | |
| 237 | - ]; | |
| 238 | - }, | |
| 200 | + | |
| 239 | 201 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 240 | 202 | }, | 
| 241 | 203 | { | 
| ... | ... | @@ -247,19 +209,6 @@ export const formSchema: FormSchema[] = [ | 
| 247 | 209 | maxLength: 32, | 
| 248 | 210 | placeholder: '请输入签名', | 
| 249 | 211 | }, | 
| 250 | - dynamicRules: () => { | |
| 251 | - return [ | |
| 252 | - { | |
| 253 | - required: false, | |
| 254 | - validator: (_, value) => { | |
| 255 | - if (String(value).length > 32) { | |
| 256 | - return Promise.reject('字数不超过32个字'); | |
| 257 | - } | |
| 258 | - return Promise.resolve(); | |
| 259 | - }, | |
| 260 | - }, | |
| 261 | - ]; | |
| 262 | - }, | |
| 263 | 212 | |
| 264 | 213 | ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 265 | 214 | }, | 
| ... | ... | @@ -287,18 +236,5 @@ export const formSchema: FormSchema[] = [ | 
| 287 | 236 | maxLength: 36, | 
| 288 | 237 | placeholder: '请输入租户ID', | 
| 289 | 238 | }, | 
| 290 | - dynamicRules: () => { | |
| 291 | - return [ | |
| 292 | - { | |
| 293 | - required: false, | |
| 294 | - validator: (_, value) => { | |
| 295 | - if (String(value).length > 36) { | |
| 296 | - return Promise.reject('字数不超过36个字'); | |
| 297 | - } | |
| 298 | - return Promise.resolve(); | |
| 299 | - }, | |
| 300 | - }, | |
| 301 | - ]; | |
| 302 | - }, | |
| 303 | 239 | }, | 
| 304 | 240 | ]; | ... | ... | 
| ... | ... | @@ -108,6 +108,9 @@ | 
| 108 | 108 | // function unique(arr) { | 
| 109 | 109 | // return Array.from(new Set(arr)); | 
| 110 | 110 | // } | 
| 111 | + const clearGetPushValueDataEmpty = () => { | |
| 112 | + getPushValueData.value.length = 0; | |
| 113 | + }; | |
| 111 | 114 | function getAllFields(getV) { | 
| 112 | 115 | const values = getFieldsValue(); | 
| 113 | 116 | getValueData.value = values; | 
| ... | ... | @@ -368,7 +371,15 @@ | 
| 368 | 371 | ]); | 
| 369 | 372 | n.value--; | 
| 370 | 373 | } | 
| 371 | - return { setFieldsFormValue, registerTrigger, add, del, getAllFields, funcResetFields }; | |
| 374 | + return { | |
| 375 | + clearGetPushValueDataEmpty, | |
| 376 | + setFieldsFormValue, | |
| 377 | + registerTrigger, | |
| 378 | + add, | |
| 379 | + del, | |
| 380 | + getAllFields, | |
| 381 | + funcResetFields, | |
| 382 | + }; | |
| 372 | 383 | }, | 
| 373 | 384 | }); | 
| 374 | 385 | </script> | ... | ... | 
| ... | ... | @@ -150,19 +150,6 @@ export const formSchema: FormSchema[] = [ | 
| 150 | 150 | maxLength: 36, | 
| 151 | 151 | placeholder: '请输入场景联动名称', | 
| 152 | 152 | }, | 
| 153 | - dynamicRules: () => { | |
| 154 | - return [ | |
| 155 | - { | |
| 156 | - required: true, | |
| 157 | - validator: (_, value) => { | |
| 158 | - if (String(value).length > 36) { | |
| 159 | - return Promise.reject('字数不超过36个字'); | |
| 160 | - } | |
| 161 | - return Promise.resolve(); | |
| 162 | - }, | |
| 163 | - }, | |
| 164 | - ]; | |
| 165 | - }, | |
| 166 | 153 | }, | 
| 167 | 154 | { | 
| 168 | 155 | required: true, | ... | ... | 
| ... | ... | @@ -5,7 +5,6 @@ import { Tinymce } from '/@/components/Tinymce/index'; | 
| 5 | 5 | import { getOrganizationList } from '/@/api/system/system'; | 
| 6 | 6 | import { copyTransFun } from '/@/utils/fnUtils'; | 
| 7 | 7 | import { Tag } from 'ant-design-vue'; | 
| 8 | -import { NotificationTitleMaxLength } from '/@/utils/rules'; | |
| 9 | 8 | |
| 10 | 9 | export enum IsOrgEnum { | 
| 11 | 10 | IS_ORG_ENUM = '1', | 
| ... | ... | @@ -98,7 +97,6 @@ export const formSchema: FormSchema[] = [ | 
| 98 | 97 | placeholder: '请输入标题', | 
| 99 | 98 | maxLength: 200, | 
| 100 | 99 | }, | 
| 101 | - rules: NotificationTitleMaxLength, | |
| 102 | 100 | }, | 
| 103 | 101 | { | 
| 104 | 102 | field: 'content', | ... | ... | 
| ... | ... | @@ -6,18 +6,21 @@ | 
| 6 | 6 | :title="getTitle" | 
| 7 | 7 | @ok="handleSubmit" | 
| 8 | 8 | > | 
| 9 | - <BasicForm @register="registerForm"> | |
| 10 | - <template #organizationId="{ model, field }"> | |
| 11 | - <BasicTree | |
| 12 | - v-model:value="model[field]" | |
| 13 | - :treeData="organizationTreeData" | |
| 14 | - :checked-keys="checkGroup" | |
| 15 | - checkable | |
| 16 | - toolbar | |
| 17 | - title="所属组织" | |
| 18 | - /> | |
| 19 | - </template> | |
| 20 | - </BasicForm> | |
| 9 | + <div style="height: 50vh"> | |
| 10 | + <BasicForm @register="registerForm"> | |
| 11 | + <template #organizationId="{ model, field }"> | |
| 12 | + <BasicTree | |
| 13 | + v-model:value="model[field]" | |
| 14 | + :treeData="organizationTreeData" | |
| 15 | + :checked-keys="checkGroup" | |
| 16 | + :defaultExpandAll="true" | |
| 17 | + checkable | |
| 18 | + toolbar | |
| 19 | + title="所属组织" | |
| 20 | + /> | |
| 21 | + </template> | |
| 22 | + </BasicForm> | |
| 23 | + </div> | |
| 21 | 24 | </BasicModal> | 
| 22 | 25 | </template> | 
| 23 | 26 | <script lang="ts"> | ... | ... | 
| ... | ... | @@ -45,6 +45,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 45 | 45 | colProps: { span: 8 }, | 
| 46 | 46 | componentProps: { | 
| 47 | 47 | maxLength: 255, | 
| 48 | + placeholder: '请输入用户名', | |
| 48 | 49 | }, | 
| 49 | 50 | dynamicRules: () => { | 
| 50 | 51 | return [ | 
| ... | ... | @@ -67,6 +68,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 67 | 68 | colProps: { span: 8 }, | 
| 68 | 69 | componentProps: { | 
| 69 | 70 | maxLength: 255, | 
| 71 | + placeholder: '请输入姓名', | |
| 70 | 72 | }, | 
| 71 | 73 | dynamicRules: () => { | 
| 72 | 74 | return [ | 
| ... | ... | @@ -93,19 +95,6 @@ export const accountFormSchema: FormSchema[] = [ | 
| 93 | 95 | componentProps: { | 
| 94 | 96 | maxLength: 36, | 
| 95 | 97 | }, | 
| 96 | - dynamicRules: () => { | |
| 97 | - return [ | |
| 98 | - { | |
| 99 | - required: false, | |
| 100 | - validator: (_, value) => { | |
| 101 | - if (String(value).length > 36) { | |
| 102 | - return Promise.reject('字数不超过36个字'); | |
| 103 | - } | |
| 104 | - return Promise.resolve(); | |
| 105 | - }, | |
| 106 | - }, | |
| 107 | - ]; | |
| 108 | - }, | |
| 109 | 98 | }, | 
| 110 | 99 | { | 
| 111 | 100 | field: 'username', | 
| ... | ... | @@ -113,9 +102,14 @@ export const accountFormSchema: FormSchema[] = [ | 
| 113 | 102 | component: 'Input', | 
| 114 | 103 | colProps: { span: 12 }, | 
| 115 | 104 | dynamicDisabled: false, | 
| 105 | + componentProps: { | |
| 106 | + maxLength: 36, | |
| 107 | + placeholder: '请输入账号', | |
| 108 | + }, | |
| 116 | 109 | dynamicRules: ({ values }) => { | 
| 117 | 110 | return [ | 
| 118 | 111 | { | 
| 112 | + required: true, | |
| 119 | 113 | validator(_, value) { | 
| 120 | 114 | return new Promise((resolve, reject) => { | 
| 121 | 115 | if (value == '') { | 
| ... | ... | @@ -159,19 +153,6 @@ export const accountFormSchema: FormSchema[] = [ | 
| 159 | 153 | componentProps: { | 
| 160 | 154 | maxLength: 255, | 
| 161 | 155 | }, | 
| 162 | - dynamicRules: () => { | |
| 163 | - return [ | |
| 164 | - { | |
| 165 | - required: true, | |
| 166 | - validator: (_, value) => { | |
| 167 | - if (String(value).length > 255) { | |
| 168 | - return Promise.reject('字数不超过255个字'); | |
| 169 | - } | |
| 170 | - return Promise.resolve(); | |
| 171 | - }, | |
| 172 | - }, | |
| 173 | - ]; | |
| 174 | - }, | |
| 175 | 156 | }, | 
| 176 | 157 | { | 
| 177 | 158 | label: '角色', | 
| ... | ... | @@ -237,18 +218,5 @@ export const accountFormSchema: FormSchema[] = [ | 
| 237 | 218 | componentProps: { | 
| 238 | 219 | maxLength: 36, | 
| 239 | 220 | }, | 
| 240 | - dynamicRules: () => { | |
| 241 | - return [ | |
| 242 | - { | |
| 243 | - required: false, | |
| 244 | - validator: (_, value) => { | |
| 245 | - if (String(value).length > 36) { | |
| 246 | - return Promise.reject('字数不超过36个字'); | |
| 247 | - } | |
| 248 | - return Promise.resolve(); | |
| 249 | - }, | |
| 250 | - }, | |
| 251 | - ]; | |
| 252 | - }, | |
| 253 | 221 | }, | 
| 254 | 222 | ]; | ... | ... | 
| ... | ... | @@ -37,6 +37,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 37 | 37 | colProps: { span: 6 }, | 
| 38 | 38 | componentProps: { | 
| 39 | 39 | maxLength: 32, | 
| 40 | + placeholder: '请输入字典名称', | |
| 40 | 41 | }, | 
| 41 | 42 | dynamicRules: () => { | 
| 42 | 43 | return [ | 
| ... | ... | @@ -59,6 +60,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 59 | 60 | colProps: { span: 6 }, | 
| 60 | 61 | componentProps: { | 
| 61 | 62 | maxLength: 32, | 
| 63 | + placeholder: '请输入字典编码', | |
| 62 | 64 | }, | 
| 63 | 65 | dynamicRules: () => { | 
| 64 | 66 | return [ | 
| ... | ... | @@ -84,19 +86,7 @@ export const formSchema: FormSchema[] = [ | 
| 84 | 86 | component: 'Input', | 
| 85 | 87 | componentProps: { | 
| 86 | 88 | maxLength: 32, | 
| 87 | - }, | |
| 88 | - dynamicRules: () => { | |
| 89 | - return [ | |
| 90 | - { | |
| 91 | - required: true, | |
| 92 | - validator: (_, value) => { | |
| 93 | - if (String(value).length > 32) { | |
| 94 | - return Promise.reject('字数不超过32个字'); | |
| 95 | - } | |
| 96 | - return Promise.resolve(); | |
| 97 | - }, | |
| 98 | - }, | |
| 99 | - ]; | |
| 89 | + placeholder: '请输入字典名称', | |
| 100 | 90 | }, | 
| 101 | 91 | }, | 
| 102 | 92 | { | 
| ... | ... | @@ -106,19 +96,7 @@ export const formSchema: FormSchema[] = [ | 
| 106 | 96 | component: 'Input', | 
| 107 | 97 | componentProps: { | 
| 108 | 98 | maxLength: 32, | 
| 109 | - }, | |
| 110 | - dynamicRules: () => { | |
| 111 | - return [ | |
| 112 | - { | |
| 113 | - required: true, | |
| 114 | - validator: (_, value) => { | |
| 115 | - if (String(value).length > 32) { | |
| 116 | - return Promise.reject('字数不超过32个字'); | |
| 117 | - } | |
| 118 | - return Promise.resolve(); | |
| 119 | - }, | |
| 120 | - }, | |
| 121 | - ]; | |
| 99 | + placeholder: '请输入字典编码', | |
| 122 | 100 | }, | 
| 123 | 101 | }, | 
| 124 | 102 | { | 
| ... | ... | @@ -127,6 +105,7 @@ export const formSchema: FormSchema[] = [ | 
| 127 | 105 | component: 'InputTextArea', | 
| 128 | 106 | componentProps: { | 
| 129 | 107 | maxLength: 255, | 
| 108 | + placeholder: '请输入备注', | |
| 130 | 109 | }, | 
| 131 | 110 | dynamicRules: () => { | 
| 132 | 111 | return [ | ... | ... | 
| ... | ... | @@ -69,6 +69,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 69 | 69 | colProps: { span: 6 }, | 
| 70 | 70 | componentProps: { | 
| 71 | 71 | maxLength: 32, | 
| 72 | + placeholder: '请输入文本值', | |
| 72 | 73 | }, | 
| 73 | 74 | dynamicRules: () => { | 
| 74 | 75 | return [ | 
| ... | ... | @@ -91,6 +92,7 @@ export const searchFormSchema: FormSchema[] = [ | 
| 91 | 92 | show: false, | 
| 92 | 93 | componentProps: { | 
| 93 | 94 | maxLength: 36, | 
| 95 | + placeholder: '请输入文本值', | |
| 94 | 96 | }, | 
| 95 | 97 | dynamicRules: () => { | 
| 96 | 98 | return [ | 
| ... | ... | @@ -116,19 +118,7 @@ export const formSchema: FormSchema[] = [ | 
| 116 | 118 | component: 'Input', | 
| 117 | 119 | componentProps: { | 
| 118 | 120 | maxLength: 32, | 
| 119 | - }, | |
| 120 | - dynamicRules: () => { | |
| 121 | - return [ | |
| 122 | - { | |
| 123 | - required: true, | |
| 124 | - validator: (_, value) => { | |
| 125 | - if (String(value).length > 32) { | |
| 126 | - return Promise.reject('字数不超过32个字'); | |
| 127 | - } | |
| 128 | - return Promise.resolve(); | |
| 129 | - }, | |
| 130 | - }, | |
| 131 | - ]; | |
| 121 | + placeholder: '请输入文本值', | |
| 132 | 122 | }, | 
| 133 | 123 | }, | 
| 134 | 124 | { | 
| ... | ... | @@ -138,19 +128,7 @@ export const formSchema: FormSchema[] = [ | 
| 138 | 128 | component: 'Input', | 
| 139 | 129 | componentProps: { | 
| 140 | 130 | maxLength: 32, | 
| 141 | - }, | |
| 142 | - dynamicRules: () => { | |
| 143 | - return [ | |
| 144 | - { | |
| 145 | - required: true, | |
| 146 | - validator: (_, value) => { | |
| 147 | - if (String(value).length > 32) { | |
| 148 | - return Promise.reject('字数不超过32个字'); | |
| 149 | - } | |
| 150 | - return Promise.resolve(); | |
| 151 | - }, | |
| 152 | - }, | |
| 153 | - ]; | |
| 131 | + placeholder: '请输入字典值', | |
| 154 | 132 | }, | 
| 155 | 133 | }, | 
| 156 | 134 | { | ... | ... | 
| ... | ... | @@ -142,19 +142,6 @@ export const formSchema: FormSchema[] = [ | 
| 142 | 142 | componentProps: { | 
| 143 | 143 | maxLength: 255, | 
| 144 | 144 | }, | 
| 145 | - dynamicRules: () => { | |
| 146 | - return [ | |
| 147 | - { | |
| 148 | - required: true, | |
| 149 | - validator: (_, value) => { | |
| 150 | - if (String(value).length > 255) { | |
| 151 | - return Promise.reject('字数不超过255个字'); | |
| 152 | - } | |
| 153 | - return Promise.resolve(); | |
| 154 | - }, | |
| 155 | - }, | |
| 156 | - ]; | |
| 157 | - }, | |
| 158 | 145 | }, | 
| 159 | 146 | |
| 160 | 147 | { | 
| ... | ... | @@ -179,19 +166,6 @@ export const formSchema: FormSchema[] = [ | 
| 179 | 166 | componentProps: { | 
| 180 | 167 | maxLength: 32, | 
| 181 | 168 | }, | 
| 182 | - dynamicRules: () => { | |
| 183 | - return [ | |
| 184 | - { | |
| 185 | - required: true, | |
| 186 | - validator: (_, value) => { | |
| 187 | - if (String(value).length > 32) { | |
| 188 | - return Promise.reject('字数不超过32个字'); | |
| 189 | - } | |
| 190 | - return Promise.resolve(); | |
| 191 | - }, | |
| 192 | - }, | |
| 193 | - ]; | |
| 194 | - }, | |
| 195 | 169 | }, | 
| 196 | 170 | { | 
| 197 | 171 | field: 'icon', | 
| ... | ... | @@ -210,19 +184,6 @@ export const formSchema: FormSchema[] = [ | 
| 210 | 184 | componentProps: { | 
| 211 | 185 | maxLength: 255, | 
| 212 | 186 | }, | 
| 213 | - dynamicRules: () => { | |
| 214 | - return [ | |
| 215 | - { | |
| 216 | - required: false, | |
| 217 | - validator: (_, value) => { | |
| 218 | - if (String(value).length > 255) { | |
| 219 | - return Promise.reject('字数不超过255个字'); | |
| 220 | - } | |
| 221 | - return Promise.resolve(); | |
| 222 | - }, | |
| 223 | - }, | |
| 224 | - ]; | |
| 225 | - }, | |
| 226 | 187 | }, | 
| 227 | 188 | { | 
| 228 | 189 | field: 'component', | ... | ... | 
| ... | ... | @@ -48,19 +48,6 @@ export const formSchema: FormSchema[] = [ | 
| 48 | 48 | componentProps: { | 
| 49 | 49 | maxLength: 255, | 
| 50 | 50 | }, | 
| 51 | - dynamicRules: () => { | |
| 52 | - return [ | |
| 53 | - { | |
| 54 | - required: true, | |
| 55 | - validator: (_, value) => { | |
| 56 | - if (String(value).length > 255) { | |
| 57 | - return Promise.reject('字数不超过255个字'); | |
| 58 | - } | |
| 59 | - return Promise.resolve(); | |
| 60 | - }, | |
| 61 | - }, | |
| 62 | - ]; | |
| 63 | - }, | |
| 64 | 51 | }, | 
| 65 | 52 | { | 
| 66 | 53 | field: 'sort', | 
| ... | ... | @@ -70,19 +57,6 @@ export const formSchema: FormSchema[] = [ | 
| 70 | 57 | componentProps: { | 
| 71 | 58 | maxLength: 32, | 
| 72 | 59 | }, | 
| 73 | - dynamicRules: () => { | |
| 74 | - return [ | |
| 75 | - { | |
| 76 | - required: true, | |
| 77 | - validator: (_, value) => { | |
| 78 | - if (String(value).length > 32) { | |
| 79 | - return Promise.reject('字数不超过32个字'); | |
| 80 | - } | |
| 81 | - return Promise.resolve(); | |
| 82 | - }, | |
| 83 | - }, | |
| 84 | - ]; | |
| 85 | - }, | |
| 86 | 60 | }, | 
| 87 | 61 | { | 
| 88 | 62 | label: t('routes.common.common.remark'), //备注 | 
| ... | ... | @@ -113,18 +87,5 @@ export const formSchema: FormSchema[] = [ | 
| 113 | 87 | componentProps: { | 
| 114 | 88 | maxLength: 36, | 
| 115 | 89 | }, | 
| 116 | - dynamicRules: () => { | |
| 117 | - return [ | |
| 118 | - { | |
| 119 | - required: false, | |
| 120 | - validator: (_, value) => { | |
| 121 | - if (String(value).length > 36) { | |
| 122 | - return Promise.reject('字数不超过36个字'); | |
| 123 | - } | |
| 124 | - return Promise.resolve(); | |
| 125 | - }, | |
| 126 | - }, | |
| 127 | - ]; | |
| 128 | - }, | |
| 129 | 90 | }, | 
| 130 | 91 | ]; | ... | ... | 
| ... | ... | @@ -70,19 +70,6 @@ export const searchFormSchema: FormSchema[] = [ | 
| 70 | 70 | componentProps: { | 
| 71 | 71 | maxLength: 255, | 
| 72 | 72 | }, | 
| 73 | - dynamicRules: () => { | |
| 74 | - return [ | |
| 75 | - { | |
| 76 | - required: false, | |
| 77 | - validator: (_, value) => { | |
| 78 | - if (String(value).length > 255) { | |
| 79 | - return Promise.reject('字数不超过255个字'); | |
| 80 | - } | |
| 81 | - return Promise.resolve(); | |
| 82 | - }, | |
| 83 | - }, | |
| 84 | - ]; | |
| 85 | - }, | |
| 86 | 73 | }, | 
| 87 | 74 | { | 
| 88 | 75 | field: 'status', | 
| ... | ... | @@ -106,19 +93,7 @@ export const formSchema: FormSchema[] = [ | 
| 106 | 93 | component: 'Input', | 
| 107 | 94 | componentProps: { | 
| 108 | 95 | maxLength: 255, | 
| 109 | - }, | |
| 110 | - dynamicRules: () => { | |
| 111 | - return [ | |
| 112 | - { | |
| 113 | - required: true, | |
| 114 | - validator: (_, value) => { | |
| 115 | - if (String(value).length > 255) { | |
| 116 | - return Promise.reject('字数不超过255个字'); | |
| 117 | - } | |
| 118 | - return Promise.resolve(); | |
| 119 | - }, | |
| 120 | - }, | |
| 121 | - ]; | |
| 96 | + placeholder: '请输入角色名称', | |
| 122 | 97 | }, | 
| 123 | 98 | }, | 
| 124 | 99 | { | 
| ... | ... | @@ -139,19 +114,7 @@ export const formSchema: FormSchema[] = [ | 
| 139 | 114 | component: 'InputTextArea', | 
| 140 | 115 | componentProps: { | 
| 141 | 116 | maxLength: 255, | 
| 142 | - }, | |
| 143 | - dynamicRules: () => { | |
| 144 | - return [ | |
| 145 | - { | |
| 146 | - required: false, | |
| 147 | - validator: (_, value) => { | |
| 148 | - if (String(value).length > 255) { | |
| 149 | - return Promise.reject('字数不超过255个字'); | |
| 150 | - } | |
| 151 | - return Promise.resolve(); | |
| 152 | - }, | |
| 153 | - }, | |
| 154 | - ]; | |
| 117 | + placeholder: '请输入备注', | |
| 155 | 118 | }, | 
| 156 | 119 | }, | 
| 157 | 120 | { | 
| ... | ... | @@ -162,18 +125,5 @@ export const formSchema: FormSchema[] = [ | 
| 162 | 125 | componentProps: { | 
| 163 | 126 | maxLength: 255, | 
| 164 | 127 | }, | 
| 165 | - dynamicRules: () => { | |
| 166 | - return [ | |
| 167 | - { | |
| 168 | - required: false, | |
| 169 | - validator: (_, value) => { | |
| 170 | - if (String(value).length > 255) { | |
| 171 | - return Promise.reject('字数不超过255个字'); | |
| 172 | - } | |
| 173 | - return Promise.resolve(); | |
| 174 | - }, | |
| 175 | - }, | |
| 176 | - ]; | |
| 177 | - }, | |
| 178 | 128 | }, | 
| 179 | 129 | ]; | ... | ... | 
| ... | ... | @@ -100,10 +100,18 @@ | 
| 100 | 100 | const [tenantAdminFormDrawer, { openDrawer: openTenantAdminFormDrawer }] = useDrawer(); | 
| 101 | 101 | |
| 102 | 102 | const tenantId = ref(''); | 
| 103 | - function handleCreateTenantAdmin() { | |
| 103 | + async function handleCreateTenantAdmin() { | |
| 104 | + const { items: getPageData } = await getTenantAdminPage({ | |
| 105 | + page: 1, | |
| 106 | + pageSize: 1000, | |
| 107 | + tenantId: tenantId.value, | |
| 108 | + roleType: RoleEnum.TENANT_ADMIN, | |
| 109 | + tenantCode: '', | |
| 110 | + }); | |
| 104 | 111 | openTenantAdminFormDrawer(true, { | 
| 105 | 112 | isUpdate: false, | 
| 106 | 113 | tenantId: tenantId.value, | 
| 114 | + judgeExistUserName: getPageData, | |
| 107 | 115 | }); | 
| 108 | 116 | } | 
| 109 | 117 | ... | ... | 
| ... | ... | @@ -17,7 +17,7 @@ | 
| 17 | 17 | import { saveTenantAdmin } from '/@/api/tenant/tenantApi'; | 
| 18 | 18 | import { UserDTO } from '/@/api/tenant/tenantInfo'; | 
| 19 | 19 | import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; | 
| 20 | - import { isAccountExist } from '/@/api/system/system'; | |
| 20 | + // import { isAccountExist } from '/@/api/system/system'; | |
| 21 | 21 | |
| 22 | 22 | export default defineComponent({ | 
| 23 | 23 | name: 'TenantAdminFormDrawer', | 
| ... | ... | @@ -29,6 +29,7 @@ | 
| 29 | 29 | setup(_, { emit }) { | 
| 30 | 30 | const isUpdate = ref(true); | 
| 31 | 31 | const tenantId = ref(''); | 
| 32 | + const isJudgeUserNameExist: any = ref([]); | |
| 32 | 33 | const formSchema: FormSchema[] = [ | 
| 33 | 34 | { | 
| 34 | 35 | field: 'id', | 
| ... | ... | @@ -37,6 +38,7 @@ | 
| 37 | 38 | component: 'Input', | 
| 38 | 39 | componentProps: { | 
| 39 | 40 | maxLength: 36, | 
| 41 | + placeholder: '请输入id', | |
| 40 | 42 | }, | 
| 41 | 43 | }, | 
| 42 | 44 | { | 
| ... | ... | @@ -44,9 +46,14 @@ | 
| 44 | 46 | required: true, | 
| 45 | 47 | label: '账号', | 
| 46 | 48 | component: 'Input', | 
| 47 | - dynamicRules: ({ values }) => { | |
| 49 | + componentProps: { | |
| 50 | + maxLength: 255, | |
| 51 | + placeholder: '请输入账号', | |
| 52 | + }, | |
| 53 | + dynamicRules: () => { | |
| 48 | 54 | return [ | 
| 49 | 55 | { | 
| 56 | + required: true, | |
| 50 | 57 | validator(_, value) { | 
| 51 | 58 | return new Promise((resolve, reject) => { | 
| 52 | 59 | if (value == '') { | 
| ... | ... | @@ -56,17 +63,19 @@ | 
| 56 | 63 | } else if (EmailRegexp.test(value)) { | 
| 57 | 64 | reject('账号不能为电子邮箱格式'); | 
| 58 | 65 | } else { | 
| 59 | - if (values.username != undefined && values.id == undefined) { | |
| 60 | - isAccountExist(value).then((data) => { | |
| 61 | - if (data.data != null) { | |
| 62 | - reject('账号已存在'); | |
| 63 | - } else { | |
| 64 | - resolve(); | |
| 65 | - } | |
| 66 | + try { | |
| 67 | + const findUserName = isJudgeUserNameExist.value.find((f) => { | |
| 68 | + return f.username == value; | |
| 66 | 69 | }); | 
| 67 | - } else { | |
| 68 | - resolve(); | |
| 70 | + if (value == findUserName?.username) { | |
| 71 | + reject('账号已存在'); | |
| 72 | + } else { | |
| 73 | + return reject(''); | |
| 74 | + } | |
| 75 | + } catch (e) { | |
| 76 | + return e; | |
| 69 | 77 | } | 
| 78 | + resolve(); | |
| 70 | 79 | } | 
| 71 | 80 | }); | 
| 72 | 81 | }, | 
| ... | ... | @@ -122,6 +131,7 @@ | 
| 122 | 131 | await resetFields(); | 
| 123 | 132 | isUpdate.value = !!data?.isUpdate; | 
| 124 | 133 | tenantId.value = data?.tenantId; | 
| 134 | + isJudgeUserNameExist.value = data.judgeExistUserName; | |
| 125 | 135 | if (unref(isUpdate)) { | 
| 126 | 136 | await updateSchema({ field: 'username', componentProps: { disabled: true } }); | 
| 127 | 137 | await setFieldsValue({ | ... | ... | 
| ... | ... | @@ -49,19 +49,7 @@ export const tenantFormSchema: FormSchema[] = [ | 
| 49 | 49 | componentProps: { | 
| 50 | 50 | maxLength: 36, | 
| 51 | 51 | }, | 
| 52 | - dynamicRules: () => { | |
| 53 | - return [ | |
| 54 | - { | |
| 55 | - required: false, | |
| 56 | - validator: (_, value) => { | |
| 57 | - if (String(value).length > 36) { | |
| 58 | - return Promise.reject('字数不超过36个字'); | |
| 59 | - } | |
| 60 | - return Promise.resolve(); | |
| 61 | - }, | |
| 62 | - }, | |
| 63 | - ]; | |
| 64 | - }, | |
| 52 | + | |
| 65 | 53 | show: false, | 
| 66 | 54 | }, | 
| 67 | 55 | { | 
| ... | ... | @@ -116,19 +104,6 @@ export const tenantFormSchema: FormSchema[] = [ | 
| 116 | 104 | componentProps: { | 
| 117 | 105 | maxLength: 255, | 
| 118 | 106 | }, | 
| 119 | - dynamicRules: () => { | |
| 120 | - return [ | |
| 121 | - { | |
| 122 | - required: false, | |
| 123 | - validator: (_, value) => { | |
| 124 | - if (String(value).length > 255) { | |
| 125 | - return Promise.reject('字数不超过255个字'); | |
| 126 | - } | |
| 127 | - return Promise.resolve(); | |
| 128 | - }, | |
| 129 | - }, | |
| 130 | - ]; | |
| 131 | - }, | |
| 132 | 107 | }, | 
| 133 | 108 | { | 
| 134 | 109 | field: 'roleIds', | ... | ... | 
| ... | ... | @@ -389,20 +389,7 @@ export const schemas: FormSchema[] = [ | 
| 389 | 389 | show: false, | 
| 390 | 390 | componentProps: { | 
| 391 | 391 | maxLength: 36, | 
| 392 | - placeholder: '请输入平台名称', | |
| 393 | - }, | |
| 394 | - dynamicRules: () => { | |
| 395 | - return [ | |
| 396 | - { | |
| 397 | - required: false, | |
| 398 | - validator: (_, value) => { | |
| 399 | - if (String(value).length > 36) { | |
| 400 | - return Promise.reject('字数不超过36个字'); | |
| 401 | - } | |
| 402 | - return Promise.resolve(); | |
| 403 | - }, | |
| 404 | - }, | |
| 405 | - ]; | |
| 392 | + placeholder: '请输入唯一id', | |
| 406 | 393 | }, | 
| 407 | 394 | }, | 
| 408 | 395 | ]; | ... | ... | 
| ... | ... | @@ -71,19 +71,6 @@ export const searchFormSchema: FormSchema[] = [ | 
| 71 | 71 | maxLength: 255, | 
| 72 | 72 | placeholder: '请输入角色名称', | 
| 73 | 73 | }, | 
| 74 | - dynamicRules: () => { | |
| 75 | - return [ | |
| 76 | - { | |
| 77 | - required: false, | |
| 78 | - validator: (_, value) => { | |
| 79 | - if (String(value).length > 255) { | |
| 80 | - return Promise.reject('字数不超过255个字'); | |
| 81 | - } | |
| 82 | - return Promise.resolve(); | |
| 83 | - }, | |
| 84 | - }, | |
| 85 | - ]; | |
| 86 | - }, | |
| 87 | 74 | }, | 
| 88 | 75 | { | 
| 89 | 76 | field: 'roleType', | 
| ... | ... | @@ -95,19 +82,6 @@ export const searchFormSchema: FormSchema[] = [ | 
| 95 | 82 | componentProps: { | 
| 96 | 83 | maxLength: 20, | 
| 97 | 84 | }, | 
| 98 | - dynamicRules: () => { | |
| 99 | - return [ | |
| 100 | - { | |
| 101 | - required: false, | |
| 102 | - validator: (_, value) => { | |
| 103 | - if (String(value).length > 20) { | |
| 104 | - return Promise.reject('字数不超过20个字'); | |
| 105 | - } | |
| 106 | - return Promise.resolve(); | |
| 107 | - }, | |
| 108 | - }, | |
| 109 | - ]; | |
| 110 | - }, | |
| 111 | 85 | }, | 
| 112 | 86 | { | 
| 113 | 87 | field: 'status', | 
| ... | ... | @@ -133,19 +107,6 @@ export const formSchema: FormSchema[] = [ | 
| 133 | 107 | maxLength: 255, | 
| 134 | 108 | placeholder: '请输入角色名称', | 
| 135 | 109 | }, | 
| 136 | - dynamicRules: () => { | |
| 137 | - return [ | |
| 138 | - { | |
| 139 | - required: true, | |
| 140 | - validator: (_, value) => { | |
| 141 | - if (String(value).length > 255) { | |
| 142 | - return Promise.reject('字数不超过255个字'); | |
| 143 | - } | |
| 144 | - return Promise.resolve(); | |
| 145 | - }, | |
| 146 | - }, | |
| 147 | - ]; | |
| 148 | - }, | |
| 149 | 110 | }, | 
| 150 | 111 | { | 
| 151 | 112 | field: 'status', | 
| ... | ... | @@ -167,19 +128,6 @@ export const formSchema: FormSchema[] = [ | 
| 167 | 128 | maxLength: 255, | 
| 168 | 129 | placeholder: '请输入备注', | 
| 169 | 130 | }, | 
| 170 | - dynamicRules: () => { | |
| 171 | - return [ | |
| 172 | - { | |
| 173 | - required: false, | |
| 174 | - validator: (_, value) => { | |
| 175 | - if (String(value).length > 255) { | |
| 176 | - return Promise.reject('字数不超过255个字'); | |
| 177 | - } | |
| 178 | - return Promise.resolve(); | |
| 179 | - }, | |
| 180 | - }, | |
| 181 | - ]; | |
| 182 | - }, | |
| 183 | 131 | }, | 
| 184 | 132 | { | 
| 185 | 133 | label: ' ', | 
| ... | ... | @@ -189,18 +137,5 @@ export const formSchema: FormSchema[] = [ | 
| 189 | 137 | componentProps: { | 
| 190 | 138 | maxLength: 255, | 
| 191 | 139 | }, | 
| 192 | - dynamicRules: () => { | |
| 193 | - return [ | |
| 194 | - { | |
| 195 | - required: false, | |
| 196 | - validator: (_, value) => { | |
| 197 | - if (String(value).length > 255) { | |
| 198 | - return Promise.reject('字数不超过255个字'); | |
| 199 | - } | |
| 200 | - return Promise.resolve(); | |
| 201 | - }, | |
| 202 | - }, | |
| 203 | - ]; | |
| 204 | - }, | |
| 205 | 140 | }, | 
| 206 | 141 | ]; | ... | ... | 
| ... | ... | @@ -66,19 +66,6 @@ export const formSchema: FormSchema[] = [ | 
| 66 | 66 | maxLength: 255, | 
| 67 | 67 | placeholder: '请输入名称', | 
| 68 | 68 | }, | 
| 69 | - dynamicRules: () => { | |
| 70 | - return [ | |
| 71 | - { | |
| 72 | - required: true, | |
| 73 | - validator: (_, value) => { | |
| 74 | - if (String(value).length > 255) { | |
| 75 | - return Promise.reject('字数不超过255个字'); | |
| 76 | - } | |
| 77 | - return Promise.resolve(); | |
| 78 | - }, | |
| 79 | - }, | |
| 80 | - ]; | |
| 81 | - }, | |
| 82 | 69 | }, | 
| 83 | 70 | { | 
| 84 | 71 | field: 'isolatedTbRuleEngine', | ... | ... | 
| 1 | 1 | import { ErrorTypeEnum } from '/@/enums/exceptionEnum'; | 
| 2 | 2 | import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum'; | 
| 3 | -import { PlainRoleInfo, RoleInfo } from '/@/api/sys/model/userModel'; | |
| 3 | +import { PlainRoleInfo } from '/@/api/sys/model/userModel'; | |
| 4 | 4 | |
| 5 | 5 | // Lock screen information | 
| 6 | 6 | export interface LockInfo { | 
| ... | ... | @@ -31,14 +31,14 @@ export interface ErrorLogInfo { | 
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | export interface UserInfo { | 
| 34 | - userId: string | number; | |
| 35 | - username: string; | |
| 36 | - realName: string; | |
| 37 | - avatar: string; | |
| 34 | + userId?: string | number; | |
| 35 | + username?: string; | |
| 36 | + realName?: string; | |
| 37 | + avatar?: string; | |
| 38 | 38 | homePath?: string; | 
| 39 | - tenantCode: string; | |
| 40 | - tenantName: string; | |
| 41 | - roles: string[]; | |
| 39 | + tenantCode?: string; | |
| 40 | + tenantName?: string; | |
| 41 | + roles?: string[]; | |
| 42 | 42 | plainRoles?: PlainRoleInfo[]; | 
| 43 | 43 | } | 
| 44 | 44 | |
| ... | ... | @@ -48,3 +48,22 @@ export interface BeforeMiniState { | 
| 48 | 48 | menuMode?: MenuModeEnum; | 
| 49 | 49 | menuType?: MenuTypeEnum; | 
| 50 | 50 | } | 
| 51 | + | |
| 52 | +export interface UserUpdateInfo { | |
| 53 | + activateToken?: string; | |
| 54 | + avatar?: string; | |
| 55 | + createTime?: string; | |
| 56 | + creator?: string; | |
| 57 | + email?: string; | |
| 58 | + enabled?: true; | |
| 59 | + hasPassword?: false; | |
| 60 | + id?: string; | |
| 61 | + level?: 2; | |
| 62 | + password?: string; | |
| 63 | + phoneNumber?: string; | |
| 64 | + realName?: string; | |
| 65 | + tenantId?: string; | |
| 66 | + updateTime?: string; | |
| 67 | + updater?: string; | |
| 68 | + username?: string; | |
| 69 | +} | ... | ... |