joy-admin-components 0.1.28 → 0.1.29
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/joy-admin-components.es.js +939 -306
- package/dist/joy-admin-components.umd.js +1 -1
- package/package.json +6 -5
- package/src/index.d.ts +3 -0
- package/src/utils/index.d.ts +193 -0
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import { ElForm as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { difference as
|
|
4
|
-
import { useI18n as
|
|
5
|
-
|
|
1
|
+
import { ElForm as Se, ElRow as xe, ElCol as Te, dayjs as re } from "element-plus";
|
|
2
|
+
import { defineComponent as ce, ref as F, onMounted as ue, h as X, mergeModels as ie, useAttrs as De, useModel as Oe, computed as J, resolveComponent as x, openBlock as w, createBlock as D, mergeProps as W, unref as B, withCtx as T, renderSlot as Y, createVNode as E, createTextVNode as R, toDisplayString as H, createCommentVNode as P, createElementBlock as A, Fragment as te, renderList as fe, withModifiers as ne, nextTick as de, createElementVNode as M, resolveDynamicComponent as he, withKeys as ze, normalizeStyle as Ee, normalizeClass as oe, reactive as ee, onUnmounted as Ue } from "vue";
|
|
3
|
+
import { difference as Ie, debounce as ge, cloneDeep as Ve } from "lodash";
|
|
4
|
+
import { useI18n as ae } from "vue-i18n";
|
|
5
|
+
import V from "crypto-js";
|
|
6
|
+
import { saveAs as Fe } from "file-saver";
|
|
7
|
+
import me from "exceljs";
|
|
8
|
+
import pe from "dayjs";
|
|
9
|
+
const vt = ce({
|
|
6
10
|
name: "LayOutForm",
|
|
7
|
-
setup(n, { slots:
|
|
8
|
-
const
|
|
9
|
-
(
|
|
11
|
+
setup(n, { slots: e, attrs: t, emit: o }) {
|
|
12
|
+
const a = F(null), c = () => e.default ? e.default().filter((u) => u.type !== Symbol.for("v-cmt")).map((u) => u.type === Symbol.for("v-fgt") ? u.children : u).flat().map(
|
|
13
|
+
(u) => {
|
|
10
14
|
var r;
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
{ span: ((r =
|
|
15
|
+
return X(
|
|
16
|
+
Te,
|
|
17
|
+
{ span: ((r = u.props) == null ? void 0 : r.span) || 24 },
|
|
14
18
|
{
|
|
15
|
-
default: () =>
|
|
19
|
+
default: () => u
|
|
16
20
|
}
|
|
17
21
|
);
|
|
18
22
|
}
|
|
19
23
|
) : null;
|
|
20
24
|
ue(() => {
|
|
21
|
-
|
|
25
|
+
o("ref", a.value);
|
|
22
26
|
});
|
|
23
|
-
function
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
{ ...t, ref:
|
|
27
|
-
() =>
|
|
27
|
+
function l() {
|
|
28
|
+
return X(
|
|
29
|
+
Se,
|
|
30
|
+
{ ...t, ref: a },
|
|
31
|
+
() => X(xe, { gutter: t.gutter ?? 20 }, { default: () => c() })
|
|
28
32
|
);
|
|
29
33
|
}
|
|
30
|
-
return
|
|
34
|
+
return l;
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
|
-
const
|
|
37
|
+
const K = (n, e) => {
|
|
34
38
|
const t = n.__vccOpts || n;
|
|
35
|
-
for (const [
|
|
36
|
-
t[
|
|
39
|
+
for (const [o, a] of e)
|
|
40
|
+
t[o] = a;
|
|
37
41
|
return t;
|
|
38
|
-
},
|
|
42
|
+
}, Le = {
|
|
39
43
|
__name: "index",
|
|
40
|
-
props: /* @__PURE__ */
|
|
44
|
+
props: /* @__PURE__ */ ie({
|
|
41
45
|
api: {
|
|
42
46
|
type: Function
|
|
43
47
|
},
|
|
@@ -75,116 +79,116 @@ const j = (n, u) => {
|
|
|
75
79
|
modelValue: {},
|
|
76
80
|
modelModifiers: {}
|
|
77
81
|
}),
|
|
78
|
-
emits: /* @__PURE__ */
|
|
79
|
-
setup(n, { emit:
|
|
80
|
-
const t = n,
|
|
82
|
+
emits: /* @__PURE__ */ ie(["success", "change"], ["update:modelValue"]),
|
|
83
|
+
setup(n, { emit: e }) {
|
|
84
|
+
const t = n, o = De(), { t: a, locale: c } = ae(), l = Oe(n, "modelValue"), u = J({
|
|
81
85
|
get() {
|
|
82
|
-
if (
|
|
86
|
+
if (o.multiple == null || l.value == null)
|
|
83
87
|
return !1;
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
let f = t.data ? t.data : v.value, i = Ie(
|
|
89
|
+
f.map((m) => o["value-key"] ? m : m[t.labelValue.value]),
|
|
90
|
+
l.value
|
|
87
91
|
).length == 0;
|
|
88
|
-
return
|
|
92
|
+
return l.value.length == f.length && i;
|
|
89
93
|
},
|
|
90
|
-
set(
|
|
91
|
-
return
|
|
94
|
+
set(f) {
|
|
95
|
+
return f;
|
|
92
96
|
}
|
|
93
|
-
}), r =
|
|
94
|
-
const { data:
|
|
95
|
-
|
|
97
|
+
}), r = e, v = F([]), p = async () => {
|
|
98
|
+
const { data: f } = await t.api();
|
|
99
|
+
v.value = [...f], r("success", v);
|
|
96
100
|
};
|
|
97
|
-
t.api &&
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
101
|
+
t.api && p();
|
|
102
|
+
const k = t.labelValue.label.split("-"), d = (f) => {
|
|
103
|
+
if (k.length == 1) {
|
|
100
104
|
if (t.changeLocal)
|
|
101
|
-
return
|
|
102
|
-
let
|
|
103
|
-
return
|
|
105
|
+
return a(f[t.labelValue.label]);
|
|
106
|
+
let i = c.value == "en_us" ? f[t.labelValue.labelEn || "i18nName"] : f[t.labelValue.label];
|
|
107
|
+
return i = i || f[t.labelValue.label], i;
|
|
104
108
|
} else {
|
|
105
|
-
let
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
+
let i = [];
|
|
110
|
+
return k.forEach((m) => {
|
|
111
|
+
i.push(f[m]);
|
|
112
|
+
}), i.join("-");
|
|
109
113
|
}
|
|
110
114
|
};
|
|
111
|
-
function
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
r("change",
|
|
115
|
+
function b(f) {
|
|
116
|
+
let i = t.data ? t.data : v.value;
|
|
117
|
+
l.value = f ? i.map((m) => o["value-key"] ? m : m[t.labelValue.value]) : [], de(() => {
|
|
118
|
+
r("change", l.value);
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
|
-
function
|
|
118
|
-
t.optionClick && t.optionClick(
|
|
121
|
+
function h(f) {
|
|
122
|
+
t.optionClick && t.optionClick(f), t.optionClick && r("change", o["value-key"] ? f : f[t.labelValue.value]);
|
|
119
123
|
}
|
|
120
|
-
function
|
|
121
|
-
r("change",
|
|
124
|
+
function s(f) {
|
|
125
|
+
r("change", f);
|
|
122
126
|
}
|
|
123
|
-
function
|
|
124
|
-
return
|
|
127
|
+
function g(f) {
|
|
128
|
+
return o.multiple != null && o.multiple != !1 && t.maxLimit > 0 ? l.value.length >= t.maxLimit && !l.value.includes(f[t.labelValue.value]) : o.multiple != null && o.multiple != !1 && t.minLimit > 0 ? l.value.length <= t.minLimit && l.value.includes(f[t.labelValue.value]) : !1;
|
|
125
129
|
}
|
|
126
|
-
return (
|
|
127
|
-
const
|
|
128
|
-
return
|
|
129
|
-
modelValue:
|
|
130
|
-
"onUpdate:modelValue":
|
|
131
|
-
},
|
|
130
|
+
return (f, i) => {
|
|
131
|
+
const m = x("el-checkbox"), $ = x("el-option"), C = x("el-select");
|
|
132
|
+
return w(), D(C, W({
|
|
133
|
+
modelValue: l.value,
|
|
134
|
+
"onUpdate:modelValue": i[1] || (i[1] = (S) => l.value = S)
|
|
135
|
+
}, B(o), {
|
|
132
136
|
filterable: "",
|
|
133
137
|
"collapse-tags": "",
|
|
134
138
|
"collapse-tags-tooltip": "",
|
|
135
139
|
clearable: "",
|
|
136
|
-
onClear:
|
|
137
|
-
onChange:
|
|
140
|
+
onClear: s,
|
|
141
|
+
onChange: s
|
|
138
142
|
}), {
|
|
139
|
-
default:
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
default: T(() => [
|
|
144
|
+
B(o).multiple != null && B(o).multiple != !1 && n.showCheckAll ? Y(f.$slots, "header", { key: 0 }, () => [
|
|
145
|
+
E(m, {
|
|
142
146
|
class: "mgl20",
|
|
143
|
-
modelValue:
|
|
144
|
-
"onUpdate:modelValue":
|
|
145
|
-
onChange:
|
|
147
|
+
modelValue: u.value,
|
|
148
|
+
"onUpdate:modelValue": i[0] || (i[0] = (S) => u.value = S),
|
|
149
|
+
onChange: b
|
|
146
150
|
}, {
|
|
147
|
-
default:
|
|
148
|
-
H(
|
|
151
|
+
default: T(() => [
|
|
152
|
+
R(H(f.$t("quan-xuan")), 1)
|
|
149
153
|
]),
|
|
150
154
|
_: 1
|
|
151
155
|
}, 8, ["modelValue"])
|
|
152
|
-
], !0) :
|
|
153
|
-
(
|
|
154
|
-
key:
|
|
155
|
-
disabled:
|
|
156
|
-
label:
|
|
157
|
-
onClick:
|
|
158
|
-
value:
|
|
156
|
+
], !0) : P("", !0),
|
|
157
|
+
(w(!0), A(te, null, fe(n.data ? n.data : v.value, (S, O) => (w(), D($, {
|
|
158
|
+
key: O,
|
|
159
|
+
disabled: g(S),
|
|
160
|
+
label: d(S),
|
|
161
|
+
onClick: ne((U) => h(S), ["stop"]),
|
|
162
|
+
value: B(o)["value-key"] ? S : S[n.labelValue.value]
|
|
159
163
|
}, null, 8, ["disabled", "label", "onClick", "value"]))), 128))
|
|
160
164
|
]),
|
|
161
165
|
_: 3
|
|
162
166
|
}, 16, ["modelValue"]);
|
|
163
167
|
};
|
|
164
168
|
}
|
|
165
|
-
},
|
|
169
|
+
}, Ae = /* @__PURE__ */ K(Le, [["__scopeId", "data-v-02dd2f72"]]), yt = {
|
|
166
170
|
__name: "index",
|
|
167
171
|
emits: ["ok", "no"],
|
|
168
|
-
setup(n, { emit:
|
|
169
|
-
const t =
|
|
172
|
+
setup(n, { emit: e }) {
|
|
173
|
+
const t = e, o = ge(() => {
|
|
170
174
|
t("ok");
|
|
171
175
|
}, 500);
|
|
172
|
-
function
|
|
176
|
+
function a() {
|
|
173
177
|
t("no");
|
|
174
178
|
}
|
|
175
|
-
return (c,
|
|
176
|
-
const
|
|
177
|
-
return
|
|
178
|
-
onConfirm:
|
|
179
|
-
onCancel:
|
|
179
|
+
return (c, l) => {
|
|
180
|
+
const u = x("el-link"), r = x("el-popconfirm");
|
|
181
|
+
return w(), D(r, W(c.$attrs, {
|
|
182
|
+
onConfirm: B(o),
|
|
183
|
+
onCancel: a
|
|
180
184
|
}), {
|
|
181
|
-
reference:
|
|
182
|
-
|
|
185
|
+
reference: T(() => [
|
|
186
|
+
E(u, {
|
|
183
187
|
underline: "never",
|
|
184
188
|
type: c.$attrs.type
|
|
185
189
|
}, {
|
|
186
|
-
default:
|
|
187
|
-
|
|
190
|
+
default: T(() => [
|
|
191
|
+
Y(c.$slots, "default")
|
|
188
192
|
]),
|
|
189
193
|
_: 3
|
|
190
194
|
}, 8, ["type"])
|
|
@@ -194,7 +198,7 @@ const j = (n, u) => {
|
|
|
194
198
|
};
|
|
195
199
|
}
|
|
196
200
|
};
|
|
197
|
-
const
|
|
201
|
+
const Me = ["accept"], Ye = {
|
|
198
202
|
__name: "index",
|
|
199
203
|
props: {
|
|
200
204
|
accept: {
|
|
@@ -207,38 +211,38 @@ const ze = ["accept"], Se = {
|
|
|
207
211
|
}
|
|
208
212
|
},
|
|
209
213
|
emits: ["fileChange"],
|
|
210
|
-
setup(n, { emit:
|
|
211
|
-
const t =
|
|
212
|
-
function
|
|
213
|
-
let
|
|
214
|
-
t("fileChange",
|
|
214
|
+
setup(n, { emit: e }) {
|
|
215
|
+
const t = e, o = F(null);
|
|
216
|
+
function a(c) {
|
|
217
|
+
let l = c.target.files[0];
|
|
218
|
+
t("fileChange", l), o.value.value = null;
|
|
215
219
|
}
|
|
216
|
-
return (c,
|
|
217
|
-
const
|
|
218
|
-
return
|
|
219
|
-
|
|
220
|
+
return (c, l) => {
|
|
221
|
+
const u = x("el-button");
|
|
222
|
+
return w(), A("span", null, [
|
|
223
|
+
E(u, {
|
|
220
224
|
loading: n.loading,
|
|
221
225
|
class: "mgr10",
|
|
222
|
-
onClick:
|
|
226
|
+
onClick: l[0] || (l[0] = (r) => o.value.click())
|
|
223
227
|
}, {
|
|
224
|
-
default:
|
|
225
|
-
H(
|
|
228
|
+
default: T(() => [
|
|
229
|
+
R(H(c.$t("dao-ru")), 1)
|
|
226
230
|
]),
|
|
227
231
|
_: 1
|
|
228
232
|
}, 8, ["loading"]),
|
|
229
|
-
|
|
230
|
-
onChange:
|
|
233
|
+
M("input", {
|
|
234
|
+
onChange: a,
|
|
231
235
|
ref_key: "input",
|
|
232
|
-
ref:
|
|
236
|
+
ref: o,
|
|
233
237
|
accept: n.accept,
|
|
234
238
|
style: { position: "absolute", width: "0px", height: "0px", opacity: "0" },
|
|
235
239
|
type: "file"
|
|
236
|
-
}, null, 40,
|
|
240
|
+
}, null, 40, Me)
|
|
237
241
|
]);
|
|
238
242
|
};
|
|
239
243
|
}
|
|
240
|
-
},
|
|
241
|
-
const
|
|
244
|
+
}, Ct = /* @__PURE__ */ K(Ye, [["__scopeId", "data-v-5f1449ad"]]);
|
|
245
|
+
const Pe = ce({
|
|
242
246
|
props: {
|
|
243
247
|
name: {
|
|
244
248
|
tyepe: String,
|
|
@@ -246,17 +250,17 @@ const Ye = re({
|
|
|
246
250
|
}
|
|
247
251
|
}
|
|
248
252
|
});
|
|
249
|
-
function
|
|
250
|
-
const
|
|
251
|
-
return
|
|
252
|
-
default:
|
|
253
|
-
(
|
|
253
|
+
function je(n, e, t, o, a, c) {
|
|
254
|
+
const l = x("el-icon");
|
|
255
|
+
return w(), D(l, { class: "cmp-icon" }, {
|
|
256
|
+
default: T(() => [
|
|
257
|
+
(w(), D(he(n.name)))
|
|
254
258
|
]),
|
|
255
259
|
_: 1
|
|
256
260
|
});
|
|
257
261
|
}
|
|
258
|
-
const
|
|
259
|
-
const Be = { key: 0 },
|
|
262
|
+
const ve = /* @__PURE__ */ K(Pe, [["render", je], ["__scopeId", "data-v-733f9daa"]]);
|
|
263
|
+
const Be = { key: 0 }, Re = { class: "btns" }, He = { class: "left" }, Ne = { class: "right" }, Ke = {
|
|
260
264
|
__name: "index",
|
|
261
265
|
props: {
|
|
262
266
|
form: {
|
|
@@ -265,72 +269,72 @@ const Be = { key: 0 }, Me = { class: "btns" }, Re = { class: "left" }, Ae = { cl
|
|
|
265
269
|
}
|
|
266
270
|
},
|
|
267
271
|
emits: ["confirm", "reset"],
|
|
268
|
-
setup(n, { emit:
|
|
269
|
-
const t =
|
|
270
|
-
function
|
|
272
|
+
setup(n, { emit: e }) {
|
|
273
|
+
const t = e, o = F(!0), a = F(null), { t: c } = ae(), l = J(() => o.value ? c("guan-bi") : c("zhan-kai"));
|
|
274
|
+
function u() {
|
|
271
275
|
t("confirm");
|
|
272
276
|
}
|
|
273
277
|
function r() {
|
|
274
278
|
t("reset");
|
|
275
279
|
}
|
|
276
|
-
function
|
|
280
|
+
function v() {
|
|
277
281
|
t("confirm");
|
|
278
282
|
}
|
|
279
|
-
return (
|
|
280
|
-
const
|
|
281
|
-
return
|
|
283
|
+
return (p, k) => {
|
|
284
|
+
const d = x("el-input"), b = x("el-date-picker"), h = x("el-form-item"), s = x("el-form"), g = x("el-link"), f = x("el-button");
|
|
285
|
+
return w(), A("div", {
|
|
282
286
|
class: "searchBar-container mgt10 mgb10",
|
|
283
|
-
onKeydown:
|
|
287
|
+
onKeydown: ze(u, ["enter"])
|
|
284
288
|
}, [
|
|
285
|
-
|
|
289
|
+
M("div", {
|
|
286
290
|
class: "searchBar",
|
|
287
|
-
style:
|
|
291
|
+
style: Ee({ height: o.value ? "auto" : "42px" })
|
|
288
292
|
}, [
|
|
289
|
-
|
|
293
|
+
E(s, {
|
|
290
294
|
inline: "",
|
|
291
295
|
model: n.form.data
|
|
292
296
|
}, {
|
|
293
|
-
default:
|
|
294
|
-
(
|
|
295
|
-
key:
|
|
297
|
+
default: T(() => [
|
|
298
|
+
(w(!0), A(te, null, fe(n.form.items.filter((i) => !i.hidden), (i) => (w(), A(te, {
|
|
299
|
+
key: i.key
|
|
296
300
|
}, [
|
|
297
|
-
|
|
301
|
+
i.type == "br" ? (w(), A("br", Be)) : (w(), D(h, {
|
|
298
302
|
key: 1,
|
|
299
|
-
label:
|
|
303
|
+
label: i.name
|
|
300
304
|
}, {
|
|
301
|
-
default:
|
|
302
|
-
var
|
|
305
|
+
default: T(() => {
|
|
306
|
+
var m, $;
|
|
303
307
|
return [
|
|
304
|
-
|
|
308
|
+
i.type === "input" ? (w(), D(d, {
|
|
305
309
|
key: 0,
|
|
306
|
-
modelValue:
|
|
307
|
-
"onUpdate:modelValue": (C) =>
|
|
308
|
-
class:
|
|
309
|
-
placeholder:
|
|
310
|
+
modelValue: i.value,
|
|
311
|
+
"onUpdate:modelValue": (C) => i.value = C,
|
|
312
|
+
class: oe(((m = i.option) == null ? void 0 : m.class) || "w150"),
|
|
313
|
+
placeholder: p.$t("qing-shu-ru"),
|
|
310
314
|
clearable: ""
|
|
311
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder"])) :
|
|
312
|
-
|
|
315
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder"])) : i.type === "custom" ? (w(), D(he(i.render), { key: 1 })) : P("", !0),
|
|
316
|
+
i.type === "select" ? (w(), D(Ae, W({
|
|
313
317
|
key: 2,
|
|
314
|
-
class: ((
|
|
315
|
-
modelValue:
|
|
316
|
-
"onUpdate:modelValue": (C) =>
|
|
317
|
-
}, { ref_for: !0 },
|
|
318
|
-
onChange:
|
|
319
|
-
onClear:
|
|
320
|
-
}), null, 16, ["class", "modelValue", "onUpdate:modelValue"])) :
|
|
321
|
-
|
|
318
|
+
class: (($ = i.option) == null ? void 0 : $.class) || "w150",
|
|
319
|
+
modelValue: i.value,
|
|
320
|
+
"onUpdate:modelValue": (C) => i.value = C
|
|
321
|
+
}, { ref_for: !0 }, i.option, {
|
|
322
|
+
onChange: u,
|
|
323
|
+
onClear: u
|
|
324
|
+
}), null, 16, ["class", "modelValue", "onUpdate:modelValue"])) : P("", !0),
|
|
325
|
+
i.type === "date" ? (w(), D(b, {
|
|
322
326
|
key: 3,
|
|
323
|
-
class:
|
|
324
|
-
modelValue:
|
|
325
|
-
"onUpdate:modelValue": (C) =>
|
|
326
|
-
"value-format": { datetimerange: "YYYY-MM-DD HH:mm:ss", daterange: "YYYY-MM-DD" }[
|
|
327
|
-
type:
|
|
328
|
-
onFocus: (C) =>
|
|
329
|
-
onChange: (C) =>
|
|
330
|
-
placeholder:
|
|
331
|
-
"start-placeholder":
|
|
332
|
-
"end-placeholder":
|
|
333
|
-
}, null, 8, ["class", "modelValue", "onUpdate:modelValue", "value-format", "type", "onFocus", "onChange", "placeholder", "start-placeholder", "end-placeholder"])) :
|
|
327
|
+
class: oe({ datetimerange: "w300", daterange: "w200" }[i.dateType] || "w100"),
|
|
328
|
+
modelValue: i.value,
|
|
329
|
+
"onUpdate:modelValue": (C) => i.value = C,
|
|
330
|
+
"value-format": { datetimerange: "YYYY-MM-DD HH:mm:ss", daterange: "YYYY-MM-DD" }[i.dateType] || "YYYY-MM-DD",
|
|
331
|
+
type: i.dateType || "date",
|
|
332
|
+
onFocus: (C) => a.value = i,
|
|
333
|
+
onChange: (C) => v(),
|
|
334
|
+
placeholder: p.$t("qing-xuan-ze"),
|
|
335
|
+
"start-placeholder": p.$t("kai-shi-shi-jian"),
|
|
336
|
+
"end-placeholder": p.$t("jie-shu-shi-jian")
|
|
337
|
+
}, null, 8, ["class", "modelValue", "onUpdate:modelValue", "value-format", "type", "onFocus", "onChange", "placeholder", "start-placeholder", "end-placeholder"])) : P("", !0)
|
|
334
338
|
];
|
|
335
339
|
}),
|
|
336
340
|
_: 2
|
|
@@ -340,70 +344,70 @@ const Be = { key: 0 }, Me = { class: "btns" }, Re = { class: "left" }, Ae = { cl
|
|
|
340
344
|
_: 1
|
|
341
345
|
}, 8, ["model"])
|
|
342
346
|
], 4),
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
M("div", Re, [
|
|
348
|
+
M("div", He, [
|
|
349
|
+
Y(p.$slots, "table-header-left", {}, void 0, !0)
|
|
346
350
|
]),
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
M("div", Ne, [
|
|
352
|
+
E(g, {
|
|
349
353
|
underline: "never",
|
|
350
354
|
class: "mgr10",
|
|
351
|
-
onClick:
|
|
355
|
+
onClick: k[0] || (k[0] = (i) => o.value = !o.value)
|
|
352
356
|
}, {
|
|
353
|
-
default:
|
|
354
|
-
|
|
355
|
-
name:
|
|
357
|
+
default: T(() => [
|
|
358
|
+
E(ve, {
|
|
359
|
+
name: o.value ? "ArrowUp" : "ArrowDown"
|
|
356
360
|
}, null, 8, ["name"]),
|
|
357
|
-
|
|
361
|
+
R(" " + H(l.value), 1)
|
|
358
362
|
]),
|
|
359
363
|
_: 1
|
|
360
364
|
}),
|
|
361
|
-
|
|
365
|
+
E(f, {
|
|
362
366
|
type: "primary",
|
|
363
|
-
onClick:
|
|
367
|
+
onClick: u
|
|
364
368
|
}, {
|
|
365
|
-
default:
|
|
366
|
-
H(
|
|
369
|
+
default: T(() => [
|
|
370
|
+
R(H(p.$t("shai-xuan")), 1)
|
|
367
371
|
]),
|
|
368
372
|
_: 1
|
|
369
373
|
}),
|
|
370
|
-
|
|
374
|
+
E(f, {
|
|
371
375
|
type: "primary",
|
|
372
376
|
onClick: r
|
|
373
377
|
}, {
|
|
374
|
-
default:
|
|
375
|
-
H(
|
|
378
|
+
default: T(() => [
|
|
379
|
+
R(H(p.$t("chong-zhi")), 1)
|
|
376
380
|
]),
|
|
377
381
|
_: 1
|
|
378
382
|
}),
|
|
379
|
-
|
|
383
|
+
Y(p.$slots, "btn", {}, void 0, !0)
|
|
380
384
|
])
|
|
381
385
|
])
|
|
382
386
|
], 32);
|
|
383
387
|
};
|
|
384
388
|
}
|
|
385
|
-
},
|
|
386
|
-
function
|
|
387
|
-
return n ? Array.isArray(n) ? n : n.split(",").map((
|
|
389
|
+
}, qe = /* @__PURE__ */ K(Ke, [["__scopeId", "data-v-f3f60f9c"]]);
|
|
390
|
+
function Ze(n) {
|
|
391
|
+
return n ? Array.isArray(n) ? n : n.split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
388
392
|
}
|
|
389
|
-
function
|
|
390
|
-
let
|
|
393
|
+
function Z(n) {
|
|
394
|
+
let e = {};
|
|
391
395
|
return n.forEach((t) => {
|
|
392
|
-
const { key:
|
|
393
|
-
if (
|
|
394
|
-
|
|
395
|
-
else if (
|
|
396
|
-
if (
|
|
397
|
-
const [
|
|
398
|
-
let [
|
|
399
|
-
|
|
396
|
+
const { key: o, type: a, option: c = {}, value: l, dateType: u, toArr: r } = t;
|
|
397
|
+
if (a == "input" && (c != null && c.multiple))
|
|
398
|
+
e[o] = Ze(l);
|
|
399
|
+
else if (a == "date")
|
|
400
|
+
if (u.includes("range")) {
|
|
401
|
+
const [v, p] = o;
|
|
402
|
+
let [k, d] = l || [];
|
|
403
|
+
k && u == "daterange" && (k = re(k).format("YYYY-MM-DD 00:00:00"), d = re(d).format("YYYY-MM-DD 23:59:59")), e[v] = k, e[p] = d;
|
|
400
404
|
} else
|
|
401
|
-
|
|
405
|
+
e[o] = l;
|
|
402
406
|
else
|
|
403
|
-
|
|
404
|
-
}),
|
|
407
|
+
a == "select" ? e[o] = r ? [l] : l : e[o] = l;
|
|
408
|
+
}), e;
|
|
405
409
|
}
|
|
406
|
-
const
|
|
410
|
+
const Je = { class: "center" }, We = {
|
|
407
411
|
__name: "index",
|
|
408
412
|
props: {
|
|
409
413
|
// 表格id 本地存储列设置时使用
|
|
@@ -442,71 +446,71 @@ const Ne = { class: "center" }, Ue = {
|
|
|
442
446
|
default: () => ({})
|
|
443
447
|
}
|
|
444
448
|
},
|
|
445
|
-
setup(n, { expose:
|
|
446
|
-
const { t, locale:
|
|
449
|
+
setup(n, { expose: e }) {
|
|
450
|
+
const { t, locale: o } = ae(), a = n, c = F(!1), l = F([]), u = Ve(a.searchForm.items), r = ee({
|
|
447
451
|
pageNo: 1,
|
|
448
452
|
pageSize: 10,
|
|
449
453
|
total: 0
|
|
450
|
-
}),
|
|
451
|
-
|
|
452
|
-
if (!
|
|
454
|
+
}), v = F(null), p = F(450), k = ge(() => {
|
|
455
|
+
de(() => {
|
|
456
|
+
if (!v.value)
|
|
453
457
|
return;
|
|
454
|
-
const
|
|
455
|
-
|
|
458
|
+
const _ = v.value.getBoundingClientRect(), z = window.innerHeight, L = _.top, j = 100, G = z - L - j, Q = 200;
|
|
459
|
+
p.value = Math.max(G, Q);
|
|
456
460
|
});
|
|
457
|
-
}, 100),
|
|
458
|
-
|
|
461
|
+
}, 100), d = () => {
|
|
462
|
+
k();
|
|
459
463
|
};
|
|
460
464
|
ue(() => {
|
|
461
|
-
|
|
462
|
-
}),
|
|
463
|
-
window.removeEventListener("resize",
|
|
465
|
+
k(), window.addEventListener("resize", d);
|
|
466
|
+
}), Ue(() => {
|
|
467
|
+
window.removeEventListener("resize", d);
|
|
464
468
|
});
|
|
465
|
-
const
|
|
466
|
-
async function
|
|
467
|
-
const { dataFormat:
|
|
469
|
+
const b = J(() => C.value.height || p.value);
|
|
470
|
+
async function h(y) {
|
|
471
|
+
const { dataFormat: _ } = a.tableConfig;
|
|
468
472
|
c.value = !0;
|
|
469
|
-
const { code:
|
|
470
|
-
c.value = !1,
|
|
473
|
+
const { code: z, data: L = {} } = await a.api(y).finally(() => {
|
|
474
|
+
c.value = !1, a.searchForm.selections = [];
|
|
471
475
|
});
|
|
472
|
-
if (
|
|
473
|
-
let
|
|
474
|
-
|
|
476
|
+
if (z == 200) {
|
|
477
|
+
let j = L.rows || [];
|
|
478
|
+
l.value = _ ? _(j) : j, r.total = L.totalRows || 0;
|
|
475
479
|
}
|
|
476
480
|
}
|
|
477
|
-
function
|
|
478
|
-
|
|
481
|
+
function s(y = {}) {
|
|
482
|
+
h({ ...r, ...Z(a.searchForm.items), ...y });
|
|
479
483
|
}
|
|
480
|
-
async function
|
|
481
|
-
const { reset:
|
|
482
|
-
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
}),
|
|
484
|
+
async function g() {
|
|
485
|
+
const { reset: y } = a.tableConfig;
|
|
486
|
+
a.searchForm.items.forEach((_) => {
|
|
487
|
+
const z = u.find((L) => L.key == _.key);
|
|
488
|
+
z && (_.value = z.value);
|
|
489
|
+
}), y && await y(), s();
|
|
486
490
|
}
|
|
487
|
-
|
|
488
|
-
function
|
|
489
|
-
return { ...r, ...
|
|
491
|
+
a.api && a.immediate && s();
|
|
492
|
+
function f() {
|
|
493
|
+
return { ...r, ...Z(a.searchForm.items) };
|
|
490
494
|
}
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
const
|
|
495
|
+
const i = F(null);
|
|
496
|
+
e({ tableRef: i, getList: s, getPrm: f, calculateTableHeight: k });
|
|
497
|
+
const m = ee({
|
|
494
498
|
storage: !0
|
|
495
|
-
}),
|
|
499
|
+
}), $ = ee({
|
|
496
500
|
drag: !0,
|
|
497
501
|
resizable: !0,
|
|
498
502
|
maxFixedSize: 0
|
|
499
|
-
}), C =
|
|
503
|
+
}), C = J(() => {
|
|
500
504
|
const {
|
|
501
|
-
customConfig:
|
|
502
|
-
columnConfig:
|
|
503
|
-
...
|
|
504
|
-
} =
|
|
505
|
+
customConfig: y,
|
|
506
|
+
columnConfig: _,
|
|
507
|
+
...z
|
|
508
|
+
} = a.tableConfig;
|
|
505
509
|
return {
|
|
506
510
|
headerAlign: "left",
|
|
507
511
|
align: "center",
|
|
508
|
-
customConfig: { ...
|
|
509
|
-
"column-config": {
|
|
512
|
+
customConfig: { ...m, ...y },
|
|
513
|
+
"column-config": { ...$, ..._ },
|
|
510
514
|
// 列过多时 自动宽度 虚拟滚动会闪屏 关闭虚拟滚动
|
|
511
515
|
"virtual-x-config": {
|
|
512
516
|
enabled: !1,
|
|
@@ -514,130 +518,759 @@ const Ne = { class: "center" }, Ue = {
|
|
|
514
518
|
},
|
|
515
519
|
// 纵向虚拟滚动 大于100条开启
|
|
516
520
|
"virtual-y-config": { enabled: !0, gt: 100 },
|
|
517
|
-
...
|
|
521
|
+
...z
|
|
518
522
|
};
|
|
519
|
-
}),
|
|
520
|
-
r.pageNo =
|
|
521
|
-
},
|
|
522
|
-
r.pageSize =
|
|
523
|
+
}), S = (y) => {
|
|
524
|
+
r.pageNo = y, h({ ...r, ...Z(a.searchForm.items) });
|
|
525
|
+
}, O = (y) => {
|
|
526
|
+
r.pageSize = y, r.pageNo = 1, h({ ...r, ...Z(a.searchForm.items) });
|
|
523
527
|
};
|
|
524
|
-
function
|
|
525
|
-
const
|
|
526
|
-
|
|
528
|
+
function U() {
|
|
529
|
+
const y = i.value.getCheckboxRecords();
|
|
530
|
+
a.searchForm.selections = y;
|
|
527
531
|
}
|
|
528
|
-
const
|
|
529
|
-
const
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
532
|
+
const I = (y) => {
|
|
533
|
+
const _ = i.value;
|
|
534
|
+
if (_) {
|
|
535
|
+
_.toggleCheckboxRow(y);
|
|
536
|
+
const z = i.value.getCheckboxRecords();
|
|
537
|
+
a.searchForm.selections = z;
|
|
534
538
|
}
|
|
535
539
|
};
|
|
536
|
-
return (
|
|
537
|
-
const
|
|
538
|
-
return
|
|
539
|
-
class:
|
|
540
|
+
return (y, _) => {
|
|
541
|
+
const z = x("el-button"), L = x("el-checkbox"), j = x("el-text"), G = x("vxe-column"), Q = x("VxeTable"), ke = x("el-pagination");
|
|
542
|
+
return w(), A("div", {
|
|
543
|
+
class: oe({ box: n.searchForm.showShadow })
|
|
540
544
|
}, [
|
|
541
|
-
n.searchForm.showSearch ? (
|
|
545
|
+
n.searchForm.showSearch ? (w(), D(qe, {
|
|
542
546
|
key: 0,
|
|
543
547
|
form: n.searchForm,
|
|
544
|
-
onReset:
|
|
545
|
-
onConfirm:
|
|
548
|
+
onReset: g,
|
|
549
|
+
onConfirm: _[1] || (_[1] = (N) => s())
|
|
546
550
|
}, {
|
|
547
|
-
btn:
|
|
548
|
-
|
|
549
|
-
|
|
551
|
+
btn: T(() => [
|
|
552
|
+
Y(y.$slots, "search-bar-btn", {}, void 0, !0),
|
|
553
|
+
E(z, {
|
|
550
554
|
round: "",
|
|
551
|
-
onClick:
|
|
555
|
+
onClick: _[0] || (_[0] = (N) => i.value.openCustom())
|
|
552
556
|
}, {
|
|
553
|
-
default:
|
|
554
|
-
|
|
557
|
+
default: T(() => [
|
|
558
|
+
E(ve, { name: "Tools" })
|
|
555
559
|
]),
|
|
556
560
|
_: 1
|
|
557
561
|
})
|
|
558
562
|
]),
|
|
559
563
|
_: 3
|
|
560
|
-
}, 8, ["form"])) :
|
|
561
|
-
|
|
562
|
-
|
|
564
|
+
}, 8, ["form"])) : P("", !0),
|
|
565
|
+
Y(y.$slots, "table-header-left", {}, void 0, !0),
|
|
566
|
+
M("div", {
|
|
563
567
|
ref_key: "tableContentRef",
|
|
564
|
-
ref:
|
|
568
|
+
ref: v
|
|
565
569
|
}, [
|
|
566
|
-
|
|
570
|
+
E(Q, W({
|
|
567
571
|
id: n.id,
|
|
568
572
|
ref_key: "tableRef",
|
|
569
|
-
ref:
|
|
573
|
+
ref: i,
|
|
570
574
|
loading: n.loading || c.value,
|
|
571
|
-
data: n.api ?
|
|
575
|
+
data: n.api ? l.value : n.data
|
|
572
576
|
}, C.value, {
|
|
573
|
-
height:
|
|
574
|
-
onCheckboxChange:
|
|
575
|
-
onCheckboxAll:
|
|
577
|
+
height: b.value,
|
|
578
|
+
onCheckboxChange: U,
|
|
579
|
+
onCheckboxAll: U,
|
|
576
580
|
border: ""
|
|
577
581
|
}), {
|
|
578
|
-
default:
|
|
579
|
-
n.searchForm.showCheckBox ? (
|
|
582
|
+
default: T(() => [
|
|
583
|
+
n.searchForm.showCheckBox ? (w(), D(G, {
|
|
580
584
|
key: 0,
|
|
581
585
|
type: "checkbox",
|
|
582
|
-
width:
|
|
586
|
+
width: B(o) == "zh_cn" ? 80 : 150,
|
|
583
587
|
fixed: "left",
|
|
584
|
-
title:
|
|
588
|
+
title: y.$t("xu-hao")
|
|
585
589
|
}, {
|
|
586
|
-
checkbox:
|
|
587
|
-
|
|
588
|
-
|
|
590
|
+
checkbox: T(({ rowIndex: N, row: le, checked: we, disabled: q, indeterminate: st }) => [
|
|
591
|
+
M("div", Je, [
|
|
592
|
+
we ? (w(), D(L, {
|
|
589
593
|
key: 0,
|
|
590
594
|
checked: !0,
|
|
591
|
-
disabled:
|
|
595
|
+
disabled: q,
|
|
592
596
|
size: "default",
|
|
593
|
-
onClick:
|
|
594
|
-
}, null, 8, ["disabled", "onClick"])) : (
|
|
597
|
+
onClick: ne(($e) => !q && I(le), ["stop"])
|
|
598
|
+
}, null, 8, ["disabled", "onClick"])) : (w(), D(L, {
|
|
595
599
|
key: 1,
|
|
596
|
-
disabled:
|
|
600
|
+
disabled: q,
|
|
597
601
|
checked: !1,
|
|
598
602
|
size: "default",
|
|
599
|
-
onClick:
|
|
603
|
+
onClick: ne(($e) => !q && I(le), ["stop"])
|
|
600
604
|
}, null, 8, ["disabled", "onClick"])),
|
|
601
|
-
|
|
605
|
+
E(j, {
|
|
602
606
|
type: "info",
|
|
603
607
|
class: "mgl5"
|
|
604
608
|
}, {
|
|
605
|
-
default:
|
|
606
|
-
H(
|
|
609
|
+
default: T(() => [
|
|
610
|
+
R(H(N + 1), 1)
|
|
607
611
|
]),
|
|
608
612
|
_: 2
|
|
609
613
|
}, 1024)
|
|
610
614
|
])
|
|
611
615
|
]),
|
|
612
616
|
_: 1
|
|
613
|
-
}, 8, ["width", "title"])) :
|
|
614
|
-
|
|
617
|
+
}, 8, ["width", "title"])) : P("", !0),
|
|
618
|
+
Y(y.$slots, "default", {}, void 0, !0)
|
|
615
619
|
]),
|
|
616
620
|
_: 3
|
|
617
621
|
}, 16, ["id", "loading", "data", "height"])
|
|
618
622
|
], 512),
|
|
619
|
-
n.searchForm.showPage ? (
|
|
623
|
+
n.searchForm.showPage ? (w(), D(ke, {
|
|
620
624
|
key: 1,
|
|
621
625
|
"current-page": r.pageNo,
|
|
622
|
-
"onUpdate:currentPage":
|
|
626
|
+
"onUpdate:currentPage": _[2] || (_[2] = (N) => r.pageNo = N),
|
|
623
627
|
class: "myPagination mgt10",
|
|
624
628
|
background: "",
|
|
625
629
|
layout: "total, sizes, prev, pager, next",
|
|
626
630
|
total: r.total,
|
|
627
631
|
"page-size": r.pageSize,
|
|
628
632
|
"page-sizes": [10, 50, 100, 500],
|
|
629
|
-
onCurrentChange:
|
|
630
|
-
onSizeChange:
|
|
631
|
-
}, null, 8, ["current-page", "total", "page-size"])) :
|
|
633
|
+
onCurrentChange: S,
|
|
634
|
+
onSizeChange: O
|
|
635
|
+
}, null, 8, ["current-page", "total", "page-size"])) : P("", !0)
|
|
632
636
|
], 2);
|
|
633
637
|
};
|
|
634
638
|
}
|
|
635
|
-
},
|
|
639
|
+
}, bt = /* @__PURE__ */ K(We, [["__scopeId", "data-v-7b74503d"]]);
|
|
640
|
+
function _t(n, e = {}) {
|
|
641
|
+
const t = {
|
|
642
|
+
inForm: !0,
|
|
643
|
+
required: !0,
|
|
644
|
+
...e
|
|
645
|
+
}, o = {
|
|
646
|
+
phone: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
|
|
647
|
+
password: /(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,
|
|
648
|
+
email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
|
|
649
|
+
}[n], { inForm: a, value: c, required: l, msg: u = "请输入正确内容" } = t;
|
|
650
|
+
return a ? function(r, v, p) {
|
|
651
|
+
if (l) {
|
|
652
|
+
o.test(v) ? p() : p(new Error(u));
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
v && !o.test(v) ? p(new Error(u)) : p();
|
|
656
|
+
} : o.test(c);
|
|
657
|
+
}
|
|
658
|
+
const kt = {
|
|
659
|
+
//加密
|
|
660
|
+
encrypt(n, e) {
|
|
661
|
+
e = e || "1CFEC667A1E6D42DC12565AAAA460494";
|
|
662
|
+
var t = V.enc.Utf8.parse(e), o = V.enc.Utf8.parse(n), a = V.AES.encrypt(o, t, {
|
|
663
|
+
mode: V.mode.ECB,
|
|
664
|
+
padding: V.pad.Pkcs7
|
|
665
|
+
});
|
|
666
|
+
return a.toString();
|
|
667
|
+
},
|
|
668
|
+
//解密
|
|
669
|
+
decrypt(n, e) {
|
|
670
|
+
e = e || "1CFEC667A1E6D42DC12565AAAA460494";
|
|
671
|
+
var t = V.enc.Utf8.parse(e), o = V.AES.decrypt(n, t, {
|
|
672
|
+
mode: V.mode.ECB,
|
|
673
|
+
padding: V.pad.Pkcs7
|
|
674
|
+
});
|
|
675
|
+
return V.enc.Utf8.stringify(o).toString();
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
var ye = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
679
|
+
function Ce(n) {
|
|
680
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
681
|
+
}
|
|
682
|
+
var be = { exports: {} };
|
|
683
|
+
(function(n, e) {
|
|
684
|
+
(function(t, o) {
|
|
685
|
+
n.exports = o();
|
|
686
|
+
})(ye, function() {
|
|
687
|
+
var t = "minute", o = /[+-]\d\d(?::?\d\d)?/g, a = /([+-]|\d\d)/g;
|
|
688
|
+
return function(c, l, u) {
|
|
689
|
+
var r = l.prototype;
|
|
690
|
+
u.utc = function(s) {
|
|
691
|
+
var g = { date: s, utc: !0, args: arguments };
|
|
692
|
+
return new l(g);
|
|
693
|
+
}, r.utc = function(s) {
|
|
694
|
+
var g = u(this.toDate(), { locale: this.$L, utc: !0 });
|
|
695
|
+
return s ? g.add(this.utcOffset(), t) : g;
|
|
696
|
+
}, r.local = function() {
|
|
697
|
+
return u(this.toDate(), { locale: this.$L, utc: !1 });
|
|
698
|
+
};
|
|
699
|
+
var v = r.parse;
|
|
700
|
+
r.parse = function(s) {
|
|
701
|
+
s.utc && (this.$u = !0), this.$utils().u(s.$offset) || (this.$offset = s.$offset), v.call(this, s);
|
|
702
|
+
};
|
|
703
|
+
var p = r.init;
|
|
704
|
+
r.init = function() {
|
|
705
|
+
if (this.$u) {
|
|
706
|
+
var s = this.$d;
|
|
707
|
+
this.$y = s.getUTCFullYear(), this.$M = s.getUTCMonth(), this.$D = s.getUTCDate(), this.$W = s.getUTCDay(), this.$H = s.getUTCHours(), this.$m = s.getUTCMinutes(), this.$s = s.getUTCSeconds(), this.$ms = s.getUTCMilliseconds();
|
|
708
|
+
} else
|
|
709
|
+
p.call(this);
|
|
710
|
+
};
|
|
711
|
+
var k = r.utcOffset;
|
|
712
|
+
r.utcOffset = function(s, g) {
|
|
713
|
+
var f = this.$utils().u;
|
|
714
|
+
if (f(s))
|
|
715
|
+
return this.$u ? 0 : f(this.$offset) ? k.call(this) : this.$offset;
|
|
716
|
+
if (typeof s == "string" && (s = function(C) {
|
|
717
|
+
C === void 0 && (C = "");
|
|
718
|
+
var S = C.match(o);
|
|
719
|
+
if (!S)
|
|
720
|
+
return null;
|
|
721
|
+
var O = ("" + S[0]).match(a) || ["-", 0, 0], U = O[0], I = 60 * +O[1] + +O[2];
|
|
722
|
+
return I === 0 ? 0 : U === "+" ? I : -I;
|
|
723
|
+
}(s), s === null))
|
|
724
|
+
return this;
|
|
725
|
+
var i = Math.abs(s) <= 16 ? 60 * s : s;
|
|
726
|
+
if (i === 0)
|
|
727
|
+
return this.utc(g);
|
|
728
|
+
var m = this.clone();
|
|
729
|
+
if (g)
|
|
730
|
+
return m.$offset = i, m.$u = !1, m;
|
|
731
|
+
var $ = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
732
|
+
return (m = this.local().add(i + $, t)).$offset = i, m.$x.$localOffset = $, m;
|
|
733
|
+
};
|
|
734
|
+
var d = r.format;
|
|
735
|
+
r.format = function(s) {
|
|
736
|
+
var g = s || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
737
|
+
return d.call(this, g);
|
|
738
|
+
}, r.valueOf = function() {
|
|
739
|
+
var s = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
740
|
+
return this.$d.valueOf() - 6e4 * s;
|
|
741
|
+
}, r.isUTC = function() {
|
|
742
|
+
return !!this.$u;
|
|
743
|
+
}, r.toISOString = function() {
|
|
744
|
+
return this.toDate().toISOString();
|
|
745
|
+
}, r.toString = function() {
|
|
746
|
+
return this.toDate().toUTCString();
|
|
747
|
+
};
|
|
748
|
+
var b = r.toDate;
|
|
749
|
+
r.toDate = function(s) {
|
|
750
|
+
return s === "s" && this.$offset ? u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : b.call(this);
|
|
751
|
+
};
|
|
752
|
+
var h = r.diff;
|
|
753
|
+
r.diff = function(s, g, f) {
|
|
754
|
+
if (s && this.$u === s.$u)
|
|
755
|
+
return h.call(this, s, g, f);
|
|
756
|
+
var i = this.local(), m = u(s).local();
|
|
757
|
+
return h.call(i, m, g, f);
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
});
|
|
761
|
+
})(be);
|
|
762
|
+
var Ge = be.exports;
|
|
763
|
+
const Qe = /* @__PURE__ */ Ce(Ge);
|
|
764
|
+
var _e = { exports: {} };
|
|
765
|
+
(function(n, e) {
|
|
766
|
+
(function(t, o) {
|
|
767
|
+
n.exports = o();
|
|
768
|
+
})(ye, function() {
|
|
769
|
+
var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, o = {};
|
|
770
|
+
return function(a, c, l) {
|
|
771
|
+
var u, r = function(d, b, h) {
|
|
772
|
+
h === void 0 && (h = {});
|
|
773
|
+
var s = new Date(d), g = function(f, i) {
|
|
774
|
+
i === void 0 && (i = {});
|
|
775
|
+
var m = i.timeZoneName || "short", $ = f + "|" + m, C = o[$];
|
|
776
|
+
return C || (C = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: f, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: m }), o[$] = C), C;
|
|
777
|
+
}(b, h);
|
|
778
|
+
return g.formatToParts(s);
|
|
779
|
+
}, v = function(d, b) {
|
|
780
|
+
for (var h = r(d, b), s = [], g = 0; g < h.length; g += 1) {
|
|
781
|
+
var f = h[g], i = f.type, m = f.value, $ = t[i];
|
|
782
|
+
$ >= 0 && (s[$] = parseInt(m, 10));
|
|
783
|
+
}
|
|
784
|
+
var C = s[3], S = C === 24 ? 0 : C, O = s[0] + "-" + s[1] + "-" + s[2] + " " + S + ":" + s[4] + ":" + s[5] + ":000", U = +d;
|
|
785
|
+
return (l.utc(O).valueOf() - (U -= U % 1e3)) / 6e4;
|
|
786
|
+
}, p = c.prototype;
|
|
787
|
+
p.tz = function(d, b) {
|
|
788
|
+
d === void 0 && (d = u);
|
|
789
|
+
var h, s = this.utcOffset(), g = this.toDate(), f = g.toLocaleString("en-US", { timeZone: d }), i = Math.round((g - new Date(f)) / 1e3 / 60), m = 15 * -Math.round(g.getTimezoneOffset() / 15) - i;
|
|
790
|
+
if (!Number(m))
|
|
791
|
+
h = this.utcOffset(0, b);
|
|
792
|
+
else if (h = l(f, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(m, !0), b) {
|
|
793
|
+
var $ = h.utcOffset();
|
|
794
|
+
h = h.add(s - $, "minute");
|
|
795
|
+
}
|
|
796
|
+
return h.$x.$timezone = d, h;
|
|
797
|
+
}, p.offsetName = function(d) {
|
|
798
|
+
var b = this.$x.$timezone || l.tz.guess(), h = r(this.valueOf(), b, { timeZoneName: d }).find(function(s) {
|
|
799
|
+
return s.type.toLowerCase() === "timezonename";
|
|
800
|
+
});
|
|
801
|
+
return h && h.value;
|
|
802
|
+
};
|
|
803
|
+
var k = p.startOf;
|
|
804
|
+
p.startOf = function(d, b) {
|
|
805
|
+
if (!this.$x || !this.$x.$timezone)
|
|
806
|
+
return k.call(this, d, b);
|
|
807
|
+
var h = l(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
808
|
+
return k.call(h, d, b).tz(this.$x.$timezone, !0);
|
|
809
|
+
}, l.tz = function(d, b, h) {
|
|
810
|
+
var s = h && b, g = h || b || u, f = v(+l(), g);
|
|
811
|
+
if (typeof d != "string")
|
|
812
|
+
return l(d).tz(g);
|
|
813
|
+
var i = function(S, O, U) {
|
|
814
|
+
var I = S - 60 * O * 1e3, y = v(I, U);
|
|
815
|
+
if (O === y)
|
|
816
|
+
return [I, O];
|
|
817
|
+
var _ = v(I -= 60 * (y - O) * 1e3, U);
|
|
818
|
+
return y === _ ? [I, y] : [S - 60 * Math.min(y, _) * 1e3, Math.max(y, _)];
|
|
819
|
+
}(l.utc(d, s).valueOf(), f, g), m = i[0], $ = i[1], C = l(m).utcOffset($);
|
|
820
|
+
return C.$x.$timezone = g, C;
|
|
821
|
+
}, l.tz.guess = function() {
|
|
822
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
823
|
+
}, l.tz.setDefault = function(d) {
|
|
824
|
+
u = d;
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
});
|
|
828
|
+
})(_e);
|
|
829
|
+
var Xe = _e.exports;
|
|
830
|
+
const et = /* @__PURE__ */ Ce(Xe);
|
|
831
|
+
pe.extend(Qe);
|
|
832
|
+
pe.extend(et);
|
|
833
|
+
async function wt(n, e) {
|
|
834
|
+
const { fields: t, range: o = 1 } = e;
|
|
835
|
+
if (!t)
|
|
836
|
+
throw new Error("请输入列字段映射");
|
|
837
|
+
let a = new me.Workbook();
|
|
838
|
+
await a.xlsx.load(n);
|
|
839
|
+
const c = {};
|
|
840
|
+
return a.eachSheet(function(l, u) {
|
|
841
|
+
const r = [];
|
|
842
|
+
l.eachRow(function(v, p) {
|
|
843
|
+
if (p > o) {
|
|
844
|
+
let k = {}, d = !0;
|
|
845
|
+
Object.keys(t).forEach((b) => {
|
|
846
|
+
const h = v.getCell(t[b]).value;
|
|
847
|
+
k[b] = h, h && (d = !1);
|
|
848
|
+
}), d || r.push(k);
|
|
849
|
+
}
|
|
850
|
+
}), c[l._name] = r;
|
|
851
|
+
}), a = null, c;
|
|
852
|
+
}
|
|
853
|
+
const tt = {
|
|
854
|
+
columnWidth: 30
|
|
855
|
+
};
|
|
856
|
+
async function $t(n, e, t = [], o = {}) {
|
|
857
|
+
if (!n || !e)
|
|
858
|
+
return;
|
|
859
|
+
const { columnStyle: a } = o, { columnWidth: c } = tt;
|
|
860
|
+
e.forEach((r) => {
|
|
861
|
+
r.width = r.width ? r.width : c;
|
|
862
|
+
});
|
|
863
|
+
const { workbook: l, worksheet: u } = nt();
|
|
864
|
+
u.columns = e, u.addRows(t), a && await ot(l, u, a);
|
|
865
|
+
try {
|
|
866
|
+
const r = await l.xlsx.writeBuffer(), v = new File([r], n, {
|
|
867
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
868
|
+
});
|
|
869
|
+
Fe(v);
|
|
870
|
+
} catch (r) {
|
|
871
|
+
console.log(r);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
function nt() {
|
|
875
|
+
const n = new me.Workbook();
|
|
876
|
+
n.creator = "distributor System", n.lastModifiedBy = "distributor System", n.created = /* @__PURE__ */ new Date(), n.modified = /* @__PURE__ */ new Date(), n.lastPrinted = /* @__PURE__ */ new Date();
|
|
877
|
+
const e = n.addWorksheet("Sheet1");
|
|
878
|
+
return { workbook: n, worksheet: e };
|
|
879
|
+
}
|
|
880
|
+
async function ot(n, e, t) {
|
|
881
|
+
const o = Object.keys(t);
|
|
882
|
+
for (const a of o) {
|
|
883
|
+
const c = t[a], { type: l } = c;
|
|
884
|
+
switch (l) {
|
|
885
|
+
case "IMG":
|
|
886
|
+
await at(n, e, a);
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
async function at(n, e, t, o) {
|
|
892
|
+
const a = e.getColumn(t), c = a.values;
|
|
893
|
+
e.getColumn(t).width = 20, e.eachRow((l, u) => {
|
|
894
|
+
u > 1 && (l.height = 40);
|
|
895
|
+
});
|
|
896
|
+
for (let l = 0, u = c.length; l < u; l++) {
|
|
897
|
+
if (l < 2)
|
|
898
|
+
continue;
|
|
899
|
+
let r = c[l];
|
|
900
|
+
r && (e.getCell(a.letter + l).value = "", await lt(n, e, r, {
|
|
901
|
+
width: 100,
|
|
902
|
+
height: 50,
|
|
903
|
+
col: a._number - 1,
|
|
904
|
+
row: l - 1
|
|
905
|
+
}));
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
async function lt(n, e, t, o) {
|
|
909
|
+
const { col: a, row: c, width: l, height: u } = o, { success: r, base64: v } = await rt(t, 0.3);
|
|
910
|
+
if (r) {
|
|
911
|
+
const p = n.addImage({
|
|
912
|
+
base64: v,
|
|
913
|
+
extension: "jpeg"
|
|
914
|
+
});
|
|
915
|
+
e.addImage(p, {
|
|
916
|
+
tl: { col: a, row: c },
|
|
917
|
+
ext: { width: l, height: u }
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
function rt(n, e = 1) {
|
|
922
|
+
const t = new Image();
|
|
923
|
+
return t.setAttribute("crossOrigin", "anonymous"), t.crossOrigin = "anonymous", t.src = n, new Promise((o, a) => {
|
|
924
|
+
t.onload = () => {
|
|
925
|
+
const c = document.createElement("canvas");
|
|
926
|
+
c.width = t.width, c.height = t.height, c.getContext("2d").drawImage(t, 0, 0, c.width, c.height), o({
|
|
927
|
+
success: !0,
|
|
928
|
+
//canvas.toDataURL的方法将图片的绝对路径转换为base64编码
|
|
929
|
+
base64: c.toDataURL("image/jpeg", e)
|
|
930
|
+
});
|
|
931
|
+
}, t.onerror = () => {
|
|
932
|
+
o({ success: !1 });
|
|
933
|
+
};
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
function it(n) {
|
|
937
|
+
if (n < 26)
|
|
938
|
+
return String.fromCharCode(65 + n);
|
|
939
|
+
{
|
|
940
|
+
const e = String.fromCharCode(65 + Math.floor((n - 26) / 26)), t = String.fromCharCode(65 + (n - 26) % 26);
|
|
941
|
+
return e + t;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
class St {
|
|
945
|
+
constructor(e = {}) {
|
|
946
|
+
this.config = {
|
|
947
|
+
clientCode: e.clientCode || "one-portal",
|
|
948
|
+
casServerUrl: `https://one-portal${e.isTest ? "-test" : ""}.joy-group.com/api`,
|
|
949
|
+
casPortalUrl: `https://one-portal${e.isTest ? "-test" : ""}.joy-group.com`,
|
|
950
|
+
serviceUrl: e.serviceUrl || window.location.origin + "/cas/callback",
|
|
951
|
+
tokenKey: e.tokenKey || "one_portal_token",
|
|
952
|
+
userKey: e.userKey || "one_portal_user",
|
|
953
|
+
debug: e.debug || !1,
|
|
954
|
+
autoLogin: e.autoLogin !== !1,
|
|
955
|
+
// 默认开启自动登录
|
|
956
|
+
loginCallback: e.loginCallback || null,
|
|
957
|
+
logoutCallback: e.logoutCallback || null,
|
|
958
|
+
errorCallback: e.errorCallback || null
|
|
959
|
+
}, this.token = null, this.user = null, this.init();
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* 初始化SDK
|
|
963
|
+
*/
|
|
964
|
+
init() {
|
|
965
|
+
this.log("OnePortal CAS SDK 初始化中..."), this.loadFromStorage();
|
|
966
|
+
const t = new URLSearchParams(window.location.search).get("ticket");
|
|
967
|
+
this.isLoggedIn() && this.config.loginCallback ? this.config.loginCallback(this.user, this.token) : t ? (this.log("检测到ST票据:", t), this.validateTicket(t)) : this.config.autoLogin && !this.isLoggedIn() && (this.log("用户未登录,准备跳转到CAS登录页面"), this.login());
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* 从本地存储加载数据
|
|
971
|
+
*/
|
|
972
|
+
loadFromStorage() {
|
|
973
|
+
try {
|
|
974
|
+
this.token = localStorage.getItem(this.config.tokenKey);
|
|
975
|
+
const e = localStorage.getItem(this.config.userKey);
|
|
976
|
+
e && (this.user = JSON.parse(e)), this.log("从本地存储加载数据:", { token: !!this.token, user: !!this.user });
|
|
977
|
+
} catch (e) {
|
|
978
|
+
this.log("加载本地存储数据失败:", e);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* 保存到本地存储
|
|
983
|
+
*/
|
|
984
|
+
saveToStorage() {
|
|
985
|
+
try {
|
|
986
|
+
this.token && localStorage.setItem(this.config.tokenKey, this.token), this.user && localStorage.setItem(this.config.userKey, JSON.stringify(this.user)), this.log("数据已保存到本地存储");
|
|
987
|
+
} catch (e) {
|
|
988
|
+
this.log("保存到本地存储失败:", e);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* 清除本地存储
|
|
993
|
+
*/
|
|
994
|
+
clearStorage() {
|
|
995
|
+
try {
|
|
996
|
+
localStorage.removeItem(this.config.tokenKey), localStorage.removeItem(this.config.userKey), this.log("本地存储已清除");
|
|
997
|
+
} catch (e) {
|
|
998
|
+
this.log("清除本地存储失败:", e);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* 检查用户是否已登录
|
|
1003
|
+
*/
|
|
1004
|
+
isLoggedIn() {
|
|
1005
|
+
return !!(this.token && this.user);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* 获取当前用户信息
|
|
1009
|
+
*/
|
|
1010
|
+
getUser() {
|
|
1011
|
+
return this.user;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* 获取当前token
|
|
1015
|
+
*/
|
|
1016
|
+
getToken() {
|
|
1017
|
+
return this.token;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* 登录 - 跳转到CAS登录页面
|
|
1021
|
+
*/
|
|
1022
|
+
login() {
|
|
1023
|
+
const e = `${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;
|
|
1024
|
+
this.log("跳转到CAS登录页面:", e), window.location.href = e;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* 验证ST票据
|
|
1028
|
+
*/
|
|
1029
|
+
async validateTicket(e) {
|
|
1030
|
+
try {
|
|
1031
|
+
this.log("验证ST票据:", e);
|
|
1032
|
+
const t = await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${e}`, {
|
|
1033
|
+
method: "GET",
|
|
1034
|
+
headers: {
|
|
1035
|
+
"Content-Type": "application/json"
|
|
1036
|
+
}
|
|
1037
|
+
});
|
|
1038
|
+
if (!t.ok)
|
|
1039
|
+
throw new Error(`HTTP ${t.status}: ${t.statusText}`);
|
|
1040
|
+
const o = await t.json();
|
|
1041
|
+
if (o.success && o.data)
|
|
1042
|
+
return this.token = o.data.token, this.user = o.data.user, this.saveToStorage(), this.clearTicketFromUrl(), this.log("ST票据验证成功,用户登录成功:", this.user), this.config.loginCallback && this.config.loginCallback(this.user, this.token), !0;
|
|
1043
|
+
throw new Error(o.message || "ST票据验证失败");
|
|
1044
|
+
} catch (t) {
|
|
1045
|
+
return this.log("ST票据验证失败:", t), this.handleError(t), !1;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* 清除URL中的ticket参数
|
|
1050
|
+
*/
|
|
1051
|
+
clearTicketFromUrl() {
|
|
1052
|
+
const e = new URL(window.location);
|
|
1053
|
+
e.searchParams.delete("ticket"), window.history.replaceState({}, document.title, e.toString());
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* 登出
|
|
1057
|
+
*/
|
|
1058
|
+
async logout(e = !0) {
|
|
1059
|
+
try {
|
|
1060
|
+
if (this.log("用户登出"), this.token)
|
|
1061
|
+
try {
|
|
1062
|
+
await fetch(`${this.config.casServerUrl}/auth/logout`, {
|
|
1063
|
+
method: "POST",
|
|
1064
|
+
headers: {
|
|
1065
|
+
AppId: this.config.clientCode,
|
|
1066
|
+
Authorization: `Bearer ${this.token}`,
|
|
1067
|
+
"Content-Type": "application/json"
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
} catch (t) {
|
|
1071
|
+
this.log("调用服务端登出接口失败:", t);
|
|
1072
|
+
}
|
|
1073
|
+
this.token = null, this.user = null, this.clearStorage(), this.config.logoutCallback && this.config.logoutCallback(), e && this.login();
|
|
1074
|
+
} catch (t) {
|
|
1075
|
+
this.log("登出失败:", t), this.handleError(t);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* 发送带认证的HTTP请求
|
|
1080
|
+
*/
|
|
1081
|
+
async request(e, t = {}) {
|
|
1082
|
+
const o = {
|
|
1083
|
+
headers: {
|
|
1084
|
+
"Content-Type": "application/json",
|
|
1085
|
+
...t.headers
|
|
1086
|
+
},
|
|
1087
|
+
...t
|
|
1088
|
+
};
|
|
1089
|
+
o.headers.appId = this.config.clientCode, this.token && (o.headers.Authorization = `Bearer ${this.token}`);
|
|
1090
|
+
try {
|
|
1091
|
+
const a = await fetch(e, o);
|
|
1092
|
+
return a.status === 401 ? (this.log("Token已过期,需要重新登录"), this.logout(), null) : a;
|
|
1093
|
+
} catch (a) {
|
|
1094
|
+
throw this.log("请求失败:", a), a;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* 获取用户信息(从服务端)
|
|
1099
|
+
*/
|
|
1100
|
+
async fetchUserInfo() {
|
|
1101
|
+
try {
|
|
1102
|
+
const e = await this.request(`${this.config.casServerUrl}/auth/user`);
|
|
1103
|
+
if (e && e.ok) {
|
|
1104
|
+
const t = await e.json();
|
|
1105
|
+
if (t.success && t.data)
|
|
1106
|
+
return this.user = t.data, this.saveToStorage(), this.user;
|
|
1107
|
+
}
|
|
1108
|
+
return null;
|
|
1109
|
+
} catch (e) {
|
|
1110
|
+
return this.log("获取用户信息失败:", e), null;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* 刷新token
|
|
1115
|
+
*/
|
|
1116
|
+
async refreshToken() {
|
|
1117
|
+
this.log("Token刷新功能暂未实现");
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* 错误处理
|
|
1121
|
+
*/
|
|
1122
|
+
handleError(e) {
|
|
1123
|
+
this.log("发生错误:", e), this.config.errorCallback && this.config.errorCallback(e);
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* 日志输出
|
|
1127
|
+
*/
|
|
1128
|
+
log(...e) {
|
|
1129
|
+
this.config.debug && console.log("[OnePortal CAS SDK]", ...e);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* 检查登录状态并自动处理
|
|
1133
|
+
*/
|
|
1134
|
+
checkLoginStatus() {
|
|
1135
|
+
return !this.isLoggedIn() && this.config.autoLogin ? (this.login(), !1) : this.isLoggedIn();
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* 设置配置
|
|
1139
|
+
*/
|
|
1140
|
+
setConfig(e, t) {
|
|
1141
|
+
this.config[e] = t;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* 获取配置
|
|
1145
|
+
*/
|
|
1146
|
+
getConfig(e) {
|
|
1147
|
+
return this.config[e];
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
function xt(n) {
|
|
1151
|
+
return new Promise((e) => {
|
|
1152
|
+
setTimeout(() => {
|
|
1153
|
+
e();
|
|
1154
|
+
}, n);
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
function Tt(n) {
|
|
1158
|
+
return JSON.parse(JSON.stringify(n));
|
|
1159
|
+
}
|
|
1160
|
+
function Dt(n) {
|
|
1161
|
+
let e = [], t = {}, o = (a, c) => Object.prototype.hasOwnProperty.call(a, c);
|
|
1162
|
+
for (const a of n) {
|
|
1163
|
+
t[a.id] = {
|
|
1164
|
+
...a,
|
|
1165
|
+
// 判断当前项的子项 如果map有存储就用存储的子项 否则初始化
|
|
1166
|
+
children: o(t, a.id) ? t[a.id].children : []
|
|
1167
|
+
};
|
|
1168
|
+
const c = t[a.id];
|
|
1169
|
+
a.pid == -1 ? e.push(c) : (o(t, a.pid) || (t[a.pid] = {
|
|
1170
|
+
children: []
|
|
1171
|
+
}), t[a.pid].children.push(c));
|
|
1172
|
+
}
|
|
1173
|
+
return e;
|
|
1174
|
+
}
|
|
1175
|
+
function Ot(n, e = " ") {
|
|
1176
|
+
return n ? n.split(e).filter((t) => t.trim()) : [];
|
|
1177
|
+
}
|
|
1178
|
+
class se {
|
|
1179
|
+
constructor(e, t = ["label", "value", "labelEn"]) {
|
|
1180
|
+
this.list = e, this.map = new Map(
|
|
1181
|
+
e.map((o) => {
|
|
1182
|
+
let a = {
|
|
1183
|
+
...o,
|
|
1184
|
+
label: o[t[0]],
|
|
1185
|
+
value: o[t[1]]
|
|
1186
|
+
};
|
|
1187
|
+
return t[2] && (a.labelEn = o[t[2]]), [o[t[1]], a];
|
|
1188
|
+
})
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
getName(e, t) {
|
|
1192
|
+
if (!this.has(e))
|
|
1193
|
+
return "-";
|
|
1194
|
+
const { label: o, labelEn: a } = this.map.get(e);
|
|
1195
|
+
return (t == "zh_cn" ? o : a) || o || "-";
|
|
1196
|
+
}
|
|
1197
|
+
getTag(e) {
|
|
1198
|
+
if (!this.has(e))
|
|
1199
|
+
return "info";
|
|
1200
|
+
const { tag: t = "info" } = this.map.get(e);
|
|
1201
|
+
return t;
|
|
1202
|
+
}
|
|
1203
|
+
getItem(e) {
|
|
1204
|
+
return this.has(e) ? this.map.get(e) : null;
|
|
1205
|
+
}
|
|
1206
|
+
getColor(e) {
|
|
1207
|
+
if (!this.has(e))
|
|
1208
|
+
return null;
|
|
1209
|
+
const { color: t } = this.map.get(e);
|
|
1210
|
+
return t;
|
|
1211
|
+
}
|
|
1212
|
+
has(e) {
|
|
1213
|
+
return this.map.has(e);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
function zt(n, e = [], t = "i18nName") {
|
|
1217
|
+
if (n.length == 0)
|
|
1218
|
+
return new se([]);
|
|
1219
|
+
if (e.length < 2)
|
|
1220
|
+
throw new Error("keys 长度必须大于2 默认前两位为 label value ");
|
|
1221
|
+
let o = n.map((a) => {
|
|
1222
|
+
let c = {};
|
|
1223
|
+
return t && (c.labelEn = a[t]), e.forEach((l, u) => {
|
|
1224
|
+
u === 0 ? c.label = a[l] : u === 1 ? c.value = a[l] : c[l] = a[l];
|
|
1225
|
+
}), c;
|
|
1226
|
+
});
|
|
1227
|
+
return new se(o);
|
|
1228
|
+
}
|
|
1229
|
+
function Et(n) {
|
|
1230
|
+
return n ? n.replace(/<[^>]+>/g, "") : "";
|
|
1231
|
+
}
|
|
1232
|
+
function Ut(n) {
|
|
1233
|
+
return n ? (n.includes("\\\\u") && (n = n.replace(/\\/g, "")), n.replace(/\\u[\dA-F]{4}/gi, (e) => String.fromCharCode(parseInt(e.replace(/\\u/g, ""), 16)))) : "";
|
|
1234
|
+
}
|
|
1235
|
+
function It(n, e = 10) {
|
|
1236
|
+
let t = 1048576 * e;
|
|
1237
|
+
return !(n.size > t);
|
|
1238
|
+
}
|
|
1239
|
+
function Vt(n) {
|
|
1240
|
+
return Array.from(10).fill(0).map((t, o) => n + "_" + o);
|
|
1241
|
+
}
|
|
1242
|
+
function Ft(n) {
|
|
1243
|
+
let e = {};
|
|
1244
|
+
return n.map((t, o) => {
|
|
1245
|
+
let { key: a, option: c, type: l } = t, u = it(o);
|
|
1246
|
+
c ? e[a] = `${u}---option` : l === "image" ? e[a] = `${u}---image` : e[a] = u;
|
|
1247
|
+
}), e;
|
|
1248
|
+
}
|
|
1249
|
+
function Lt(n, e) {
|
|
1250
|
+
return e.split(".").reduce((t, o) => t && t[o], n);
|
|
1251
|
+
}
|
|
636
1252
|
export {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
1253
|
+
Ae as CmpDictionary,
|
|
1254
|
+
yt as ConfrimButton,
|
|
1255
|
+
Ct as ImportButton,
|
|
1256
|
+
vt as LayOutForm,
|
|
1257
|
+
bt as ListPage,
|
|
1258
|
+
St as OnePortalCasSDK,
|
|
1259
|
+
qe as SearchBar,
|
|
1260
|
+
se as StatusMap,
|
|
1261
|
+
Tt as _toRaw,
|
|
1262
|
+
zt as arrToStatusMap,
|
|
1263
|
+
Dt as arrayToTree,
|
|
1264
|
+
It as checkFileSize,
|
|
1265
|
+
_t as creatValidator,
|
|
1266
|
+
Ft as createImportFields,
|
|
1267
|
+
Vt as createListPageId,
|
|
1268
|
+
kt as crypto,
|
|
1269
|
+
$t as exportExcel,
|
|
1270
|
+
Lt as getValueBykey,
|
|
1271
|
+
wt as importExcel,
|
|
1272
|
+
xt as sleep,
|
|
1273
|
+
Ot as stringToArray,
|
|
1274
|
+
Et as stripHtmlTags,
|
|
1275
|
+
Ut as unicode2Str
|
|
643
1276
|
};
|