From 9283d58ce963f5898ca8d5e943416c4f0e995db5 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Fri, 20 Jun 2025 18:32:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20dict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/dict-tag/dict-tag.vue | 1 + .../form-create/components/dict-select.vue | 17 +- apps/web-antd/src/utils/dict.ts | 206 +++++++++++------- .../ai/workflow/form/modules/basic-info.vue | 4 +- .../views/ai/write/index/components/Left.vue | 10 +- .../bpm/model/form/modules/basic-info.vue | 9 +- apps/web-antd/src/views/mall/home/index.vue | 2 - .../mall/promotion/article/category/data.ts | 9 +- .../src/views/mall/promotion/banner/data.ts | 9 +- .../mall/promotion/seckill/config/data.ts | 4 +- apps/web-antd/src/views/pay/refund/data.ts | 11 +- 11 files changed, 158 insertions(+), 124 deletions(-) diff --git a/apps/web-antd/src/components/dict-tag/dict-tag.vue b/apps/web-antd/src/components/dict-tag/dict-tag.vue index 7d9a5f1f3..8aba7d261 100644 --- a/apps/web-antd/src/components/dict-tag/dict-tag.vue +++ b/apps/web-antd/src/components/dict-tag/dict-tag.vue @@ -66,6 +66,7 @@ const dictTag = computed(() => { return { label: dict.label || '', colorType, + cssClass: dict.cssClass, }; }); diff --git a/apps/web-antd/src/components/form-create/components/dict-select.vue b/apps/web-antd/src/components/form-create/components/dict-select.vue index c137a5678..80c26cbad 100644 --- a/apps/web-antd/src/components/form-create/components/dict-select.vue +++ b/apps/web-antd/src/components/form-create/components/dict-select.vue @@ -13,7 +13,7 @@ import { SelectOption, } from 'ant-design-vue'; -import { getDictObj, getIntDictOptions, getStrDictOptions } from '#/utils'; +import { getDictOptions } from '#/utils'; defineOptions({ name: 'DictSelect' }); @@ -25,17 +25,16 @@ const props = withDefaults(defineProps(), { const attrs = useAttrs(); // 获得字典配置 -// TODO @dhb:可以使用 getDictOptions 替代么? -const getDictOptions = computed(() => { +const getDictOption = computed(() => { switch (props.valueType) { case 'bool': { - return getDictObj(props.dictType, 'bool'); + return getDictOptions(props.dictType, 'boolean'); } case 'int': { - return getIntDictOptions(props.dictType); + return getDictOptions(props.dictType, 'number'); } case 'str': { - return getStrDictOptions(props.dictType); + return getDictOptions(props.dictType, 'string'); } default: { return []; @@ -47,7 +46,7 @@ const getDictOptions = computed(() => {