@dazhicheng/ui 1.5.251 → 1.5.253
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.
|
@@ -33,7 +33,7 @@ function ce(e) {
|
|
|
33
33
|
return u && a.unshift({
|
|
34
34
|
type: "seq",
|
|
35
35
|
title: "序号",
|
|
36
|
-
width:
|
|
36
|
+
width: 48,
|
|
37
37
|
resizable: !1,
|
|
38
38
|
align: "center",
|
|
39
39
|
fixed: "left",
|
|
@@ -123,7 +123,7 @@ function fe({
|
|
|
123
123
|
let p = W;
|
|
124
124
|
h.length > 0 && (p = h.includes(s.field)), b.length > 0 && (p = !b.includes(s.field));
|
|
125
125
|
let d = {
|
|
126
|
-
minWidth:
|
|
126
|
+
minWidth: 80,
|
|
127
127
|
sortable: p,
|
|
128
128
|
resizable: C,
|
|
129
129
|
...s
|
|
@@ -91,6 +91,28 @@ export type BasicDataCodeRegistryItem = {
|
|
|
91
91
|
/** 拉取并归一化为 label/value 选项 */
|
|
92
92
|
fetchOptions: (ctx?: BasicDataFetchContext) => Promise<BasicDataOption[]>;
|
|
93
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* 地理层级(数字越大越细)。
|
|
96
|
+
* 更细层级的扁平字段已含上级 code/name,可去重派生上级,避免同页重复请求。
|
|
97
|
+
* 机场 → 城市/国家/区域/洲;城市 → 国家/区域/洲;国家 → 区域/洲;区域 → 洲
|
|
98
|
+
*/
|
|
99
|
+
export declare const GEO_LEVEL_CODES: readonly ["continent", "region", "country", "city", "airport"];
|
|
100
|
+
export type GeoLevelCode = (typeof GEO_LEVEL_CODES)[number];
|
|
101
|
+
/** @deprecated 使用 GEO_LEVEL_CODES;保留兼容「从机场可派生」语义 */
|
|
102
|
+
export declare const GEO_CODES_DERIVABLE_FROM_AIRPORT: readonly ["continent", "region", "country", "city"];
|
|
103
|
+
export declare function isGeoLevelCode(code: BasicDataCode): code is GeoLevelCode;
|
|
104
|
+
export declare function isGeoCodeDerivableFromAirport(code: BasicDataCode): boolean;
|
|
105
|
+
/** source 是否可派生 target(source 更细) */
|
|
106
|
+
export declare function canDeriveGeoLevel(source: BasicDataCode, target: BasicDataCode): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* 从任一地理层级 options 去重生成更粗层级 options。
|
|
109
|
+
* 扁平字段已含 continentCode / regionCode / countryCode / cityCode 等。
|
|
110
|
+
*/
|
|
111
|
+
export declare function deriveRegionLevelOptionsFromGeoSource(sourceOptions: BasicDataOption[], targetCode: BasicDataCode): BasicDataOption[];
|
|
112
|
+
/** @deprecated 使用 deriveRegionLevelOptionsFromGeoSource */
|
|
113
|
+
export declare function deriveRegionLevelOptionsFromAirports(airports: BasicDataOption[], code: BasicDataCode): BasicDataOption[];
|
|
114
|
+
/** 在候选 code 中取最细的地理层级(机场 > 城市 > 国家 > 区域 > 洲) */
|
|
115
|
+
export declare function resolveHighestGeoLevelCode(codes: Iterable<BasicDataCode>): GeoLevelCode | undefined;
|
|
94
116
|
/**
|
|
95
117
|
* code → 接口与默认展示配置。
|
|
96
118
|
* 后续扩展航线/舱位等,只需在此追加。
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getAllBasicAirline as
|
|
2
|
-
import { queryAllRoles as
|
|
3
|
-
import { secondaryDropdownListLossReason as
|
|
4
|
-
import { listAllValidSupplierManage as
|
|
5
|
-
const
|
|
1
|
+
import { getAllBasicAirline as R, getDictItemsByCodes as O, listChainByTypeAirportRegionLevel as A } from "../api/basicData.js";
|
|
2
|
+
import { queryAllRoles as L, pageUser as I } from "../api/dataTypeContext.js";
|
|
3
|
+
import { secondaryDropdownListLossReason as _, primaryDropdownListLossReason as S } from "../api/lossReason.js";
|
|
4
|
+
import { listAllValidSupplierManage as T, getAllConfigListSupplierConfigManage as b } from "../api/supplier.js";
|
|
5
|
+
const o = {
|
|
6
6
|
AIRLINE: "airline",
|
|
7
7
|
CONTINENT: "continent",
|
|
8
8
|
REGION: "region",
|
|
@@ -36,7 +36,7 @@ const u = {
|
|
|
36
36
|
/** 按供应商名称(配置号) */
|
|
37
37
|
SUPPLIER_MANAGE_NAME: "supplierManageName",
|
|
38
38
|
PINYIN: "pinyin"
|
|
39
|
-
},
|
|
39
|
+
}, g = {
|
|
40
40
|
[d.CONTINENT]: { codeKey: "continentCode", nameKey: "continentName" },
|
|
41
41
|
[d.REGION]: { codeKey: "regionCode", nameKey: "regionName" },
|
|
42
42
|
[d.COUNTRY]: { codeKey: "countryCode", nameKey: "countryName" },
|
|
@@ -47,186 +47,226 @@ const u = {
|
|
|
47
47
|
nameKey: "supplierManageName",
|
|
48
48
|
labelMode: "name"
|
|
49
49
|
}
|
|
50
|
-
},
|
|
50
|
+
}, P = {
|
|
51
51
|
TICKETING: "出票",
|
|
52
52
|
REFUND: "退票",
|
|
53
53
|
REBOOK: "改签"
|
|
54
54
|
};
|
|
55
|
-
function
|
|
55
|
+
function H(a, e) {
|
|
56
56
|
if (!Array.isArray(a) || !a.length) return a || [];
|
|
57
57
|
if (e === d.PINYIN) return a;
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
return a.forEach((
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
58
|
+
const r = g[e];
|
|
59
|
+
if (!r) return a;
|
|
60
|
+
const l = /* @__PURE__ */ new Map(), s = [], n = r.labelMode || "codeName";
|
|
61
|
+
return a.forEach((u) => {
|
|
62
|
+
const t = u[r.codeKey], c = t != null && t !== "", i = c ? String(t) : "__unknown__";
|
|
63
|
+
if (!l.has(i)) {
|
|
64
64
|
s.push(i);
|
|
65
|
-
const
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
label:
|
|
69
|
-
value:
|
|
65
|
+
const f = u[r.nameKey];
|
|
66
|
+
let E = "未知";
|
|
67
|
+
c && (n === "name" ? E = f != null && String(f) !== "" ? String(f) : String(t) : E = `${t}(${f || ""})`), l.set(i, {
|
|
68
|
+
label: E,
|
|
69
|
+
value: c ? t : "__unknown__",
|
|
70
70
|
children: []
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
}), s.map((
|
|
73
|
+
l.get(i).children.push(u);
|
|
74
|
+
}), s.map((u) => l.get(u));
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
return e || (a ===
|
|
76
|
+
function W(a, e) {
|
|
77
|
+
return e || (a === o.AIRPORT ? d.COUNTRY : a === o.LOSS_REASON ? d.BUSINESS_TYPE : a === o.LOSS_REASON_SECONDARY ? d.PRIMARY_REASON : a === o.SUPPLIER_CONFIG ? d.SUPPLIER_MANAGE_NAME : d.PINYIN);
|
|
78
78
|
}
|
|
79
|
-
const
|
|
79
|
+
const h = {
|
|
80
80
|
1: { codeKey: "continentCode", nameKey: "continentName", statusKey: "continentStatus" },
|
|
81
81
|
2: { codeKey: "regionCode", nameKey: "regionName", statusKey: "regionStatus" },
|
|
82
82
|
3: { codeKey: "countryCode", nameKey: "countryName", statusKey: "countryStatus" },
|
|
83
83
|
4: { codeKey: "cityCode", nameKey: "cityName", statusKey: "cityStatus" },
|
|
84
84
|
5: { codeKey: "airportCode", nameKey: "airportName", statusKey: "airportStatus" }
|
|
85
85
|
};
|
|
86
|
-
function
|
|
86
|
+
function v(a = []) {
|
|
87
87
|
return (Array.isArray(a) ? a : []).filter((e) => e == null ? void 0 : e.airlineCode).map((e) => ({
|
|
88
88
|
...e,
|
|
89
89
|
label: `${e.airlineCode}(${e.airlineNameCn || ""})`,
|
|
90
90
|
value: e.airlineCode
|
|
91
91
|
}));
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function K(a) {
|
|
94
94
|
if (!a || typeof a != "object" || Array.isArray(a))
|
|
95
95
|
return a || {};
|
|
96
|
-
const e = a.continentCode || a.regionCode || a.countryCode || a.cityCode || a.airportCode,
|
|
97
|
-
if (e && !
|
|
96
|
+
const e = a.continentCode || a.regionCode || a.countryCode || a.cityCode || a.airportCode, r = [1, 2, 3, 4, 5].some((u) => a[String(u)] || a[u]);
|
|
97
|
+
if (e && !r)
|
|
98
98
|
return a;
|
|
99
|
-
let
|
|
100
|
-
for (const
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
const
|
|
104
|
-
|
|
99
|
+
let l = {}, s = 0;
|
|
100
|
+
for (const u of [1, 2, 3, 4, 5]) {
|
|
101
|
+
const t = a[String(u)] || a[u];
|
|
102
|
+
if (!t || typeof t != "object") continue;
|
|
103
|
+
const c = Number(t.type ?? u);
|
|
104
|
+
c >= s && (s = c, l = t);
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
for (const
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
const { codeKey:
|
|
111
|
-
|
|
106
|
+
const n = { ...l };
|
|
107
|
+
for (const u of [1, 2, 3, 4, 5]) {
|
|
108
|
+
const t = a[String(u)] || a[u];
|
|
109
|
+
if (!t || typeof t != "object") continue;
|
|
110
|
+
const { codeKey: c, nameKey: i, statusKey: f } = h[u];
|
|
111
|
+
t.code !== void 0 && t.code !== null && t.code !== "" && (n[c] = t.code), t.name !== void 0 && (n[i] = t.name), t.status !== void 0 && (n[f] = t.status);
|
|
112
112
|
}
|
|
113
|
-
return
|
|
113
|
+
return n;
|
|
114
114
|
}
|
|
115
115
|
function M(a) {
|
|
116
|
-
return (Array.isArray(a) ? a : []).map((
|
|
116
|
+
return (Array.isArray(a) ? a : []).map((r) => K(r || {}));
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
return (Array.isArray(a) ? a : []).filter((
|
|
120
|
-
...
|
|
121
|
-
label: `${
|
|
122
|
-
value:
|
|
118
|
+
function w(a = [], e, r) {
|
|
119
|
+
return (Array.isArray(a) ? a : []).filter((l) => l == null ? void 0 : l[e]).map((l) => ({
|
|
120
|
+
...l,
|
|
121
|
+
label: `${l[e]}(${l[r] || ""})`,
|
|
122
|
+
value: l[e]
|
|
123
123
|
}));
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
const Y = [o.CONTINENT, o.REGION, o.COUNTRY, o.CITY, o.AIRPORT], y = {
|
|
126
|
+
[o.CONTINENT]: 1,
|
|
127
|
+
[o.REGION]: 2,
|
|
128
|
+
[o.COUNTRY]: 3,
|
|
129
|
+
[o.CITY]: 4,
|
|
130
|
+
[o.AIRPORT]: 5
|
|
131
|
+
}, U = {
|
|
132
|
+
[o.CONTINENT]: { codeKey: "continentCode", nameKey: "continentName" },
|
|
133
|
+
[o.REGION]: { codeKey: "regionCode", nameKey: "regionName" },
|
|
134
|
+
[o.COUNTRY]: { codeKey: "countryCode", nameKey: "countryName" },
|
|
135
|
+
[o.CITY]: { codeKey: "cityCode", nameKey: "cityName" },
|
|
136
|
+
[o.AIRPORT]: { codeKey: "airportCode", nameKey: "airportName" }
|
|
137
|
+
};
|
|
138
|
+
o.CONTINENT, o.REGION, o.COUNTRY, o.CITY;
|
|
139
|
+
function N(a) {
|
|
140
|
+
return Y.includes(a);
|
|
141
|
+
}
|
|
142
|
+
function J(a, e) {
|
|
143
|
+
return !N(a) || !N(e) ? !1 : y[a] > y[e];
|
|
144
|
+
}
|
|
145
|
+
function Q(a, e) {
|
|
146
|
+
if (!N(e)) return [];
|
|
147
|
+
const { codeKey: r, nameKey: l } = U[e], s = /* @__PURE__ */ new Map();
|
|
148
|
+
return (Array.isArray(a) ? a : []).forEach((n) => {
|
|
149
|
+
const u = n == null ? void 0 : n[r];
|
|
150
|
+
if (u == null || u === "") return;
|
|
151
|
+
const t = String(u);
|
|
152
|
+
s.has(t) || s.set(t, {
|
|
153
|
+
...n,
|
|
154
|
+
label: `${u}(${n[l] || ""})`,
|
|
155
|
+
value: u
|
|
156
|
+
});
|
|
157
|
+
}), Array.from(s.values());
|
|
158
|
+
}
|
|
159
|
+
function X(a) {
|
|
160
|
+
let e;
|
|
161
|
+
for (const r of a)
|
|
162
|
+
N(r) && (!e || y[r] > y[e]) && (e = r);
|
|
163
|
+
return e;
|
|
164
|
+
}
|
|
165
|
+
function p(a, e, r) {
|
|
126
166
|
return async () => {
|
|
127
167
|
try {
|
|
128
|
-
const
|
|
129
|
-
return
|
|
168
|
+
const l = await A({ type: a });
|
|
169
|
+
return w(M(l), e, r);
|
|
130
170
|
} catch {
|
|
131
171
|
return [];
|
|
132
172
|
}
|
|
133
173
|
};
|
|
134
174
|
}
|
|
135
|
-
function
|
|
175
|
+
function D(a = []) {
|
|
136
176
|
return (Array.isArray(a) ? 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) => ({
|
|
137
177
|
...e,
|
|
138
178
|
label: e.itemName || "",
|
|
139
179
|
value: e.itemCode
|
|
140
180
|
}));
|
|
141
181
|
}
|
|
142
|
-
function
|
|
143
|
-
const e = Array.isArray(a) ? a : [],
|
|
144
|
-
e.map((
|
|
145
|
-
),
|
|
146
|
-
e.filter((
|
|
147
|
-
), s = e.filter((
|
|
148
|
-
const
|
|
182
|
+
function F(a = []) {
|
|
183
|
+
const e = Array.isArray(a) ? a : [], r = new Set(
|
|
184
|
+
e.map((n) => n.parentItemCode).filter((n) => n != null && String(n) !== "").map(String)
|
|
185
|
+
), l = new Set(
|
|
186
|
+
e.filter((n) => (n == null ? void 0 : n.itemCode) !== void 0 && (n == null ? void 0 : n.itemCode) !== null && (n == null ? void 0 : n.itemCode) !== "").map((n) => String(n.itemCode))
|
|
187
|
+
), s = e.filter((n) => (n == null ? void 0 : n.itemCode) !== void 0 && (n == null ? void 0 : n.itemCode) !== null && (n == null ? void 0 : n.itemCode) !== "").map((n) => {
|
|
188
|
+
const u = String(n.itemCode), t = n.itemName || "";
|
|
149
189
|
return {
|
|
150
|
-
...
|
|
151
|
-
label:
|
|
152
|
-
value:
|
|
190
|
+
...n,
|
|
191
|
+
label: r.has(u) ? `${u}(${t})` : t,
|
|
192
|
+
value: u
|
|
153
193
|
};
|
|
154
194
|
});
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
itemCode:
|
|
158
|
-
itemName:
|
|
159
|
-
label:
|
|
160
|
-
value:
|
|
195
|
+
return r.forEach((n) => {
|
|
196
|
+
l.has(n) || s.push({
|
|
197
|
+
itemCode: n,
|
|
198
|
+
itemName: n,
|
|
199
|
+
label: n,
|
|
200
|
+
value: n,
|
|
161
201
|
parentItemCode: null
|
|
162
202
|
});
|
|
163
203
|
}), s;
|
|
164
204
|
}
|
|
165
|
-
function
|
|
166
|
-
return async (
|
|
205
|
+
function C(a, e = D) {
|
|
206
|
+
return async (r) => {
|
|
167
207
|
try {
|
|
168
|
-
const
|
|
208
|
+
const l = await O({
|
|
169
209
|
dictCodeList: [a],
|
|
170
|
-
permissionOnlyCode:
|
|
171
|
-
}), s = (
|
|
210
|
+
permissionOnlyCode: r == null ? void 0 : r.permissionOnlyCode
|
|
211
|
+
}), s = (l == null ? void 0 : l[a]) || [];
|
|
172
212
|
return e(s);
|
|
173
213
|
} catch {
|
|
174
214
|
return [];
|
|
175
215
|
}
|
|
176
216
|
};
|
|
177
217
|
}
|
|
178
|
-
function
|
|
218
|
+
function G(a = []) {
|
|
179
219
|
return (Array.isArray(a) ? a : []).filter((e) => (e == null ? void 0 : e.id) !== void 0 && (e == null ? void 0 : e.id) !== null).map((e) => ({
|
|
180
220
|
...e,
|
|
181
221
|
label: e.fullName || e.username || String(e.id),
|
|
182
222
|
value: e.id
|
|
183
223
|
}));
|
|
184
224
|
}
|
|
185
|
-
function
|
|
225
|
+
function m(a = []) {
|
|
186
226
|
return (Array.isArray(a) ? a : []).filter((e) => (e == null ? void 0 : e.id) !== void 0 && (e == null ? void 0 : e.id) !== null).map((e) => ({
|
|
187
227
|
...e,
|
|
188
228
|
label: e.roleName || e.roleCode || String(e.id),
|
|
189
229
|
value: e.id
|
|
190
230
|
}));
|
|
191
231
|
}
|
|
192
|
-
function
|
|
232
|
+
function x(a = []) {
|
|
193
233
|
return (Array.isArray(a) ? a : []).filter((e) => (e == null ? void 0 : e.id) !== void 0 && (e == null ? void 0 : e.id) !== null).map((e) => {
|
|
194
|
-
const
|
|
234
|
+
const r = e.businessType || "";
|
|
195
235
|
return {
|
|
196
236
|
...e,
|
|
197
|
-
businessTypeName:
|
|
237
|
+
businessTypeName: P[r] || r,
|
|
198
238
|
label: e.reasonName || "",
|
|
199
239
|
value: e.id
|
|
200
240
|
};
|
|
201
241
|
});
|
|
202
242
|
}
|
|
203
|
-
function
|
|
204
|
-
return (Array.isArray(a) ? a : []).filter((
|
|
205
|
-
const
|
|
243
|
+
function B(a = [], e = /* @__PURE__ */ new Map()) {
|
|
244
|
+
return (Array.isArray(a) ? a : []).filter((r) => (r == null ? void 0 : r.id) !== void 0 && (r == null ? void 0 : r.id) !== null).map((r) => {
|
|
245
|
+
const l = r.primaryReasonId, s = (l != null ? e.get(l) : void 0) || (l != null ? String(l) : "");
|
|
206
246
|
return {
|
|
207
|
-
...
|
|
247
|
+
...r,
|
|
208
248
|
primaryReasonName: s,
|
|
209
|
-
label:
|
|
210
|
-
value:
|
|
249
|
+
label: r.reasonName || "",
|
|
250
|
+
value: r.id
|
|
211
251
|
};
|
|
212
252
|
});
|
|
213
253
|
}
|
|
214
|
-
function
|
|
254
|
+
function $(a = []) {
|
|
215
255
|
return (Array.isArray(a) ? a : []).filter((e) => e == null ? void 0 : e.supplierConfigPcc).map((e) => ({
|
|
216
256
|
...e,
|
|
217
257
|
label: e.supplierConfigPcc,
|
|
218
258
|
value: e.supplierConfigPcc
|
|
219
259
|
}));
|
|
220
260
|
}
|
|
221
|
-
function
|
|
261
|
+
function V(a = []) {
|
|
222
262
|
return (Array.isArray(a) ? a : []).filter((e) => e == null ? void 0 : e.supplierCode).map((e) => ({
|
|
223
263
|
...e,
|
|
224
264
|
label: e.supplierName || e.supplierCode,
|
|
225
265
|
value: e.supplierCode
|
|
226
266
|
}));
|
|
227
267
|
}
|
|
228
|
-
const
|
|
229
|
-
[
|
|
268
|
+
const Z = {
|
|
269
|
+
[o.AIRLINE]: {
|
|
230
270
|
defaultFieldName: "airlineCodes",
|
|
231
271
|
defaultLabel: "航司",
|
|
232
272
|
defaultExcludeLabel: "排除航司",
|
|
@@ -234,14 +274,14 @@ const q = {
|
|
|
234
274
|
defaultShowAll: !0,
|
|
235
275
|
async fetchOptions() {
|
|
236
276
|
try {
|
|
237
|
-
const a = await
|
|
238
|
-
return
|
|
277
|
+
const a = await R();
|
|
278
|
+
return v(a || []);
|
|
239
279
|
} catch {
|
|
240
280
|
return [];
|
|
241
281
|
}
|
|
242
282
|
}
|
|
243
283
|
},
|
|
244
|
-
[
|
|
284
|
+
[o.CONTINENT]: {
|
|
245
285
|
defaultFieldName: "continentCodes",
|
|
246
286
|
defaultLabel: "洲",
|
|
247
287
|
defaultExcludeLabel: "排除洲",
|
|
@@ -249,7 +289,7 @@ const q = {
|
|
|
249
289
|
defaultShowAll: !1,
|
|
250
290
|
fetchOptions: p(1, "continentCode", "continentName")
|
|
251
291
|
},
|
|
252
|
-
[
|
|
292
|
+
[o.REGION]: {
|
|
253
293
|
defaultFieldName: "regionCodes",
|
|
254
294
|
defaultLabel: "区域",
|
|
255
295
|
defaultExcludeLabel: "排除区域",
|
|
@@ -257,7 +297,7 @@ const q = {
|
|
|
257
297
|
defaultShowAll: !1,
|
|
258
298
|
fetchOptions: p(2, "regionCode", "regionName")
|
|
259
299
|
},
|
|
260
|
-
[
|
|
300
|
+
[o.COUNTRY]: {
|
|
261
301
|
defaultFieldName: "countryCodes",
|
|
262
302
|
defaultLabel: "国家",
|
|
263
303
|
defaultExcludeLabel: "排除国家",
|
|
@@ -265,7 +305,7 @@ const q = {
|
|
|
265
305
|
defaultShowAll: !1,
|
|
266
306
|
fetchOptions: p(3, "countryCode", "countryName")
|
|
267
307
|
},
|
|
268
|
-
[
|
|
308
|
+
[o.CITY]: {
|
|
269
309
|
defaultFieldName: "cityCodes",
|
|
270
310
|
defaultLabel: "城市",
|
|
271
311
|
defaultExcludeLabel: "排除城市",
|
|
@@ -273,7 +313,7 @@ const q = {
|
|
|
273
313
|
defaultShowAll: !1,
|
|
274
314
|
fetchOptions: p(4, "cityCode", "cityName")
|
|
275
315
|
},
|
|
276
|
-
[
|
|
316
|
+
[o.AIRPORT]: {
|
|
277
317
|
defaultFieldName: "airportCodes",
|
|
278
318
|
defaultLabel: "机场",
|
|
279
319
|
defaultExcludeLabel: "排除机场",
|
|
@@ -281,7 +321,7 @@ const q = {
|
|
|
281
321
|
defaultShowAll: !1,
|
|
282
322
|
fetchOptions: p(5, "airportCode", "airportName")
|
|
283
323
|
},
|
|
284
|
-
[
|
|
324
|
+
[o.SALES_ORDER_TYPE]: {
|
|
285
325
|
defaultFieldName: "orderType",
|
|
286
326
|
defaultLabel: "订单类型",
|
|
287
327
|
defaultExcludeLabel: "排除订单类型",
|
|
@@ -294,9 +334,9 @@ const q = {
|
|
|
294
334
|
valueField: "value",
|
|
295
335
|
parentField: "parentItemCode"
|
|
296
336
|
},
|
|
297
|
-
fetchOptions:
|
|
337
|
+
fetchOptions: C(o.SALES_ORDER_TYPE, F)
|
|
298
338
|
},
|
|
299
|
-
[
|
|
339
|
+
[o.SALES_ORDER_PRODUCT_TYPE]: {
|
|
300
340
|
defaultFieldName: "productType",
|
|
301
341
|
defaultLabel: "产品类型",
|
|
302
342
|
defaultExcludeLabel: "排除产品类型",
|
|
@@ -308,9 +348,9 @@ const q = {
|
|
|
308
348
|
valueField: "itemCode",
|
|
309
349
|
parentField: "parentItemCode"
|
|
310
350
|
},
|
|
311
|
-
fetchOptions:
|
|
351
|
+
fetchOptions: C(o.SALES_ORDER_PRODUCT_TYPE)
|
|
312
352
|
},
|
|
313
|
-
[
|
|
353
|
+
[o.USER]: {
|
|
314
354
|
defaultFieldName: "userIds",
|
|
315
355
|
defaultLabel: "用户",
|
|
316
356
|
defaultExcludeLabel: "排除用户",
|
|
@@ -318,14 +358,14 @@ const q = {
|
|
|
318
358
|
defaultShowAll: !1,
|
|
319
359
|
async fetchOptions() {
|
|
320
360
|
try {
|
|
321
|
-
const a = await
|
|
322
|
-
return
|
|
361
|
+
const a = await I({ pageNo: 1, pageSize: 9999 });
|
|
362
|
+
return G((a == null ? void 0 : a.records) || []);
|
|
323
363
|
} catch {
|
|
324
364
|
return [];
|
|
325
365
|
}
|
|
326
366
|
}
|
|
327
367
|
},
|
|
328
|
-
[
|
|
368
|
+
[o.ROLE]: {
|
|
329
369
|
defaultFieldName: "roleIds",
|
|
330
370
|
defaultLabel: "角色",
|
|
331
371
|
defaultExcludeLabel: "排除角色",
|
|
@@ -333,14 +373,14 @@ const q = {
|
|
|
333
373
|
defaultShowAll: !1,
|
|
334
374
|
async fetchOptions() {
|
|
335
375
|
try {
|
|
336
|
-
const a = await
|
|
337
|
-
return
|
|
376
|
+
const a = await L();
|
|
377
|
+
return m(a || []);
|
|
338
378
|
} catch {
|
|
339
379
|
return [];
|
|
340
380
|
}
|
|
341
381
|
}
|
|
342
382
|
},
|
|
343
|
-
[
|
|
383
|
+
[o.LOSS_REASON]: {
|
|
344
384
|
defaultFieldName: "lossReasonIds",
|
|
345
385
|
defaultLabel: "亏损原因",
|
|
346
386
|
defaultExcludeLabel: "排除亏损原因",
|
|
@@ -349,13 +389,13 @@ const q = {
|
|
|
349
389
|
async fetchOptions() {
|
|
350
390
|
try {
|
|
351
391
|
const a = await S();
|
|
352
|
-
return
|
|
392
|
+
return x(a || []);
|
|
353
393
|
} catch {
|
|
354
394
|
return [];
|
|
355
395
|
}
|
|
356
396
|
}
|
|
357
397
|
},
|
|
358
|
-
[
|
|
398
|
+
[o.LOSS_REASON_SECONDARY]: {
|
|
359
399
|
defaultFieldName: "lossReasonSecondaryIds",
|
|
360
400
|
defaultLabel: "亏损原因细类",
|
|
361
401
|
defaultExcludeLabel: "排除亏损原因细类",
|
|
@@ -364,18 +404,18 @@ const q = {
|
|
|
364
404
|
async fetchOptions() {
|
|
365
405
|
try {
|
|
366
406
|
const [a, e] = await Promise.all([
|
|
367
|
-
|
|
407
|
+
_(),
|
|
368
408
|
S()
|
|
369
|
-
]),
|
|
370
|
-
return (e || []).forEach((
|
|
371
|
-
(
|
|
372
|
-
}),
|
|
409
|
+
]), r = /* @__PURE__ */ new Map();
|
|
410
|
+
return (e || []).forEach((l) => {
|
|
411
|
+
(l == null ? void 0 : l.id) !== void 0 && (l == null ? void 0 : l.id) !== null && r.set(l.id, l.reasonName || String(l.id));
|
|
412
|
+
}), B(a || [], r);
|
|
373
413
|
} catch {
|
|
374
414
|
return [];
|
|
375
415
|
}
|
|
376
416
|
}
|
|
377
417
|
},
|
|
378
|
-
[
|
|
418
|
+
[o.SUPPLIER_CONFIG]: {
|
|
379
419
|
defaultFieldName: "supplierConfigPccs",
|
|
380
420
|
defaultLabel: "配置号",
|
|
381
421
|
defaultExcludeLabel: "排除配置号",
|
|
@@ -383,14 +423,14 @@ const q = {
|
|
|
383
423
|
defaultShowAll: !1,
|
|
384
424
|
async fetchOptions() {
|
|
385
425
|
try {
|
|
386
|
-
const a = await
|
|
387
|
-
return
|
|
426
|
+
const a = await b({});
|
|
427
|
+
return $(a || []);
|
|
388
428
|
} catch {
|
|
389
429
|
return [];
|
|
390
430
|
}
|
|
391
431
|
}
|
|
392
432
|
},
|
|
393
|
-
[
|
|
433
|
+
[o.SUPPLIER]: {
|
|
394
434
|
defaultFieldName: "supplierCodes",
|
|
395
435
|
defaultLabel: "供应商",
|
|
396
436
|
defaultExcludeLabel: "排除供应商",
|
|
@@ -398,8 +438,8 @@ const q = {
|
|
|
398
438
|
defaultShowAll: !1,
|
|
399
439
|
async fetchOptions() {
|
|
400
440
|
try {
|
|
401
|
-
const a = await
|
|
402
|
-
return
|
|
441
|
+
const a = await T();
|
|
442
|
+
return V(a || []);
|
|
403
443
|
} catch {
|
|
404
444
|
return [];
|
|
405
445
|
}
|
|
@@ -407,9 +447,14 @@ const q = {
|
|
|
407
447
|
}
|
|
408
448
|
};
|
|
409
449
|
export {
|
|
410
|
-
|
|
411
|
-
|
|
450
|
+
o as CODES,
|
|
451
|
+
Z as CODE_REGISTRY,
|
|
452
|
+
Y as GEO_LEVEL_CODES,
|
|
412
453
|
d as GROUP_BY,
|
|
413
|
-
|
|
414
|
-
|
|
454
|
+
J as canDeriveGeoLevel,
|
|
455
|
+
Q as deriveRegionLevelOptionsFromGeoSource,
|
|
456
|
+
H as groupBasicDataOptions,
|
|
457
|
+
N as isGeoLevelCode,
|
|
458
|
+
W as resolveDefaultGroupBy,
|
|
459
|
+
X as resolveHighestGeoLevelCode
|
|
415
460
|
};
|
|
@@ -1,112 +1,147 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
import { CODE_REGISTRY as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return Array.isArray(
|
|
1
|
+
import { ref as A, watchEffect as M, unref as C, watch as _, computed as F } from "vue";
|
|
2
|
+
import { useRoute as K } from "vue-router";
|
|
3
|
+
import { GEO_LEVEL_CODES as E, canDeriveGeoLevel as R, deriveRegionLevelOptionsFromGeoSource as T, resolveHighestGeoLevelCode as L, isGeoLevelCode as G, CODE_REGISTRY as V } from "./basicDataCodes.js";
|
|
4
|
+
const o = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
5
|
+
function v(t) {
|
|
6
|
+
return Array.isArray(t) ? t : [];
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function b(t) {
|
|
9
|
+
return t.reduce((n, l) => (n[l] = [], n), {});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
function O(t, n) {
|
|
12
|
+
return Object.prototype.hasOwnProperty.call(t, n);
|
|
13
|
+
}
|
|
14
|
+
function q(t) {
|
|
15
|
+
return L(E.filter((n) => O(t, n)));
|
|
16
|
+
}
|
|
17
|
+
function y(t) {
|
|
18
|
+
const n = q(t);
|
|
19
|
+
if (!n) return t;
|
|
20
|
+
const l = t[n];
|
|
21
|
+
if (!Array.isArray(l)) return t;
|
|
22
|
+
const u = { ...t };
|
|
23
|
+
let d = !1;
|
|
24
|
+
return E.forEach((i) => {
|
|
25
|
+
R(n, i) && (O(u, i) || (u[i] = T(l, i), d = !0));
|
|
26
|
+
}), d ? u : t;
|
|
27
|
+
}
|
|
28
|
+
function j(t, n) {
|
|
29
|
+
const l = q(n), u = t.filter(G), d = l || L(u) || void 0;
|
|
30
|
+
return d ? t.filter((i) => G(i) ? !(R(d, i) || i === d && O(n, d)) : !0) : t;
|
|
31
|
+
}
|
|
32
|
+
function k(t) {
|
|
33
|
+
const n = K(), l = A({});
|
|
34
|
+
function u(s = {}) {
|
|
35
|
+
l.value = t.codes.reduce(
|
|
36
|
+
(e, r) => (e[r] = v(s[r]), e),
|
|
16
37
|
{}
|
|
17
38
|
);
|
|
18
39
|
}
|
|
19
|
-
|
|
20
|
-
async function
|
|
21
|
-
var
|
|
22
|
-
const e = (
|
|
40
|
+
u();
|
|
41
|
+
async function d(s) {
|
|
42
|
+
var h;
|
|
43
|
+
const e = (h = n.meta) == null ? void 0 : h.permissionOnlyCode;
|
|
23
44
|
return (await Promise.allSettled(
|
|
24
|
-
|
|
45
|
+
s.map(async (c) => {
|
|
25
46
|
try {
|
|
26
|
-
const
|
|
27
|
-
return [
|
|
47
|
+
const p = await V[c].fetchOptions({ permissionOnlyCode: e });
|
|
48
|
+
return [c, v(p)];
|
|
28
49
|
} catch {
|
|
29
|
-
return [
|
|
50
|
+
return [c, []];
|
|
30
51
|
}
|
|
31
52
|
})
|
|
32
|
-
)).reduce((
|
|
33
|
-
const
|
|
34
|
-
return
|
|
53
|
+
)).reduce((c, f, p) => {
|
|
54
|
+
const S = s[p];
|
|
55
|
+
return f.status === "fulfilled" ? c[f.value[0]] = v(f.value[1]) : c[S] = [], c;
|
|
35
56
|
}, {});
|
|
36
57
|
}
|
|
37
|
-
async function
|
|
38
|
-
const e =
|
|
39
|
-
let
|
|
58
|
+
async function i(s = !1) {
|
|
59
|
+
const e = n.path;
|
|
60
|
+
let r = [];
|
|
40
61
|
try {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
62
|
+
const h = C(t.dataSource);
|
|
63
|
+
if (h) {
|
|
64
|
+
let a = { ...o.get(e) || {}, ...h };
|
|
65
|
+
a = y(a), o.set(e, a), u(a);
|
|
45
66
|
return;
|
|
46
67
|
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
|
|
68
|
+
let c = y(o.get(e) || {});
|
|
69
|
+
if (c !== (o.get(e) || {}) && o.set(e, c), r = s ? [...t.codes] : t.codes.filter((a) => !O(c, a)), !r.length) {
|
|
70
|
+
u(c);
|
|
50
71
|
return;
|
|
51
72
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
73
|
+
const f = s ? void 0 : D.get(e);
|
|
74
|
+
if (f)
|
|
54
75
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
const a = await f, g = y({
|
|
77
|
+
...o.get(e) || {},
|
|
78
|
+
...a
|
|
79
|
+
});
|
|
80
|
+
if (o.set(e, g), r = t.codes.filter((P) => !O(g, P)), !r.length) {
|
|
81
|
+
u(g);
|
|
58
82
|
return;
|
|
59
83
|
}
|
|
84
|
+
c = g;
|
|
60
85
|
} catch {
|
|
61
86
|
}
|
|
62
|
-
const
|
|
63
|
-
|
|
87
|
+
const p = j(r, c);
|
|
88
|
+
if (!p.length) {
|
|
89
|
+
const a = y(c);
|
|
90
|
+
o.set(e, a), u(a);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const S = d(p), w = (m.get(e) || 0) + 1;
|
|
94
|
+
m.set(e, w), D.set(e, S);
|
|
64
95
|
try {
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
96
|
+
const a = await S;
|
|
97
|
+
if (m.get(e) !== w) return;
|
|
98
|
+
let g = {
|
|
99
|
+
...o.get(e) || {},
|
|
100
|
+
...a
|
|
101
|
+
};
|
|
102
|
+
g = y(g), o.set(e, g), u(g);
|
|
69
103
|
} finally {
|
|
70
|
-
|
|
104
|
+
m.get(e) === w && D.delete(e);
|
|
71
105
|
}
|
|
72
106
|
} catch {
|
|
73
|
-
const
|
|
74
|
-
|
|
107
|
+
const h = b(r.length ? r : t.codes), f = { ...o.get(e) || {}, ...h };
|
|
108
|
+
o.set(e, f), u(f);
|
|
75
109
|
}
|
|
76
110
|
}
|
|
77
|
-
async function
|
|
78
|
-
const
|
|
79
|
-
|
|
111
|
+
async function x() {
|
|
112
|
+
const s = n.path;
|
|
113
|
+
D.clear(), o.clear(), m.clear(), o.delete(s), await i(!0);
|
|
80
114
|
}
|
|
81
|
-
return
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
const e =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
return M(() => {
|
|
116
|
+
const s = C(t.dataSource);
|
|
117
|
+
if (!s) return;
|
|
118
|
+
const e = n.path;
|
|
119
|
+
let r = { ...o.get(e) || {}, ...s };
|
|
120
|
+
r = y(r), o.set(e, r), u(r);
|
|
121
|
+
}), _(
|
|
122
|
+
() => n.path,
|
|
88
123
|
() => {
|
|
89
|
-
|
|
124
|
+
i();
|
|
90
125
|
},
|
|
91
126
|
{ immediate: !0 }
|
|
92
127
|
), {
|
|
93
|
-
dataSource:
|
|
94
|
-
const
|
|
95
|
-
(e,
|
|
128
|
+
dataSource: F(() => {
|
|
129
|
+
const s = t.codes.reduce(
|
|
130
|
+
(e, r) => (e[r] = v(l.value[r]), e),
|
|
96
131
|
{}
|
|
97
132
|
);
|
|
98
|
-
return new Proxy(
|
|
99
|
-
get(e,
|
|
100
|
-
return typeof
|
|
133
|
+
return new Proxy(s, {
|
|
134
|
+
get(e, r) {
|
|
135
|
+
return typeof r != "string" ? [] : v(s[r]);
|
|
101
136
|
},
|
|
102
137
|
set() {
|
|
103
138
|
return !1;
|
|
104
139
|
}
|
|
105
140
|
});
|
|
106
141
|
}),
|
|
107
|
-
reload:
|
|
142
|
+
reload: x
|
|
108
143
|
};
|
|
109
144
|
}
|
|
110
145
|
export {
|
|
111
|
-
|
|
146
|
+
k as useBasicDataOptions
|
|
112
147
|
};
|