From aecc9bb8cb2e564d9a7dc0a5be0c5cb31a16e66b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 3 Dec 2023 09:52:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20IDEA=20?= =?UTF-8?q?=E5=9C=A8=20`v-for=3D"dict=20in=20getIntDictOptions(...)"`=20?= =?UTF-8?q?=E6=97=B6=EF=BC=8C`el-option`=20=E7=9A=84=20`key`=20=E4=BC=9A?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/dict.ts | 11 +++++++++-- src/views/infra/config/ConfigForm.vue | 2 +- src/views/system/dept/DeptForm.vue | 2 +- src/views/system/dept/index.vue | 2 +- src/views/system/dict/DictTypeForm.vue | 2 +- src/views/system/dict/data/DictDataForm.vue | 2 +- src/views/system/dict/data/index.vue | 2 +- src/views/system/dict/index.vue | 2 +- src/views/system/errorCode/index.vue | 2 +- src/views/system/menu/index.vue | 2 +- src/views/system/notice/index.vue | 2 +- src/views/system/notify/message/index.vue | 4 ++-- src/views/system/notify/my/index.vue | 2 +- .../system/notify/template/NotifyTemplateForm.vue | 6 +++--- .../system/notify/template/NotifyTemplateSendForm.vue | 4 ++-- src/views/system/notify/template/index.vue | 2 +- src/views/system/oauth2/client/ClientForm.vue | 2 +- src/views/system/oauth2/client/index.vue | 2 +- src/views/system/oauth2/token/index.vue | 2 +- src/views/system/operatelog/index.vue | 2 +- src/views/system/post/PostForm.vue | 2 +- src/views/system/post/index.vue | 2 +- src/views/system/sensitiveWord/SensitiveWordForm.vue | 2 +- src/views/system/sensitiveWord/index.vue | 2 +- src/views/system/sms/channel/SmsChannelForm.vue | 4 ++-- src/views/system/sms/channel/index.vue | 2 +- src/views/system/sms/template/SmsTemplateForm.vue | 6 +++--- src/views/system/sms/template/index.vue | 4 ++-- src/views/system/social/client/SocialClientForm.vue | 4 ++-- src/views/system/social/client/index.vue | 6 +++--- src/views/system/social/user/index.vue | 2 +- src/views/system/tenant/TenantForm.vue | 2 +- src/views/system/tenant/index.vue | 2 +- src/views/system/tenantPackage/TenantPackageForm.vue | 2 +- src/views/system/tenantPackage/index.vue | 2 +- src/views/system/user/UserForm.vue | 2 +- src/views/system/user/index.vue | 2 +- 37 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 65d185b7..98ed9797 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -20,13 +20,20 @@ export interface DictDataType { cssClass: string } +export interface NumberDictDataType extends DictDataType { + value: number +} + export const getDictOptions = (dictType: string) => { return dictStore.getDictByType(dictType) || [] } -export const getIntDictOptions = (dictType: string): DictDataType[] => { - const dictOption: DictDataType[] = [] +export const getIntDictOptions = (dictType: string): NumberDictDataType[] => { + // 获得通用的 DictDataType 列表 const dictOptions: DictDataType[] = getDictOptions(dictType) + // 转换成 number 类型的 NumberDictDataType 类型 + // why 需要特殊转换:避免 IDEA 在 v-for="dict in getIntDictOptions(...)" 时,el-option 的 key 会告警 + const dictOption: NumberDictDataType[] = [] dictOptions.forEach((dict: DictDataType) => { dictOption.push({ ...dict, diff --git a/src/views/infra/config/ConfigForm.vue b/src/views/infra/config/ConfigForm.vue index 19b5bf1e..f61face0 100644 --- a/src/views/infra/config/ConfigForm.vue +++ b/src/views/infra/config/ConfigForm.vue @@ -23,7 +23,7 @@ {{ dict.label }} diff --git a/src/views/system/dept/DeptForm.vue b/src/views/system/dept/DeptForm.vue index cc3b6773..c759ef38 100644 --- a/src/views/system/dept/DeptForm.vue +++ b/src/views/system/dept/DeptForm.vue @@ -44,7 +44,7 @@ diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 1e2c522c..e99d7f8a 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -25,7 +25,7 @@ > diff --git a/src/views/system/dict/DictTypeForm.vue b/src/views/system/dict/DictTypeForm.vue index 5d6f4575..5e416d78 100644 --- a/src/views/system/dict/DictTypeForm.vue +++ b/src/views/system/dict/DictTypeForm.vue @@ -21,7 +21,7 @@ {{ dict.label }} diff --git a/src/views/system/dict/data/DictDataForm.vue b/src/views/system/dict/data/DictDataForm.vue index 008b6fb1..2094371d 100644 --- a/src/views/system/dict/data/DictDataForm.vue +++ b/src/views/system/dict/data/DictDataForm.vue @@ -27,7 +27,7 @@ {{ dict.label }} diff --git a/src/views/system/dict/data/index.vue b/src/views/system/dict/data/index.vue index aa200116..2811f06a 100644 --- a/src/views/system/dict/data/index.vue +++ b/src/views/system/dict/data/index.vue @@ -30,7 +30,7 @@ diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 1523d6f4..acc737c6 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -35,7 +35,7 @@ > diff --git a/src/views/system/errorCode/index.vue b/src/views/system/errorCode/index.vue index ef3aa4a6..c9538c8c 100644 --- a/src/views/system/errorCode/index.vue +++ b/src/views/system/errorCode/index.vue @@ -14,7 +14,7 @@ diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index d683ac68..f482f91c 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -26,7 +26,7 @@ > diff --git a/src/views/system/notify/message/index.vue b/src/views/system/notify/message/index.vue index 99f145c5..94844118 100644 --- a/src/views/system/notify/message/index.vue +++ b/src/views/system/notify/message/index.vue @@ -28,7 +28,7 @@ > @@ -52,7 +52,7 @@ > diff --git a/src/views/system/notify/my/index.vue b/src/views/system/notify/my/index.vue index af77aba7..ae4b9c52 100644 --- a/src/views/system/notify/my/index.vue +++ b/src/views/system/notify/my/index.vue @@ -19,7 +19,7 @@ > diff --git a/src/views/system/notify/template/NotifyTemplateForm.vue b/src/views/system/notify/template/NotifyTemplateForm.vue index 87516025..a734e2d6 100644 --- a/src/views/system/notify/template/NotifyTemplateForm.vue +++ b/src/views/system/notify/template/NotifyTemplateForm.vue @@ -23,7 +23,7 @@ @@ -33,8 +33,8 @@ {{ dict.label }} diff --git a/src/views/system/notify/template/NotifyTemplateSendForm.vue b/src/views/system/notify/template/NotifyTemplateSendForm.vue index 53089d1a..126067c1 100644 --- a/src/views/system/notify/template/NotifyTemplateSendForm.vue +++ b/src/views/system/notify/template/NotifyTemplateSendForm.vue @@ -19,8 +19,8 @@ {{ dict.label }} diff --git a/src/views/system/notify/template/index.vue b/src/views/system/notify/template/index.vue index eb0e73a6..5aef80d2 100644 --- a/src/views/system/notify/template/index.vue +++ b/src/views/system/notify/template/index.vue @@ -37,7 +37,7 @@ > diff --git a/src/views/system/oauth2/client/ClientForm.vue b/src/views/system/oauth2/client/ClientForm.vue index fc08e964..5d13f71b 100644 --- a/src/views/system/oauth2/client/ClientForm.vue +++ b/src/views/system/oauth2/client/ClientForm.vue @@ -26,7 +26,7 @@ {{ dict.label }} diff --git a/src/views/system/oauth2/client/index.vue b/src/views/system/oauth2/client/index.vue index b34386ea..fceee571 100644 --- a/src/views/system/oauth2/client/index.vue +++ b/src/views/system/oauth2/client/index.vue @@ -23,7 +23,7 @@ diff --git a/src/views/system/oauth2/token/index.vue b/src/views/system/oauth2/token/index.vue index a0ada245..2a94f8e7 100644 --- a/src/views/system/oauth2/token/index.vue +++ b/src/views/system/oauth2/token/index.vue @@ -28,7 +28,7 @@ > diff --git a/src/views/system/operatelog/index.vue b/src/views/system/operatelog/index.vue index 5f8658e2..5af8c4e2 100644 --- a/src/views/system/operatelog/index.vue +++ b/src/views/system/operatelog/index.vue @@ -37,7 +37,7 @@ > diff --git a/src/views/system/post/PostForm.vue b/src/views/system/post/PostForm.vue index 504ba402..1894e0cb 100644 --- a/src/views/system/post/PostForm.vue +++ b/src/views/system/post/PostForm.vue @@ -20,7 +20,7 @@ diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index deb43fe5..44663263 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -28,7 +28,7 @@ diff --git a/src/views/system/sensitiveWord/SensitiveWordForm.vue b/src/views/system/sensitiveWord/SensitiveWordForm.vue index c88962a8..795b8148 100644 --- a/src/views/system/sensitiveWord/SensitiveWordForm.vue +++ b/src/views/system/sensitiveWord/SensitiveWordForm.vue @@ -14,7 +14,7 @@ {{ dict.label }} diff --git a/src/views/system/sensitiveWord/index.vue b/src/views/system/sensitiveWord/index.vue index 5e70509a..05aff7a5 100644 --- a/src/views/system/sensitiveWord/index.vue +++ b/src/views/system/sensitiveWord/index.vue @@ -32,7 +32,7 @@ @@ -24,7 +24,7 @@ {{ dict.label }} diff --git a/src/views/system/sms/channel/index.vue b/src/views/system/sms/channel/index.vue index 17360173..417d870e 100644 --- a/src/views/system/sms/channel/index.vue +++ b/src/views/system/sms/channel/index.vue @@ -21,7 +21,7 @@ diff --git a/src/views/system/sms/template/SmsTemplateForm.vue b/src/views/system/sms/template/SmsTemplateForm.vue index 760d1e61..9750e8a7 100644 --- a/src/views/system/sms/template/SmsTemplateForm.vue +++ b/src/views/system/sms/template/SmsTemplateForm.vue @@ -24,7 +24,7 @@ @@ -43,8 +43,8 @@ {{ dict.label }} diff --git a/src/views/system/sms/template/index.vue b/src/views/system/sms/template/index.vue index d94baff2..a59c48dd 100644 --- a/src/views/system/sms/template/index.vue +++ b/src/views/system/sms/template/index.vue @@ -19,7 +19,7 @@ > @@ -34,7 +34,7 @@ > diff --git a/src/views/system/social/client/SocialClientForm.vue b/src/views/system/social/client/SocialClientForm.vue index 225d94d6..e6f92bd6 100644 --- a/src/views/system/social/client/SocialClientForm.vue +++ b/src/views/system/social/client/SocialClientForm.vue @@ -14,7 +14,7 @@ {{ dict.label }} @@ -48,7 +48,7 @@ {{ dict.label }} diff --git a/src/views/system/social/client/index.vue b/src/views/system/social/client/index.vue index 72c83128..fa49018c 100644 --- a/src/views/system/social/client/index.vue +++ b/src/views/system/social/client/index.vue @@ -28,7 +28,7 @@ > @@ -43,7 +43,7 @@ > @@ -62,7 +62,7 @@ diff --git a/src/views/system/social/user/index.vue b/src/views/system/social/user/index.vue index 50a4cf7b..dda9eb82 100644 --- a/src/views/system/social/user/index.vue +++ b/src/views/system/social/user/index.vue @@ -19,7 +19,7 @@ > diff --git a/src/views/system/tenant/TenantForm.vue b/src/views/system/tenant/TenantForm.vue index de22b0ab..4d5fde5a 100644 --- a/src/views/system/tenant/TenantForm.vue +++ b/src/views/system/tenant/TenantForm.vue @@ -61,7 +61,7 @@ {{ dict.label }} diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue index 06992610..ae9a2b79 100644 --- a/src/views/system/tenant/index.vue +++ b/src/views/system/tenant/index.vue @@ -46,7 +46,7 @@ > diff --git a/src/views/system/tenantPackage/TenantPackageForm.vue b/src/views/system/tenantPackage/TenantPackageForm.vue index 87d927d8..74928892 100644 --- a/src/views/system/tenantPackage/TenantPackageForm.vue +++ b/src/views/system/tenantPackage/TenantPackageForm.vue @@ -44,7 +44,7 @@ {{ dict.label }} diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue index 26eabeb0..7ee111cc 100644 --- a/src/views/system/tenantPackage/index.vue +++ b/src/views/system/tenantPackage/index.vue @@ -23,7 +23,7 @@ diff --git a/src/views/system/user/UserForm.vue b/src/views/system/user/UserForm.vue index 60a360ba..630688a3 100644 --- a/src/views/system/user/UserForm.vue +++ b/src/views/system/user/UserForm.vue @@ -61,7 +61,7 @@ diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index a35c3b4d..4f04dff5 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -47,7 +47,7 @@ >