@dazhicheng/ui 1.5.245 → 1.5.246

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.
@@ -31,3 +31,28 @@ export declare function listChainByTypeAirportRegionLevel(params: {
31
31
  }, options?: {
32
32
  [key: string]: any;
33
33
  }): Promise<AirportRegionItem[]>;
34
+ /** 系统字典项 */
35
+ export type SysDictItem = {
36
+ id?: number;
37
+ dictCode?: string;
38
+ itemCode?: string;
39
+ itemName?: string;
40
+ itemOrder?: number;
41
+ parentItemCode?: string;
42
+ status?: number;
43
+ remark?: string;
44
+ [key: string]: any;
45
+ };
46
+ /** 按字典编码批量查询字典项入参 */
47
+ export type SysDictItemByCodesQry = {
48
+ permissionOnlyCode?: string;
49
+ dictCodeList?: string[];
50
+ status?: number;
51
+ };
52
+ /**
53
+ * 根据权限编码和多个字典编码获取系统字典枚举项
54
+ * POST /sysDictItem/getDictItemsByCodes
55
+ */
56
+ export declare function getDictItemsByCodes(body: SysDictItemByCodesQry, options?: {
57
+ [key: string]: any;
58
+ }): Promise<Record<string, SysDictItem[]>>;
@@ -1,16 +1,23 @@
1
1
  import { request as e } from "../utils/xhr.js";
2
- async function r(i) {
2
+ async function n(t) {
3
3
  return e.get({
4
4
  url: "/basic/basicAirline/getAll"
5
5
  });
6
6
  }
7
- async function o(i, t) {
7
+ async function r(t, i) {
8
8
  return e.get({
9
9
  url: "/basic/airportRegionLevel/listChainByType",
10
- params: i
10
+ params: t
11
+ });
12
+ }
13
+ async function o(t, i) {
14
+ return e.post({
15
+ url: "/basic/sysDictItem/getDictItemsByCodes",
16
+ params: t
11
17
  });
12
18
  }
13
19
  export {
14
- r as getAllBasicAirline,
15
- o as listChainByTypeAirportRegionLevel
20
+ n as getAllBasicAirline,
21
+ o as getDictItemsByCodes,
22
+ r as listChainByTypeAirportRegionLevel
16
23
  };
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * 基础数据 code 常量,页面传入 hooks 时使用。
3
3
  * 区域层级 type:1-洲,2-区域,3-国家,4-城市,5-机场
4
+ * 字典类:SALES_ORDER_TYPE / SALES_ORDER_PRODUCT_TYPE 对应 sysDictItem 字典编码
4
5
  */
5
6
  export declare const CODES: {
6
7
  readonly AIRLINE: "airline";
@@ -9,6 +10,10 @@ export declare const CODES: {
9
10
  readonly COUNTRY: "country";
10
11
  readonly CITY: "city";
11
12
  readonly AIRPORT: "airport";
13
+ /** 订单类型(字典 SALES_ORDER_TYPE) */
14
+ readonly SALES_ORDER_TYPE: "SALES_ORDER_TYPE";
15
+ /** 产品类型(字典 SALES_ORDER_PRODUCT_TYPE) */
16
+ readonly SALES_ORDER_PRODUCT_TYPE: "SALES_ORDER_PRODUCT_TYPE";
12
17
  };
13
18
  export type BasicDataCode = (typeof CODES)[keyof typeof CODES];
14
19
  export type BasicDataOption = {
@@ -36,6 +41,19 @@ export type PanelSelectGroupBy = (typeof GROUP_BY)[keyof typeof GROUP_BY];
36
41
  export declare function groupBasicDataOptions(options: BasicDataOption[], groupBy: PanelSelectGroupBy): BasicDataOption[];
37
42
  /** 机场默认按国家分组;其余默认拼音 */
38
43
  export declare function resolveDefaultGroupBy(code: BasicDataCode, groupBy?: PanelSelectGroupBy): PanelSelectGroupBy;
44
+ export type BasicDataFetchContext = {
45
+ /** 当前路由 permissionOnlyCode,字典接口按权限过滤时使用 */
46
+ permissionOnlyCode?: string;
47
+ };
48
+ export type BasicDataTreeConfig = {
49
+ transform?: boolean;
50
+ labelField?: string;
51
+ valueField?: string;
52
+ parentField?: string;
53
+ childrenField?: string;
54
+ disabledField?: string;
55
+ rootParentValue?: string | number | null;
56
+ };
39
57
  export type BasicDataCodeRegistryItem = {
40
58
  /** 默认表单字段名 */
41
59
  defaultFieldName: string;
@@ -47,8 +65,12 @@ export type BasicDataCodeRegistryItem = {
47
65
  defaultMultiple: boolean;
48
66
  /** 默认是否展示「全部」 */
49
67
  defaultShowAll: boolean;
68
+ /** 默认是否展示左侧导航 */
69
+ defaultShowNav?: boolean;
70
+ /** 默认树配置(如产品类型父子字典);有值时关闭拼音分组 */
71
+ defaultTreeConfig?: BasicDataTreeConfig;
50
72
  /** 拉取并归一化为 label/value 选项 */
51
- fetchOptions: () => Promise<BasicDataOption[]>;
73
+ fetchOptions: (ctx?: BasicDataFetchContext) => Promise<BasicDataOption[]>;
52
74
  };
53
75
  /**
54
76
  * code → 接口与默认展示配置。
@@ -1,102 +1,149 @@
1
- import { getAllBasicAirline as N, listChainByTypeAirportRegionLevel as C } from "../api/basicData.js";
2
- const d = {
1
+ import { getAllBasicAirline as p, getDictItemsByCodes as N, listChainByTypeAirportRegionLevel as E } from "../api/basicData.js";
2
+ const u = {
3
3
  AIRLINE: "airline",
4
4
  CONTINENT: "continent",
5
5
  REGION: "region",
6
6
  COUNTRY: "country",
7
7
  CITY: "city",
8
- AIRPORT: "airport"
8
+ AIRPORT: "airport",
9
+ /** 订单类型(字典 SALES_ORDER_TYPE) */
10
+ SALES_ORDER_TYPE: "SALES_ORDER_TYPE",
11
+ /** 产品类型(字典 SALES_ORDER_PRODUCT_TYPE) */
12
+ SALES_ORDER_PRODUCT_TYPE: "SALES_ORDER_PRODUCT_TYPE"
9
13
  }, i = {
10
14
  CONTINENT: "continent",
11
15
  REGION: "region",
12
16
  COUNTRY: "country",
13
17
  PINYIN: "pinyin"
14
- }, p = {
18
+ }, O = {
15
19
  [i.CONTINENT]: { codeKey: "continentCode", nameKey: "continentName" },
16
20
  [i.REGION]: { codeKey: "regionCode", nameKey: "regionName" },
17
21
  [i.COUNTRY]: { codeKey: "countryCode", nameKey: "countryName" }
18
22
  };
19
- function R(e, t) {
20
- if (!Array.isArray(e) || !e.length) return e || [];
21
- if (t === i.PINYIN) return e;
22
- const r = p[t];
23
- if (!r) return e;
24
- const o = /* @__PURE__ */ new Map(), c = [];
25
- return e.forEach((l) => {
26
- const a = l[r.codeKey], n = a != null && a !== "", u = n ? String(a) : "__unknown__";
27
- if (!o.has(u)) {
28
- c.push(u);
29
- const f = l[r.nameKey];
30
- o.set(u, {
31
- label: n ? `${a}(${f || ""})` : "未知",
32
- value: n ? a : "__unknown__",
23
+ function g(t, a) {
24
+ if (!Array.isArray(t) || !t.length) return t || [];
25
+ if (a === i.PINYIN) return t;
26
+ const r = O[a];
27
+ if (!r) return t;
28
+ const n = /* @__PURE__ */ new Map(), d = [];
29
+ return t.forEach((e) => {
30
+ const l = e[r.codeKey], o = l != null && l !== "", s = o ? String(l) : "__unknown__";
31
+ if (!n.has(s)) {
32
+ d.push(s);
33
+ const c = e[r.nameKey];
34
+ n.set(s, {
35
+ label: o ? `${l}(${c || ""})` : "未知",
36
+ value: o ? l : "__unknown__",
33
37
  children: []
34
38
  });
35
39
  }
36
- o.get(u).children.push(l);
37
- }), c.map((l) => o.get(l));
40
+ n.get(s).children.push(e);
41
+ }), d.map((e) => n.get(e));
38
42
  }
39
- function L(e, t) {
40
- return t || (e === d.AIRPORT ? i.COUNTRY : i.PINYIN);
43
+ function h(t, a) {
44
+ return a || (t === u.AIRPORT ? i.COUNTRY : i.PINYIN);
41
45
  }
42
- const m = {
46
+ const R = {
43
47
  1: { codeKey: "continentCode", nameKey: "continentName", statusKey: "continentStatus" },
44
48
  2: { codeKey: "regionCode", nameKey: "regionName", statusKey: "regionStatus" },
45
49
  3: { codeKey: "countryCode", nameKey: "countryName", statusKey: "countryStatus" },
46
50
  4: { codeKey: "cityCode", nameKey: "cityName", statusKey: "cityStatus" },
47
51
  5: { codeKey: "airportCode", nameKey: "airportName", statusKey: "airportStatus" }
48
52
  };
49
- function O(e = []) {
50
- return (Array.isArray(e) ? e : []).filter((t) => t == null ? void 0 : t.airlineCode).map((t) => ({
51
- ...t,
52
- label: `${t.airlineCode}(${t.airlineNameCn || ""})`,
53
- value: t.airlineCode
53
+ function S(t = []) {
54
+ return (Array.isArray(t) ? t : []).filter((a) => a == null ? void 0 : a.airlineCode).map((a) => ({
55
+ ...a,
56
+ label: `${a.airlineCode}(${a.airlineNameCn || ""})`,
57
+ value: a.airlineCode
54
58
  }));
55
59
  }
56
- function I(e) {
57
- if (!e || typeof e != "object" || Array.isArray(e))
58
- return e || {};
59
- const t = e.continentCode || e.regionCode || e.countryCode || e.cityCode || e.airportCode, r = [1, 2, 3, 4, 5].some((a) => e[String(a)] || e[a]);
60
- if (t && !r)
61
- return e;
62
- let o = {}, c = 0;
63
- for (const a of [1, 2, 3, 4, 5]) {
64
- const n = e[String(a)] || e[a];
65
- if (!n || typeof n != "object") continue;
66
- const u = Number(n.type ?? a);
67
- u >= c && (c = u, o = n);
60
+ function A(t) {
61
+ if (!t || typeof t != "object" || Array.isArray(t))
62
+ return t || {};
63
+ const a = t.continentCode || t.regionCode || t.countryCode || t.cityCode || t.airportCode, r = [1, 2, 3, 4, 5].some((l) => t[String(l)] || t[l]);
64
+ if (a && !r)
65
+ return t;
66
+ let n = {}, d = 0;
67
+ for (const l of [1, 2, 3, 4, 5]) {
68
+ const o = t[String(l)] || t[l];
69
+ if (!o || typeof o != "object") continue;
70
+ const s = Number(o.type ?? l);
71
+ s >= d && (d = s, n = o);
68
72
  }
69
- const l = { ...o };
70
- for (const a of [1, 2, 3, 4, 5]) {
71
- const n = e[String(a)] || e[a];
72
- if (!n || typeof n != "object") continue;
73
- const { codeKey: u, nameKey: f, statusKey: y } = m[a];
74
- n.code !== void 0 && n.code !== null && n.code !== "" && (l[u] = n.code), n.name !== void 0 && (l[f] = n.name), n.status !== void 0 && (l[y] = n.status);
73
+ const e = { ...n };
74
+ for (const l of [1, 2, 3, 4, 5]) {
75
+ const o = t[String(l)] || t[l];
76
+ if (!o || typeof o != "object") continue;
77
+ const { codeKey: s, nameKey: c, statusKey: C } = R[l];
78
+ o.code !== void 0 && o.code !== null && o.code !== "" && (e[s] = o.code), o.name !== void 0 && (e[c] = o.name), o.status !== void 0 && (e[C] = o.status);
75
79
  }
76
- return l;
80
+ return e;
77
81
  }
78
- function A(e) {
79
- return (Array.isArray(e) ? e : []).map((r) => I(r || {}));
82
+ function T(t) {
83
+ return (Array.isArray(t) ? t : []).map((r) => A(r || {}));
80
84
  }
81
- function E(e = [], t, r) {
82
- return (Array.isArray(e) ? e : []).filter((o) => o == null ? void 0 : o[t]).map((o) => ({
83
- ...o,
84
- label: `${o[t]}(${o[r] || ""})`,
85
- value: o[t]
85
+ function L(t = [], a, r) {
86
+ return (Array.isArray(t) ? t : []).filter((n) => n == null ? void 0 : n[a]).map((n) => ({
87
+ ...n,
88
+ label: `${n[a]}(${n[r] || ""})`,
89
+ value: n[a]
86
90
  }));
87
91
  }
88
- function s(e, t, r) {
92
+ function f(t, a, r) {
89
93
  return async () => {
90
94
  try {
91
- const o = await C({ type: e });
92
- return E(A(o), t, r);
95
+ const n = await E({ type: t });
96
+ return L(T(n), a, r);
93
97
  } catch {
94
98
  return [];
95
99
  }
96
100
  };
97
101
  }
98
- const g = {
99
- [d.AIRLINE]: {
102
+ function _(t = []) {
103
+ return (Array.isArray(t) ? t : []).filter((a) => (a == null ? void 0 : a.itemCode) !== void 0 && (a == null ? void 0 : a.itemCode) !== null && (a == null ? void 0 : a.itemCode) !== "").map((a) => ({
104
+ ...a,
105
+ label: a.itemName || "",
106
+ value: a.itemCode
107
+ }));
108
+ }
109
+ function I(t = []) {
110
+ const a = Array.isArray(t) ? t : [], r = new Set(
111
+ a.map((e) => e.parentItemCode).filter((e) => e != null && String(e) !== "").map(String)
112
+ ), n = new Set(
113
+ a.filter((e) => (e == null ? void 0 : e.itemCode) !== void 0 && (e == null ? void 0 : e.itemCode) !== null && (e == null ? void 0 : e.itemCode) !== "").map((e) => String(e.itemCode))
114
+ ), d = a.filter((e) => (e == null ? void 0 : e.itemCode) !== void 0 && (e == null ? void 0 : e.itemCode) !== null && (e == null ? void 0 : e.itemCode) !== "").map((e) => {
115
+ const l = String(e.itemCode), o = e.itemName || "";
116
+ return {
117
+ ...e,
118
+ label: r.has(l) ? `${l}(${o})` : o,
119
+ value: l
120
+ };
121
+ });
122
+ return r.forEach((e) => {
123
+ n.has(e) || d.push({
124
+ itemCode: e,
125
+ itemName: e,
126
+ label: e,
127
+ value: e,
128
+ parentItemCode: null
129
+ });
130
+ }), d;
131
+ }
132
+ function y(t, a = _) {
133
+ return async (r) => {
134
+ try {
135
+ const n = await N({
136
+ dictCodeList: [t],
137
+ permissionOnlyCode: r == null ? void 0 : r.permissionOnlyCode
138
+ }), d = (n == null ? void 0 : n[t]) || [];
139
+ return a(d);
140
+ } catch {
141
+ return [];
142
+ }
143
+ };
144
+ }
145
+ const m = {
146
+ [u.AIRLINE]: {
100
147
  defaultFieldName: "airlineCodes",
101
148
  defaultLabel: "航司",
102
149
  defaultExcludeLabel: "排除航司",
@@ -104,58 +151,87 @@ const g = {
104
151
  defaultShowAll: !0,
105
152
  async fetchOptions() {
106
153
  try {
107
- const e = await N();
108
- return O(e || []);
154
+ const t = await p();
155
+ return S(t || []);
109
156
  } catch {
110
157
  return [];
111
158
  }
112
159
  }
113
160
  },
114
- [d.CONTINENT]: {
161
+ [u.CONTINENT]: {
115
162
  defaultFieldName: "continentCodes",
116
163
  defaultLabel: "洲",
117
164
  defaultExcludeLabel: "排除洲",
118
165
  defaultMultiple: !0,
119
166
  defaultShowAll: !1,
120
- fetchOptions: s(1, "continentCode", "continentName")
167
+ fetchOptions: f(1, "continentCode", "continentName")
121
168
  },
122
- [d.REGION]: {
169
+ [u.REGION]: {
123
170
  defaultFieldName: "regionCodes",
124
171
  defaultLabel: "区域",
125
172
  defaultExcludeLabel: "排除区域",
126
173
  defaultMultiple: !0,
127
174
  defaultShowAll: !1,
128
- fetchOptions: s(2, "regionCode", "regionName")
175
+ fetchOptions: f(2, "regionCode", "regionName")
129
176
  },
130
- [d.COUNTRY]: {
177
+ [u.COUNTRY]: {
131
178
  defaultFieldName: "countryCodes",
132
179
  defaultLabel: "国家",
133
180
  defaultExcludeLabel: "排除国家",
134
181
  defaultMultiple: !0,
135
182
  defaultShowAll: !1,
136
- fetchOptions: s(3, "countryCode", "countryName")
183
+ fetchOptions: f(3, "countryCode", "countryName")
137
184
  },
138
- [d.CITY]: {
185
+ [u.CITY]: {
139
186
  defaultFieldName: "cityCodes",
140
187
  defaultLabel: "城市",
141
188
  defaultExcludeLabel: "排除城市",
142
189
  defaultMultiple: !0,
143
190
  defaultShowAll: !1,
144
- fetchOptions: s(4, "cityCode", "cityName")
191
+ fetchOptions: f(4, "cityCode", "cityName")
145
192
  },
146
- [d.AIRPORT]: {
193
+ [u.AIRPORT]: {
147
194
  defaultFieldName: "airportCodes",
148
195
  defaultLabel: "机场",
149
196
  defaultExcludeLabel: "排除机场",
150
197
  defaultMultiple: !0,
151
198
  defaultShowAll: !1,
152
- fetchOptions: s(5, "airportCode", "airportName")
199
+ fetchOptions: f(5, "airportCode", "airportName")
200
+ },
201
+ [u.SALES_ORDER_TYPE]: {
202
+ defaultFieldName: "orderType",
203
+ defaultLabel: "订单类型",
204
+ defaultExcludeLabel: "排除订单类型",
205
+ defaultMultiple: !1,
206
+ defaultShowAll: !1,
207
+ defaultShowNav: !0,
208
+ defaultTreeConfig: {
209
+ transform: !0,
210
+ labelField: "label",
211
+ valueField: "value",
212
+ parentField: "parentItemCode"
213
+ },
214
+ fetchOptions: y(u.SALES_ORDER_TYPE, I)
215
+ },
216
+ [u.SALES_ORDER_PRODUCT_TYPE]: {
217
+ defaultFieldName: "productType",
218
+ defaultLabel: "产品类型",
219
+ defaultExcludeLabel: "排除产品类型",
220
+ defaultMultiple: !1,
221
+ defaultShowAll: !1,
222
+ defaultTreeConfig: {
223
+ transform: !0,
224
+ labelField: "itemName",
225
+ valueField: "itemCode",
226
+ parentField: "parentItemCode"
227
+ },
228
+ fetchOptions: y(u.SALES_ORDER_PRODUCT_TYPE)
153
229
  }
154
230
  };
155
231
  export {
156
- d as CODES,
157
- g as CODE_REGISTRY,
232
+ u as CODES,
233
+ m as CODE_REGISTRY,
158
234
  i as GROUP_BY,
159
- R as groupBasicDataOptions,
160
- L as resolveDefaultGroupBy
235
+ g as groupBasicDataOptions,
236
+ h as resolveDefaultGroupBy
161
237
  };
@@ -1,88 +1,90 @@
1
1
  import { ref as P, watchEffect as R, unref as D, watch as q, computed as x } from "vue";
2
2
  import { useRoute as M } from "vue-router";
3
3
  import { CODE_REGISTRY as b } from "./basicDataCodes.js";
4
- const n = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
5
- function g(c) {
4
+ const n = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
5
+ function p(c) {
6
6
  return Array.isArray(c) ? c : [];
7
7
  }
8
8
  function E(c) {
9
- return c.reduce((s, l) => (s[l] = [], s), {});
9
+ return c.reduce((u, y) => (u[y] = [], u), {});
10
10
  }
11
11
  function _(c) {
12
- const s = M(), l = P({});
13
- function u(r = {}) {
14
- l.value = c.codes.reduce(
15
- (e, t) => (e[t] = g(r[t]), e),
12
+ const u = M(), y = P({});
13
+ function i(r = {}) {
14
+ y.value = c.codes.reduce(
15
+ (e, t) => (e[t] = p(r[t]), e),
16
16
  {}
17
17
  );
18
18
  }
19
- u();
19
+ i();
20
20
  async function O(r) {
21
+ var s;
22
+ const e = (s = u.meta) == null ? void 0 : s.permissionOnlyCode;
21
23
  return (await Promise.allSettled(
22
- r.map(async (t) => {
24
+ r.map(async (a) => {
23
25
  try {
24
- const o = await b[t].fetchOptions();
25
- return [t, g(o)];
26
+ const f = await b[a].fetchOptions({ permissionOnlyCode: e });
27
+ return [a, p(f)];
26
28
  } catch {
27
- return [t, []];
29
+ return [a, []];
28
30
  }
29
31
  })
30
- )).reduce((t, a, o) => {
31
- const i = r[o];
32
- return a.status === "fulfilled" ? t[a.value[0]] = g(a.value[1]) : t[i] = [], t;
32
+ )).reduce((a, o, f) => {
33
+ const l = r[f];
34
+ return o.status === "fulfilled" ? a[o.value[0]] = p(o.value[1]) : a[l] = [], a;
33
35
  }, {});
34
36
  }
35
37
  async function w(r = !1) {
36
- const e = s.path;
38
+ const e = u.path;
37
39
  let t = [];
38
40
  try {
39
- const a = D(c.dataSource);
40
- if (a) {
41
- const p = { ...n.get(e) || {}, ...a };
42
- n.set(e, p), u(p);
41
+ const s = D(c.dataSource);
42
+ if (s) {
43
+ const m = { ...n.get(e) || {}, ...s };
44
+ n.set(e, m), i(m);
43
45
  return;
44
46
  }
45
- const o = n.get(e) || {};
46
- if (t = r ? [...c.codes] : c.codes.filter((f) => !Object.prototype.hasOwnProperty.call(o, f)), !t.length) {
47
- u(o);
47
+ const a = n.get(e) || {};
48
+ if (t = r ? [...c.codes] : c.codes.filter((d) => !Object.prototype.hasOwnProperty.call(a, d)), !t.length) {
49
+ i(a);
48
50
  return;
49
51
  }
50
- const i = r ? void 0 : y.get(e);
51
- if (i)
52
+ const o = r ? void 0 : C.get(e);
53
+ if (o)
52
54
  try {
53
- const f = await i, d = { ...n.get(e) || {}, ...f };
54
- if (n.set(e, d), t = c.codes.filter((v) => !Object.prototype.hasOwnProperty.call(d, v)), !t.length) {
55
- u(d);
55
+ const d = await o, h = { ...n.get(e) || {}, ...d };
56
+ if (n.set(e, h), t = c.codes.filter((v) => !Object.prototype.hasOwnProperty.call(h, v)), !t.length) {
57
+ i(h);
56
58
  return;
57
59
  }
58
60
  } catch {
59
61
  }
60
- const C = O(t), m = (h.get(e) || 0) + 1;
61
- h.set(e, m), y.set(e, C);
62
+ const f = O(t), l = (g.get(e) || 0) + 1;
63
+ g.set(e, l), C.set(e, f);
62
64
  try {
63
- const f = await C;
64
- if (h.get(e) !== m) return;
65
- const d = { ...n.get(e) || {}, ...f };
66
- n.set(e, d), u(d);
65
+ const d = await f;
66
+ if (g.get(e) !== l) return;
67
+ const h = { ...n.get(e) || {}, ...d };
68
+ n.set(e, h), i(h);
67
69
  } finally {
68
- h.get(e) === m && y.delete(e);
70
+ g.get(e) === l && C.delete(e);
69
71
  }
70
72
  } catch {
71
- const a = E(t.length ? t : c.codes), i = { ...n.get(e) || {}, ...a };
72
- n.set(e, i), u(i);
73
+ const s = E(t.length ? t : c.codes), o = { ...n.get(e) || {}, ...s };
74
+ n.set(e, o), i(o);
73
75
  }
74
76
  }
75
77
  async function S() {
76
- const r = s.path;
77
- y.clear(), n.clear(), h.clear(), n.delete(r), await w(!0);
78
+ const r = u.path;
79
+ C.clear(), n.clear(), g.clear(), n.delete(r), await w(!0);
78
80
  }
79
81
  return R(() => {
80
82
  const r = D(c.dataSource);
81
83
  if (!r) return;
82
- const e = s.path, a = { ...n.get(e) || {}, ...r };
83
- n.set(e, a), u(a);
84
+ const e = u.path, s = { ...n.get(e) || {}, ...r };
85
+ n.set(e, s), i(s);
84
86
  }), q(
85
- () => s.path,
87
+ () => u.path,
86
88
  () => {
87
89
  w();
88
90
  },
@@ -90,12 +92,12 @@ function _(c) {
90
92
  ), {
91
93
  dataSource: x(() => {
92
94
  const r = c.codes.reduce(
93
- (e, t) => (e[t] = g(l.value[t]), e),
95
+ (e, t) => (e[t] = p(y.value[t]), e),
94
96
  {}
95
97
  );
96
98
  return new Proxy(r, {
97
99
  get(e, t) {
98
- return typeof t != "string" ? [] : g(r[t]);
100
+ return typeof t != "string" ? [] : p(r[t]);
99
101
  },
100
102
  set() {
101
103
  return !1;
@@ -1,6 +1,6 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
- import { isFunction as j } from "../packages/utils/src/is.js";
3
+ import { isFunction as H } from "../packages/utils/src/is.js";
4
4
  import "vue";
5
5
  import "xe-utils";
6
6
  import "dayjs";
@@ -12,116 +12,117 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js
12
12
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
13
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
14
  import { omit as L } from "lodash-es";
15
- import { CODE_REGISTRY as C, resolveDefaultGroupBy as ee, GROUP_BY as te, groupBasicDataOptions as U } from "./basicDataCodes.js";
16
- import { useBasicDataOptions as ne } from "./useBasicDataOptions.js";
17
- const N = "all";
15
+ import { CODE_REGISTRY as ne, resolveDefaultGroupBy as oe, GROUP_BY as re, groupBasicDataOptions as $ } from "./basicDataCodes.js";
16
+ import { useBasicDataOptions as se } from "./useBasicDataOptions.js";
17
+ const b = "all";
18
18
  function d(t) {
19
19
  return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
20
20
  }
21
- function oe(t, n = N) {
21
+ function ce(t, n = b) {
22
22
  return t === n ? !0 : typeof t == "string" && typeof n == "string" && t.toLowerCase() === String(n).toLowerCase();
23
23
  }
24
- function re(t, n = N) {
25
- return d(t).some((r) => oe(r, n));
24
+ function le(t, n = b) {
25
+ return d(t).some((r) => ce(r, n));
26
26
  }
27
- function se(t) {
27
+ function pe(t) {
28
28
  return t.replace(/[-_]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("");
29
29
  }
30
- function W(t, n, r, s) {
31
- return t ? j(t) ? t(n, r, s) : t : {};
30
+ function z(t, n, r, c) {
31
+ return t ? H(t) ? t(n, r, c) : t : {};
32
32
  }
33
- function Y(t, n, r, s) {
33
+ function K(t, n, r, c) {
34
34
  const p = new Set(r.map((e) => e.value)), l = t[n];
35
- if (s) {
36
- const e = d(l).filter((u) => p.has(u)), c = d(l);
37
- (e.length !== c.length || e.some((u, S) => u !== c[S])) && (t[n] = e);
35
+ if (c) {
36
+ const e = d(l).filter((u) => p.has(u)), s = d(l);
37
+ (e.length !== s.length || e.some((u, g) => u !== s[g])) && (t[n] = e);
38
38
  return;
39
39
  }
40
40
  l == null || l === "" || p.has(l) || (t[n] = void 0);
41
41
  }
42
- function $(t, n, r, s, p, l) {
43
- const e = l ? p.filter((c) => d(r[n]).includes(c.value)) : p.find((c) => c.value === r[n]);
42
+ function V(t, n, r, c, p, l) {
43
+ const e = l ? p.filter((s) => d(r[n]).includes(s.value)) : p.find((s) => s.value === r[n]);
44
44
  return {
45
45
  values: r,
46
- actions: s,
46
+ actions: c,
47
47
  fieldName: n,
48
48
  code: t,
49
49
  options: p,
50
50
  currentOption: e
51
51
  };
52
52
  }
53
- function z(t, n, r) {
54
- const s = d(t);
55
- if (!s.length) return [];
56
- if (re(t, r)) return n;
57
- const p = new Set(s);
53
+ function j(t, n, r) {
54
+ const c = d(t);
55
+ if (!c.length) return [];
56
+ if (le(t, r)) return n;
57
+ const p = new Set(c);
58
58
  return n.filter((l) => p.has(l.value));
59
59
  }
60
- function K(t, n) {
60
+ function q(t, n) {
61
61
  const r = new Set(d(t));
62
- return r.size ? n.filter((s) => !r.has(s.value)) : n;
62
+ return r.size ? n.filter((c) => !r.has(c.value)) : n;
63
63
  }
64
- function V(t, n) {
65
- var s;
66
- const r = (s = t.value) == null ? void 0 : s[n];
64
+ function Z(t, n) {
65
+ var c;
66
+ const r = (c = t.value) == null ? void 0 : c[n];
67
67
  return Array.isArray(r) ? r : [];
68
68
  }
69
- function ge(t, n = {}) {
70
- const r = [...new Set(t.map((e) => e.code))], s = t.reduce(
71
- (e, c) => (e[c.code] = (e[c.code] || 0) + 1, e),
69
+ function Ee(t, n = {}) {
70
+ const r = [...new Set(t.map((e) => e.code))], c = t.reduce(
71
+ (e, s) => (e[s.code] = (e[s.code] || 0) + 1, e),
72
72
  {}
73
- ), { dataSource: p } = ne({
73
+ ), { dataSource: p } = se({
74
74
  codes: r,
75
75
  dataSource: n.dataSource
76
76
  }), l = {};
77
77
  return t.forEach((e) => {
78
- var G;
79
- const c = C[e.code], u = e.fieldName || c.defaultFieldName, S = e.key || ((s[e.code] || 0) > 1 ? u : e.code), T = e.label || c.defaultLabel, _ = e.multiple ?? c.defaultMultiple, q = e.showAll ?? c.defaultShowAll, b = e.showAllField ?? N, m = e.mutexWith, E = ee(e.code, e.groupBy), F = E !== te.PINYIN, Z = [
78
+ var U;
79
+ const s = ne[e.code], u = e.fieldName || s.defaultFieldName, g = e.key || ((c[e.code] || 0) > 1 ? u : e.code), _ = e.label || s.defaultLabel, k = e.multiple ?? s.defaultMultiple, J = e.showAll ?? s.defaultShowAll, E = e.showAllField ?? b, m = e.mutexWith, T = oe(e.code, e.groupBy), F = T !== re.PINYIN, P = s.defaultTreeConfig, G = !!P, I = s.defaultShowNav ?? !1, Q = [
80
80
  ...m ? [m] : [],
81
- ...((G = e.dependencies) == null ? void 0 : G.triggerFields) || []
82
- ], k = [...new Set(Z)], H = L(e.dependencies || {}, ["triggerFields"]), J = k.length ? {
83
- ...H,
84
- triggerFields: k
81
+ ...((U = e.dependencies) == null ? void 0 : U.triggerFields) || []
82
+ ], R = [...new Set(Q)], X = L(e.dependencies || {}, ["triggerFields"]), v = R.length ? {
83
+ ...X,
84
+ triggerFields: R
85
85
  } : e.dependencies, M = {
86
86
  component: "TtPanelSelect",
87
87
  fieldName: u,
88
- label: T,
88
+ label: _,
89
89
  rules: e.rules,
90
- dependencies: J,
90
+ dependencies: v,
91
91
  componentProps: (o, x) => {
92
- const A = V(p, e.code);
93
- let a = m ? K(o[m], A) : A;
94
- j(e.customOptions) && (a = e.customOptions(o, a) || []);
95
- const O = F ? U(a, E) : a, B = W(e.componentProps, o, x, a), { onChange: I, ...P } = B;
92
+ const A = Z(p, e.code);
93
+ let a = m ? q(o[m], A) : A;
94
+ H(e.customOptions) && (a = e.customOptions(o, a) || []);
95
+ const O = F ? $(a, T) : a, B = z(e.componentProps, o, x, a), { onChange: W, ...S } = B;
96
96
  return {
97
- multiple: _,
98
- showAll: q,
99
- showAllField: b,
100
- showNav: !1,
97
+ multiple: k,
98
+ showAll: J,
99
+ showAllField: E,
100
+ showNav: I,
101
101
  showOriginMode: !1,
102
- showPinyinMode: !F,
103
- ...P,
102
+ showPinyinMode: G ? !1 : !F,
103
+ ...P ? { treeConfig: P } : {},
104
+ ...S,
104
105
  options: O,
105
106
  onChange(w) {
106
107
  var y;
107
108
  if (m) {
108
- const i = Array.isArray(o[m]), h = K(w, A);
109
- Y(o, m, h, i);
109
+ const i = Array.isArray(o[m]), h = q(w, A);
110
+ K(o, m, h, i);
110
111
  }
111
112
  if (e.exclude) {
112
- const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0, D = z(w, A, b);
113
- d(w).length ? Y(o, i, D, h) : o[i] = h ? [] : void 0;
113
+ const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0, D = j(w, A, E);
114
+ d(w).length ? K(o, i, D, h) : o[i] = h ? [] : void 0;
114
115
  }
115
116
  (y = e.onChange) == null || y.call(
116
117
  e,
117
118
  w,
118
- $(e.code, u, o, x, a, _)
119
+ V(e.code, u, o, x, a, k)
119
120
  );
120
121
  }
121
122
  };
122
123
  }
123
124
  };
124
- if (l[S] = {
125
+ if (l[g] = {
125
126
  ...M,
126
127
  ...L(e, [
127
128
  "code",
@@ -141,16 +142,16 @@ function ge(t, n = {}) {
141
142
  "customOptions"
142
143
  ]),
143
144
  fieldName: u,
144
- label: T,
145
+ label: _,
145
146
  rules: e.rules,
146
147
  dependencies: M.dependencies,
147
148
  componentProps: M.componentProps,
148
149
  component: "TtPanelSelect"
149
150
  }, e.exclude) {
150
- const o = e.exclude, x = o.fieldName, A = o.key || `exclude${se(S)}`, a = o.label || c.defaultExcludeLabel, O = o.multiple ?? !0, B = o.showAll ?? !1, I = o.showAllField ?? N, P = o.dependencies || {}, w = {
151
- ...P,
152
- triggerFields: P.triggerFields ?? [u],
153
- if: P.if ?? ((i) => d(i[u]).length > 0)
151
+ const o = e.exclude, x = o.fieldName, A = o.key || `exclude${pe(g)}`, a = o.label || s.defaultExcludeLabel, O = o.multiple ?? !0, B = o.showAll ?? !1, W = o.showAllField ?? b, S = o.dependencies || {}, w = {
152
+ ...S,
153
+ triggerFields: S.triggerFields ?? [u],
154
+ if: S.if ?? ((i) => d(i[u]).length > 0)
154
155
  }, y = {
155
156
  component: "TtPanelSelect",
156
157
  fieldName: x,
@@ -158,22 +159,23 @@ function ge(t, n = {}) {
158
159
  rules: o.rules,
159
160
  dependencies: w,
160
161
  componentProps: (i, h) => {
161
- const D = V(p, e.code), g = z(i[u], D, b), Q = F ? U(g, E) : g, X = W(o.componentProps, i, h, g), { onChange: ce, ...v } = X;
162
+ const D = Z(p, e.code), N = j(i[u], D, E), f = F ? $(N, T) : N, C = z(o.componentProps, i, h, N), { onChange: ue, ...ee } = C;
162
163
  return {
163
164
  multiple: O,
164
165
  showAll: B,
165
- showAllField: I,
166
- showNav: !1,
166
+ showAllField: W,
167
+ showNav: I,
167
168
  showOriginMode: !1,
168
- showPinyinMode: !F,
169
- ...v,
170
- options: Q,
171
- onChange(f) {
172
- var R;
173
- (R = o.onChange) == null || R.call(
169
+ showPinyinMode: G ? !1 : !F,
170
+ ...P ? { treeConfig: P } : {},
171
+ ...ee,
172
+ options: f,
173
+ onChange(te) {
174
+ var Y;
175
+ (Y = o.onChange) == null || Y.call(
174
176
  o,
175
- f,
176
- $(e.code, x, i, h, g, O)
177
+ te,
178
+ V(e.code, x, i, h, N, O)
177
179
  );
178
180
  }
179
181
  };
@@ -207,5 +209,5 @@ function ge(t, n = {}) {
207
209
  };
208
210
  }
209
211
  export {
210
- ge as usePanelSelectSchemas
212
+ Ee as usePanelSelectSchemas
211
213
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.245",
3
+ "version": "1.5.246",
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/hooks": "1.4.46",
71
- "@dazhicheng/utils": "1.3.43"
70
+ "@dazhicheng/utils": "1.3.43",
71
+ "@dazhicheng/hooks": "1.4.46"
72
72
  },
73
73
  "files": [
74
74
  "dist"