mirror of
https://github.com/bufanyun/hotgo.git
synced 2026-04-28 14:04:53 +08:00
发布v2.15.7版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
124
web/src/enums/localDictEnum.ts
Normal file
124
web/src/enums/localDictEnum.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
// 本地字典
|
||||
// 一些不需要放在服务端注册的字典,也可以在这里进行注册
|
||||
|
||||
import { DictOptions, Option } from '@/store/modules/dict';
|
||||
|
||||
export const noticeTypeOptions: Option[] = [
|
||||
{
|
||||
key: 1,
|
||||
value: 1,
|
||||
label: '通知',
|
||||
listClass: 'warning',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: 2,
|
||||
label: '公告',
|
||||
listClass: 'error',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
key: 3,
|
||||
value: 3,
|
||||
label: '私信',
|
||||
listClass: 'info',
|
||||
extra: null,
|
||||
},
|
||||
];
|
||||
|
||||
export const noticeTagOptions: Option[] = [
|
||||
{
|
||||
value: 0,
|
||||
label: '无标签',
|
||||
key: 0,
|
||||
listClass: 'default',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '一般',
|
||||
key: 1,
|
||||
listClass: 'info',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '紧急',
|
||||
key: 2,
|
||||
listClass: 'error',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '重要',
|
||||
key: 3,
|
||||
listClass: 'warning',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: '提醒',
|
||||
key: 4,
|
||||
listClass: 'success',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: '次要',
|
||||
key: 5,
|
||||
listClass: 'default',
|
||||
extra: null,
|
||||
},
|
||||
];
|
||||
|
||||
export const tagTypeOptions: Option[] = [
|
||||
{
|
||||
value: 'success',
|
||||
label: '绿色',
|
||||
key: 'success',
|
||||
listClass: 'success',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 'warning',
|
||||
label: '橙色',
|
||||
key: 'warning',
|
||||
listClass: 'warning',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 'error',
|
||||
label: '红色',
|
||||
key: 'error',
|
||||
listClass: 'error',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 'info',
|
||||
label: '蓝色',
|
||||
key: 'info',
|
||||
listClass: 'info',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 'default',
|
||||
label: '灰色',
|
||||
key: 'default',
|
||||
listClass: 'default',
|
||||
extra: null,
|
||||
},
|
||||
{
|
||||
value: 'primary',
|
||||
label: '主题色',
|
||||
key: 'primary',
|
||||
listClass: 'primary',
|
||||
extra: null,
|
||||
},
|
||||
];
|
||||
|
||||
export const localDict: DictOptions = {
|
||||
noticeTypeOptions: noticeTypeOptions, // 消息通知类型
|
||||
noticeTagOptions: noticeTagOptions, // 消息标签类型
|
||||
tagTypeOptions: tagTypeOptions, // 标签类型选项
|
||||
};
|
||||
@@ -1,67 +1,7 @@
|
||||
import { NAvatar, NTag, NText, SelectRenderLabel, SelectRenderTag } from 'naive-ui';
|
||||
import { Component, h } from 'vue';
|
||||
import { getOptionLabel, getOptionTag, Option } from '@/utils/hotgo';
|
||||
import { BellOutlined, NotificationOutlined, SendOutlined } from '@vicons/antd';
|
||||
|
||||
export const noticeTypeOptions: Option[] = [
|
||||
{
|
||||
key: 1,
|
||||
value: 1,
|
||||
label: '通知',
|
||||
listClass: 'warning',
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: 2,
|
||||
label: '公告',
|
||||
listClass: 'error',
|
||||
},
|
||||
{
|
||||
key: 3,
|
||||
value: 3,
|
||||
label: '私信',
|
||||
listClass: 'info',
|
||||
},
|
||||
];
|
||||
|
||||
export const noticeTagOptions: Option[] = [
|
||||
{
|
||||
value: 0,
|
||||
label: '无标签',
|
||||
key: 0,
|
||||
listClass: 'default',
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '一般',
|
||||
key: 1,
|
||||
listClass: 'info',
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '紧急',
|
||||
key: 2,
|
||||
listClass: 'error',
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '重要',
|
||||
key: 3,
|
||||
listClass: 'warning',
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: '提醒',
|
||||
key: 4,
|
||||
listClass: 'success',
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: '次要',
|
||||
key: 5,
|
||||
listClass: 'default',
|
||||
},
|
||||
];
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
|
||||
export interface personOption {
|
||||
value: number;
|
||||
@@ -231,8 +171,9 @@ export function parseMessage(row): MessageRow {
|
||||
if (row.tag <= 0) {
|
||||
return row;
|
||||
}
|
||||
|
||||
row.tagTitle = getOptionLabel(noticeTagOptions, row.tag);
|
||||
row.tagProps = { type: getOptionTag(noticeTagOptions, row.tag) };
|
||||
const dict = useDictStore();
|
||||
const label = dict.getLabel('noticeTagOptions', row.tag);
|
||||
row.tagTitle = label;
|
||||
row.tagProps = { type: label };
|
||||
return row;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user