@pubinfo-pr/module-rbac 0.244.1 → 0.245.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -601,8 +601,8 @@ function y(e) {
601
601
  return Array.isArray(e) ? e : [e];
602
602
  }
603
603
  async function b(e) {
604
- let t = y(e.dictCode), n = await l({ dictCode: t.join(",") });
605
- if (n.success) return t.length === 1 ? n.data?.[0]?.dictItemList : n.data;
604
+ let t = Array.isArray(e.dictCode), n = await l({ dictCode: y(e.dictCode).join(",") });
605
+ if (n.success) return t ? n.data : n.data?.[0]?.dictItemList;
606
606
  }
607
607
  //#endregion
608
608
  //#region src/utils/routeSystem.ts
@@ -2,5 +2,8 @@
2
2
  * 获取字典数据
3
3
  */
4
4
  export declare function getDictItem(params: {
5
- dictCode: string | string[];
6
- }): Promise<API.DictItemVo[] | API.DictItemBatchVo[] | undefined>;
5
+ dictCode: string;
6
+ }): Promise<API.DictItemVo[] | undefined>;
7
+ export declare function getDictItem(params: {
8
+ dictCode: string[];
9
+ }): Promise<API.DictItemBatchVo[] | undefined>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo-pr/module-rbac",
3
3
  "type": "module",
4
- "version": "0.244.1",
4
+ "version": "0.245.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "alova": "^3.5.0",
26
26
  "ant-design-vue": "^4.2.6",
27
27
  "pinia": "^3.0.4",
28
- "pubinfo-pr": "0.244.1"
28
+ "pubinfo-pr": "0.245.1"
29
29
  },
30
30
  "dependencies": {
31
31
  "@destyler/color-picker": "^0.2.6",
@@ -50,7 +50,7 @@
50
50
  "alova": "^3.5.0",
51
51
  "ant-design-vue": "^4.2.6",
52
52
  "pinia": "^3.0.4",
53
- "pubinfo-pr": "0.244.1",
53
+ "pubinfo-pr": "0.245.1",
54
54
  "type-fest": "^5.4.4"
55
55
  },
56
56
  "scripts": {
package/src/utils/dict.ts CHANGED
@@ -7,12 +7,15 @@ function arraify<T>(data: T | T[]) {
7
7
  /**
8
8
  * 获取字典数据
9
9
  */
10
+ export async function getDictItem(params: { dictCode: string }): Promise<API.DictItemVo[] | undefined>;
11
+ export async function getDictItem(params: { dictCode: string[] }): Promise<API.DictItemBatchVo[] | undefined>;
10
12
  export async function getDictItem(params: { dictCode: string | string[] }) {
13
+ const isBatch = Array.isArray(params.dictCode);
11
14
  const dictCodes = arraify(params.dictCode);
12
15
  const res = await getDictItemListBatch({ dictCode: dictCodes.join(',') });
13
16
 
14
17
  if (res.success) {
15
- if (dictCodes.length === 1) {
18
+ if (!isBatch) {
16
19
  return res.data?.[0]?.dictItemList;
17
20
  }
18
21