From 27a7046465d9b9706f967f36cabc8e6e6644ec4a Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Wed, 9 Apr 2025 16:04:08 +0800 Subject: [PATCH] =?UTF-8?q?Popup=E5=AD=97=E5=85=B8=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=94=AF=E6=8C=81=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vue3/${entityName}List.vuei | 33 +++++++++++++++++++ jeecgboot-vue3/src/utils/dict/index.ts | 15 +++++++++ 2 files changed, 48 insertions(+) diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei index 60c3ca1f4..52f6a1171 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei @@ -2,6 +2,7 @@
<#assign list_need_category=false> <#assign list_need_pca=false> +<#assign list_has_popup_dict=false> <#assign bpm_flag=false> <#-- 开始循环 --> @@ -12,6 +13,9 @@ <#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0> <#assign list_need_category=true> +<#if po.classType=='popup_dict'> +<#assign list_has_popup_dict=true> + <#if po.classType=='pca'> <#assign list_need_pca=true> @@ -91,6 +95,10 @@ import { loadCategoryData } from '/@/api/common/api' import { getAuthCache, setAuthCache } from '/@/utils/auth'; import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum'; + + <#if list_has_popup_dict> + import {getPopDictByCode} from "@/utils/dict"; + import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil"; <#if bpm_flag==true> import { startProcess } from '/@/api/common/api'; @@ -146,6 +154,9 @@ beforeFetch: (params) => { return Object.assign(params, queryParam); }, + <#if list_has_popup_dict> + afterFetch: afterFetch + }, exportConfig: { name:"${tableVo.ftlDescription}", @@ -319,6 +330,28 @@ } initDictConfig(); + + <#if list_has_popup_dict> + /** + * 翻译Popup字典配置 + */ + async function afterFetch(records){ + <#list columns as po> + <#if po.isQuery=='Y' || po.isShowList=='Y'> + <#if po.classType=='popup_dict' && list_has_popup_dict==true> + const ${po.fieldName}Keys = [...new Set(records.map((item) => item['${po.fieldName}']).flatMap((item) => item.split(',')))]; + if(${po.fieldName}Keys && ${po.fieldName}Keys.length){ + const dictOptions = await getPopDictByCode(${po.fieldName}Keys.join(','), '${po.dictTable},${po.dictField},${po.dictText}'); + records.forEach((item) => { + item['${po.fieldName}_dictText'] = filterMultiDictText(dictOptions, item['${po.fieldName}']); + }); + } + + + + return records; + } +