From 001b025ff84dec3c614f0b0346e9a50491034f04 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 06 十一月 2025 11:09:16 +0800
Subject: [PATCH] 应收台账-查询修改
---
src/store/modules/dict.js | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js
index e58e4ec..7521a74 100644
--- a/src/store/modules/dict.js
+++ b/src/store/modules/dict.js
@@ -1,15 +1,43 @@
+import {ListAllData} from "@/api/system/dict/data"
+
const useDictStore = defineStore(
'dict',
{
state: () => ({
- dict: new Array()
+ dict: []
}),
actions: {
+ async initDict() {
+ const response = await ListAllData()
+ this.dict = response.data
+ },
+
+ // 鏍规嵁瀛楀吀绫诲瀷鑾峰彇瀛楀吀
+ getDictTypeList(_type) {
+ if (_type == null || _type === "") {
+ return null;
+ }
+ return this.dict.filter(item => item.type === _type);
+ },
+
+ getDictDataByTypeAndValue(_type,_value){
+ if (_type == null || _value == null) {
+ return {
+ type:"",
+ value:"",
+ label:""
+ };
+ }
+ return this.dict.find(item => item.type == _type && item.value == _value ) || null;
+
+ },
+
// 鑾峰彇瀛楀吀
getDict(_key) {
if (_key == null && _key == "") {
return null
}
+ // console.log(this.dict)
try {
for (let i = 0; i < this.dict.length; i++) {
if (this.dict[i].key == _key) {
@@ -48,9 +76,7 @@
cleanDict() {
this.dict = new Array()
},
- // 鍒濆瀛楀吀
- initDict() {
- }
+
}
})
--
Gitblit v1.9.3