diff --git a/apps/web-antd/src/adapter/vxe-table.ts b/apps/web-antd/src/adapter/vxe-table.ts
index 2e7f6908d..c773cea4a 100644
--- a/apps/web-antd/src/adapter/vxe-table.ts
+++ b/apps/web-antd/src/adapter/vxe-table.ts
@@ -5,9 +5,8 @@ import { $te } from '@vben/locales';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { isFunction, isString } from '@vben/utils';
-import { Button, Image, Popconfirm, Switch, Tag } from 'ant-design-vue';
-
-import { getDictObj } from '#/utils/dict';
+import { Button, Image, Popconfirm, Switch } from 'ant-design-vue';
+import { DictTag } from '#/components/dict-tag';
import { useVbenForm } from './form';
import type { Recordable } from '@vben/types';
@@ -81,7 +80,6 @@ setupVbenVxeTable({
});
// 表格配置项可以用 cellRender: { name: 'CellDict', props:{dictType: ''} },
- // TODO @芋艿:后续研究下,看看有没优解
vxeUI.renderer.add('CellDict', {
renderTableDefault(renderOpts, params) {
const { props } = renderOpts;
@@ -89,20 +87,11 @@ setupVbenVxeTable({
if (!props) {
return '';
}
- const dict = getDictObj(props.type, row[column.field]);
- // 转义
- if (dict) {
- if (`${dict.colorType}` === 'primary') dict.colorType = 'processing';
- else if (`${dict.colorType}` === 'danger') dict.colorType = 'error';
- else if (`${dict.colorType}` === 'info') dict.colorType = 'default';
- else if (!dict.colorType) dict.colorType = 'default';
- return h(
- Tag,
- { color: dict.colorType },
- { default: () => dict.label },
- );
- }
- return '';
+ // 使用 DictTag 组件替代原来的实现
+ return h(DictTag, {
+ type: props.type,
+ value: row[column.field]?.toString(),
+ });
},
});
diff --git a/apps/web-antd/src/components/dict-tag/index.ts b/apps/web-antd/src/components/dict-tag/index.ts
new file mode 100644
index 000000000..4db274209
--- /dev/null
+++ b/apps/web-antd/src/components/dict-tag/index.ts
@@ -0,0 +1,3 @@
+import DictTag from './src/DictTag.vue'
+
+export { DictTag }
diff --git a/apps/web-antd/src/components/dict-tag/src/DictTag.vue b/apps/web-antd/src/components/dict-tag/src/DictTag.vue
new file mode 100644
index 000000000..90078a0c7
--- /dev/null
+++ b/apps/web-antd/src/components/dict-tag/src/DictTag.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ {{ dictTag.label }}
+
+
diff --git a/apps/web-antd/src/views/system/mail/log/modules/detail.vue b/apps/web-antd/src/views/system/mail/log/modules/detail.vue
index 21b87acad..eac6f12e3 100644
--- a/apps/web-antd/src/views/system/mail/log/modules/detail.vue
+++ b/apps/web-antd/src/views/system/mail/log/modules/detail.vue
@@ -2,11 +2,12 @@
import type { SystemMailLogApi } from '#/api/system/mail/log';
import { useVbenModal } from '@vben/common-ui';
-import { Descriptions, Tag } from 'ant-design-vue';
+import { Descriptions } from 'ant-design-vue';
+import { DictTag } from '#/components/dict-tag';
import { ref } from 'vue';
import { formatDateTime } from '@vben/utils';
-import { DICT_TYPE, getDictLabel } from '#/utils/dict';
+import { DICT_TYPE } from '#/utils/dict';
const formData = ref();
@@ -63,10 +64,7 @@ const [Modal, modalApi] = useVbenModal({
-
-
- {{ getDictLabel(DICT_TYPE.SYSTEM_MAIL_SEND_STATUS, formData?.sendStatus ) }}
-
+
{{ formatDateTime(formData?.sendTime || '') }}
diff --git a/apps/web-antd/src/views/system/notify/message/modules/detail.vue b/apps/web-antd/src/views/system/notify/message/modules/detail.vue
index 6f4786cfb..e5993c275 100644
--- a/apps/web-antd/src/views/system/notify/message/modules/detail.vue
+++ b/apps/web-antd/src/views/system/notify/message/modules/detail.vue
@@ -2,13 +2,14 @@
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
import { useVbenModal } from '@vben/common-ui';
-import { Descriptions, Tag } from 'ant-design-vue';
+import { Descriptions } from 'ant-design-vue';
+import { DictTag } from '#/components/dict-tag';
import { ref } from 'vue';
import { formatDateTime } from '@vben/utils';
-import { DICT_TYPE, getDictLabel } from '#/utils/dict';
+import { DICT_TYPE } from '#/utils/dict';
-const messageData = ref();
+const formData = ref();
const [Modal, modalApi] = useVbenModal({
async onOpenChange(isOpen: boolean) {
@@ -22,7 +23,7 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
- messageData.value = data;
+ formData.value = data;
} finally {
modalApi.lock(false);
}
@@ -33,48 +34,39 @@ const [Modal, modalApi] = useVbenModal({
- {{ messageData?.id }}
+ {{ formData?.id }}
-
-
- {{ getDictLabel(DICT_TYPE.USER_TYPE, messageData?.userType) }}
-
+
- {{ messageData?.userId }}
+ {{ formData?.userId }}
- {{ messageData?.templateId }}
+ {{ formData?.templateId }}
- {{ messageData?.templateCode }}
+ {{ formData?.templateCode }}
- {{ messageData?.templateNickname }}
+ {{ formData?.templateNickname }}
- {{ messageData?.templateContent }}
+ {{ formData?.templateContent }}
- {{ messageData?.templateParams }}
+ {{ formData?.templateParams }}
-
-
- {{ getDictLabel(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE, messageData?.templateType) }}
-
+
-
-
- {{ getDictLabel(DICT_TYPE.INFRA_BOOLEAN_STRING, messageData?.readStatus) }}
-
+
- {{ formatDateTime(messageData?.readTime || '') }}
+ {{ formatDateTime(formData?.readTime || '') }}
- {{ formatDateTime(messageData?.createTime || '') }}
+ {{ formatDateTime(formData?.createTime || '') }}
diff --git a/apps/web-antd/src/views/system/notify/my/modules/detail.vue b/apps/web-antd/src/views/system/notify/my/modules/detail.vue
index 307c86e33..fd0fafce5 100644
--- a/apps/web-antd/src/views/system/notify/my/modules/detail.vue
+++ b/apps/web-antd/src/views/system/notify/my/modules/detail.vue
@@ -2,13 +2,14 @@
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
import { useVbenModal } from '@vben/common-ui';
-import { Descriptions, Tag } from 'ant-design-vue';
+import { Descriptions } from 'ant-design-vue';
+import { DictTag } from '#/components/dict-tag';
import { ref } from 'vue';
import { formatDateTime } from '@vben/utils';
-import { DICT_TYPE, getDictLabel } from '#/utils/dict';
+import { DICT_TYPE } from '#/utils/dict';
-const messageData = ref();
+const formData = ref();
const [Modal, modalApi] = useVbenModal({
async onOpenChange(isOpen: boolean) {
@@ -22,7 +23,7 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
- messageData.value = data;
+ formData.value = data;
} finally {
modalApi.lock(false);
}
@@ -33,58 +34,39 @@ const [Modal, modalApi] = useVbenModal({
- {{ messageData?.id }}
+ {{ formData?.id }}
-
-
- {{ getDictLabel(DICT_TYPE.USER_TYPE, messageData?.userType) }}
-
+
- {{ messageData?.userId }}
+ {{ formData?.userId }}
- {{ messageData?.templateId }}
+ {{ formData?.templateId }}
- {{ messageData?.templateCode }}
+ {{ formData?.templateCode }}
- {{ messageData?.templateNickname }}
+ {{ formData?.templateNickname }}
- {{ messageData?.templateContent }}
+ {{ formData?.templateContent }}
- {{ messageData?.templateParams }}
+ {{ formData?.templateParams }}
-
-
- {{
- getDictLabel(
- DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
- messageData?.templateType,
- )
- }}
-
+
-
-
- {{
- getDictLabel(
- DICT_TYPE.INFRA_BOOLEAN_STRING,
- messageData?.readStatus,
- )
- }}
-
+
- {{ formatDateTime(messageData?.readTime || '') }}
+ {{ formatDateTime(formData?.readTime || '') }}
- {{ formatDateTime(messageData?.createTime || '') }}
+ {{ formatDateTime(formData?.createTime || '') }}
diff --git a/apps/web-antd/src/views/system/sms/log/modules/detail.vue b/apps/web-antd/src/views/system/sms/log/modules/detail.vue
index 04c7871d9..b8f94758d 100644
--- a/apps/web-antd/src/views/system/sms/log/modules/detail.vue
+++ b/apps/web-antd/src/views/system/sms/log/modules/detail.vue
@@ -6,7 +6,8 @@ import { Descriptions, Tag } from 'ant-design-vue';
import { ref } from 'vue';
import { formatDateTime } from '@vben/utils';
-import { DICT_TYPE, getDictLabel } from '#/utils/dict';
+import { DICT_TYPE } from '#/utils/dict';
+import { DictTag } from '#/components/dict-tag';
const formData = ref();
@@ -46,19 +47,13 @@ const [Modal, modalApi] = useVbenModal({
{{ formData?.templateId }}
-
-
- {{ getDictLabel(DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, formData?.templateType) }}
-
+
{{ formData?.templateContent }}
-
-
- {{ getDictLabel(DICT_TYPE.SYSTEM_SMS_SEND_STATUS, formData?.sendStatus) }}
-
+
{{ formatDateTime(formData?.sendTime || '') }}
@@ -70,10 +65,7 @@ const [Modal, modalApi] = useVbenModal({
{{ formData?.apiSendMsg }}
-
-
- {{ getDictLabel(DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS, formData?.receiveStatus) }}
-
+
{{ formatDateTime(formData?.receiveTime || '') }}