fix(1-5): 🐛 优化系统问题
This commit is contained in:
@@ -2,54 +2,53 @@ import { defineStore } from 'pinia';
|
||||
import { DictionaryStates } from './interface';
|
||||
import { request } from '../utils/service';
|
||||
|
||||
export const urlPrefix = '/api/init/dictionary/'
|
||||
export const urlPrefix = '/api/init/dictionary/';
|
||||
export const BUTTON_VALUE_TO_COLOR_MAPPING: any = {
|
||||
1: 'success',
|
||||
true: 'success',
|
||||
0: 'danger',
|
||||
false: 'danger',
|
||||
Search: 'warning', // 查询
|
||||
Update: 'primary', // 编辑
|
||||
Create: 'success', // 新增
|
||||
Retrieve: 'info', // 单例
|
||||
Delete: 'danger' // 删除
|
||||
}
|
||||
1: 'success',
|
||||
true: 'success',
|
||||
0: 'danger',
|
||||
false: 'danger',
|
||||
Search: 'warning', // 查询
|
||||
Update: 'primary', // 编辑
|
||||
Create: 'success', // 新增
|
||||
Retrieve: 'info', // 单例
|
||||
Delete: 'danger', // 删除
|
||||
};
|
||||
|
||||
export function getButtonSettings(objectSettings: any) {
|
||||
return objectSettings.map((item: any) => ({
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
color: item.color || BUTTON_VALUE_TO_COLOR_MAPPING[item.value]
|
||||
}))
|
||||
return objectSettings.map((item: any) => ({
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
color: item.color || BUTTON_VALUE_TO_COLOR_MAPPING[item.value],
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 字典管理数据
|
||||
* @methods getSystemDictionarys 获取系统字典数据
|
||||
*/
|
||||
export const DictionaryStore = defineStore('Dictionary', {
|
||||
state: (): DictionaryStates => ({
|
||||
data: {}
|
||||
}),
|
||||
actions: {
|
||||
async getSystemDictionarys() {
|
||||
request({
|
||||
url: '/api/init/dictionary/?dictionary_key=all',
|
||||
method: 'get',
|
||||
}).then((ret: {
|
||||
data: []
|
||||
}) => {
|
||||
// 转换数据格式并保存到pinia
|
||||
let dataList = ret.data
|
||||
dataList.forEach((item: any) => {
|
||||
let childrens = item.children
|
||||
this.data[item.value] = childrens
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
enabled: true,
|
||||
},
|
||||
state: (): DictionaryStates => ({
|
||||
data: {},
|
||||
}),
|
||||
actions: {
|
||||
async getSystemDictionarys() {
|
||||
request({
|
||||
url: '/api/init/dictionary/?dictionary_key=all',
|
||||
method: 'get',
|
||||
}).then((ret: { data: [] }) => {
|
||||
// 转换数据格式并保存到pinia
|
||||
let dataList = ret.data;
|
||||
|
||||
dataList.forEach((item: any) => {
|
||||
let childrens = item.children;
|
||||
console.log(item);
|
||||
this.data[item.value] = childrens;
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -141,7 +141,7 @@ export const useThemeConfig = defineStore('themeConfig', {
|
||||
// 网站副标题(登录页顶部文字)
|
||||
globalViceTitle: 'dvadmin',
|
||||
// 网站副标题(登录页顶部文字)
|
||||
globalViceTitleMsg: '企业级后台管理系统',
|
||||
globalViceTitleMsg: '企业级快速开发平台',
|
||||
// 默认初始语言,可选值"<zh-cn|en|zh-tw>",默认 zh-cn
|
||||
globalI18n: 'zh-cn',
|
||||
// 默认全局组件大小,可选值"<large|'default'|small>",默认 'large'
|
||||
|
||||
Reference in New Issue
Block a user