Commit 7c87f4b70f8fefffffc8cf74c4af2fc811e58884

Authored by xp.Huang
2 parents a1ae6e5a c3607d8c

Merge branch 'ft-dev' into 'main'

fix:检查修复了之前字段有些验证失效问题,修复了账号管理的租户管理员用户名需要显示已经存在问题,修复组织管理默认展开,修复了消息模板邮件里面的有些字段为数组问题

See merge request huang/yun-teng-iot-front!81
Showing 35 changed files with 254 additions and 835 deletions
@@ -41,6 +41,8 @@ export interface TenantPageRequestParams extends BaseQueryParams { @@ -41,6 +41,8 @@ export interface TenantPageRequestParams extends BaseQueryParams {
41 export interface TenantAdminPageRequestParams extends BaseQueryParams { 41 export interface TenantAdminPageRequestParams extends BaseQueryParams {
42 realName?: string; 42 realName?: string;
43 tenantCode: string; 43 tenantCode: string;
  44 + tenantId?: string;
  45 + roleType?: string;
44 } 46 }
45 47
46 export interface tenantProfileDTO { 48 export interface tenantProfileDTO {
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 :before-upload="beforeUploadqrcodePic" 33 :before-upload="beforeUploadqrcodePic"
34 > 34 >
35 <img 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 v-if="peresonalPic" 37 v-if="peresonalPic"
38 :src="peresonalPic" 38 :src="peresonalPic"
39 alt="avatar" 39 alt="avatar"
@@ -92,6 +92,7 @@ @@ -92,6 +92,7 @@
92 import { Upload } from 'ant-design-vue'; 92 import { Upload } from 'ant-design-vue';
93 import { PlusOutlined } from '@ant-design/icons-vue'; 93 import { PlusOutlined } from '@ant-design/icons-vue';
94 import type { FileItem } from '/@/components/Upload/src/typing'; 94 import type { FileItem } from '/@/components/Upload/src/typing';
  95 + import { useUserStore } from '/@/store/modules/user';
95 96
96 const schema: DescItem[] = [ 97 const schema: DescItem[] = [
97 { 98 {
@@ -124,12 +125,16 @@ @@ -124,12 +125,16 @@
124 components: { BasicModal, BasicForm, Description, Upload, PlusOutlined }, 125 components: { BasicModal, BasicForm, Description, Upload, PlusOutlined },
125 emits: ['refreshPersonl', 'register'], 126 emits: ['refreshPersonl', 'register'],
126 setup(_, { emit }) { 127 setup(_, { emit }) {
  128 + // const userStore = useUserStore();
127 const userInfo = getAuthCache(USER_INFO_KEY); 129 const userInfo = getAuthCache(USER_INFO_KEY);
128 const { createMessage } = useMessage(); 130 const { createMessage } = useMessage();
129 const getPersonalValue: any = ref({}); 131 const getPersonalValue: any = ref({});
130 const getPersonalDetailValue: any = ref({}); 132 const getPersonalDetailValue: any = ref({});
131 const updatePersonalData: any = ref({}); 133 const updatePersonalData: any = ref({});
132 const getBackendV: any = ref({}); 134 const getBackendV: any = ref({});
  135 + const getData: any = ref({});
  136 + const updataPersonlData: any = ref({});
  137 + // const getUpdateUserInfo: any = ref({});
133 const [registerDesc] = useDescription({ 138 const [registerDesc] = useDescription({
134 title: '个人详情', 139 title: '个人详情',
135 schema: schema, 140 schema: schema,
@@ -164,16 +169,37 @@ @@ -164,16 +169,37 @@
164 showActionButtonGroup: false, 169 showActionButtonGroup: false,
165 schemas: formSchema, 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 const [registerModal, { closeModal }] = useModalInner(async (data) => { 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 if (Object.keys(updatePersonalData.value).length != 0) { 204 if (Object.keys(updatePersonalData.value).length != 0) {
179 getPersonalDetailValue.value = updatePersonalData.value; 205 getPersonalDetailValue.value = updatePersonalData.value;
@@ -191,9 +217,11 @@ @@ -191,9 +217,11 @@
191 getPersonalValue.value.id = getUserInfo.userId; 217 getPersonalValue.value.id = getUserInfo.userId;
192 getPersonalValue.value.username = getBackendV.value.username; 218 getPersonalValue.value.username = getBackendV.value.username;
193 getPersonalValue.value.avatar = peresonalPic.value; 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 createMessage.success('修改成功'); 222 createMessage.success('修改成功');
  223 + const setUpdateUserInfo = JSON.stringify(getData.value);
  224 + window.localStorage.setItem('updateUserInfo', setUpdateUserInfo);
197 closeModal(); 225 closeModal();
198 resetFields(); 226 resetFields();
199 emit('refreshPersonl', updatePersonalData.value); 227 emit('refreshPersonl', updatePersonalData.value);
@@ -221,7 +249,7 @@ @@ -221,7 +249,7 @@
221 /deep/ .ant-upload-select-picture-card { 249 /deep/ .ant-upload-select-picture-card {
222 display: inherit; 250 display: inherit;
223 float: none; 251 float: none;
224 - width: 10vw; 252 + width: 8.6vw;
225 height: 17vh; 253 height: 17vh;
226 margin-right: 8px; 254 margin-right: 8px;
227 margin-bottom: 8px; 255 margin-bottom: 8px;
@@ -3,11 +3,23 @@ @@ -3,11 +3,23 @@
3 <span :class="[prefixCls, `${prefixCls}--${theme}`]" class="flex"> 3 <span :class="[prefixCls, `${prefixCls}--${theme}`]" class="flex">
4 <img 4 <img
5 :class="`${prefixCls}__header`" 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 <span :class="`${prefixCls}__info hidden md:block`"> 14 <span :class="`${prefixCls}__info hidden md:block`">
9 <span :class="`${prefixCls}__name `" class="truncate"> 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 </span> 23 </span>
12 </span> 24 </span>
13 </span> 25 </span>
@@ -78,6 +90,10 @@ @@ -78,6 +90,10 @@
78 avatar: '', 90 avatar: '',
79 realName: '', 91 realName: '',
80 }); 92 });
  93 + const updataPersonlData = reactive({
  94 + avatar: '',
  95 + realName: '',
  96 + });
81 const userInfo = getAuthCache(USER_INFO_KEY); 97 const userInfo = getAuthCache(USER_INFO_KEY);
82 const { proxy } = getCurrentInstance(); 98 const { proxy } = getCurrentInstance();
83 const personalRef = ref(null); 99 const personalRef = ref(null);
@@ -132,6 +148,13 @@ @@ -132,6 +148,13 @@
132 }); 148 });
133 }, 10); 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 const refreshPersonlFunc = (v) => { 159 const refreshPersonlFunc = (v) => {
137 refreshPersonlData.avatar = v.avatar; 160 refreshPersonlData.avatar = v.avatar;
@@ -139,6 +162,7 @@ @@ -139,6 +162,7 @@
139 }; 162 };
140 163
141 return { 164 return {
  165 + updataPersonlData,
142 refreshPersonlData, 166 refreshPersonlData,
143 refreshPersonlFunc, 167 refreshPersonlFunc,
144 personalRef, 168 personalRef,
1 -import type { UserInfo } from '/#/store'; 1 +import type { UserInfo, UserUpdateInfo } from '/#/store';
2 import type { ErrorMessageMode } from '/#/axios'; 2 import type { ErrorMessageMode } from '/#/axios';
3 import { defineStore } from 'pinia'; 3 import { defineStore } from 'pinia';
4 import { store } from '/@/store'; 4 import { store } from '/@/store';
@@ -30,6 +30,7 @@ interface UserState { @@ -30,6 +30,7 @@ interface UserState {
30 platInfo: any; 30 platInfo: any;
31 enterPriseInfo: any; 31 enterPriseInfo: any;
32 userInfo: Nullable<UserInfo>; 32 userInfo: Nullable<UserInfo>;
  33 + userUpdateInfo?: Nullable<UserUpdateInfo>;
33 token?: string; 34 token?: string;
34 roleList: RoleEnum[]; 35 roleList: RoleEnum[];
35 sessionTimeout?: boolean; 36 sessionTimeout?: boolean;
@@ -47,6 +48,7 @@ export const useUserStore = defineStore({ @@ -47,6 +48,7 @@ export const useUserStore = defineStore({
47 enterPriseInfo: storage.get('enterPriseInfo') || null, 48 enterPriseInfo: storage.get('enterPriseInfo') || null,
48 // user info 49 // user info
49 userInfo: null, 50 userInfo: null,
  51 + userUpdateInfo: null,
50 // token 52 // token
51 jwtToken: undefined, 53 jwtToken: undefined,
52 //refresh Token 54 //refresh Token
@@ -66,6 +68,9 @@ export const useUserStore = defineStore({ @@ -66,6 +68,9 @@ export const useUserStore = defineStore({
66 getUserInfo(): UserInfo { 68 getUserInfo(): UserInfo {
67 return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {}; 69 return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
68 }, 70 },
  71 + getUserUpdateInfo(): UserUpdateInfo {
  72 + return this.userUpdateInfo || {};
  73 + },
69 getJwtToken(): string { 74 getJwtToken(): string {
70 return this.jwtToken || getAuthCache<string>(JWT_TOKEN_KEY); 75 return this.jwtToken || getAuthCache<string>(JWT_TOKEN_KEY);
71 }, 76 },
@@ -108,6 +113,9 @@ export const useUserStore = defineStore({ @@ -108,6 +113,9 @@ export const useUserStore = defineStore({
108 this.lastUpdateTime = new Date().getTime(); 113 this.lastUpdateTime = new Date().getTime();
109 setAuthCache(USER_INFO_KEY, info); 114 setAuthCache(USER_INFO_KEY, info);
110 }, 115 },
  116 + setUserUpdateInfo(info: UserUpdateInfo) {
  117 + this.userUpdateInfo = info;
  118 + },
111 setSessionTimeout(flag: boolean) { 119 setSessionTimeout(flag: boolean) {
112 this.sessionTimeout = flag; 120 this.sessionTimeout = flag;
113 }, 121 },
@@ -194,6 +202,8 @@ export const useUserStore = defineStore({ @@ -194,6 +202,8 @@ export const useUserStore = defineStore({
194 // this.setSessionTimeout(false); 202 // this.setSessionTimeout(false);
195 // goLogin && router.push(PageEnum.BASE_LOGIN); 203 // goLogin && router.push(PageEnum.BASE_LOGIN);
196 await router.push(PageEnum.BASE_LOGIN); 204 await router.push(PageEnum.BASE_LOGIN);
  205 + window.localStorage.clear();
  206 + window.localStorage.removeItem('updateUserInfo');
197 }, 207 },
198 208
199 async doRefresh() { 209 async doRefresh() {
@@ -41,7 +41,9 @@ export const formSchema: FormSchema[] = [ @@ -41,7 +41,9 @@ export const formSchema: FormSchema[] = [
41 label: '', 41 label: '',
42 component: 'Input', 42 component: 'Input',
43 componentProps: { 43 componentProps: {
  44 + maxLength: 255,
44 placeholder: '请输入设备名称', 45 placeholder: '请输入设备名称',
  46 + maxLength: 255,
45 }, 47 },
46 }, 48 },
47 { 49 {
@@ -56,7 +56,9 @@ export const searchFormSchema: FormSchema[] = [ @@ -56,7 +56,9 @@ export const searchFormSchema: FormSchema[] = [
56 component: 'Input', 56 component: 'Input',
57 colProps: { span: 6 }, 57 colProps: { span: 6 },
58 componentProps: { 58 componentProps: {
  59 + maxLength: 36,
59 placeholder: '请输入联系人姓名', 60 placeholder: '请输入联系人姓名',
  61 + maxLength: 36,
60 }, 62 },
61 }, 63 },
62 ]; 64 ];
@@ -128,6 +130,7 @@ export const formSchema: FormSchema[] = [ @@ -128,6 +130,7 @@ export const formSchema: FormSchema[] = [
128 show: false, 130 show: false,
129 componentProps: { 131 componentProps: {
130 maxLength: 36, 132 maxLength: 36,
  133 + placeholder: 'id',
131 }, 134 },
132 }, 135 },
133 ]; 136 ];
1 <template> 1 <template>
2 <div class="bg-white m-4 mr-0 overflow-hidden"> 2 <div class="bg-white m-4 mr-0 overflow-hidden">
3 <BasicTree 3 <BasicTree
  4 + v-if="treeData.length > 0"
4 title="组织列表" 5 title="组织列表"
5 toolbar 6 toolbar
6 search 7 search
7 :clickRowToExpand="false" 8 :clickRowToExpand="false"
8 :treeData="treeData" 9 :treeData="treeData"
9 :replaceFields="{ key: 'id', title: 'name' }" 10 :replaceFields="{ key: 'id', title: 'name' }"
  11 + v-model:expandedKeys="expandedKeys"
10 v-model:selectedKeys="selectedKeys" 12 v-model:selectedKeys="selectedKeys"
11 @select="handleSelect" 13 @select="handleSelect"
  14 + :defaultExpandAll="true"
12 /> 15 />
13 </div> 16 </div>
14 </template> 17 </template>
@@ -24,8 +27,11 @@ @@ -24,8 +27,11 @@
24 27
25 emits: ['select'], 28 emits: ['select'],
26 setup(_, { emit }) { 29 setup(_, { emit }) {
  30 + // const { proxy } = getCurrentInstance();
  31 + const getTreeRef: any = ref(null);
27 const treeData = ref<TreeItem[]>([]); 32 const treeData = ref<TreeItem[]>([]);
28 const selectedKeys = ref<string[]>(); 33 const selectedKeys = ref<string[]>();
  34 + const expandedKeys = ref<string[]>();
29 async function fetch() { 35 async function fetch() {
30 treeData.value = (await getOrganizationList()) as unknown as TreeItem[]; 36 treeData.value = (await getOrganizationList()) as unknown as TreeItem[];
31 } 37 }
@@ -40,7 +46,14 @@ @@ -40,7 +46,14 @@
40 onMounted(() => { 46 onMounted(() => {
41 fetch(); 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 </script> 59 </script>
@@ -28,11 +28,9 @@ @@ -28,11 +28,9 @@
28 }); 28 });
29 29
30 const userInfo: any = getAuthCache(USER_INFO_KEY); 30 const userInfo: any = getAuthCache(USER_INFO_KEY);
31 - const role: string = userInfo.roles[0]; 31 + const role: string = userInfo?.roles[0];
32 const loading = ref(true); 32 const loading = ref(true);
33 33
34 - console.log(role);  
35 -  
36 setTimeout(() => { 34 setTimeout(() => {
37 loading.value = false; 35 loading.value = false;
38 }, 1500); 36 }, 1500);
@@ -3,11 +3,6 @@ import { findDictItemByCode } from '/@/api/system/dict'; @@ -3,11 +3,6 @@ import { findDictItemByCode } from '/@/api/system/dict';
3 import { deviceProfile } from '/@/api/device/deviceManager'; 3 import { deviceProfile } from '/@/api/device/deviceManager';
4 import { getOrganizationList } from '/@/api/system/system'; 4 import { getOrganizationList } from '/@/api/system/system';
5 import { copyTransFun } from '/@/utils/fnUtils'; 5 import { copyTransFun } from '/@/utils/fnUtils';
6 -import {  
7 - DeviceNameMaxLength,  
8 - DeviceProfileIdMaxLength,  
9 - DeviceOrgIdMaxLength,  
10 -} from '/@/utils/rules';  
11 6
12 // 第一步的表单 7 // 第一步的表单
13 export const step1Schemas: FormSchema[] = [ 8 export const step1Schemas: FormSchema[] = [
@@ -26,7 +21,6 @@ export const step1Schemas: FormSchema[] = [ @@ -26,7 +21,6 @@ export const step1Schemas: FormSchema[] = [
26 placeholder: '设备名称', 21 placeholder: '设备名称',
27 maxLength: 30, 22 maxLength: 30,
28 }, 23 },
29 - rules: DeviceNameMaxLength,  
30 }, 24 },
31 { 25 {
32 field: 'deviceType', 26 field: 'deviceType',
@@ -53,7 +47,6 @@ export const step1Schemas: FormSchema[] = [ @@ -53,7 +47,6 @@ export const step1Schemas: FormSchema[] = [
53 labelField: 'name', 47 labelField: 'name',
54 valueField: 'id', 48 valueField: 'id',
55 }, 49 },
56 - rules: DeviceProfileIdMaxLength,  
57 }, 50 },
58 { 51 {
59 field: 'organizationId', 52 field: 'organizationId',
@@ -67,7 +60,6 @@ export const step1Schemas: FormSchema[] = [ @@ -67,7 +60,6 @@ export const step1Schemas: FormSchema[] = [
67 return data; 60 return data;
68 }, 61 },
69 }, 62 },
70 - rules: DeviceOrgIdMaxLength,  
71 }, 63 },
72 { 64 {
73 field: 'label', 65 field: 'label',
@@ -128,19 +120,6 @@ export const step1Schemas: FormSchema[] = [ @@ -128,19 +120,6 @@ export const step1Schemas: FormSchema[] = [
128 maxLength: 36, 120 maxLength: 36,
129 placeholder: '请输入id', 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 field: 'tenantId', 125 field: 'tenantId',
@@ -174,19 +153,6 @@ export const step1Schemas: FormSchema[] = [ @@ -174,19 +153,6 @@ export const step1Schemas: FormSchema[] = [
174 maxLength: 36, 153 maxLength: 36,
175 placeholder: '请输入tbDeviceId', 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,19 +307,6 @@ export const step2Schemas: FormSchema[] = [
341 maxLength: 36, 307 maxLength: 36,
342 placeholder: '请输入访问令牌', 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 label: 'RSA公钥', 312 label: 'RSA公钥',
@@ -365,19 +318,6 @@ export const step2Schemas: FormSchema[] = [ @@ -365,19 +318,6 @@ export const step2Schemas: FormSchema[] = [
365 maxLength: 36, 318 maxLength: 36,
366 placeholder: '请输入RSA公钥', 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 label: '客户端ID', 323 label: '客户端ID',
@@ -389,19 +329,6 @@ export const step2Schemas: FormSchema[] = [ @@ -389,19 +329,6 @@ export const step2Schemas: FormSchema[] = [
389 maxLength: 36, 329 maxLength: 36,
390 placeholder: '请输入客户端ID', 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 label: '用户名', 334 label: '用户名',
@@ -413,19 +340,6 @@ export const step2Schemas: FormSchema[] = [ @@ -413,19 +340,6 @@ export const step2Schemas: FormSchema[] = [
413 maxLength: 255, 340 maxLength: 255,
414 placeholder: '请输入用户名', 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 label: '密码', 345 label: '密码',
@@ -591,19 +505,6 @@ export const TokenSchemas: FormSchema[] = [ @@ -591,19 +505,6 @@ export const TokenSchemas: FormSchema[] = [
591 maxLength: 36, 505 maxLength: 36,
592 placeholder: '请输入访问令牌', 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 label: 'RSA公钥', 510 label: 'RSA公钥',
@@ -615,19 +516,6 @@ export const TokenSchemas: FormSchema[] = [ @@ -615,19 +516,6 @@ export const TokenSchemas: FormSchema[] = [
615 maxLength: 36, 516 maxLength: 36,
616 placeholder: '请输入RSA公钥', 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 label: '客户端ID', 521 label: '客户端ID',
@@ -639,19 +527,6 @@ export const TokenSchemas: FormSchema[] = [ @@ -639,19 +527,6 @@ export const TokenSchemas: FormSchema[] = [
639 maxLength: 36, 527 maxLength: 36,
640 placeholder: '请输入客户端ID', 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 label: '用户名', 532 label: '用户名',
@@ -663,19 +538,6 @@ export const TokenSchemas: FormSchema[] = [ @@ -663,19 +538,6 @@ export const TokenSchemas: FormSchema[] = [
663 maxLength: 255, 538 maxLength: 255,
664 placeholder: '请输入用户名', 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 label: '密码', 543 label: '密码',
@@ -709,19 +571,6 @@ export const TokenSchemas: FormSchema[] = [ @@ -709,19 +571,6 @@ export const TokenSchemas: FormSchema[] = [
709 maxLength: 36, 571 maxLength: 36,
710 placeholder: '请输入id', 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 label: 'tbDeviceId', 576 label: 'tbDeviceId',
@@ -89,6 +89,9 @@ export const alarmSearchSchemas: FormSchema[] = [ @@ -89,6 +89,9 @@ export const alarmSearchSchemas: FormSchema[] = [
89 label: '告警类型', 89 label: '告警类型',
90 component: 'Input', 90 component: 'Input',
91 colProps: { span: 6 }, 91 colProps: { span: 6 },
  92 + componentProps: {
  93 + maxLength: 36,
  94 + },
92 }, 95 },
93 { 96 {
94 field: 'endTime', 97 field: 'endTime',
@@ -226,6 +229,7 @@ export const childDeviceSchemas: FormSchema[] = [ @@ -226,6 +229,7 @@ export const childDeviceSchemas: FormSchema[] = [
226 colProps: { span: 12 }, 229 colProps: { span: 12 },
227 componentProps: { 230 componentProps: {
228 maxLength: 255, 231 maxLength: 255,
  232 + placeholder: '请输入设备名称',
229 }, 233 },
230 }, 234 },
231 ]; 235 ];
@@ -72,19 +72,6 @@ export const formSchema: FormSchema[] = [ @@ -72,19 +72,6 @@ export const formSchema: FormSchema[] = [
72 maxLength: 255, 72 maxLength: 255,
73 placeholder: '请输入配置名称', 73 placeholder: '请输入配置名称',
74 }, 74 },
75 - dynamicRules: () => {  
76 - return [  
77 - {  
78 - required: true,  
79 - validator: (_, value) => {  
80 - if (String(value).length > 255) {  
81 - return Promise.reject('字数不超过255个字');  
82 - }  
83 - return Promise.resolve();  
84 - },  
85 - },  
86 - ];  
87 - },  
88 }, 75 },
89 { 76 {
90 field: 'messageType', 77 field: 'messageType',
@@ -124,19 +111,7 @@ export const formSchema: FormSchema[] = [ @@ -124,19 +111,7 @@ export const formSchema: FormSchema[] = [
124 maxLength: 36, 111 maxLength: 36,
125 placeholder: '请输入accessKeyId', 112 placeholder: '请输入accessKeyId',
126 }, 113 },
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 - }, 114 +
140 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), 115 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
141 }, 116 },
142 { 117 {
@@ -148,19 +123,7 @@ export const formSchema: FormSchema[] = [ @@ -148,19 +123,7 @@ export const formSchema: FormSchema[] = [
148 maxLength: 36, 123 maxLength: 36,
149 placeholder: '请输入accessKeySecret', 124 placeholder: '请输入accessKeySecret',
150 }, 125 },
151 - dynamicRules: () => {  
152 - return [  
153 - {  
154 - required: true,  
155 - validator: (_, value) => {  
156 - if (String(value).length > 36) {  
157 - return Promise.reject('字数不超过36个字');  
158 - }  
159 - return Promise.resolve();  
160 - },  
161 - },  
162 - ];  
163 - }, 126 +
164 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), 127 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
165 }, 128 },
166 { 129 {
@@ -173,19 +136,7 @@ export const formSchema: FormSchema[] = [ @@ -173,19 +136,7 @@ export const formSchema: FormSchema[] = [
173 maxLength: 36, 136 maxLength: 36,
174 placeholder: '请输入accessKeySecret', 137 placeholder: '请输入accessKeySecret',
175 }, 138 },
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 - ];  
188 - }, 139 +
189 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), 140 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
190 }, 141 },
191 { 142 {
@@ -211,19 +162,6 @@ export const formSchema: FormSchema[] = [ @@ -211,19 +162,6 @@ export const formSchema: FormSchema[] = [
211 maxLength: 255, 162 maxLength: 255,
212 placeholder: '请输入用户名', 163 placeholder: '请输入用户名',
213 }, 164 },
214 - dynamicRules: () => {  
215 - return [  
216 - {  
217 - required: true,  
218 - validator: (_, value) => {  
219 - if (String(value).length > 255) {  
220 - return Promise.reject('字数不超过255个字');  
221 - }  
222 - return Promise.resolve();  
223 - },  
224 - },  
225 - ];  
226 - },  
227 165
228 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), 166 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
229 }, 167 },
@@ -266,19 +204,6 @@ export const formSchema: FormSchema[] = [ @@ -266,19 +204,6 @@ export const formSchema: FormSchema[] = [
266 maxLength: 36, 204 maxLength: 36,
267 placeholder: '请输入主键', 205 placeholder: '请输入主键',
268 }, 206 },
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 }, 207 },
283 { 208 {
284 field: 'status', 209 field: 'status',
@@ -11,18 +11,5 @@ export const formSchema: FormSchema[] = [ @@ -11,18 +11,5 @@ export const formSchema: FormSchema[] = [
11 maxLength: 255, 11 maxLength: 255,
12 placeholder: '请输入报警详细信息', 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,19 +16,6 @@ export const step1Schemas: FormSchema[] = [
16 maxLength: 255, 16 maxLength: 255,
17 placeholder: '请输入配置名称', 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 //规则链(string) 20 //规则链(string)
34 { 21 {
@@ -118,19 +118,6 @@ export const formSchema: FormSchema[] = [ @@ -118,19 +118,6 @@ export const formSchema: FormSchema[] = [
118 maxLength: 30, 118 maxLength: 30,
119 placeholder: '请输入配置名称', 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 field: 'messageType', 123 field: 'messageType',
@@ -170,19 +157,7 @@ export const formSchema: FormSchema[] = [ @@ -170,19 +157,7 @@ export const formSchema: FormSchema[] = [
170 maxLength: 36, 157 maxLength: 36,
171 placeholder: '请输入accessKeyId', 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 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), 161 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
187 }, 162 },
188 { 163 {
@@ -193,19 +168,7 @@ export const formSchema: FormSchema[] = [ @@ -193,19 +168,7 @@ export const formSchema: FormSchema[] = [
193 maxLength: 36, 168 maxLength: 36,
194 placeholder: '请输入accessKeySecret', 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 component: 'Input', 172 component: 'Input',
210 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), 173 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
211 }, 174 },
@@ -219,19 +182,7 @@ export const formSchema: FormSchema[] = [ @@ -219,19 +182,7 @@ export const formSchema: FormSchema[] = [
219 maxLength: 36, 182 maxLength: 36,
220 placeholder: '请输入服务器地址', 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 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), 186 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
236 }, 187 },
237 { 188 {
@@ -243,19 +194,7 @@ export const formSchema: FormSchema[] = [ @@ -243,19 +194,7 @@ export const formSchema: FormSchema[] = [
243 maxLength: 36, 194 maxLength: 36,
244 placeholder: '请输入端口', 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 component: 'InputNumber', 198 component: 'InputNumber',
260 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), 199 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
261 }, 200 },
@@ -267,19 +206,6 @@ export const formSchema: FormSchema[] = [ @@ -267,19 +206,6 @@ export const formSchema: FormSchema[] = [
267 maxLength: 255, 206 maxLength: 255,
268 placeholder: '请输入用户名', 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 component: 'Input', 210 component: 'Input',
285 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), 211 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
@@ -324,19 +250,6 @@ export const formSchema: FormSchema[] = [ @@ -324,19 +250,6 @@ export const formSchema: FormSchema[] = [
324 maxLength: 36, 250 maxLength: 36,
325 placeholder: '请输入主键', 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 field: 'status', 255 field: 'status',
@@ -382,18 +295,5 @@ export const formSchema: FormSchema[] = [ @@ -382,18 +295,5 @@ export const formSchema: FormSchema[] = [
382 maxLength: 36, 295 maxLength: 36,
383 placeholder: '请输入租户ID', 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 ];
@@ -52,6 +52,9 @@ export const searchFormSchema: FormSchema[] = [ @@ -52,6 +52,9 @@ export const searchFormSchema: FormSchema[] = [
52 label: '发送手机', 52 label: '发送手机',
53 component: 'Input', 53 component: 'Input',
54 colProps: { span: 6 }, 54 colProps: { span: 6 },
  55 + componentProps: {
  56 + maxLength: 36,
  57 + },
55 }, 58 },
56 { 59 {
57 field: 'sendTime', 60 field: 'sendTime',
@@ -18,24 +18,38 @@ @@ -18,24 +18,38 @@
18 import { useMessage } from '/@/hooks/web/useMessage'; 18 import { useMessage } from '/@/hooks/web/useMessage';
19 import { Tinymce } from '/@/components/Tinymce'; 19 import { Tinymce } from '/@/components/Tinymce';
20 import { sendEmail } from '/@/api/message/template'; 20 import { sendEmail } from '/@/api/message/template';
  21 + import { emailRule } from '/@/utils/rules';
  22 +
21 const schemas: FormSchema[] = [ 23 const schemas: FormSchema[] = [
22 { 24 {
23 field: 'id', 25 field: 'id',
24 component: 'Input', 26 component: 'Input',
25 label: 'id', 27 label: 'id',
26 show: false, 28 show: false,
  29 + componentProps: {
  30 + maxLength: 36,
  31 + placeholder: '请输入id',
  32 + },
27 }, 33 },
28 { 34 {
29 field: 'templatePurpose', 35 field: 'templatePurpose',
30 label: '用途', 36 label: '用途',
31 component: 'Input', 37 component: 'Input',
32 show: false, 38 show: false,
  39 + componentProps: {
  40 + maxLength: 255,
  41 + placeholder: '请输入用途',
  42 + },
33 }, 43 },
34 { 44 {
35 field: 'messageType', 45 field: 'messageType',
36 component: 'Input', 46 component: 'Input',
37 label: 'messageType', 47 label: 'messageType',
38 show: false, 48 show: false,
  49 + componentProps: {
  50 + maxLength: 255,
  51 + placeholder: '请输入messageType',
  52 + },
39 }, 53 },
40 { 54 {
41 field: 'subject', 55 field: 'subject',
@@ -45,6 +59,10 @@ @@ -45,6 +59,10 @@
45 colProps: { 59 colProps: {
46 span: 12, 60 span: 12,
47 }, 61 },
  62 + componentProps: {
  63 + maxLength: 255,
  64 + placeholder: '请输入邮件主题',
  65 + },
48 }, 66 },
49 { 67 {
50 field: 'to', 68 field: 'to',
@@ -54,6 +72,11 @@ @@ -54,6 +72,11 @@
54 colProps: { 72 colProps: {
55 span: 12, 73 span: 12,
56 }, 74 },
  75 + rules: emailRule,
  76 + componentProps: {
  77 + maxLength: 255,
  78 + placeholder: '请输入主送',
  79 + },
57 }, 80 },
58 { 81 {
59 field: 'cc', 82 field: 'cc',
@@ -62,6 +85,11 @@ @@ -62,6 +85,11 @@
62 colProps: { 85 colProps: {
63 span: 12, 86 span: 12,
64 }, 87 },
  88 + rules: emailRule,
  89 + componentProps: {
  90 + maxLength: 255,
  91 + placeholder: '请输入抄送',
  92 + },
65 }, 93 },
66 { 94 {
67 field: 'bcc', 95 field: 'bcc',
@@ -70,6 +98,11 @@ @@ -70,6 +98,11 @@
70 colProps: { 98 colProps: {
71 span: 12, 99 span: 12,
72 }, 100 },
  101 + rules: emailRule,
  102 + componentProps: {
  103 + maxLength: 255,
  104 + placeholder: '请输入密送',
  105 + },
73 }, 106 },
74 { 107 {
75 field: 'body', 108 field: 'body',
@@ -111,17 +144,14 @@ @@ -111,17 +144,14 @@
111 const cc = Reflect.get(values, 'cc'); 144 const cc = Reflect.get(values, 'cc');
112 const bcc = Reflect.get(values, 'bcc'); 145 const bcc = Reflect.get(values, 'bcc');
113 if (typeof cc != 'undefined') { 146 if (typeof cc != 'undefined') {
114 - cc.split(',');  
115 - Reflect.set(values, 'cc', cc); 147 + Reflect.set(values, 'cc', cc.split(','));
116 } 148 }
117 if (typeof bcc != 'undefined') { 149 if (typeof bcc != 'undefined') {
118 - bcc.split(',');  
119 - Reflect.set(values, 'bcc', bcc); 150 + Reflect.set(values, 'bcc', bcc.split(','));
120 } 151 }
121 Reflect.set(values, 'to', to); 152 Reflect.set(values, 'to', to);
122 Reflect.set(values, 'emailFormatEnum', 'HTML'); 153 Reflect.set(values, 'emailFormatEnum', 'HTML');
123 await sendEmail(values); 154 await sendEmail(values);
124 - console.log(values, 'values');  
125 closeModal(); 155 closeModal();
126 createMessage.success('发送成功'); 156 createMessage.success('发送成功');
127 } 157 }
@@ -148,19 +148,6 @@ export const formSchema: FormSchema[] = [ @@ -148,19 +148,6 @@ export const formSchema: FormSchema[] = [
148 maxLength: 36, 148 maxLength: 36,
149 placeholder: '请输入主键', 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 field: 'messageType', 153 field: 'messageType',
@@ -200,19 +187,6 @@ export const formSchema: FormSchema[] = [ @@ -200,19 +187,6 @@ export const formSchema: FormSchema[] = [
200 maxLength: 32, 187 maxLength: 32,
201 placeholder: '请输入模板名称', 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 field: 'templateCode', 192 field: 'templateCode',
@@ -223,19 +197,7 @@ export const formSchema: FormSchema[] = [ @@ -223,19 +197,7 @@ export const formSchema: FormSchema[] = [
223 maxLength: 20, 197 maxLength: 20,
224 placeholder: '请输入模板编号', 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 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), 201 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
240 }, 202 },
241 { 203 {
@@ -247,19 +209,6 @@ export const formSchema: FormSchema[] = [ @@ -247,19 +209,6 @@ export const formSchema: FormSchema[] = [
247 maxLength: 32, 209 maxLength: 32,
248 placeholder: '请输入签名', 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 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), 213 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
265 }, 214 },
@@ -287,18 +236,5 @@ export const formSchema: FormSchema[] = [ @@ -287,18 +236,5 @@ export const formSchema: FormSchema[] = [
287 maxLength: 36, 236 maxLength: 36,
288 placeholder: '请输入租户ID', 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,6 +108,9 @@
108 // function unique(arr) { 108 // function unique(arr) {
109 // return Array.from(new Set(arr)); 109 // return Array.from(new Set(arr));
110 // } 110 // }
  111 + const clearGetPushValueDataEmpty = () => {
  112 + getPushValueData.value.length = 0;
  113 + };
111 function getAllFields(getV) { 114 function getAllFields(getV) {
112 const values = getFieldsValue(); 115 const values = getFieldsValue();
113 getValueData.value = values; 116 getValueData.value = values;
@@ -368,7 +371,15 @@ @@ -368,7 +371,15 @@
368 ]); 371 ]);
369 n.value--; 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 </script> 385 </script>
@@ -150,19 +150,6 @@ export const formSchema: FormSchema[] = [ @@ -150,19 +150,6 @@ export const formSchema: FormSchema[] = [
150 maxLength: 36, 150 maxLength: 36,
151 placeholder: '请输入场景联动名称', 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 required: true, 155 required: true,
@@ -101,6 +101,7 @@ @@ -101,6 +101,7 @@
101 } 101 }
102 } else { 102 } else {
103 await resetFields(); 103 await resetFields();
  104 + proxy.$refs.getTriggerChildData.clearGetPushValueDataEmpty();
104 } 105 }
105 }); 106 });
106 const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); 107 const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动'));
@@ -5,7 +5,6 @@ import { Tinymce } from '/@/components/Tinymce/index'; @@ -5,7 +5,6 @@ import { Tinymce } from '/@/components/Tinymce/index';
5 import { getOrganizationList } from '/@/api/system/system'; 5 import { getOrganizationList } from '/@/api/system/system';
6 import { copyTransFun } from '/@/utils/fnUtils'; 6 import { copyTransFun } from '/@/utils/fnUtils';
7 import { Tag } from 'ant-design-vue'; 7 import { Tag } from 'ant-design-vue';
8 -import { NotificationTitleMaxLength } from '/@/utils/rules';  
9 8
10 export enum IsOrgEnum { 9 export enum IsOrgEnum {
11 IS_ORG_ENUM = '1', 10 IS_ORG_ENUM = '1',
@@ -98,7 +97,6 @@ export const formSchema: FormSchema[] = [ @@ -98,7 +97,6 @@ export const formSchema: FormSchema[] = [
98 placeholder: '请输入标题', 97 placeholder: '请输入标题',
99 maxLength: 200, 98 maxLength: 200,
100 }, 99 },
101 - rules: NotificationTitleMaxLength,  
102 }, 100 },
103 { 101 {
104 field: 'content', 102 field: 'content',
@@ -6,18 +6,21 @@ @@ -6,18 +6,21 @@
6 :title="getTitle" 6 :title="getTitle"
7 @ok="handleSubmit" 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 </BasicModal> 24 </BasicModal>
22 </template> 25 </template>
23 <script lang="ts"> 26 <script lang="ts">
@@ -45,6 +45,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -45,6 +45,7 @@ export const searchFormSchema: FormSchema[] = [
45 colProps: { span: 8 }, 45 colProps: { span: 8 },
46 componentProps: { 46 componentProps: {
47 maxLength: 255, 47 maxLength: 255,
  48 + placeholder: '请输入用户名',
48 }, 49 },
49 dynamicRules: () => { 50 dynamicRules: () => {
50 return [ 51 return [
@@ -67,6 +68,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -67,6 +68,7 @@ export const searchFormSchema: FormSchema[] = [
67 colProps: { span: 8 }, 68 colProps: { span: 8 },
68 componentProps: { 69 componentProps: {
69 maxLength: 255, 70 maxLength: 255,
  71 + placeholder: '请输入姓名',
70 }, 72 },
71 dynamicRules: () => { 73 dynamicRules: () => {
72 return [ 74 return [
@@ -93,19 +95,6 @@ export const accountFormSchema: FormSchema[] = [ @@ -93,19 +95,6 @@ export const accountFormSchema: FormSchema[] = [
93 componentProps: { 95 componentProps: {
94 maxLength: 36, 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 field: 'username', 100 field: 'username',
@@ -113,9 +102,14 @@ export const accountFormSchema: FormSchema[] = [ @@ -113,9 +102,14 @@ export const accountFormSchema: FormSchema[] = [
113 component: 'Input', 102 component: 'Input',
114 colProps: { span: 12 }, 103 colProps: { span: 12 },
115 dynamicDisabled: false, 104 dynamicDisabled: false,
  105 + componentProps: {
  106 + maxLength: 36,
  107 + placeholder: '请输入账号',
  108 + },
116 dynamicRules: ({ values }) => { 109 dynamicRules: ({ values }) => {
117 return [ 110 return [
118 { 111 {
  112 + required: true,
119 validator(_, value) { 113 validator(_, value) {
120 return new Promise((resolve, reject) => { 114 return new Promise((resolve, reject) => {
121 if (value == '') { 115 if (value == '') {
@@ -159,19 +153,6 @@ export const accountFormSchema: FormSchema[] = [ @@ -159,19 +153,6 @@ export const accountFormSchema: FormSchema[] = [
159 componentProps: { 153 componentProps: {
160 maxLength: 255, 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 label: '角色', 158 label: '角色',
@@ -237,18 +218,5 @@ export const accountFormSchema: FormSchema[] = [ @@ -237,18 +218,5 @@ export const accountFormSchema: FormSchema[] = [
237 componentProps: { 218 componentProps: {
238 maxLength: 36, 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,6 +37,7 @@ export const searchFormSchema: FormSchema[] = [
37 colProps: { span: 6 }, 37 colProps: { span: 6 },
38 componentProps: { 38 componentProps: {
39 maxLength: 32, 39 maxLength: 32,
  40 + placeholder: '请输入字典名称',
40 }, 41 },
41 dynamicRules: () => { 42 dynamicRules: () => {
42 return [ 43 return [
@@ -59,6 +60,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -59,6 +60,7 @@ export const searchFormSchema: FormSchema[] = [
59 colProps: { span: 6 }, 60 colProps: { span: 6 },
60 componentProps: { 61 componentProps: {
61 maxLength: 32, 62 maxLength: 32,
  63 + placeholder: '请输入字典编码',
62 }, 64 },
63 dynamicRules: () => { 65 dynamicRules: () => {
64 return [ 66 return [
@@ -84,19 +86,7 @@ export const formSchema: FormSchema[] = [ @@ -84,19 +86,7 @@ export const formSchema: FormSchema[] = [
84 component: 'Input', 86 component: 'Input',
85 componentProps: { 87 componentProps: {
86 maxLength: 32, 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,19 +96,7 @@ export const formSchema: FormSchema[] = [
106 component: 'Input', 96 component: 'Input',
107 componentProps: { 97 componentProps: {
108 maxLength: 32, 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,6 +105,7 @@ export const formSchema: FormSchema[] = [
127 component: 'InputTextArea', 105 component: 'InputTextArea',
128 componentProps: { 106 componentProps: {
129 maxLength: 255, 107 maxLength: 255,
  108 + placeholder: '请输入备注',
130 }, 109 },
131 dynamicRules: () => { 110 dynamicRules: () => {
132 return [ 111 return [
@@ -69,6 +69,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -69,6 +69,7 @@ export const searchFormSchema: FormSchema[] = [
69 colProps: { span: 6 }, 69 colProps: { span: 6 },
70 componentProps: { 70 componentProps: {
71 maxLength: 32, 71 maxLength: 32,
  72 + placeholder: '请输入文本值',
72 }, 73 },
73 dynamicRules: () => { 74 dynamicRules: () => {
74 return [ 75 return [
@@ -91,6 +92,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -91,6 +92,7 @@ export const searchFormSchema: FormSchema[] = [
91 show: false, 92 show: false,
92 componentProps: { 93 componentProps: {
93 maxLength: 36, 94 maxLength: 36,
  95 + placeholder: '请输入文本值',
94 }, 96 },
95 dynamicRules: () => { 97 dynamicRules: () => {
96 return [ 98 return [
@@ -116,19 +118,7 @@ export const formSchema: FormSchema[] = [ @@ -116,19 +118,7 @@ export const formSchema: FormSchema[] = [
116 component: 'Input', 118 component: 'Input',
117 componentProps: { 119 componentProps: {
118 maxLength: 32, 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,19 +128,7 @@ export const formSchema: FormSchema[] = [
138 component: 'Input', 128 component: 'Input',
139 componentProps: { 129 componentProps: {
140 maxLength: 32, 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,19 +142,6 @@ export const formSchema: FormSchema[] = [
142 componentProps: { 142 componentProps: {
143 maxLength: 255, 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,19 +166,6 @@ export const formSchema: FormSchema[] = [
179 componentProps: { 166 componentProps: {
180 maxLength: 32, 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 field: 'icon', 171 field: 'icon',
@@ -210,19 +184,6 @@ export const formSchema: FormSchema[] = [ @@ -210,19 +184,6 @@ export const formSchema: FormSchema[] = [
210 componentProps: { 184 componentProps: {
211 maxLength: 255, 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 field: 'component', 189 field: 'component',
@@ -48,19 +48,6 @@ export const formSchema: FormSchema[] = [ @@ -48,19 +48,6 @@ export const formSchema: FormSchema[] = [
48 componentProps: { 48 componentProps: {
49 maxLength: 255, 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 field: 'sort', 53 field: 'sort',
@@ -70,19 +57,6 @@ export const formSchema: FormSchema[] = [ @@ -70,19 +57,6 @@ export const formSchema: FormSchema[] = [
70 componentProps: { 57 componentProps: {
71 maxLength: 32, 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 label: t('routes.common.common.remark'), //备注 62 label: t('routes.common.common.remark'), //备注
@@ -113,18 +87,5 @@ export const formSchema: FormSchema[] = [ @@ -113,18 +87,5 @@ export const formSchema: FormSchema[] = [
113 componentProps: { 87 componentProps: {
114 maxLength: 36, 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,19 +70,6 @@ export const searchFormSchema: FormSchema[] = [
70 componentProps: { 70 componentProps: {
71 maxLength: 255, 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 field: 'status', 75 field: 'status',
@@ -106,19 +93,7 @@ export const formSchema: FormSchema[] = [ @@ -106,19 +93,7 @@ export const formSchema: FormSchema[] = [
106 component: 'Input', 93 component: 'Input',
107 componentProps: { 94 componentProps: {
108 maxLength: 255, 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,19 +114,7 @@ export const formSchema: FormSchema[] = [
139 component: 'InputTextArea', 114 component: 'InputTextArea',
140 componentProps: { 115 componentProps: {
141 maxLength: 255, 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,18 +125,5 @@ export const formSchema: FormSchema[] = [
162 componentProps: { 125 componentProps: {
163 maxLength: 255, 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,10 +100,18 @@
100 const [tenantAdminFormDrawer, { openDrawer: openTenantAdminFormDrawer }] = useDrawer(); 100 const [tenantAdminFormDrawer, { openDrawer: openTenantAdminFormDrawer }] = useDrawer();
101 101
102 const tenantId = ref(''); 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 openTenantAdminFormDrawer(true, { 111 openTenantAdminFormDrawer(true, {
105 isUpdate: false, 112 isUpdate: false,
106 tenantId: tenantId.value, 113 tenantId: tenantId.value,
  114 + judgeExistUserName: getPageData,
107 }); 115 });
108 } 116 }
109 117
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 import { saveTenantAdmin } from '/@/api/tenant/tenantApi'; 17 import { saveTenantAdmin } from '/@/api/tenant/tenantApi';
18 import { UserDTO } from '/@/api/tenant/tenantInfo'; 18 import { UserDTO } from '/@/api/tenant/tenantInfo';
19 import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; 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 export default defineComponent({ 22 export default defineComponent({
23 name: 'TenantAdminFormDrawer', 23 name: 'TenantAdminFormDrawer',
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
29 setup(_, { emit }) { 29 setup(_, { emit }) {
30 const isUpdate = ref(true); 30 const isUpdate = ref(true);
31 const tenantId = ref(''); 31 const tenantId = ref('');
  32 + const isJudgeUserNameExist: any = ref([]);
32 const formSchema: FormSchema[] = [ 33 const formSchema: FormSchema[] = [
33 { 34 {
34 field: 'id', 35 field: 'id',
@@ -37,6 +38,7 @@ @@ -37,6 +38,7 @@
37 component: 'Input', 38 component: 'Input',
38 componentProps: { 39 componentProps: {
39 maxLength: 36, 40 maxLength: 36,
  41 + placeholder: '请输入id',
40 }, 42 },
41 }, 43 },
42 { 44 {
@@ -44,9 +46,14 @@ @@ -44,9 +46,14 @@
44 required: true, 46 required: true,
45 label: '账号', 47 label: '账号',
46 component: 'Input', 48 component: 'Input',
47 - dynamicRules: ({ values }) => { 49 + componentProps: {
  50 + maxLength: 255,
  51 + placeholder: '请输入账号',
  52 + },
  53 + dynamicRules: () => {
48 return [ 54 return [
49 { 55 {
  56 + required: true,
50 validator(_, value) { 57 validator(_, value) {
51 return new Promise((resolve, reject) => { 58 return new Promise((resolve, reject) => {
52 if (value == '') { 59 if (value == '') {
@@ -56,17 +63,19 @@ @@ -56,17 +63,19 @@
56 } else if (EmailRegexp.test(value)) { 63 } else if (EmailRegexp.test(value)) {
57 reject('账号不能为电子邮箱格式'); 64 reject('账号不能为电子邮箱格式');
58 } else { 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,6 +131,7 @@
122 await resetFields(); 131 await resetFields();
123 isUpdate.value = !!data?.isUpdate; 132 isUpdate.value = !!data?.isUpdate;
124 tenantId.value = data?.tenantId; 133 tenantId.value = data?.tenantId;
  134 + isJudgeUserNameExist.value = data.judgeExistUserName;
125 if (unref(isUpdate)) { 135 if (unref(isUpdate)) {
126 await updateSchema({ field: 'username', componentProps: { disabled: true } }); 136 await updateSchema({ field: 'username', componentProps: { disabled: true } });
127 await setFieldsValue({ 137 await setFieldsValue({
@@ -49,19 +49,7 @@ export const tenantFormSchema: FormSchema[] = [ @@ -49,19 +49,7 @@ export const tenantFormSchema: FormSchema[] = [
49 componentProps: { 49 componentProps: {
50 maxLength: 36, 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 show: false, 53 show: false,
66 }, 54 },
67 { 55 {
@@ -116,19 +104,6 @@ export const tenantFormSchema: FormSchema[] = [ @@ -116,19 +104,6 @@ export const tenantFormSchema: FormSchema[] = [
116 componentProps: { 104 componentProps: {
117 maxLength: 255, 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 field: 'roleIds', 109 field: 'roleIds',
@@ -389,20 +389,7 @@ export const schemas: FormSchema[] = [ @@ -389,20 +389,7 @@ export const schemas: FormSchema[] = [
389 show: false, 389 show: false,
390 componentProps: { 390 componentProps: {
391 maxLength: 36, 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,19 +71,6 @@ export const searchFormSchema: FormSchema[] = [
71 maxLength: 255, 71 maxLength: 255,
72 placeholder: '请输入角色名称', 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 field: 'roleType', 76 field: 'roleType',
@@ -95,19 +82,6 @@ export const searchFormSchema: FormSchema[] = [ @@ -95,19 +82,6 @@ export const searchFormSchema: FormSchema[] = [
95 componentProps: { 82 componentProps: {
96 maxLength: 20, 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 field: 'status', 87 field: 'status',
@@ -133,19 +107,6 @@ export const formSchema: FormSchema[] = [ @@ -133,19 +107,6 @@ export const formSchema: FormSchema[] = [
133 maxLength: 255, 107 maxLength: 255,
134 placeholder: '请输入角色名称', 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 field: 'status', 112 field: 'status',
@@ -167,19 +128,6 @@ export const formSchema: FormSchema[] = [ @@ -167,19 +128,6 @@ export const formSchema: FormSchema[] = [
167 maxLength: 255, 128 maxLength: 255,
168 placeholder: '请输入备注', 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 label: ' ', 133 label: ' ',
@@ -189,18 +137,5 @@ export const formSchema: FormSchema[] = [ @@ -189,18 +137,5 @@ export const formSchema: FormSchema[] = [
189 componentProps: { 137 componentProps: {
190 maxLength: 255, 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,19 +66,6 @@ export const formSchema: FormSchema[] = [
66 maxLength: 255, 66 maxLength: 255,
67 placeholder: '请输入名称', 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 field: 'isolatedTbRuleEngine', 71 field: 'isolatedTbRuleEngine',
1 import { ErrorTypeEnum } from '/@/enums/exceptionEnum'; 1 import { ErrorTypeEnum } from '/@/enums/exceptionEnum';
2 import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum'; 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 // Lock screen information 5 // Lock screen information
6 export interface LockInfo { 6 export interface LockInfo {
@@ -31,14 +31,14 @@ export interface ErrorLogInfo { @@ -31,14 +31,14 @@ export interface ErrorLogInfo {
31 } 31 }
32 32
33 export interface UserInfo { 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 homePath?: string; 38 homePath?: string;
39 - tenantCode: string;  
40 - tenantName: string;  
41 - roles: string[]; 39 + tenantCode?: string;
  40 + tenantName?: string;
  41 + roles?: string[];
42 plainRoles?: PlainRoleInfo[]; 42 plainRoles?: PlainRoleInfo[];
43 } 43 }
44 44
@@ -48,3 +48,22 @@ export interface BeforeMiniState { @@ -48,3 +48,22 @@ export interface BeforeMiniState {
48 menuMode?: MenuModeEnum; 48 menuMode?: MenuModeEnum;
49 menuType?: MenuTypeEnum; 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 +}