@dazhicheng/ui 1.5.212 → 1.5.213

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.
@@ -1,9 +1,9 @@
1
- import { queryDataPermissionDetailDataTypeContext as x, pageUser as T } from "../api/dataTypeContext.js";
2
- import { ref as K, watchEffect as L, unref as q, watch as U, computed as b } from "vue";
3
- import { useRoute as M } from "vue-router";
4
- const c = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
5
- let C, m;
6
- const V = "all", _ = { label: "全部", value: V }, j = {
1
+ import { queryDataPermissionDetailDataTypeContext as L, pageUser as R } from "../api/dataTypeContext.js";
2
+ import { ref as U, watchEffect as b, unref as O, watch as M, computed as V } from "vue";
3
+ import { useRoute as _ } from "vue-router";
4
+ const c = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
5
+ let D, h;
6
+ const j = "all", E = { label: "全部", value: j }, z = {
7
7
  platformId: ["platformName", "platformId"],
8
8
  shopId: ["shopName", "shopId"],
9
9
  purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
@@ -11,114 +11,117 @@ const V = "all", _ = { label: "全部", value: V }, j = {
11
11
  lockUserId: ["userName", "userId"],
12
12
  userId: ["fullName", "id"]
13
13
  };
14
- async function E() {
15
- if (C) return C;
16
- if (m) return m;
17
- m = T({ pageNo: 1, pageSize: 9999 }).then((a) => {
18
- const l = a.records || [];
19
- return C = l, l;
14
+ async function k() {
15
+ if (D) return D;
16
+ if (h) return h;
17
+ h = R({ pageNo: 1, pageSize: 9999 }).then((n) => {
18
+ const l = n.records || [];
19
+ return D = l, l;
20
20
  });
21
21
  try {
22
- return await m;
22
+ return await h;
23
23
  } finally {
24
- m = void 0;
24
+ h = void 0;
25
25
  }
26
26
  }
27
- function G(a) {
28
- const l = M(), P = K({});
29
- function p(t = {}) {
30
- P.value = a.codes.reduce(
27
+ function J(n) {
28
+ const l = _(), v = U({});
29
+ function m(t = {}) {
30
+ v.value = n.codes.reduce(
31
31
  (e, r) => {
32
- const [s, d] = j[r], y = (t[r] || []).map((f) => {
33
- const u = r === "purchasePlaceId" ? f.purchaseInfo || {} : f;
32
+ const [s, d] = z[r], g = (t[r] || []).map((f) => {
33
+ const o = r === "purchasePlaceId" ? f.purchaseInfo || {} : f;
34
34
  return {
35
35
  ...f,
36
- label: u == null ? void 0 : u[s],
37
- value: u == null ? void 0 : u[d]
36
+ label: o == null ? void 0 : o[s],
37
+ value: o == null ? void 0 : o[d]
38
38
  };
39
39
  });
40
- return e[r] = y, e;
40
+ return e[r] = g, e;
41
41
  },
42
42
  {}
43
43
  );
44
44
  }
45
- function N(t) {
45
+ function A(t) {
46
46
  var e;
47
- return typeof a.showAll == "boolean" ? a.showAll : ((e = a.showAll) == null ? void 0 : e[t]) ?? !1;
47
+ return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
48
48
  }
49
- function O() {
50
- I.clear(), c.clear(), g.clear(), C = void 0, m = void 0;
49
+ function x() {
50
+ C.clear(), c.clear(), p.clear(), D = void 0, h = void 0;
51
51
  }
52
- function A(t) {
52
+ function T(t) {
53
53
  c.delete(t);
54
54
  }
55
- async function D(t = !1) {
56
- const e = l.path, r = q(a.dataSource);
55
+ async function S(t = !1) {
56
+ const e = l.path, r = O(n.dataSource);
57
57
  if (r) {
58
58
  const i = { ...c.get(e) || {}, ...r };
59
- c.set(e, i), p(i);
59
+ c.set(e, i), m(i);
60
60
  return;
61
61
  }
62
62
  const s = c.get(e) || {};
63
- let d = t ? [...a.codes] : a.codes.filter((n) => !Object.prototype.hasOwnProperty.call(s, n));
63
+ let d = t ? [...n.codes] : n.codes.filter((a) => !Object.prototype.hasOwnProperty.call(s, a));
64
64
  if (!d.length) {
65
- p(s);
65
+ m(s);
66
66
  return;
67
67
  }
68
- const y = t ? void 0 : I.get(e);
69
- if (y) {
70
- const n = await y, o = { ...c.get(e) || {}, ...n };
71
- if (c.set(e, o), d = a.codes.filter((h) => !Object.prototype.hasOwnProperty.call(o, h)), !d.length) {
72
- p(o);
68
+ const g = t ? void 0 : C.get(e);
69
+ if (g) {
70
+ const a = await g, u = { ...c.get(e) || {}, ...a };
71
+ if (c.set(e, u), d = n.codes.filter((y) => !Object.prototype.hasOwnProperty.call(u, y)), !d.length) {
72
+ m(u);
73
73
  return;
74
74
  }
75
75
  }
76
- const f = d.filter((n) => n !== "userId"), u = d.includes("userId"), v = Promise.all([
77
- f.length ? x({ dataTypeName: f }).then(
78
- (n) => n
76
+ const f = d.filter((a) => a !== "userId"), o = d.includes("userId"), q = Promise.allSettled([
77
+ f.length ? L({ dataTypeName: f }).then(
78
+ (a) => a
79
79
  ) : Promise.resolve([]),
80
- u ? E() : Promise.resolve(void 0)
81
- ]).then(([n, i]) => ({
82
- ...i ? { userId: i } : {},
83
- ...n.reduce((o, h) => {
84
- const S = h == null ? void 0 : h.dataTypeCode;
85
- return S && (o[S] = h.originalItems || []), o;
86
- }, {})
87
- })), w = (g.get(e) || 0) + 1;
88
- g.set(e, w), I.set(e, v);
80
+ o ? k() : Promise.resolve(void 0)
81
+ ]).then(([a, i]) => {
82
+ const u = a.status === "fulfilled" ? a.value : [], y = i.status === "fulfilled" ? i.value : void 0;
83
+ return {
84
+ ...y ? { userId: y } : {},
85
+ ...u.reduce((P, I) => {
86
+ const N = I == null ? void 0 : I.dataTypeCode;
87
+ return N && (P[N] = I.originalItems || []), P;
88
+ }, {})
89
+ };
90
+ }), w = (p.get(e) || 0) + 1;
91
+ p.set(e, w), C.set(e, q);
89
92
  try {
90
- const n = await v;
91
- if (g.get(e) !== w) return;
92
- const o = { ...c.get(e) || {}, ...n };
93
- c.set(e, o), p(o);
93
+ const a = await q;
94
+ if (p.get(e) !== w) return;
95
+ const u = { ...c.get(e) || {}, ...a };
96
+ c.set(e, u), m(u);
94
97
  } finally {
95
- g.get(e) === w && I.delete(e);
98
+ p.get(e) === w && C.delete(e);
96
99
  }
97
100
  }
98
- async function R() {
101
+ async function K() {
99
102
  const t = l.path;
100
- O(), A(t), await D(!0);
103
+ x(), T(t), await S(!0);
101
104
  }
102
- return L(() => {
103
- const t = q(a.dataSource);
105
+ return b(() => {
106
+ const t = O(n.dataSource);
104
107
  if (!t) return;
105
108
  const e = l.path, s = { ...c.get(e) || {}, ...t };
106
- c.set(e, s), p(s);
107
- }), U(
109
+ c.set(e, s), m(s);
110
+ }), M(
108
111
  () => l.path,
109
112
  () => {
110
- D();
113
+ S();
111
114
  },
112
115
  { immediate: !0 }
113
116
  ), {
114
117
  /**
115
118
  * 数据源
116
119
  */
117
- dataSource: b(() => {
118
- const t = a.codes.reduce(
120
+ dataSource: V(() => {
121
+ const t = n.codes.reduce(
119
122
  (e, r) => {
120
- const s = P.value[r] || [];
121
- return e[r] = N(r) ? [_, ...s] : s, e;
123
+ const s = v.value[r] || [];
124
+ return e[r] = A(r) ? [E, ...s] : s, e;
122
125
  },
123
126
  {}
124
127
  );
@@ -134,9 +137,9 @@ function G(a) {
134
137
  /**
135
138
  * @description 清空所有缓存,重新请求
136
139
  */
137
- reload: R
140
+ reload: K
138
141
  };
139
142
  }
140
143
  export {
141
- G as useDataPermissionOptions
144
+ J as useDataPermissionOptions
142
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.212",
3
+ "version": "1.5.213",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -67,8 +67,8 @@
67
67
  "vue-router": "^5.0.2",
68
68
  "vxe-pc-ui": "^4.12.36",
69
69
  "vxe-table": "^4.17.48",
70
- "@dazhicheng/utils": "1.3.41",
71
- "@dazhicheng/hooks": "1.4.44"
70
+ "@dazhicheng/hooks": "1.4.44",
71
+ "@dazhicheng/utils": "1.3.41"
72
72
  },
73
73
  "files": [
74
74
  "dist"