mirror of
https://github.com/1024-lab/smart-admin.git
synced 2026-06-08 06:46:05 +00:00
v3.14.0 更新;【新增】EasyExcel重磅升级为FastExcel;【新增】使用最强Argon2算法作为密码存储;【新增】大家吐槽的数据字典改为可重复;【新增】前端布局再增加多种样式;
This commit is contained in:
53
smart-admin-web-javascript/src/store/modules/system/dict.js
Normal file
53
smart-admin-web-javascript/src/store/modules/system/dict.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useDictStore = defineStore({
|
||||
id: 'dict',
|
||||
state: () => ({
|
||||
dict: new Array(),
|
||||
}),
|
||||
actions: {
|
||||
// 获取字典
|
||||
getDict(keyCode) {
|
||||
if (keyCode == null && keyCode == '') {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
for (let i = 0; i < this.dict.length; i++) {
|
||||
if (this.dict[i].keyCode == keyCode) {
|
||||
return this.dict[i].value;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// 设置字典
|
||||
setDict(keyCode, value) {
|
||||
if (keyCode !== null && keyCode !== '') {
|
||||
this.dict.push({
|
||||
key: keyCode,
|
||||
value: value,
|
||||
});
|
||||
}
|
||||
},
|
||||
// 删除字典
|
||||
removeDict(keyCode) {
|
||||
let flag = false;
|
||||
try {
|
||||
for (let i = 0; i < this.dict.length; i++) {
|
||||
if (this.dict[i].keyCode == keyCode) {
|
||||
this.dict.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
flag = false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// 清空字典
|
||||
cleanDict() {
|
||||
this.dict = new Array();
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user