@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.
package/dist/api/basicData.d.ts
CHANGED
|
@@ -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[]>>;
|
package/dist/api/basicData.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { request as e } from "../utils/xhr.js";
|
|
2
|
-
async function
|
|
2
|
+
async function n(t) {
|
|
3
3
|
return e.get({
|
|
4
4
|
url: "/basic/basicAirline/getAll"
|
|
5
5
|
});
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
7
|
+
async function r(t, i) {
|
|
8
8
|
return e.get({
|
|
9
9
|
url: "/basic/airportRegionLevel/listChainByType",
|
|
10
|
-
params:
|
|
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
|
-
|
|
15
|
-
o as
|
|
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
|
|
2
|
-
const
|
|
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
|
-
},
|
|
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
|
|
20
|
-
if (!Array.isArray(
|
|
21
|
-
if (
|
|
22
|
-
const r =
|
|
23
|
-
if (!r) return
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
label:
|
|
32
|
-
value:
|
|
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
|
-
|
|
37
|
-
}),
|
|
40
|
+
n.get(s).children.push(e);
|
|
41
|
+
}), d.map((e) => n.get(e));
|
|
38
42
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
43
|
+
function h(t, a) {
|
|
44
|
+
return a || (t === u.AIRPORT ? i.COUNTRY : i.PINYIN);
|
|
41
45
|
}
|
|
42
|
-
const
|
|
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
|
|
50
|
-
return (Array.isArray(
|
|
51
|
-
...
|
|
52
|
-
label: `${
|
|
53
|
-
value:
|
|
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
|
|
57
|
-
if (!
|
|
58
|
-
return
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
62
|
-
let
|
|
63
|
-
for (const
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
66
|
-
const
|
|
67
|
-
|
|
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
|
|
70
|
-
for (const
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
73
|
-
const { codeKey:
|
|
74
|
-
|
|
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
|
|
80
|
+
return e;
|
|
77
81
|
}
|
|
78
|
-
function
|
|
79
|
-
return (Array.isArray(
|
|
82
|
+
function T(t) {
|
|
83
|
+
return (Array.isArray(t) ? t : []).map((r) => A(r || {}));
|
|
80
84
|
}
|
|
81
|
-
function
|
|
82
|
-
return (Array.isArray(
|
|
83
|
-
...
|
|
84
|
-
label: `${
|
|
85
|
-
value:
|
|
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
|
|
92
|
+
function f(t, a, r) {
|
|
89
93
|
return async () => {
|
|
90
94
|
try {
|
|
91
|
-
const
|
|
92
|
-
return
|
|
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
|
-
|
|
99
|
-
[
|
|
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
|
|
108
|
-
return
|
|
154
|
+
const t = await p();
|
|
155
|
+
return S(t || []);
|
|
109
156
|
} catch {
|
|
110
157
|
return [];
|
|
111
158
|
}
|
|
112
159
|
}
|
|
113
160
|
},
|
|
114
|
-
[
|
|
161
|
+
[u.CONTINENT]: {
|
|
115
162
|
defaultFieldName: "continentCodes",
|
|
116
163
|
defaultLabel: "洲",
|
|
117
164
|
defaultExcludeLabel: "排除洲",
|
|
118
165
|
defaultMultiple: !0,
|
|
119
166
|
defaultShowAll: !1,
|
|
120
|
-
fetchOptions:
|
|
167
|
+
fetchOptions: f(1, "continentCode", "continentName")
|
|
121
168
|
},
|
|
122
|
-
[
|
|
169
|
+
[u.REGION]: {
|
|
123
170
|
defaultFieldName: "regionCodes",
|
|
124
171
|
defaultLabel: "区域",
|
|
125
172
|
defaultExcludeLabel: "排除区域",
|
|
126
173
|
defaultMultiple: !0,
|
|
127
174
|
defaultShowAll: !1,
|
|
128
|
-
fetchOptions:
|
|
175
|
+
fetchOptions: f(2, "regionCode", "regionName")
|
|
129
176
|
},
|
|
130
|
-
[
|
|
177
|
+
[u.COUNTRY]: {
|
|
131
178
|
defaultFieldName: "countryCodes",
|
|
132
179
|
defaultLabel: "国家",
|
|
133
180
|
defaultExcludeLabel: "排除国家",
|
|
134
181
|
defaultMultiple: !0,
|
|
135
182
|
defaultShowAll: !1,
|
|
136
|
-
fetchOptions:
|
|
183
|
+
fetchOptions: f(3, "countryCode", "countryName")
|
|
137
184
|
},
|
|
138
|
-
[
|
|
185
|
+
[u.CITY]: {
|
|
139
186
|
defaultFieldName: "cityCodes",
|
|
140
187
|
defaultLabel: "城市",
|
|
141
188
|
defaultExcludeLabel: "排除城市",
|
|
142
189
|
defaultMultiple: !0,
|
|
143
190
|
defaultShowAll: !1,
|
|
144
|
-
fetchOptions:
|
|
191
|
+
fetchOptions: f(4, "cityCode", "cityName")
|
|
145
192
|
},
|
|
146
|
-
[
|
|
193
|
+
[u.AIRPORT]: {
|
|
147
194
|
defaultFieldName: "airportCodes",
|
|
148
195
|
defaultLabel: "机场",
|
|
149
196
|
defaultExcludeLabel: "排除机场",
|
|
150
197
|
defaultMultiple: !0,
|
|
151
198
|
defaultShowAll: !1,
|
|
152
|
-
fetchOptions:
|
|
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
|
-
|
|
157
|
-
|
|
232
|
+
u as CODES,
|
|
233
|
+
m as CODE_REGISTRY,
|
|
158
234
|
i as GROUP_BY,
|
|
159
|
-
|
|
160
|
-
|
|
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(),
|
|
5
|
-
function
|
|
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((
|
|
9
|
+
return c.reduce((u, y) => (u[y] = [], u), {});
|
|
10
10
|
}
|
|
11
11
|
function _(c) {
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
(e, t) => (e[t] =
|
|
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
|
-
|
|
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 (
|
|
24
|
+
r.map(async (a) => {
|
|
23
25
|
try {
|
|
24
|
-
const
|
|
25
|
-
return [
|
|
26
|
+
const f = await b[a].fetchOptions({ permissionOnlyCode: e });
|
|
27
|
+
return [a, p(f)];
|
|
26
28
|
} catch {
|
|
27
|
-
return [
|
|
29
|
+
return [a, []];
|
|
28
30
|
}
|
|
29
31
|
})
|
|
30
|
-
)).reduce((
|
|
31
|
-
const
|
|
32
|
-
return
|
|
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 =
|
|
38
|
+
const e = u.path;
|
|
37
39
|
let t = [];
|
|
38
40
|
try {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
n.set(e,
|
|
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
|
|
46
|
-
if (t = r ? [...c.codes] : c.codes.filter((
|
|
47
|
-
|
|
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
|
|
51
|
-
if (
|
|
52
|
+
const o = r ? void 0 : C.get(e);
|
|
53
|
+
if (o)
|
|
52
54
|
try {
|
|
53
|
-
const
|
|
54
|
-
if (n.set(e,
|
|
55
|
-
|
|
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
|
|
61
|
-
|
|
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
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
n.set(e,
|
|
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
|
-
|
|
70
|
+
g.get(e) === l && C.delete(e);
|
|
69
71
|
}
|
|
70
72
|
} catch {
|
|
71
|
-
const
|
|
72
|
-
n.set(e,
|
|
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 =
|
|
77
|
-
|
|
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 =
|
|
83
|
-
n.set(e,
|
|
84
|
+
const e = u.path, s = { ...n.get(e) || {}, ...r };
|
|
85
|
+
n.set(e, s), i(s);
|
|
84
86
|
}), q(
|
|
85
|
-
() =>
|
|
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] =
|
|
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" ? [] :
|
|
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
|
|
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
|
|
16
|
-
import { useBasicDataOptions as
|
|
17
|
-
const
|
|
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
|
|
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
|
|
25
|
-
return d(t).some((r) =>
|
|
24
|
+
function le(t, n = b) {
|
|
25
|
+
return d(t).some((r) => ce(r, n));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
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
|
|
31
|
-
return t ?
|
|
30
|
+
function z(t, n, r, c) {
|
|
31
|
+
return t ? H(t) ? t(n, r, c) : t : {};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function K(t, n, r, c) {
|
|
34
34
|
const p = new Set(r.map((e) => e.value)), l = t[n];
|
|
35
|
-
if (
|
|
36
|
-
const e = d(l).filter((u) => p.has(u)),
|
|
37
|
-
(e.length !==
|
|
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
|
|
43
|
-
const e = l ? p.filter((
|
|
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:
|
|
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
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
if (
|
|
57
|
-
const p = new Set(
|
|
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
|
|
60
|
+
function q(t, n) {
|
|
61
61
|
const r = new Set(d(t));
|
|
62
|
-
return r.size ? n.filter((
|
|
62
|
+
return r.size ? n.filter((c) => !r.has(c.value)) : n;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
var
|
|
66
|
-
const r = (
|
|
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
|
|
70
|
-
const r = [...new Set(t.map((e) => e.code))],
|
|
71
|
-
(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 } =
|
|
73
|
+
), { dataSource: p } = se({
|
|
74
74
|
codes: r,
|
|
75
75
|
dataSource: n.dataSource
|
|
76
76
|
}), l = {};
|
|
77
77
|
return t.forEach((e) => {
|
|
78
|
-
var
|
|
79
|
-
const
|
|
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
|
-
...((
|
|
82
|
-
],
|
|
83
|
-
...
|
|
84
|
-
triggerFields:
|
|
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:
|
|
88
|
+
label: _,
|
|
89
89
|
rules: e.rules,
|
|
90
|
-
dependencies:
|
|
90
|
+
dependencies: v,
|
|
91
91
|
componentProps: (o, x) => {
|
|
92
|
-
const A =
|
|
93
|
-
let a = m ?
|
|
94
|
-
|
|
95
|
-
const O = F ?
|
|
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:
|
|
99
|
-
showAllField:
|
|
100
|
-
showNav:
|
|
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 =
|
|
109
|
-
|
|
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 =
|
|
113
|
-
d(w).length ?
|
|
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
|
-
|
|
119
|
+
V(e.code, u, o, x, a, k)
|
|
119
120
|
);
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
123
|
}
|
|
123
124
|
};
|
|
124
|
-
if (l[
|
|
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:
|
|
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${
|
|
151
|
-
...
|
|
152
|
-
triggerFields:
|
|
153
|
-
if:
|
|
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 =
|
|
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:
|
|
166
|
-
showNav:
|
|
166
|
+
showAllField: W,
|
|
167
|
+
showNav: I,
|
|
167
168
|
showOriginMode: !1,
|
|
168
|
-
showPinyinMode: !F,
|
|
169
|
-
...
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
176
|
-
|
|
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
|
-
|
|
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.
|
|
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/
|
|
71
|
-
"@dazhicheng/
|
|
70
|
+
"@dazhicheng/utils": "1.3.43",
|
|
71
|
+
"@dazhicheng/hooks": "1.4.46"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"dist"
|