joy-admin-components 0.2.73 → 0.2.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2376 +1,2045 @@
1
- import { ElForm as $t, ElRow as St, ElCol as Ft, ElMessageBox as Lt, ElInputNumber as Et, ElText as It, ElLink as Je } from "element-plus";
2
- import { defineComponent as ot, ref as j, onMounted as lt, h as ze, mergeModels as Xe, useAttrs as Tt, useModel as Dt, computed as ue, watch as Re, resolveComponent as O, unref as N, openBlock as E, createBlock as W, mergeProps as de, createSlots as at, withCtx as D, createElementVNode as ie, toDisplayString as te, renderSlot as Q, createVNode as z, createTextVNode as ne, createCommentVNode as me, createElementBlock as ce, Fragment as Ve, renderList as rt, withModifiers as qe, nextTick as be, resolveDynamicComponent as st, withKeys as Mt, normalizeStyle as zt, normalizeClass as it, reactive as Ee, onUpdated as Ot, onUnmounted as Vt, withDirectives as qt, isVNode as Pt } from "vue";
3
- import { saveAs as ct } from "file-saver";
4
- import Te from "exceljs";
5
- import Fe from "dayjs";
6
- import { createI18n as At, useI18n as we } from "vue-i18n";
7
- import { debounce as Be, cloneDeep as ut, isArray as Qe } from "lodash";
8
- import { useRoute as Ut, useRouter as jt } from "vue-router";
9
- import { createNamespacedHelpers as Ye, useStore as dt, mapState as Rt, mapGetters as Bt, mapActions as Yt } from "vuex";
10
- import { VxeUI as he } from "vxe-pc-ui";
11
- const Kn = ot({
12
- name: "LayOutForm",
13
- setup(e, { slots: t, attrs: n, emit: a }) {
14
- const r = j(null), o = () => t.default ? t.default().filter((s) => s.type !== Symbol.for("v-cmt")).map((s) => s.type === Symbol.for("v-fgt") ? s.children : s).flat().map(
15
- (s) => {
16
- var i, g, m, p;
17
- return ze(
18
- Ft,
19
- {
20
- span: ((i = s.props) == null ? void 0 : i.span) || ((m = (g = s.props) == null ? void 0 : g.colProps) == null ? void 0 : m.span) || 24,
21
- //兼容老写法
22
- ...(p = s.props) == null ? void 0 : p.colProps
23
- },
24
- {
25
- default: () => s
26
- }
27
- );
28
- }
29
- ) : null;
30
- lt(() => {
31
- a("ref", r.value);
32
- });
33
- function l() {
34
- return ze(
35
- $t,
36
- { ...n, ref: r },
37
- () => ze(St, { gutter: n.gutter ?? 20 }, { default: () => o() })
38
- );
39
- }
40
- return l;
41
- }
42
- });
43
- var ft = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
44
- function ht(e) {
45
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1
+ import { ElCol as e, ElForm as t, ElInputNumber as n, ElLink as r, ElMessageBox as i, ElRow as a, ElText as o } from "element-plus";
2
+ import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createSlots as p, createTextVNode as m, createVNode as h, defineComponent as g, h as _, isVNode as v, mergeModels as y, mergeProps as b, nextTick as x, normalizeClass as S, normalizeStyle as C, onMounted as w, onUnmounted as T, onUpdated as E, openBlock as D, reactive as O, ref as k, renderList as A, renderSlot as j, resolveComponent as M, resolveDynamicComponent as N, toDisplayString as P, unref as F, useAttrs as ee, useModel as I, watch as L, withCtx as R, withDirectives as z, withKeys as B, withModifiers as te } from "vue";
3
+ import { saveAs as V } from "file-saver";
4
+ import H from "exceljs";
5
+ import U from "dayjs";
6
+ import { createI18n as W, useI18n as G } from "vue-i18n";
7
+ import { cloneDeep as ne, debounce as re, isArray as ie } from "lodash";
8
+ import { useRoute as ae, useRouter as oe } from "vue-router";
9
+ import { createNamespacedHelpers as se, mapActions as ce, mapGetters as le, mapState as ue, useStore as K } from "vuex";
10
+ import { VxeUI as q } from "vxe-pc-ui";
11
+ //#region \0rolldown/runtime.js
12
+ var J = Object.create, Y = Object.defineProperty, X = Object.getOwnPropertyDescriptor, de = Object.getOwnPropertyNames, fe = Object.getPrototypeOf, pe = Object.prototype.hasOwnProperty, me = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), he = (e, t, n, r) => {
13
+ if (t && typeof t == "object" || typeof t == "function") for (var i = de(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !pe.call(e, s) && s !== n && Y(e, s, {
14
+ get: ((e) => t[e]).bind(null, s),
15
+ enumerable: !(r = X(t, s)) || r.enumerable
16
+ });
17
+ return e;
18
+ }, ge = (e, t, n) => (n = e == null ? {} : J(fe(e)), he(t || !e || !e.__esModule ? Y(n, "default", {
19
+ value: e,
20
+ enumerable: !0
21
+ }) : n, e)), _e = g({
22
+ name: "LayOutForm",
23
+ setup(n, { slots: r, attrs: i, emit: o }) {
24
+ let s = k(null), c = () => r.default ? r.default().filter((e) => e.type !== Symbol.for("v-cmt")).map((e) => e.type === Symbol.for("v-fgt") ? e.children : e).flat().map((t) => _(e, {
25
+ span: t.props?.span || t.props?.colProps?.span || 24,
26
+ ...t.props?.colProps
27
+ }, { default: () => t })) : null;
28
+ w(() => {
29
+ o("ref", s.value);
30
+ });
31
+ function l() {
32
+ return _(t, {
33
+ ...i,
34
+ ref: s
35
+ }, () => _(a, { gutter: i.gutter ?? 20 }, { default: () => c() }));
36
+ }
37
+ return l;
38
+ }
39
+ }), ve = /* @__PURE__ */ me(((e, t) => {
40
+ (function(n, r) {
41
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_utc = r();
42
+ })(e, (function() {
43
+ var e = "minute", t = /[+-]\d\d(?::?\d\d)?/g, n = /([+-]|\d\d)/g;
44
+ return function(r, i, a) {
45
+ var o = i.prototype;
46
+ a.utc = function(e) {
47
+ return new i({
48
+ date: e,
49
+ utc: !0,
50
+ args: arguments
51
+ });
52
+ }, o.utc = function(t) {
53
+ var n = a(this.toDate(), {
54
+ locale: this.$L,
55
+ utc: !0
56
+ });
57
+ return t ? n.add(this.utcOffset(), e) : n;
58
+ }, o.local = function() {
59
+ return a(this.toDate(), {
60
+ locale: this.$L,
61
+ utc: !1
62
+ });
63
+ };
64
+ var s = o.parse;
65
+ o.parse = function(e) {
66
+ e.utc && (this.$u = !0), this.$utils().u(e.$offset) || (this.$offset = e.$offset), s.call(this, e);
67
+ };
68
+ var c = o.init;
69
+ o.init = function() {
70
+ if (this.$u) {
71
+ var e = this.$d;
72
+ this.$y = e.getUTCFullYear(), this.$M = e.getUTCMonth(), this.$D = e.getUTCDate(), this.$W = e.getUTCDay(), this.$H = e.getUTCHours(), this.$m = e.getUTCMinutes(), this.$s = e.getUTCSeconds(), this.$ms = e.getUTCMilliseconds();
73
+ } else c.call(this);
74
+ };
75
+ var l = o.utcOffset;
76
+ o.utcOffset = function(r, i) {
77
+ var a = this.$utils().u;
78
+ if (a(r)) return this.$u ? 0 : a(this.$offset) ? l.call(this) : this.$offset;
79
+ if (typeof r == "string" && (r = function(e) {
80
+ e === void 0 && (e = "");
81
+ var r = e.match(t);
82
+ if (!r) return null;
83
+ var i = ("" + r[0]).match(n) || [
84
+ "-",
85
+ 0,
86
+ 0
87
+ ], a = i[0], o = 60 * i[1] + +i[2];
88
+ return o === 0 ? 0 : a === "+" ? o : -o;
89
+ }(r), r === null)) return this;
90
+ var o = Math.abs(r) <= 16 ? 60 * r : r;
91
+ if (o === 0) return this.utc(i);
92
+ var s = this.clone();
93
+ if (i) return s.$offset = o, s.$u = !1, s;
94
+ var c = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
95
+ return (s = this.local().add(o + c, e)).$offset = o, s.$x.$localOffset = c, s;
96
+ };
97
+ var u = o.format;
98
+ o.format = function(e) {
99
+ var t = e || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
100
+ return u.call(this, t);
101
+ }, o.valueOf = function() {
102
+ var e = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
103
+ return this.$d.valueOf() - 6e4 * e;
104
+ }, o.isUTC = function() {
105
+ return !!this.$u;
106
+ }, o.toISOString = function() {
107
+ return this.toDate().toISOString();
108
+ }, o.toString = function() {
109
+ return this.toDate().toUTCString();
110
+ };
111
+ var d = o.toDate;
112
+ o.toDate = function(e) {
113
+ return e === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : d.call(this);
114
+ };
115
+ var f = o.diff;
116
+ o.diff = function(e, t, n) {
117
+ if (e && this.$u === e.$u) return f.call(this, e, t, n);
118
+ var r = this.local(), i = a(e).local();
119
+ return f.call(r, i, t, n);
120
+ };
121
+ };
122
+ }));
123
+ })), ye = /* @__PURE__ */ me(((e, t) => {
124
+ (function(n, r) {
125
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_timezone = r();
126
+ })(e, (function() {
127
+ var e = {
128
+ year: 0,
129
+ month: 1,
130
+ day: 2,
131
+ hour: 3,
132
+ minute: 4,
133
+ second: 5
134
+ }, t = {};
135
+ return function(n, r, i) {
136
+ var a, o = function(e, n, r) {
137
+ r === void 0 && (r = {});
138
+ var i = new Date(e);
139
+ return function(e, n) {
140
+ n === void 0 && (n = {});
141
+ var r = n.timeZoneName || "short", i = e + "|" + r, a = t[i];
142
+ return a || (a = new Intl.DateTimeFormat("en-US", {
143
+ hour12: !1,
144
+ timeZone: e,
145
+ year: "numeric",
146
+ month: "2-digit",
147
+ day: "2-digit",
148
+ hour: "2-digit",
149
+ minute: "2-digit",
150
+ second: "2-digit",
151
+ timeZoneName: r
152
+ }), t[i] = a), a;
153
+ }(n, r).formatToParts(i);
154
+ }, s = function(t, n) {
155
+ for (var r = o(t, n), a = [], s = 0; s < r.length; s += 1) {
156
+ var c = r[s], l = c.type, u = c.value, d = e[l];
157
+ d >= 0 && (a[d] = parseInt(u, 10));
158
+ }
159
+ var f = a[3], p = f === 24 ? 0 : f, m = a[0] + "-" + a[1] + "-" + a[2] + " " + p + ":" + a[4] + ":" + a[5] + ":000", h = +t;
160
+ return (i.utc(m).valueOf() - (h -= h % 1e3)) / 6e4;
161
+ }, c = r.prototype;
162
+ c.tz = function(e, t) {
163
+ e === void 0 && (e = a);
164
+ var n, r = this.utcOffset(), o = this.toDate(), s = o.toLocaleString("en-US", { timeZone: e }), c = Math.round((o - new Date(s)) / 1e3 / 60), l = 15 * -Math.round(o.getTimezoneOffset() / 15) - c;
165
+ if (!Number(l)) n = this.utcOffset(0, t);
166
+ else if (n = i(s, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(l, !0), t) {
167
+ var u = n.utcOffset();
168
+ n = n.add(r - u, "minute");
169
+ }
170
+ return n.$x.$timezone = e, n;
171
+ }, c.offsetName = function(e) {
172
+ var t = this.$x.$timezone || i.tz.guess(), n = o(this.valueOf(), t, { timeZoneName: e }).find((function(e) {
173
+ return e.type.toLowerCase() === "timezonename";
174
+ }));
175
+ return n && n.value;
176
+ };
177
+ var l = c.startOf;
178
+ c.startOf = function(e, t) {
179
+ if (!this.$x || !this.$x.$timezone) return l.call(this, e, t);
180
+ var n = i(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
181
+ return l.call(n, e, t).tz(this.$x.$timezone, !0);
182
+ }, i.tz = function(e, t, n) {
183
+ var r = n && t, o = n || t || a, c = s(+i(), o);
184
+ if (typeof e != "string") return i(e).tz(o);
185
+ var l = function(e, t, n) {
186
+ var r = e - 60 * t * 1e3, i = s(r, n);
187
+ if (t === i) return [r, t];
188
+ var a = s(r -= 60 * (i - t) * 1e3, n);
189
+ return i === a ? [r, i] : [e - 60 * Math.min(i, a) * 1e3, Math.max(i, a)];
190
+ }(i.utc(e, r).valueOf(), c, o), u = l[0], d = l[1], f = i(u).utcOffset(d);
191
+ return f.$x.$timezone = o, f;
192
+ }, i.tz.guess = function() {
193
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
194
+ }, i.tz.setDefault = function(e) {
195
+ a = e;
196
+ };
197
+ };
198
+ }));
199
+ })), be = /* @__PURE__ */ ge(ve()), xe = /* @__PURE__ */ ge(ye()), Se = {
200
+ "dao-ru": "导入",
201
+ "quan-xuan": "全选",
202
+ "xia-zai-dao-ru-mo-ban": "下载导入模板",
203
+ "xu-hao": "序号",
204
+ "qing-shu-ru": "请输入",
205
+ "qing-xuan-ze": "请选择",
206
+ "kai-shi-shi-jian": "开始时间",
207
+ "jie-shu-shi-jian": "结束时间",
208
+ "shai-xuan": "筛选",
209
+ "chong-zhi": "重置",
210
+ "guan-bi": "关闭",
211
+ "zhan-kai": "展开",
212
+ "qu-xiao": "取消",
213
+ "ti-jiao": "提交",
214
+ "que-ding": "确定",
215
+ "que-ding-guan-bi-ma": "确定关闭吗",
216
+ "xia-zai-dao-ru-mo-ban": "下载导入模板",
217
+ excel: {
218
+ fieldsMappingRequired: "请输入列字段映射",
219
+ invalidInput: "非法输入",
220
+ invalidOption: "请输入有效选项!",
221
+ copyFailed: "复制失败",
222
+ sheetNameTooLong: "Sheet名称 \"{0}\" 长度超过31个字符,已自动截断为 \"{1}\""
223
+ },
224
+ validate: { invalidInput: "请输入正确内容" },
225
+ tools: { keysLengthError: "keys 长度必须大于2 默认前两位为 label value" }
226
+ }, Ce = {
227
+ "dao-ru": "Import",
228
+ "quan-xuan": "Select All",
229
+ "xia-zai-dao-ru-mo-ban": "Download Import Template",
230
+ "xu-hao": "No.",
231
+ "qing-shu-ru": "Please enter",
232
+ "qing-xuan-ze": "Please select",
233
+ "kai-shi-shi-jian": "Start Time",
234
+ "jie-shu-shi-jian": "End Time",
235
+ "shai-xuan": "Filter",
236
+ "chong-zhi": "Reset",
237
+ "guan-bi": "Collapse",
238
+ "zhan-kai": "Expand",
239
+ "qu-xiao": "Cancel",
240
+ "ti-jiao": "Submit",
241
+ "que-ding": "Confirm",
242
+ "que-ding-guan-bi-ma": "Are you sure to close?",
243
+ "xia-zai-dao-ru-mo-ban": "Download Import Template",
244
+ excel: {
245
+ fieldsMappingRequired: "Please enter column field mapping",
246
+ invalidInput: "Invalid input",
247
+ invalidOption: "Please enter a valid option!",
248
+ copyFailed: "Copy failed",
249
+ sheetNameTooLong: "Sheet name \"{0}\" exceeds 31 characters, automatically truncated to \"{1}\""
250
+ },
251
+ validate: { invalidInput: "Please enter valid content" },
252
+ tools: { keysLengthError: "Keys length must be greater than 2, default first two are label and value" }
253
+ }, we = {
254
+ zh_cn: Se,
255
+ en_us: Ce
256
+ }, Te = null;
257
+ function Ee(e = null) {
258
+ if (e) {
259
+ let { global: t } = e;
260
+ return t.messages.value.zh_cn ? t.mergeLocaleMessage("zh_cn", Se) : t.setLocaleMessage("zh_cn", Se), t.messages.value.en_us ? t.mergeLocaleMessage("en_us", Ce) : t.setLocaleMessage("en_us", Ce), Te = e, e;
261
+ }
262
+ return Te ||= W({
263
+ legacy: !1,
264
+ locale: "zh_cn",
265
+ fallbackLocale: "zh_cn",
266
+ messages: we
267
+ }), Te;
46
268
  }
47
- var mt = { exports: {} };
48
- (function(e, t) {
49
- (function(n, a) {
50
- e.exports = a();
51
- })(ft, function() {
52
- var n = "minute", a = /[+-]\d\d(?::?\d\d)?/g, r = /([+-]|\d\d)/g;
53
- return function(o, l, s) {
54
- var i = l.prototype;
55
- s.utc = function(c) {
56
- var v = { date: c, utc: !0, args: arguments };
57
- return new l(v);
58
- }, i.utc = function(c) {
59
- var v = s(this.toDate(), { locale: this.$L, utc: !0 });
60
- return c ? v.add(this.utcOffset(), n) : v;
61
- }, i.local = function() {
62
- return s(this.toDate(), { locale: this.$L, utc: !1 });
63
- };
64
- var g = i.parse;
65
- i.parse = function(c) {
66
- c.utc && (this.$u = !0), this.$utils().u(c.$offset) || (this.$offset = c.$offset), g.call(this, c);
67
- };
68
- var m = i.init;
69
- i.init = function() {
70
- if (this.$u) {
71
- var c = this.$d;
72
- this.$y = c.getUTCFullYear(), this.$M = c.getUTCMonth(), this.$D = c.getUTCDate(), this.$W = c.getUTCDay(), this.$H = c.getUTCHours(), this.$m = c.getUTCMinutes(), this.$s = c.getUTCSeconds(), this.$ms = c.getUTCMilliseconds();
73
- } else
74
- m.call(this);
75
- };
76
- var p = i.utcOffset;
77
- i.utcOffset = function(c, v) {
78
- var w = this.$utils().u;
79
- if (w(c))
80
- return this.$u ? 0 : w(this.$offset) ? p.call(this) : this.$offset;
81
- if (typeof c == "string" && (c = function(V) {
82
- V === void 0 && (V = "");
83
- var K = V.match(a);
84
- if (!K)
85
- return null;
86
- var I = ("" + K[0]).match(r) || ["-", 0, 0], A = I[0], $ = 60 * +I[1] + +I[2];
87
- return $ === 0 ? 0 : A === "+" ? $ : -$;
88
- }(c), c === null))
89
- return this;
90
- var x = Math.abs(c) <= 16 ? 60 * c : c;
91
- if (x === 0)
92
- return this.utc(v);
93
- var C = this.clone();
94
- if (v)
95
- return C.$offset = x, C.$u = !1, C;
96
- var S = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
97
- return (C = this.local().add(x + S, n)).$offset = x, C.$x.$localOffset = S, C;
98
- };
99
- var y = i.format;
100
- i.format = function(c) {
101
- var v = c || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
102
- return y.call(this, v);
103
- }, i.valueOf = function() {
104
- var c = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
105
- return this.$d.valueOf() - 6e4 * c;
106
- }, i.isUTC = function() {
107
- return !!this.$u;
108
- }, i.toISOString = function() {
109
- return this.toDate().toISOString();
110
- }, i.toString = function() {
111
- return this.toDate().toUTCString();
112
- };
113
- var h = i.toDate;
114
- i.toDate = function(c) {
115
- return c === "s" && this.$offset ? s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : h.call(this);
116
- };
117
- var f = i.diff;
118
- i.diff = function(c, v, w) {
119
- if (c && this.$u === c.$u)
120
- return f.call(this, c, v, w);
121
- var x = this.local(), C = s(c).local();
122
- return f.call(x, C, v, w);
123
- };
124
- };
125
- });
126
- })(mt);
127
- var Kt = mt.exports;
128
- const Ht = /* @__PURE__ */ ht(Kt);
129
- var gt = { exports: {} };
130
- (function(e, t) {
131
- (function(n, a) {
132
- e.exports = a();
133
- })(ft, function() {
134
- var n = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, a = {};
135
- return function(r, o, l) {
136
- var s, i = function(y, h, f) {
137
- f === void 0 && (f = {});
138
- var c = new Date(y), v = function(w, x) {
139
- x === void 0 && (x = {});
140
- var C = x.timeZoneName || "short", S = w + "|" + C, V = a[S];
141
- return V || (V = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: w, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: C }), a[S] = V), V;
142
- }(h, f);
143
- return v.formatToParts(c);
144
- }, g = function(y, h) {
145
- for (var f = i(y, h), c = [], v = 0; v < f.length; v += 1) {
146
- var w = f[v], x = w.type, C = w.value, S = n[x];
147
- S >= 0 && (c[S] = parseInt(C, 10));
148
- }
149
- var V = c[3], K = V === 24 ? 0 : V, I = c[0] + "-" + c[1] + "-" + c[2] + " " + K + ":" + c[4] + ":" + c[5] + ":000", A = +y;
150
- return (l.utc(I).valueOf() - (A -= A % 1e3)) / 6e4;
151
- }, m = o.prototype;
152
- m.tz = function(y, h) {
153
- y === void 0 && (y = s);
154
- var f, c = this.utcOffset(), v = this.toDate(), w = v.toLocaleString("en-US", { timeZone: y }), x = Math.round((v - new Date(w)) / 1e3 / 60), C = 15 * -Math.round(v.getTimezoneOffset() / 15) - x;
155
- if (!Number(C))
156
- f = this.utcOffset(0, h);
157
- else if (f = l(w, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(C, !0), h) {
158
- var S = f.utcOffset();
159
- f = f.add(c - S, "minute");
160
- }
161
- return f.$x.$timezone = y, f;
162
- }, m.offsetName = function(y) {
163
- var h = this.$x.$timezone || l.tz.guess(), f = i(this.valueOf(), h, { timeZoneName: y }).find(function(c) {
164
- return c.type.toLowerCase() === "timezonename";
165
- });
166
- return f && f.value;
167
- };
168
- var p = m.startOf;
169
- m.startOf = function(y, h) {
170
- if (!this.$x || !this.$x.$timezone)
171
- return p.call(this, y, h);
172
- var f = l(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
173
- return p.call(f, y, h).tz(this.$x.$timezone, !0);
174
- }, l.tz = function(y, h, f) {
175
- var c = f && h, v = f || h || s, w = g(+l(), v);
176
- if (typeof y != "string")
177
- return l(y).tz(v);
178
- var x = function(K, I, A) {
179
- var $ = K - 60 * I * 1e3, ee = g($, A);
180
- if (I === ee)
181
- return [$, I];
182
- var b = g($ -= 60 * (ee - I) * 1e3, A);
183
- return ee === b ? [$, ee] : [K - 60 * Math.min(ee, b) * 1e3, Math.max(ee, b)];
184
- }(l.utc(y, c).valueOf(), w, v), C = x[0], S = x[1], V = l(C).utcOffset(S);
185
- return V.$x.$timezone = v, V;
186
- }, l.tz.guess = function() {
187
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
188
- }, l.tz.setDefault = function(y) {
189
- s = y;
190
- };
191
- };
192
- });
193
- })(gt);
194
- var Nt = gt.exports;
195
- const Wt = /* @__PURE__ */ ht(Nt), Pe = {
196
- // 组件通用文本
197
- "dao-ru": "导入",
198
- "quan-xuan": "全选",
199
- "xia-zai-dao-ru-mo-ban": "下载导入模板",
200
- "xu-hao": "序号",
201
- "qing-shu-ru": "请输入",
202
- "qing-xuan-ze": "请选择",
203
- "kai-shi-shi-jian": "开始时间",
204
- "jie-shu-shi-jian": "结束时间",
205
- "shai-xuan": "筛选",
206
- "chong-zhi": "重置",
207
- "guan-bi": "关闭",
208
- "zhan-kai": "展开",
209
- "qu-xiao": "取消",
210
- "ti-jiao": "提交",
211
- "que-ding": "确定",
212
- "que-ding-guan-bi-ma": "确定关闭吗",
213
- "xia-zai-dao-ru-mo-ban": "下载导入模板",
214
- // Excel 工具相关
215
- excel: {
216
- fieldsMappingRequired: "请输入列字段映射",
217
- invalidInput: "非法输入",
218
- invalidOption: "请输入有效选项!",
219
- copyFailed: "复制失败",
220
- sheetNameTooLong: 'Sheet名称 "{0}" 长度超过31个字符,已自动截断为 "{1}"'
221
- },
222
- // 表单验证相关
223
- validate: {
224
- invalidInput: "请输入正确内容"
225
- },
226
- // 工具函数相关
227
- tools: {
228
- keysLengthError: "keys 长度必须大于2 默认前两位为 label value"
229
- }
230
- }, Ae = {
231
- // Common component text
232
- "dao-ru": "Import",
233
- "quan-xuan": "Select All",
234
- "xia-zai-dao-ru-mo-ban": "Download Import Template",
235
- "xu-hao": "No.",
236
- "qing-shu-ru": "Please enter",
237
- "qing-xuan-ze": "Please select",
238
- "kai-shi-shi-jian": "Start Time",
239
- "jie-shu-shi-jian": "End Time",
240
- "shai-xuan": "Filter",
241
- "chong-zhi": "Reset",
242
- "guan-bi": "Collapse",
243
- "zhan-kai": "Expand",
244
- "qu-xiao": "Cancel",
245
- "ti-jiao": "Submit",
246
- "que-ding": "Confirm",
247
- "que-ding-guan-bi-ma": "Are you sure to close?",
248
- "xia-zai-dao-ru-mo-ban": "Download Import Template",
249
- // Excel utilities
250
- excel: {
251
- fieldsMappingRequired: "Please enter column field mapping",
252
- invalidInput: "Invalid input",
253
- invalidOption: "Please enter a valid option!",
254
- copyFailed: "Copy failed",
255
- sheetNameTooLong: 'Sheet name "{0}" exceeds 31 characters, automatically truncated to "{1}"'
256
- },
257
- // Form validation
258
- validate: {
259
- invalidInput: "Please enter valid content"
260
- },
261
- // Tool functions
262
- tools: {
263
- keysLengthError: "Keys length must be greater than 2, default first two are label and value"
264
- }
265
- }, Zt = {
266
- zh_cn: Pe,
267
- en_us: Ae
268
- };
269
- let Ce = null;
270
- function Gt(e = null) {
271
- if (e) {
272
- const { global: t } = e;
273
- return t.messages.value.zh_cn ? t.mergeLocaleMessage("zh_cn", Pe) : t.setLocaleMessage("zh_cn", Pe), t.messages.value.en_us ? t.mergeLocaleMessage("en_us", Ae) : t.setLocaleMessage("en_us", Ae), Ce = e, e;
274
- }
275
- return Ce || (Ce = At({
276
- legacy: !1,
277
- locale: "zh_cn",
278
- fallbackLocale: "zh_cn",
279
- messages: Zt
280
- })), Ce;
281
- }
282
- function Ke() {
283
- return Ce || Gt();
269
+ function De() {
270
+ return Te || Ee();
284
271
  }
285
- function xe() {
286
- return Ke().global.t;
272
+ function Z() {
273
+ return De().global.t;
287
274
  }
288
- Fe.extend(Ht);
289
- Fe.extend(Wt);
290
- async function Hn(e, t) {
291
- const { fields: n, range: a = 1 } = t;
292
- if (!n) {
293
- const l = xe();
294
- throw new Error(l("excel.fieldsMappingRequired"));
295
- }
296
- let r = new Te.Workbook();
297
- await r.xlsx.load(e);
298
- const o = {};
299
- return r.eachSheet(function(l, s) {
300
- const i = [];
301
- l.eachRow(function(g, m) {
302
- if (m > a) {
303
- let p = {}, y = !0;
304
- Object.keys(n).forEach((h) => {
305
- const f = g.getCell(n[h]).value;
306
- p[h] = f, f && (y = !1);
307
- }), y || i.push(p);
308
- }
309
- }), o[l._name] = i;
310
- }), r = null, o;
275
+ U.extend(be.default), U.extend(xe.default);
276
+ async function Oe(e, t) {
277
+ let { fields: n, range: r = 1 } = t;
278
+ if (!n) {
279
+ let e = Z();
280
+ throw Error(e("excel.fieldsMappingRequired"));
281
+ }
282
+ let i = new H.Workbook();
283
+ await i.xlsx.load(e);
284
+ let a = {};
285
+ return i.eachSheet(function(e, t) {
286
+ let i = [];
287
+ e.eachRow(function(e, t) {
288
+ if (t > r) {
289
+ let t = {}, r = !0;
290
+ Object.keys(n).forEach((i) => {
291
+ let a = e.getCell(n[i]).value;
292
+ t[i] = a, a && (r = !1);
293
+ }), r || i.push(t);
294
+ }
295
+ }), a[e._name] = i;
296
+ }), i = null, a;
311
297
  }
312
- const pt = {
313
- columnWidth: 30
314
- };
315
- async function Nn(e, t, n = [], a = {}) {
316
- if (!e || !t)
317
- return;
318
- const { columnStyle: r } = a, { columnWidth: o } = pt;
319
- t.forEach((i) => {
320
- i.width = i.width ? i.width : o;
321
- });
322
- const { workbook: l, worksheet: s } = Jt();
323
- s.columns = t, s.addRows(n), r && await Xt(l, s, r);
324
- try {
325
- const i = await l.xlsx.writeBuffer(), g = new File([i], e, {
326
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
327
- });
328
- ct(g);
329
- } catch (i) {
330
- console.log(i);
331
- }
298
+ var ke = { columnWidth: 30 };
299
+ async function Ae(e, t, n = [], r = {}) {
300
+ if (!e || !t) return;
301
+ let { columnStyle: i } = r, { columnWidth: a } = ke;
302
+ t.forEach((e) => {
303
+ e.width = e.width ? e.width : a;
304
+ });
305
+ let { workbook: o, worksheet: s } = je();
306
+ s.columns = t, s.addRows(n), i && await Me(o, s, i);
307
+ try {
308
+ let t = await o.xlsx.writeBuffer();
309
+ V(new File([t], e, { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }));
310
+ } catch (e) {
311
+ console.log(e);
312
+ }
332
313
  }
333
- function Jt() {
334
- const e = new Te.Workbook();
335
- e.creator = "distributor System", e.lastModifiedBy = "distributor System", e.created = /* @__PURE__ */ new Date(), e.modified = /* @__PURE__ */ new Date(), e.lastPrinted = /* @__PURE__ */ new Date();
336
- const t = e.addWorksheet("Sheet1");
337
- return { workbook: e, worksheet: t };
314
+ function je() {
315
+ let e = new H.Workbook();
316
+ return e.creator = "distributor System", e.lastModifiedBy = "distributor System", e.created = /* @__PURE__ */ new Date(), e.modified = /* @__PURE__ */ new Date(), e.lastPrinted = /* @__PURE__ */ new Date(), {
317
+ workbook: e,
318
+ worksheet: e.addWorksheet("Sheet1")
319
+ };
338
320
  }
339
- async function Xt(e, t, n) {
340
- const a = Object.keys(n);
341
- for (const r of a) {
342
- const o = n[r], { type: l } = o;
343
- switch (l) {
344
- case "IMG":
345
- await Qt(e, t, r);
346
- break;
347
- }
348
- }
321
+ async function Me(e, t, n) {
322
+ let r = Object.keys(n);
323
+ for (let i of r) {
324
+ let r = n[i], { type: a } = r;
325
+ switch (a) {
326
+ case "IMG":
327
+ await Ne(e, t, i, r);
328
+ break;
329
+ }
330
+ }
349
331
  }
350
- async function Qt(e, t, n, a) {
351
- const r = t.getColumn(n), o = r.values;
352
- t.getColumn(n).width = 20, t.eachRow((l, s) => {
353
- s > 1 && (l.height = 40);
354
- });
355
- for (let l = 0, s = o.length; l < s; l++) {
356
- if (l < 2)
357
- continue;
358
- let i = o[l];
359
- i && (t.getCell(r.letter + l).value = "", await en(e, t, i, {
360
- width: 100,
361
- height: 50,
362
- col: r._number - 1,
363
- row: l - 1
364
- }));
365
- }
332
+ async function Ne(e, t, n, r) {
333
+ let i = t.getColumn(n), a = i.values;
334
+ t.getColumn(n).width = 20, t.eachRow((e, t) => {
335
+ t > 1 && (e.height = 40);
336
+ });
337
+ for (let n = 0, r = a.length; n < r; n++) {
338
+ if (n < 2) continue;
339
+ let r = a[n];
340
+ r && (t.getCell(i.letter + n).value = "", await Pe(e, t, r, {
341
+ width: 100,
342
+ height: 50,
343
+ col: i._number - 1,
344
+ row: n - 1
345
+ }));
346
+ }
366
347
  }
367
- async function en(e, t, n, a) {
368
- const { col: r, row: o, width: l, height: s } = a, { success: i, base64: g } = await tn(n, 0.3);
369
- if (i) {
370
- const m = e.addImage({
371
- base64: g,
372
- extension: "jpeg"
373
- });
374
- t.addImage(m, {
375
- tl: { col: r, row: o },
376
- ext: { width: l, height: s }
377
- });
378
- }
348
+ async function Pe(e, t, n, r) {
349
+ let { col: i, row: a, width: o, height: s } = r, { success: c, base64: l } = await Fe(n, .3);
350
+ if (c) {
351
+ let n = e.addImage({
352
+ base64: l,
353
+ extension: "jpeg"
354
+ });
355
+ t.addImage(n, {
356
+ tl: {
357
+ col: i,
358
+ row: a
359
+ },
360
+ ext: {
361
+ width: o,
362
+ height: s
363
+ }
364
+ });
365
+ }
379
366
  }
380
- function tn(e, t = 1) {
381
- const n = new Image();
382
- return n.setAttribute("crossOrigin", "anonymous"), n.crossOrigin = "anonymous", n.src = e, new Promise((a, r) => {
383
- n.onload = () => {
384
- const o = document.createElement("canvas");
385
- o.width = n.width, o.height = n.height, o.getContext("2d").drawImage(n, 0, 0, o.width, o.height), a({
386
- success: !0,
387
- //canvas.toDataURL的方法将图片的绝对路径转换为base64编码
388
- base64: o.toDataURL("image/jpeg", t)
389
- });
390
- }, n.onerror = () => {
391
- a({ success: !1 });
392
- };
393
- });
367
+ function Fe(e, t = 1) {
368
+ let n = new Image();
369
+ return n.setAttribute("crossOrigin", "anonymous"), n.crossOrigin = "anonymous", n.src = e, new Promise((e, r) => {
370
+ n.onload = () => {
371
+ let r = document.createElement("canvas");
372
+ r.width = n.width, r.height = n.height, r.getContext("2d").drawImage(n, 0, 0, r.width, r.height), e({
373
+ success: !0,
374
+ base64: r.toDataURL("image/jpeg", t)
375
+ });
376
+ }, n.onerror = () => {
377
+ e({ success: !1 });
378
+ };
379
+ });
394
380
  }
395
- const Ue = "---";
396
- async function nn(e, t) {
397
- const { fields: n, range: a = 1 } = t;
398
- if (!n) {
399
- const l = xe();
400
- throw new Error(l("excel.fieldsMappingRequired"));
401
- }
402
- let r = new Te.Workbook();
403
- await r.xlsx.load(e);
404
- const o = {};
405
- return r.eachSheet(function(l, s) {
406
- if (l.state == "visible") {
407
- const i = [], g = n[l._name];
408
- if (g) {
409
- let m = Object.values(g).some((y) => y.includes("image")), p = {};
410
- m && (l.getImages().forEach((h) => {
411
- const { tl: f } = h.range, c = r.model.media.find((v) => v.index === h.imageId);
412
- if (c) {
413
- const v = c.buffer.toString("base64"), w = `data:image/${c.extension};base64,${v}`, x = `${Math.ceil(f.row)}_${Math.ceil(f.col)}`;
414
- p[x] ? p[x].push(w) : p[x] = [w];
415
- }
416
- }), console.log("withImages-imageMap", p)), l.eachRow(function(y, h) {
417
- if (h > a) {
418
- let f = {
419
- _excelRowNumber: h
420
- }, c = !0;
421
- Object.keys(g).forEach((v) => {
422
- var V;
423
- let [w, x] = g[v].split(Ue);
424
- const C = y.getCell(w);
425
- let S;
426
- if (x == "image" && m) {
427
- const K = C._column._number, I = `${h}_${K}`;
428
- S = p[I] || "";
429
- } else
430
- C.result != null ? S = C.result : (V = C.value) != null && V.richText ? S = C.value.richText.reduce((K, I) => K + I.text, "") : C.type == 4 && C.value ? S = Fe(C.value).utc().format("YYYY-MM-DD HH:mm:ss") : S = C.value;
431
- S && x == "option" && (S = S.split(Ue)[1]), f[v] = S, S && (c = !1);
432
- }), c || i.push(f);
433
- }
434
- }), o[l._name] = i;
435
- }
436
- }
437
- }), r = null, o;
381
+ var Ie = "---";
382
+ async function Le(e, t) {
383
+ let { fields: n, range: r = 1 } = t;
384
+ if (!n) {
385
+ let e = Z();
386
+ throw Error(e("excel.fieldsMappingRequired"));
387
+ }
388
+ let i = new H.Workbook();
389
+ await i.xlsx.load(e);
390
+ let a = {};
391
+ return i.eachSheet(function(e, t) {
392
+ if (e.state == "visible") {
393
+ let t = [], o = n[e._name];
394
+ if (o) {
395
+ let n = Object.values(o).some((e) => e.includes("image")), s = {};
396
+ n && (e.getImages().forEach((e) => {
397
+ let { tl: t } = e.range, n = i.model.media.find((t) => t.index === e.imageId);
398
+ if (n) {
399
+ let e = n.buffer.toString("base64"), r = `data:image/${n.extension};base64,${e}`, i = `${Math.ceil(t.row)}_${Math.ceil(t.col)}`;
400
+ s[i] ? s[i].push(r) : s[i] = [r];
401
+ }
402
+ }), console.log("withImages-imageMap", s)), e.eachRow(function(e, i) {
403
+ if (i > r) {
404
+ let r = { _excelRowNumber: i }, a = !0;
405
+ Object.keys(o).forEach((t) => {
406
+ let [c, l] = o[t].split(Ie), u = e.getCell(c), d;
407
+ d = l == "image" && n ? s[`${i}_${u._column._number}`] || "" : u.result == null ? u.value?.richText ? u.value.richText.reduce((e, t) => e + t.text, "") : u.value?.hyperlink ? u.value.text || u.value.hyperlink : u.type == 4 && u.value ? U(u.value).utc().format("YYYY-MM-DD HH:mm:ss") : u.value : u.result, d && l == "option" && (d = d.split(Ie)[1]), r[t] = d, d && (a = !1);
408
+ }), a || t.push(r);
409
+ }
410
+ }), a[e._name] = t;
411
+ }
412
+ }
413
+ }), i = null, a;
438
414
  }
439
- const on = {
440
- date: "yyyy-mm-dd",
441
- number: "0",
442
- string: "@"
415
+ var Re = {
416
+ date: "yyyy-mm-dd",
417
+ number: "0",
418
+ string: "@"
443
419
  };
444
- async function ln(e, t) {
445
- if (!e || t.length == 0)
446
- return;
447
- const n = an(t);
448
- for (const a of n.worksheets) {
449
- const { columnWidth: r } = pt, o = t[a.name];
450
- if (!o)
451
- continue;
452
- const { tableHeader: l, tableData: s } = o;
453
- l.forEach((i) => {
454
- const { style: g = {}, required: m } = i, { font: p = {} } = g;
455
- i.style = {
456
- ...g,
457
- font: {
458
- ...p,
459
- color: {
460
- argb: m ? "FFFF0000" : void 0
461
- }
462
- }
463
- };
464
- }), a.columns = l, a.addRows(s), l.forEach((i) => {
465
- let { header: g, key: m, width: p, option: y, numFmt: h, locked: f, optionFormater: c } = i;
466
- const v = a.getColumn(m);
467
- if (v.numFmt = on[h] || h, v.width = p || r, v.protection = { locked: f === !0 }, y) {
468
- const w = n.addWorksheet(m);
469
- w.state = "hidden", c || (c = (x) => `${x.label}${Ue}${x.value}`), w.getColumn(1).values = y.map(c), Array(100).fill("").forEach((x, C) => {
470
- if (C > 0) {
471
- const S = xe();
472
- a.getCell(`${v.letter}${C}`).dataValidation = {
473
- type: "list",
474
- formulae: [`${m}!$A$1:$A$${y.length}`],
475
- showErrorMessage: !0,
476
- error: S("excel.invalidInput"),
477
- errorStyle: "stop",
478
- errorMessage: S("excel.invalidOption")
479
- };
480
- }
481
- });
482
- }
483
- }), l.some((i) => i.locked) && await a.protect("6737187214", {
484
- selectLockedCells: !0,
485
- selectUnlockedCells: !0
486
- });
487
- }
488
- try {
489
- const a = await n.xlsx.writeBuffer(), r = new File([a], e, {
490
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
491
- });
492
- ct(r);
493
- } catch (a) {
494
- console.log(a);
495
- }
420
+ async function ze(e, t) {
421
+ if (!e || t.length == 0) return;
422
+ let n = Be(t);
423
+ for (let e of n.worksheets) {
424
+ let { columnWidth: r } = ke, i = t[e.name];
425
+ if (!i) continue;
426
+ let { tableHeader: a, tableData: o } = i;
427
+ a.forEach((e) => {
428
+ let { style: t = {}, required: n } = e, { font: r = {} } = t;
429
+ e.style = {
430
+ ...t,
431
+ font: {
432
+ ...r,
433
+ color: { argb: n ? "FFFF0000" : void 0 }
434
+ }
435
+ };
436
+ }), e.columns = a, e.addRows(o), a.forEach((t) => {
437
+ let { header: i, key: a, width: o, option: s, numFmt: c, locked: l, optionFormater: u } = t, d = e.getColumn(a);
438
+ if (d.numFmt = Re[c] || c, d.width = o || r, d.protection = { locked: l === !0 }, s) {
439
+ let t = n.addWorksheet(a);
440
+ t.state = "hidden", u ||= (e) => `${e.label}${Ie}${e.value}`, t.getColumn(1).values = s.map(u), Array(100).fill("").forEach((t, n) => {
441
+ if (n > 0) {
442
+ let t = Z();
443
+ e.getCell(`${d.letter}${n}`).dataValidation = {
444
+ type: "list",
445
+ formulae: [`${a}!$A$1:$A$${s.length}`],
446
+ showErrorMessage: !0,
447
+ error: t("excel.invalidInput"),
448
+ errorStyle: "stop",
449
+ errorMessage: t("excel.invalidOption")
450
+ };
451
+ }
452
+ });
453
+ }
454
+ }), a.some((e) => e.locked) && await e.protect("6737187214", {
455
+ selectLockedCells: !0,
456
+ selectUnlockedCells: !0
457
+ });
458
+ }
459
+ try {
460
+ let t = await n.xlsx.writeBuffer();
461
+ V(new File([t], e, { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }));
462
+ } catch (e) {
463
+ console.log(e);
464
+ }
496
465
  }
497
- function an(e) {
498
- const t = xe(), n = new Te.Workbook();
499
- return n.creator = "distributor System", n.lastModifiedBy = "distributor System", n.created = /* @__PURE__ */ new Date(), n.modified = /* @__PURE__ */ new Date(), n.lastPrinted = /* @__PURE__ */ new Date(), Object.keys(e).sort((r, o) => {
500
- const l = e[r].sort ?? 0, s = e[o].sort ?? 0;
501
- return l - s;
502
- }).forEach((r) => {
503
- let o = r, l = !1;
504
- /[\\/:*?\[\]]/g.test(r) && (r = r.replace(/[\\/:*?\[\]]/g, ""), l = !0), r.length > 31 && (r = r.substring(0, 31).trim(), l = !0, console.warn(t("excel.sheetNameTooLong", [o, r]))), l && (e[r] = e[o], delete e[o]), n.addWorksheet(r);
505
- }), n;
466
+ function Be(e) {
467
+ let t = Z(), n = new H.Workbook();
468
+ return n.creator = "distributor System", n.lastModifiedBy = "distributor System", n.created = /* @__PURE__ */ new Date(), n.modified = /* @__PURE__ */ new Date(), n.lastPrinted = /* @__PURE__ */ new Date(), Object.keys(e).sort((t, n) => (e[t].sort ?? 0) - (e[n].sort ?? 0)).forEach((r) => {
469
+ let i = r, a = !1;
470
+ /[\\/:*?\[\]]/g.test(r) && (r = r.replace(/[\\/:*?\[\]]/g, ""), a = !0), r.length > 31 && (r = r.substring(0, 31).trim(), a = !0, console.warn(t("excel.sheetNameTooLong", [i, r]))), a && (e[r] = e[i], delete e[i]), n.addWorksheet(r);
471
+ }), n;
506
472
  }
507
- function rn(e) {
508
- if (e < 26)
509
- return String.fromCharCode(65 + e);
510
- {
511
- const t = String.fromCharCode(65 + Math.floor((e - 26) / 26)), n = String.fromCharCode(65 + (e - 26) % 26);
512
- return t + n;
513
- }
473
+ function Ve(e) {
474
+ return e < 26 ? String.fromCharCode(65 + e) : String.fromCharCode(65 + Math.floor((e - 26) / 26)) + String.fromCharCode(65 + (e - 26) % 26);
514
475
  }
515
- function Wn(e) {
516
- return new Promise((t) => {
517
- setTimeout(() => {
518
- t();
519
- }, e);
520
- });
476
+ //#endregion
477
+ //#region src/utils/tools/tools.js
478
+ function He(e) {
479
+ return new Promise((t) => {
480
+ setTimeout(() => {
481
+ t();
482
+ }, e);
483
+ });
521
484
  }
522
- function Zn(e) {
523
- return JSON.parse(JSON.stringify(e));
485
+ function Ue(e) {
486
+ return JSON.parse(JSON.stringify(e));
524
487
  }
525
- function Gn(e) {
526
- let t = [], n = {}, a = (r, o) => Object.prototype.hasOwnProperty.call(r, o);
527
- for (const r of e) {
528
- n[r.id] = {
529
- ...r,
530
- // 判断当前项的子项 如果map有存储就用存储的子项 否则初始化
531
- children: a(n, r.id) ? n[r.id].children : []
532
- };
533
- const o = n[r.id];
534
- r.pid == -1 ? t.push(o) : (a(n, r.pid) || (n[r.pid] = {
535
- children: []
536
- }), n[r.pid].children.push(o));
537
- }
538
- return t;
488
+ function We(e) {
489
+ let t = [], n = {}, r = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
490
+ for (let i of e) {
491
+ n[i.id] = {
492
+ ...i,
493
+ children: r(n, i.id) ? n[i.id].children : []
494
+ };
495
+ let e = n[i.id];
496
+ i.pid == -1 ? t.push(e) : (r(n, i.pid) || (n[i.pid] = { children: [] }), n[i.pid].children.push(e));
497
+ }
498
+ return t;
539
499
  }
540
- function yt(e, t = " ") {
541
- return e ? e.split(t).filter((n) => n.trim()) : [];
500
+ function Ge(e, t = " ") {
501
+ return e ? e.split(t).filter((e) => e.trim()) : [];
542
502
  }
543
- class et {
544
- constructor(t, n = ["label", "value", "labelEn"]) {
545
- this.list = t.map((a) => ({
546
- ...a,
547
- label: a[n[0]],
548
- labelEn: a[n[2]] ?? a[n[0]] ?? "",
549
- value: a[n[1]]
550
- })), this.map = new Map(this.list.map((a) => [a[n[1]], a]));
551
- }
552
- getName(t) {
553
- if (!this.has(t))
554
- return "-";
555
- const n = Ke().global.locale, { label: a, labelEn: r } = this.map.get(t);
556
- return (n.value == "zh_cn" ? a : r) ?? a ?? "-";
557
- }
558
- getTag(t) {
559
- if (!this.has(t))
560
- return "info";
561
- const { tag: n = "info" } = this.map.get(t);
562
- return n;
563
- }
564
- getItem(t) {
565
- return this.has(t) ? this.map.get(t) : null;
566
- }
567
- getColor(t) {
568
- if (!this.has(t))
569
- return null;
570
- const { color: n } = this.map.get(t);
571
- return n;
572
- }
573
- has(t) {
574
- return this.map.has(t);
575
- }
503
+ var Ke = class {
504
+ constructor(e, t = [
505
+ "label",
506
+ "value",
507
+ "labelEn"
508
+ ]) {
509
+ this.list = e.map((e) => ({
510
+ ...e,
511
+ label: e[t[0]],
512
+ labelEn: e[t[2]] ?? e[t[0]] ?? "",
513
+ value: e[t[1]]
514
+ })), this.map = new Map(this.list.map((e) => [e[t[1]], e]));
515
+ }
516
+ getName(e) {
517
+ if (!this.has(e)) return "-";
518
+ let t = De().global.locale, { label: n, labelEn: r } = this.map.get(e);
519
+ return (t.value == "zh_cn" ? n : r) ?? n ?? "-";
520
+ }
521
+ getTag(e) {
522
+ if (!this.has(e)) return "info";
523
+ let { tag: t = "info" } = this.map.get(e);
524
+ return t;
525
+ }
526
+ getItem(e) {
527
+ return this.has(e) ? this.map.get(e) : null;
528
+ }
529
+ getColor(e) {
530
+ if (!this.has(e)) return null;
531
+ let { color: t } = this.map.get(e);
532
+ return t;
533
+ }
534
+ has(e) {
535
+ return this.map.has(e);
536
+ }
537
+ };
538
+ function qe(e, t = [], n = "i18nName") {
539
+ if (e.length == 0) return new Ke([]);
540
+ if (t.length < 2) {
541
+ let e = Z();
542
+ throw Error(e("tools.keysLengthError"));
543
+ }
544
+ return new Ke(e.map((e) => {
545
+ let r = {};
546
+ return n && (r.labelEn = e[n]), t.forEach((t, n) => {
547
+ n === 0 ? r.label = e[t] : n === 1 ? r.value = e[t] : r[t] = e[t];
548
+ }), r;
549
+ }));
576
550
  }
577
- function Jn(e, t = [], n = "i18nName") {
578
- if (e.length == 0)
579
- return new et([]);
580
- if (t.length < 2) {
581
- const r = xe();
582
- throw new Error(r("tools.keysLengthError"));
583
- }
584
- let a = e.map((r) => {
585
- let o = {};
586
- return n && (o.labelEn = r[n]), t.forEach((l, s) => {
587
- s === 0 ? o.label = r[l] : s === 1 ? o.value = r[l] : o[l] = r[l];
588
- }), o;
589
- });
590
- return new et(a);
551
+ function Je(e) {
552
+ return e ? e.replace(/<[^>]+>/g, "") : "";
591
553
  }
592
- function Xn(e) {
593
- return e ? e.replace(/<[^>]+>/g, "") : "";
554
+ function Ye(e) {
555
+ return e ? (e.includes("\\\\u") && (e = e.replace(/\\/g, "")), e.replace(/\\u[\dA-F]{4}/gi, (e) => String.fromCharCode(parseInt(e.replace(/\\u/g, ""), 16)))) : "";
594
556
  }
595
- function Qn(e) {
596
- return e ? (e.includes("\\\\u") && (e = e.replace(/\\/g, "")), e.replace(/\\u[\dA-F]{4}/gi, (t) => String.fromCharCode(parseInt(t.replace(/\\u/g, ""), 16)))) : "";
557
+ function Xe(e, t = 10) {
558
+ let n = 1024 * 1024 * t;
559
+ return !(e.size > n);
597
560
  }
598
- function eo(e, t = 10) {
599
- let n = 1048576 * t;
600
- return !(e.size > n);
561
+ function Ze(e) {
562
+ return Array.from(10).fill(0).map((t, n) => e + "_" + n);
601
563
  }
602
- function to(e) {
603
- return Array.from(10).fill(0).map((n, a) => e + "_" + a);
564
+ function Qe(e) {
565
+ let t = {};
566
+ return e.map((e, n) => {
567
+ let { key: r, option: i, type: a, optionFormater: o } = e, s = Ve(n);
568
+ i && !o ? t[r] = `${s}---option` : a === "image" ? t[r] = `${s}---image` : t[r] = s;
569
+ }), t;
604
570
  }
605
- function no(e) {
606
- let t = {};
607
- return e.map((n, a) => {
608
- let { key: r, option: o, type: l, optionFormater: s } = n, i = rn(a);
609
- o && !s ? t[r] = `${i}---option` : l === "image" ? t[r] = `${i}---image` : t[r] = i;
610
- }), t;
571
+ function $e(e, t) {
572
+ return t.split(".").reduce((e, t) => e && e[t], e);
611
573
  }
612
- function oo(e, t) {
613
- return t.split(".").reduce((n, a) => n && n[a], e);
574
+ //#endregion
575
+ //#region \0plugin-vue:export-helper
576
+ var Q = (e, t) => {
577
+ let n = e.__vccOpts || e;
578
+ for (let [e, r] of t) n[e] = r;
579
+ return n;
580
+ }, et = ["onClick"], tt = /* @__PURE__ */ Q({
581
+ __name: "index",
582
+ props: /* @__PURE__ */ y({
583
+ api: { type: Function },
584
+ showCheckAll: {
585
+ type: Boolean,
586
+ default: !0
587
+ },
588
+ maxLimit: {
589
+ type: Number,
590
+ default: void 0
591
+ },
592
+ minLimit: {
593
+ type: Number,
594
+ default: void 0
595
+ },
596
+ optionClick: {
597
+ type: Function,
598
+ default: () => {}
599
+ },
600
+ data: { type: Array },
601
+ labelValue: {
602
+ type: Object,
603
+ default: () => ({
604
+ label: "label",
605
+ labelEn: "labelEn",
606
+ value: "value"
607
+ })
608
+ },
609
+ changeLocal: {
610
+ type: Boolean,
611
+ default: !1
612
+ }
613
+ }, {
614
+ modelValue: {},
615
+ modelModifiers: {}
616
+ }),
617
+ emits: /* @__PURE__ */ y([
618
+ "success",
619
+ "change",
620
+ "changeAll"
621
+ ], ["update:modelValue"]),
622
+ setup(e, { emit: t }) {
623
+ let n = e, r = ee(), { t: i, locale: a } = G(), o = I(e, "modelValue"), g = c(() => r["value-key"] != null), _ = k(""), v = c(() => {
624
+ if (r.remote !== void 0) return n.data;
625
+ let e = Ge(_.value), { data: t, labelValue: i } = n, o = t || C.value;
626
+ if (e.length == 0) return o;
627
+ let { label: s, labelEn: c } = i, l = a.value == "en_us" ? c || "i18nName" : s;
628
+ return e.length == 1 ? o.filter((t) => t[l].toLowerCase().includes(e[0].toLowerCase())) : o.filter((t) => {
629
+ let n = !1;
630
+ return n = e.some((e) => t[l].toLowerCase() == e.toLowerCase()), n;
631
+ });
632
+ }), y = c({
633
+ get() {
634
+ return r.multiple == null || o.value == null ? !1 : o.value.length == v.value.length;
635
+ },
636
+ set(e) {
637
+ return e;
638
+ }
639
+ }), S = t, C = k([]);
640
+ n.api && (async () => {
641
+ let { data: e } = await n.api();
642
+ C.value = [...e], S("success", C);
643
+ })();
644
+ function w(e) {
645
+ S("change", e), T.value && x(() => {
646
+ n.optionClick && n.optionClick(T.value), T.value = null;
647
+ });
648
+ }
649
+ let T = k(null);
650
+ function E() {
651
+ S("change", o.value), x(() => {
652
+ n.optionClick && n.optionClick(null);
653
+ });
654
+ }
655
+ function O(e) {
656
+ T.value = e;
657
+ }
658
+ let N = n.labelValue.label.split("-"), z = (e) => {
659
+ if (N.length == 1) {
660
+ if (n.changeLocal) return i(e[n.labelValue.label]);
661
+ let t = a.value == "en_us" ? e[n.labelValue.labelEn || "i18nName"] : e[n.labelValue.label];
662
+ return t ||= e[n.labelValue.label], t + "";
663
+ } else {
664
+ let t = [];
665
+ return N.forEach((n) => {
666
+ t.push(e[n]);
667
+ }), t.join("-");
668
+ }
669
+ };
670
+ function B(e) {
671
+ let t = n.data ? n.data : C.value;
672
+ o.value = e ? t.map((e) => g.value ? e : e[n.labelValue.value]) : [], x(() => {
673
+ S("change", o.value), S("changeAll", o.value, t);
674
+ });
675
+ }
676
+ function V(e) {
677
+ S("change", g.value ? e : e[n.labelValue.value]), x(() => {
678
+ n.optionClick && n.optionClick(e);
679
+ });
680
+ }
681
+ function H(e) {
682
+ let t = g.value ? e : e[n.labelValue.value], r = g.value ? o.value.some((t) => t[n.labelValue.value] === e[n.labelValue.value]) : o.value.includes(t);
683
+ return !!(n.maxLimit > 0 && o.value.length >= n.maxLimit && !r || n.minLimit > 0 && o.value.length === n.minLimit && r);
684
+ }
685
+ function U(e) {
686
+ return e.map((e) => ({
687
+ ...e,
688
+ label: z(e),
689
+ value: g.value ? e : e[n.labelValue.value]
690
+ }));
691
+ }
692
+ let W = k([]);
693
+ W.value = U(n.data ? n.data : C.value), L(() => n.data ? n.data : C.value, (e) => {
694
+ let t = U(e);
695
+ if (t.length !== W.value.length) W.value = t;
696
+ else {
697
+ let e = !1;
698
+ for (let n = 0; n < t.length; n++) if (t[n].value !== W.value[n]?.value) {
699
+ e = !0;
700
+ break;
701
+ }
702
+ e && (W.value = t);
703
+ }
704
+ }, { deep: !0 });
705
+ let ne = c(() => r.multiple !== void 0 && (n.maxLimit > 0 || n.minLimit > 0) ? W.value.map((e) => ({
706
+ ...e,
707
+ disabled: H(e)
708
+ })) : W.value);
709
+ return (t, n) => {
710
+ let i = M("el-checkbox"), a = M("el-select-v2"), c = M("el-option"), x = M("el-select");
711
+ return F(r).v2 == null ? (D(), l(x, b({
712
+ key: 1,
713
+ modelValue: o.value,
714
+ "onUpdate:modelValue": n[3] ||= (e) => o.value = e,
715
+ filterable: "",
716
+ "collapse-tags": "",
717
+ "collapse-tags-tooltip": "",
718
+ "filter-method": F(r).remote == null ? (e) => _.value = e : void 0,
719
+ clearable: ""
720
+ }, F(r), { onClear: E }), {
721
+ default: R(() => [F(r).multiple != null && e.showCheckAll && e.maxLimit == null ? j(t.$slots, "header", { key: 0 }, () => [h(i, {
722
+ class: "mgl20",
723
+ modelValue: y.value,
724
+ "onUpdate:modelValue": n[2] ||= (e) => y.value = e,
725
+ onChange: B
726
+ }, {
727
+ default: R(() => [m(P(t.$t("quan-xuan")), 1)]),
728
+ _: 1
729
+ }, 8, ["modelValue"])], !0) : u("", !0), (D(!0), d(s, null, A(v.value, (t, n) => (D(), l(c, {
730
+ key: n,
731
+ label: z(t),
732
+ disabled: F(r).multiple != null && (e.maxLimit > 0 || e.minLimit > 0) ? H(t) : !1,
733
+ onClick: te((e) => V(t), ["stop"]),
734
+ value: g.value ? t : t[e.labelValue.value]
735
+ }, null, 8, [
736
+ "label",
737
+ "disabled",
738
+ "onClick",
739
+ "value"
740
+ ]))), 128))]),
741
+ _: 3
742
+ }, 16, ["modelValue", "filter-method"])) : (D(), l(a, b({
743
+ key: 0,
744
+ options: ne.value,
745
+ modelValue: o.value,
746
+ "onUpdate:modelValue": n[1] ||= (e) => o.value = e
747
+ }, F(r), {
748
+ filterable: "",
749
+ "collapse-tags": "",
750
+ "collapse-tags-tooltip": "",
751
+ clearable: "",
752
+ onChange: w
753
+ }), p({
754
+ default: R(({ item: e }) => [f("div", { onClick: (t) => O(e) }, P(e.label), 9, et)]),
755
+ _: 2
756
+ }, [F(r).multiple == null ? void 0 : {
757
+ name: "header",
758
+ fn: R(() => [j(t.$slots, "header", {}, () => [h(i, {
759
+ class: "mgl20",
760
+ modelValue: y.value,
761
+ "onUpdate:modelValue": n[0] ||= (e) => y.value = e,
762
+ onChange: B
763
+ }, {
764
+ default: R(() => [m(P(t.$t("quan-xuan")), 1)]),
765
+ _: 1
766
+ }, 8, ["modelValue"])], !0)]),
767
+ key: "0"
768
+ }]), 1040, ["options", "modelValue"]));
769
+ };
770
+ }
771
+ }, [["__scopeId", "data-v-12794201"]]), nt = g({ props: { name: {
772
+ tyepe: String,
773
+ required: !0
774
+ } } });
775
+ function rt(e, t, n, r, i, a) {
776
+ let o = M("el-icon");
777
+ return D(), l(o, { class: "cmp-icon" }, {
778
+ default: R(() => [(D(), l(N(e.name)))]),
779
+ _: 1
780
+ });
614
781
  }
615
- const ke = (e, t) => {
616
- const n = e.__vccOpts || e;
617
- for (const [a, r] of t)
618
- n[a] = r;
619
- return n;
620
- }, sn = ["onClick"], cn = {
621
- __name: "index",
622
- props: /* @__PURE__ */ Xe({
623
- api: {
624
- type: Function
625
- },
626
- showCheckAll: {
627
- type: Boolean,
628
- default: !0
629
- },
630
- maxLimit: {
631
- type: Number,
632
- default: void 0
633
- },
634
- minLimit: {
635
- type: Number,
636
- default: void 0
637
- },
638
- optionClick: {
639
- type: Function,
640
- default: () => {
641
- }
642
- },
643
- data: {
644
- type: Array
645
- },
646
- labelValue: {
647
- type: Object,
648
- default: () => ({
649
- label: "label",
650
- labelEn: "labelEn",
651
- value: "value"
652
- })
653
- },
654
- changeLocal: {
655
- type: Boolean,
656
- default: !1
657
- }
658
- }, {
659
- modelValue: {},
660
- modelModifiers: {}
661
- }),
662
- emits: /* @__PURE__ */ Xe(["success", "change", "changeAll"], ["update:modelValue"]),
663
- setup(e, { emit: t }) {
664
- const n = e, a = Tt(), { t: r, locale: o } = we(), l = Dt(e, "modelValue"), s = ue(() => a["value-key"] != null), i = j(""), g = ue(() => {
665
- if (a.remote !== void 0)
666
- return n.data;
667
- const b = yt(i.value), { data: k, labelValue: R } = n, _ = k || y.value;
668
- if (b.length == 0)
669
- return _;
670
- const { label: oe, labelEn: ge } = R;
671
- let M = o.value == "en_us" ? ge || "i18nName" : oe;
672
- return b.length == 1 ? _.filter(
673
- (fe) => fe[M].toLowerCase().includes(b[0].toLowerCase())
674
- ) : _.filter((fe) => {
675
- let _e = !1;
676
- return _e = b.some((Le) => fe[M].toLowerCase() == Le.toLowerCase()), _e;
677
- });
678
- }), m = ue({
679
- get() {
680
- return a.multiple == null || l.value == null ? !1 : l.value.length == g.value.length;
681
- },
682
- set(b) {
683
- return b;
684
- }
685
- }), p = t, y = j([]), h = async () => {
686
- const { data: b } = await n.api();
687
- y.value = [...b], p("success", y);
688
- };
689
- n.api && h();
690
- function f(b) {
691
- p("change", b), c.value && be(() => {
692
- n.optionClick && n.optionClick(c.value), c.value = null;
693
- });
694
- }
695
- const c = j(null);
696
- function v() {
697
- p("change", l.value), be(() => {
698
- n.optionClick && n.optionClick(null);
699
- });
700
- }
701
- function w(b) {
702
- c.value = b;
703
- }
704
- const x = n.labelValue.label.split("-"), C = (b) => {
705
- if (x.length == 1) {
706
- if (n.changeLocal)
707
- return r(b[n.labelValue.label]);
708
- let k = o.value == "en_us" ? b[n.labelValue.labelEn || "i18nName"] : b[n.labelValue.label];
709
- return k = k || b[n.labelValue.label], k + "";
710
- } else {
711
- let k = [];
712
- return x.forEach((R) => {
713
- k.push(b[R]);
714
- }), k.join("-");
715
- }
716
- };
717
- function S(b) {
718
- let k = n.data ? n.data : y.value;
719
- l.value = b ? k.map((R) => s.value ? R : R[n.labelValue.value]) : [], be(() => {
720
- p("change", l.value), p("changeAll", l.value, k);
721
- });
722
- }
723
- function V(b) {
724
- p("change", s.value ? b : b[n.labelValue.value]), be(() => {
725
- n.optionClick && n.optionClick(b);
726
- });
727
- }
728
- function K(b) {
729
- const k = s.value ? b : b[n.labelValue.value], R = s.value ? l.value.some((_) => _[n.labelValue.value] === b[n.labelValue.value]) : l.value.includes(k);
730
- return !!(n.maxLimit > 0 && l.value.length >= n.maxLimit && !R || n.minLimit > 0 && l.value.length === n.minLimit && R);
731
- }
732
- function I(b) {
733
- return b.map((k) => ({
734
- ...k,
735
- label: C(k),
736
- value: s.value ? k : k[n.labelValue.value]
737
- }));
738
- }
739
- const A = j([]), $ = n.data ? n.data : y.value;
740
- A.value = I($), Re(
741
- () => n.data ? n.data : y.value,
742
- (b) => {
743
- var R;
744
- const k = I(b);
745
- if (k.length !== A.value.length)
746
- A.value = k;
747
- else {
748
- let _ = !1;
749
- for (let oe = 0; oe < k.length; oe++)
750
- if (k[oe].value !== ((R = A.value[oe]) == null ? void 0 : R.value)) {
751
- _ = !0;
752
- break;
753
- }
754
- _ && (A.value = k);
755
- }
756
- },
757
- { deep: !0 }
758
- );
759
- const ee = ue(() => a.multiple !== void 0 && (n.maxLimit > 0 || n.minLimit > 0) ? A.value.map((b) => ({
760
- ...b,
761
- disabled: K(b)
762
- })) : A.value);
763
- return (b, k) => {
764
- const R = O("el-checkbox"), _ = O("el-select-v2"), oe = O("el-option"), ge = O("el-select");
765
- return N(a).v2 != null ? (E(), W(_, de({
766
- key: 0,
767
- options: ee.value,
768
- modelValue: l.value,
769
- "onUpdate:modelValue": k[1] || (k[1] = (M) => l.value = M)
770
- }, N(a), {
771
- filterable: "",
772
- "collapse-tags": "",
773
- "collapse-tags-tooltip": "",
774
- clearable: "",
775
- onChange: f
776
- }), at({
777
- default: D(({ item: M }) => [
778
- ie("div", {
779
- onClick: (pe) => w(M)
780
- }, te(M.label), 9, sn)
781
- ]),
782
- _: 2
783
- }, [
784
- N(a).multiple != null ? {
785
- name: "header",
786
- fn: D(() => [
787
- Q(b.$slots, "header", {}, () => [
788
- z(R, {
789
- class: "mgl20",
790
- modelValue: m.value,
791
- "onUpdate:modelValue": k[0] || (k[0] = (M) => m.value = M),
792
- onChange: S
793
- }, {
794
- default: D(() => [
795
- ne(te(b.$t("quan-xuan")), 1)
796
- ]),
797
- _: 1
798
- }, 8, ["modelValue"])
799
- ], !0)
800
- ]),
801
- key: "0"
802
- } : void 0
803
- ]), 1040, ["options", "modelValue"])) : (E(), W(ge, de({
804
- key: 1,
805
- modelValue: l.value,
806
- "onUpdate:modelValue": k[3] || (k[3] = (M) => l.value = M),
807
- filterable: "",
808
- "collapse-tags": "",
809
- "collapse-tags-tooltip": "",
810
- "filter-method": N(a).remote != null ? void 0 : (M) => i.value = M,
811
- clearable: ""
812
- }, N(a), { onClear: v }), {
813
- default: D(() => [
814
- N(a).multiple != null && e.showCheckAll && e.maxLimit == null ? Q(b.$slots, "header", { key: 0 }, () => [
815
- z(R, {
816
- class: "mgl20",
817
- modelValue: m.value,
818
- "onUpdate:modelValue": k[2] || (k[2] = (M) => m.value = M),
819
- onChange: S
820
- }, {
821
- default: D(() => [
822
- ne(te(b.$t("quan-xuan")), 1)
823
- ]),
824
- _: 1
825
- }, 8, ["modelValue"])
826
- ], !0) : me("", !0),
827
- (E(!0), ce(Ve, null, rt(g.value, (M, pe) => (E(), W(oe, {
828
- key: pe,
829
- label: C(M),
830
- disabled: N(a).multiple != null && (e.maxLimit > 0 || e.minLimit > 0) ? K(M) : !1,
831
- onClick: qe((fe) => V(M), ["stop"]),
832
- value: s.value ? M : M[e.labelValue.value]
833
- }, null, 8, ["label", "disabled", "onClick", "value"]))), 128))
834
- ]),
835
- _: 3
836
- }, 16, ["modelValue", "filter-method"]));
837
- };
838
- }
839
- }, un = /* @__PURE__ */ ke(cn, [["__scopeId", "data-v-12794201"]]);
840
- const dn = ot({
841
- props: {
842
- name: {
843
- tyepe: String,
844
- required: !0
845
- }
846
- }
847
- });
848
- function fn(e, t, n, a, r, o) {
849
- const l = O("el-icon");
850
- return E(), W(l, { class: "cmp-icon" }, {
851
- default: D(() => [
852
- (E(), W(st(e.name)))
853
- ]),
854
- _: 1
855
- });
782
+ var it = /* @__PURE__ */ Q(nt, [["render", rt], ["__scopeId", "data-v-733f9daa"]]), at = { class: "confirm-button-wrapper" }, ot = /* @__PURE__ */ Q({
783
+ __name: "index",
784
+ emits: ["ok", "no"],
785
+ setup(e, { emit: t }) {
786
+ let n = t, r = re(() => {
787
+ n("ok");
788
+ }, 500);
789
+ function i() {
790
+ n("no");
791
+ }
792
+ return (e, t) => {
793
+ let n = M("el-popconfirm");
794
+ return D(), d("span", at, [h(n, b(e.$attrs, {
795
+ onConfirm: F(r),
796
+ onCancel: i
797
+ }), {
798
+ reference: R(() => [j(e.$slots, "default", {}, void 0, !0)]),
799
+ _: 3
800
+ }, 16, ["onConfirm"])]);
801
+ };
802
+ }
803
+ }, [["__scopeId", "data-v-24cb35fd"]]), st = { class: "ImportButton" }, ct = ["accept"], lt = /* @__PURE__ */ Q({
804
+ __name: "index",
805
+ props: {
806
+ accept: {
807
+ type: String,
808
+ default: ".xlsx,.xls"
809
+ },
810
+ fields: {
811
+ type: Object,
812
+ default: () => ({})
813
+ },
814
+ fileChange: {
815
+ type: Function,
816
+ required: !0
817
+ }
818
+ },
819
+ emits: ["fileChange"],
820
+ setup(e, { emit: t }) {
821
+ let n = e, r = k(null), i = k(!1);
822
+ async function a(e) {
823
+ i.value = !0;
824
+ let t = e.target.files[0], a = await Le(t, n.fields).catch(() => {
825
+ i.value = !1;
826
+ }).finally(() => {
827
+ r.value.value = null;
828
+ });
829
+ await n.fileChange(a).finally(() => {
830
+ i.value = !1;
831
+ });
832
+ }
833
+ return (t, n) => {
834
+ let o = M("el-button");
835
+ return D(), d("div", st, [h(o, b({
836
+ type: "primary",
837
+ loading: i.value,
838
+ class: "mgr10",
839
+ onClick: n[0] ||= (e) => r.value.click()
840
+ }, t.$attrs), {
841
+ default: R(() => [j(t.$slots, "default", {}, () => [m(P(t.$t("dao-ru")), 1)], !0)]),
842
+ _: 3
843
+ }, 16, ["loading"]), f("input", {
844
+ onChange: a,
845
+ ref_key: "input",
846
+ ref: r,
847
+ accept: e.accept,
848
+ style: {
849
+ position: "absolute",
850
+ width: "0px",
851
+ height: "0px",
852
+ opacity: "0"
853
+ },
854
+ type: "file"
855
+ }, null, 40, ct)]);
856
+ };
857
+ }
858
+ }, [["__scopeId", "data-v-ea0a4c60"]]);
859
+ //#endregion
860
+ //#region src/components/SearchBar/tools.js
861
+ function ut(e) {
862
+ let t = {};
863
+ return e.forEach((e) => {
864
+ let { key: n, type: r, option: i = {}, value: a, dateType: o = "date" } = e;
865
+ if (n) if (r == "input" && i?.multiple) t[n] = Ge(a);
866
+ else if (r == "date") if (o.includes("range")) {
867
+ let [e, r] = n, [i, s] = a || [];
868
+ i && o == "daterange" && (i = U(i).format("YYYY-MM-DD 00:00:00"), s = U(s).format("YYYY-MM-DD 23:59:59")), t[e] = i, t[r] = s;
869
+ } else t[n] = a;
870
+ else t[n] = a;
871
+ }), t;
856
872
  }
857
- const vt = /* @__PURE__ */ ke(dn, [["render", fn], ["__scopeId", "data-v-733f9daa"]]);
858
- const hn = { class: "confirm-button-wrapper" }, mn = {
859
- __name: "index",
860
- emits: ["ok", "no"],
861
- setup(e, { emit: t }) {
862
- const n = t, a = Be(() => {
863
- n("ok");
864
- }, 500);
865
- function r() {
866
- n("no");
867
- }
868
- return (o, l) => {
869
- const s = O("el-popconfirm");
870
- return E(), ce("span", hn, [
871
- z(s, de(o.$attrs, {
872
- onConfirm: N(a),
873
- onCancel: r
874
- }), {
875
- reference: D(() => [
876
- Q(o.$slots, "default", {}, void 0, !0)
877
- ]),
878
- _: 3
879
- }, 16, ["onConfirm"])
880
- ]);
881
- };
882
- }
883
- }, lo = /* @__PURE__ */ ke(mn, [["__scopeId", "data-v-24cb35fd"]]);
884
- const gn = { class: "ImportButton" }, pn = ["accept"], yn = {
885
- __name: "index",
886
- props: {
887
- accept: {
888
- type: String,
889
- default: ".xlsx,.xls"
890
- },
891
- fields: {
892
- type: Object,
893
- default: () => ({})
894
- },
895
- fileChange: {
896
- type: Function,
897
- required: !0
898
- }
899
- },
900
- emits: ["fileChange"],
901
- setup(e, { emit: t }) {
902
- const n = e, a = j(null), r = j(!1);
903
- async function o(l) {
904
- r.value = !0;
905
- let s = l.target.files[0];
906
- const i = await nn(s, n.fields).catch(() => {
907
- r.value = !1;
908
- }).finally(() => {
909
- a.value.value = null;
910
- });
911
- await n.fileChange(i).finally(() => {
912
- r.value = !1;
913
- });
914
- }
915
- return (l, s) => {
916
- const i = O("el-button");
917
- return E(), ce("div", gn, [
918
- z(i, de({
919
- type: "primary",
920
- loading: r.value,
921
- class: "mgr10",
922
- onClick: s[0] || (s[0] = (g) => a.value.click())
923
- }, l.$attrs), {
924
- default: D(() => [
925
- Q(l.$slots, "default", {}, () => [
926
- ne(te(l.$t("dao-ru")), 1)
927
- ], !0)
928
- ]),
929
- _: 3
930
- }, 16, ["loading"]),
931
- ie("input", {
932
- onChange: o,
933
- ref_key: "input",
934
- ref: a,
935
- accept: e.accept,
936
- style: { position: "absolute", width: "0px", height: "0px", opacity: "0" },
937
- type: "file"
938
- }, null, 40, pn)
939
- ]);
940
- };
941
- }
942
- }, ao = /* @__PURE__ */ ke(yn, [["__scopeId", "data-v-ea0a4c60"]]);
943
- function je(e) {
944
- let t = {};
945
- return e.forEach((n) => {
946
- const { key: a, type: r, option: o = {}, value: l, dateType: s = "date" } = n;
947
- if (a)
948
- if (r == "input" && (o != null && o.multiple))
949
- t[a] = yt(l);
950
- else if (r == "date")
951
- if (s.includes("range")) {
952
- const [i, g] = a;
953
- let [m, p] = l || [];
954
- m && s == "daterange" && (m = Fe(m).format("YYYY-MM-DD 00:00:00"), p = Fe(p).format("YYYY-MM-DD 23:59:59")), t[i] = m, t[g] = p;
955
- } else
956
- t[a] = l;
957
- else
958
- t[a] = l;
959
- }), t;
873
+ //#endregion
874
+ //#region src/components/SearchBar/index.vue
875
+ var dt = { key: 0 }, ft = { class: "btns" }, pt = { class: "left" }, mt = { class: "right" }, ht = /* @__PURE__ */ Q({
876
+ __name: "index",
877
+ props: { form: {
878
+ type: Object,
879
+ required: !0
880
+ } },
881
+ emits: [
882
+ "confirm",
883
+ "reset",
884
+ "visibleChange"
885
+ ],
886
+ setup(e, { expose: t, emit: n }) {
887
+ let r = e, i = n, a = k(!0), o = k(null), { t: p } = G(), g = {
888
+ datetimerange: "YYYY-MM-DD HH:mm:ss",
889
+ daterange: "YYYY-MM-DD",
890
+ month: "YYYY-MM"
891
+ }, _ = c(() => a.value ? p("guan-bi") : p("zhan-kai"));
892
+ function v() {
893
+ i("confirm");
894
+ }
895
+ function y(e) {
896
+ e.option.onClear && e.option.onClear(), i("confirm");
897
+ }
898
+ function x() {
899
+ i("reset");
900
+ }
901
+ function w() {
902
+ i("confirm");
903
+ }
904
+ function T() {
905
+ return ut(r.form.items);
906
+ }
907
+ let E = ne(r.form.items);
908
+ function O() {
909
+ r.form.items.forEach((e) => {
910
+ let t = E.find((t) => t.key == e.key);
911
+ t && (e.value = t.value);
912
+ });
913
+ }
914
+ return t({
915
+ getPrm: T,
916
+ reset: O
917
+ }), (t, n) => {
918
+ let r = M("el-input"), c = M("el-date-picker"), p = M("el-form-item"), T = M("el-form"), E = M("el-link"), O = M("el-button");
919
+ return D(), d("div", {
920
+ class: "searchBar-container mgt10 mgb10",
921
+ onKeydown: B(v, ["enter"])
922
+ }, [f("div", {
923
+ class: "searchBar",
924
+ style: C({ height: a.value ? "auto" : "32px" })
925
+ }, [h(T, {
926
+ inline: "",
927
+ model: e.form.data
928
+ }, {
929
+ default: R(() => [(D(!0), d(s, null, A(e.form.items.filter((e) => !e.hidden), (e) => (D(), d(s, { key: e.key }, [e.type == "br" ? (D(), d("br", dt)) : (D(), l(p, {
930
+ key: 1,
931
+ label: e.name
932
+ }, {
933
+ default: R(() => [
934
+ e.type === "input" ? (D(), l(r, {
935
+ key: 0,
936
+ modelValue: e.value,
937
+ "onUpdate:modelValue": (t) => e.value = t,
938
+ class: S(e.option?.class || "w150"),
939
+ placeholder: t.$t("qing-shu-ru"),
940
+ clearable: ""
941
+ }, null, 8, [
942
+ "modelValue",
943
+ "onUpdate:modelValue",
944
+ "class",
945
+ "placeholder"
946
+ ])) : e.type === "custom" ? (D(), l(N(e.render), { key: 1 })) : u("", !0),
947
+ e.type === "select" ? (D(), l(tt, b({
948
+ key: 2,
949
+ class: e.option?.class || "w150",
950
+ modelValue: e.value,
951
+ "onUpdate:modelValue": (t) => e.value = t
952
+ }, { ref_for: !0 }, e.option, {
953
+ onChange: v,
954
+ onClear: (t) => y(e),
955
+ placeholder: t.$t("qing-xuan-ze")
956
+ }), null, 16, [
957
+ "class",
958
+ "modelValue",
959
+ "onUpdate:modelValue",
960
+ "onClear",
961
+ "placeholder"
962
+ ])) : u("", !0),
963
+ e.type === "date" ? (D(), l(c, b({
964
+ key: 3,
965
+ class: {
966
+ datetimerange: "w300",
967
+ daterange: "w200"
968
+ }[e.dateType] || "w100",
969
+ modelValue: e.value,
970
+ "onUpdate:modelValue": (t) => e.value = t,
971
+ "value-format": g[e.dateType] || "YYYY-MM-DD",
972
+ type: e.dateType || "date",
973
+ onFocus: (t) => o.value = e,
974
+ onChange: (t) => w(e),
975
+ placeholder: t.$t("qing-xuan-ze"),
976
+ "start-placeholder": t.$t("kai-shi-shi-jian"),
977
+ "end-placeholder": t.$t("jie-shu-shi-jian")
978
+ }, { ref_for: !0 }, e.option), null, 16, [
979
+ "class",
980
+ "modelValue",
981
+ "onUpdate:modelValue",
982
+ "value-format",
983
+ "type",
984
+ "onFocus",
985
+ "onChange",
986
+ "placeholder",
987
+ "start-placeholder",
988
+ "end-placeholder"
989
+ ])) : u("", !0)
990
+ ]),
991
+ _: 2
992
+ }, 1032, ["label"]))], 64))), 128))]),
993
+ _: 1
994
+ }, 8, ["model"])], 4), f("div", ft, [f("div", pt, [j(t.$slots, "table-header-left", {}, void 0, !0)]), f("div", mt, [
995
+ h(E, {
996
+ underline: "never",
997
+ class: "mgr10",
998
+ onClick: n[0] ||= () => {
999
+ i("visibleChange", !a.value), a.value = !a.value;
1000
+ }
1001
+ }, {
1002
+ default: R(() => [h(it, { name: a.value ? "ArrowUp" : "ArrowDown" }, null, 8, ["name"]), m(" " + P(_.value), 1)]),
1003
+ _: 1
1004
+ }),
1005
+ h(O, {
1006
+ type: "primary",
1007
+ onClick: v
1008
+ }, {
1009
+ default: R(() => [m(P(t.$t("shai-xuan")), 1)]),
1010
+ _: 1
1011
+ }),
1012
+ h(O, {
1013
+ type: "primary",
1014
+ onClick: x
1015
+ }, {
1016
+ default: R(() => [m(P(t.$t("chong-zhi")), 1)]),
1017
+ _: 1
1018
+ }),
1019
+ j(t.$slots, "btn", {}, void 0, !0)
1020
+ ])])], 32);
1021
+ };
1022
+ }
1023
+ }, [["__scopeId", "data-v-db6f71dd"]]), gt = {
1024
+ pageNoKey: "pageNo",
1025
+ pageSizeKey: "pageSize",
1026
+ totalKey: "total",
1027
+ defaultPageSize: 10,
1028
+ pageSizes: [
1029
+ 10,
1030
+ 50,
1031
+ 100,
1032
+ 500
1033
+ ],
1034
+ responseDataKeys: {
1035
+ rows: [
1036
+ "rows",
1037
+ "records",
1038
+ "list"
1039
+ ],
1040
+ total: ["totalRows", "total"]
1041
+ },
1042
+ showSearch: !1,
1043
+ showPage: !1,
1044
+ showShadow: !1,
1045
+ showCheckBox: !1,
1046
+ enableCellCopy: !0
1047
+ }, $ = { ...gt };
1048
+ function _t(e) {
1049
+ $ = {
1050
+ ...$,
1051
+ ...e,
1052
+ responseDataKeys: {
1053
+ ...$.responseDataKeys,
1054
+ ...e.responseDataKeys || {}
1055
+ }
1056
+ };
960
1057
  }
961
- const vn = { key: 0 }, bn = { class: "btns" }, wn = { class: "left" }, Cn = { class: "right" }, xn = {
962
- __name: "index",
963
- props: {
964
- form: {
965
- type: Object,
966
- required: !0
967
- }
968
- },
969
- emits: ["confirm", "reset", "visibleChange"],
970
- setup(e, { expose: t, emit: n }) {
971
- const a = e, r = n, o = j(!0), l = j(null), { t: s } = we(), i = {
972
- datetimerange: "YYYY-MM-DD HH:mm:ss",
973
- daterange: "YYYY-MM-DD",
974
- month: "YYYY-MM"
975
- }, g = ue(() => o.value ? s("guan-bi") : s("zhan-kai"));
976
- function m() {
977
- r("confirm");
978
- }
979
- function p(w) {
980
- w.option.onClear && w.option.onClear(), r("confirm");
981
- }
982
- function y() {
983
- r("reset");
984
- }
985
- function h() {
986
- r("confirm");
987
- }
988
- function f() {
989
- return je(a.form.items);
990
- }
991
- const c = ut(a.form.items);
992
- function v() {
993
- a.form.items.forEach((w) => {
994
- const x = c.find((C) => C.key == w.key);
995
- x && (w.value = x.value);
996
- });
997
- }
998
- return t({ getPrm: f, reset: v }), (w, x) => {
999
- const C = O("el-input"), S = O("el-date-picker"), V = O("el-form-item"), K = O("el-form"), I = O("el-link"), A = O("el-button");
1000
- return E(), ce("div", {
1001
- class: "searchBar-container mgt10 mgb10",
1002
- onKeydown: Mt(m, ["enter"])
1003
- }, [
1004
- ie("div", {
1005
- class: "searchBar",
1006
- style: zt({ height: o.value ? "auto" : "32px" })
1007
- }, [
1008
- z(K, {
1009
- inline: "",
1010
- model: e.form.data
1011
- }, {
1012
- default: D(() => [
1013
- (E(!0), ce(Ve, null, rt(e.form.items.filter(($) => !$.hidden), ($) => (E(), ce(Ve, {
1014
- key: $.key
1015
- }, [
1016
- $.type == "br" ? (E(), ce("br", vn)) : (E(), W(V, {
1017
- key: 1,
1018
- label: $.name
1019
- }, {
1020
- default: D(() => {
1021
- var ee, b;
1022
- return [
1023
- $.type === "input" ? (E(), W(C, {
1024
- key: 0,
1025
- modelValue: $.value,
1026
- "onUpdate:modelValue": (k) => $.value = k,
1027
- class: it(((ee = $.option) == null ? void 0 : ee.class) || "w150"),
1028
- placeholder: w.$t("qing-shu-ru"),
1029
- clearable: ""
1030
- }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder"])) : $.type === "custom" ? (E(), W(st($.render), { key: 1 })) : me("", !0),
1031
- $.type === "select" ? (E(), W(un, de({
1032
- key: 2,
1033
- class: ((b = $.option) == null ? void 0 : b.class) || "w150",
1034
- modelValue: $.value,
1035
- "onUpdate:modelValue": (k) => $.value = k
1036
- }, { ref_for: !0 }, $.option, {
1037
- onChange: m,
1038
- onClear: (k) => p($),
1039
- placeholder: w.$t("qing-xuan-ze")
1040
- }), null, 16, ["class", "modelValue", "onUpdate:modelValue", "onClear", "placeholder"])) : me("", !0),
1041
- $.type === "date" ? (E(), W(S, de({
1042
- key: 3,
1043
- class: { datetimerange: "w300", daterange: "w200" }[$.dateType] || "w100",
1044
- modelValue: $.value,
1045
- "onUpdate:modelValue": (k) => $.value = k,
1046
- "value-format": i[$.dateType] || "YYYY-MM-DD",
1047
- type: $.dateType || "date",
1048
- onFocus: (k) => l.value = $,
1049
- onChange: (k) => h(),
1050
- placeholder: w.$t("qing-xuan-ze"),
1051
- "start-placeholder": w.$t("kai-shi-shi-jian"),
1052
- "end-placeholder": w.$t("jie-shu-shi-jian")
1053
- }, { ref_for: !0 }, $.option), null, 16, ["class", "modelValue", "onUpdate:modelValue", "value-format", "type", "onFocus", "onChange", "placeholder", "start-placeholder", "end-placeholder"])) : me("", !0)
1054
- ];
1055
- }),
1056
- _: 2
1057
- }, 1032, ["label"]))
1058
- ], 64))), 128))
1059
- ]),
1060
- _: 1
1061
- }, 8, ["model"])
1062
- ], 4),
1063
- ie("div", bn, [
1064
- ie("div", wn, [
1065
- Q(w.$slots, "table-header-left", {}, void 0, !0)
1066
- ]),
1067
- ie("div", Cn, [
1068
- z(I, {
1069
- underline: "never",
1070
- class: "mgr10",
1071
- onClick: x[0] || (x[0] = () => {
1072
- r("visibleChange", !o.value), o.value = !o.value;
1073
- })
1074
- }, {
1075
- default: D(() => [
1076
- z(vt, {
1077
- name: o.value ? "ArrowUp" : "ArrowDown"
1078
- }, null, 8, ["name"]),
1079
- ne(" " + te(g.value), 1)
1080
- ]),
1081
- _: 1
1082
- }),
1083
- z(A, {
1084
- type: "primary",
1085
- onClick: m
1086
- }, {
1087
- default: D(() => [
1088
- ne(te(w.$t("shai-xuan")), 1)
1089
- ]),
1090
- _: 1
1091
- }),
1092
- z(A, {
1093
- type: "primary",
1094
- onClick: y
1095
- }, {
1096
- default: D(() => [
1097
- ne(te(w.$t("chong-zhi")), 1)
1098
- ]),
1099
- _: 1
1100
- }),
1101
- Q(w.$slots, "btn", {}, void 0, !0)
1102
- ])
1103
- ])
1104
- ], 32);
1105
- };
1106
- }
1107
- }, kn = /* @__PURE__ */ ke(xn, [["__scopeId", "data-v-db6f71dd"]]), bt = {
1108
- // 分页参数名
1109
- pageNoKey: "pageNo",
1110
- // 页码参数名
1111
- pageSizeKey: "pageSize",
1112
- // 每页条数参数名
1113
- totalKey: "total",
1114
- // 总条数字段名
1115
- // 分页默认值
1116
- defaultPageSize: 10,
1117
- pageSizes: [10, 50, 100, 500],
1118
- // 响应数据字段映射
1119
- responseDataKeys: {
1120
- rows: ["rows", "records", "list"],
1121
- // 数据列表字段名(优先级从左到右)
1122
- total: ["totalRows", "total"]
1123
- // 总条数字段名
1124
- },
1125
- // UI 功能默认配置
1126
- showSearch: !1,
1127
- // 是否显示搜索栏
1128
- showPage: !1,
1129
- // 是否显示分页
1130
- showShadow: !1,
1131
- // 是否显示阴影
1132
- showCheckBox: !1,
1133
- // 是否显示复选框列
1134
- enableCellCopy: !0
1135
- // 是否启用单元格选区复制功能
1136
- };
1137
- let Se = { ...bt };
1138
- function ro(e) {
1139
- Se = {
1140
- ...Se,
1141
- ...e,
1142
- responseDataKeys: {
1143
- ...Se.responseDataKeys,
1144
- ...e.responseDataKeys || {}
1145
- }
1146
- };
1058
+ function vt() {
1059
+ return $;
1147
1060
  }
1148
- function _n() {
1149
- return Se;
1061
+ function yt() {
1062
+ $ = { ...gt };
1150
1063
  }
1151
- function so() {
1152
- Se = { ...bt };
1153
- }
1154
- const $n = { class: "center" }, Sn = {
1155
- __name: "index",
1156
- props: {
1157
- // 表格id 本地存储列设置时使用,不传则使用路由路径自动生成
1158
- id: {
1159
- type: String,
1160
- required: !1
1161
- },
1162
- loading: {
1163
- type: Boolean,
1164
- default: !1
1165
- },
1166
- // 是否立即请求
1167
- immediate: {
1168
- type: Boolean,
1169
- default: !0
1170
- },
1171
- searchForm: {
1172
- type: Object,
1173
- default: () => ({
1174
- items: [],
1175
- selections: []
1176
- // UI 功能配置会从全局配置中读取默认值
1177
- })
1178
- },
1179
- api: {
1180
- type: Function
1181
- },
1182
- data: {
1183
- type: Array
1184
- },
1185
- tableConfig: {
1186
- type: Object,
1187
- default: () => ({})
1188
- }
1189
- },
1190
- setup(e, { expose: t }) {
1191
- const { t: n, locale: a } = we(), r = Ut(), o = _n(), l = e, s = j(!1), i = j([]);
1192
- l.searchForm.showSearch === void 0 && (l.searchForm.showSearch = o.showSearch), l.searchForm.showPage === void 0 && (l.searchForm.showPage = o.showPage), l.searchForm.showShadow === void 0 && (l.searchForm.showShadow = o.showShadow), l.searchForm.showCheckBox === void 0 && (l.searchForm.showCheckBox = o.showCheckBox), l.searchForm.enableCellCopy === void 0 && (l.searchForm.enableCellCopy = o.enableCellCopy), l.searchForm.selections || (l.searchForm.selections = []);
1193
- const g = ue(() => {
1194
- const d = r.path.replace(/\//g, "-").replace(/^-/, "") || "default-table";
1195
- return l.id ? `listPageId-${d}-${l.id}` : `listPageId-${d}`;
1196
- }), m = ut(l.searchForm.items), p = l.searchForm.pageNoKey || o.pageNoKey, y = l.searchForm.pageSizeKey || o.pageSizeKey, h = Ee({
1197
- [p]: 1,
1198
- [y]: l.searchForm.defaultPageSize || o.defaultPageSize,
1199
- total: 0
1200
- }), f = j(null), c = j(null), v = j(450), w = Be(() => {
1201
- be(() => {
1202
- if (!c.value)
1203
- return;
1204
- const u = c.value.getBoundingClientRect(), F = window.innerHeight, T = u.top, B = 100, G = F - T - B, q = 200;
1205
- v.value = Math.max(G, q);
1206
- });
1207
- }, 100), x = () => {
1208
- w();
1209
- }, C = () => {
1210
- if (!l.searchForm.enableCellCopy && !o.enableCellCopy)
1211
- return !1;
1212
- const d = f.value;
1213
- if (!d || !d.$el)
1214
- return !1;
1215
- const u = d.$el;
1216
- return u.classList.add("cell-copy-enabled"), u.setAttribute("tabindex", "-1"), u.removeEventListener("mousedown", ge), u.removeEventListener("mousemove", M), u.removeEventListener("mouseup", pe), u.removeEventListener("keydown", De), u.addEventListener("mousedown", ge), u.addEventListener("mousemove", M), u.addEventListener("mouseup", pe), u.addEventListener("keydown", De), !0;
1217
- };
1218
- lt(() => {
1219
- w(), window.addEventListener("resize", x), (l.searchForm.enableCellCopy || o.enableCellCopy) && (document.addEventListener("mouseup", Ne), document.addEventListener("mousedown", We), setTimeout(() => {
1220
- C();
1221
- }, 500));
1222
- }), Ot(() => {
1223
- (l.searchForm.enableCellCopy || o.enableCellCopy) && setTimeout(() => {
1224
- C();
1225
- }, 500);
1226
- }), Vt(() => {
1227
- if (window.removeEventListener("resize", x), l.searchForm.enableCellCopy || o.enableCellCopy) {
1228
- document.removeEventListener("mouseup", Ne), document.removeEventListener("mousedown", We);
1229
- const d = f.value;
1230
- if (d && d.$el) {
1231
- const u = d.$el;
1232
- u.removeEventListener("mousedown", ge), u.removeEventListener("mousemove", M), u.removeEventListener("mouseup", pe), u.removeEventListener("keydown", De);
1233
- }
1234
- }
1235
- });
1236
- const S = ue(() => R.value.height || v.value);
1237
- let V;
1238
- async function K(d) {
1239
- const { dataFormat: u } = l.tableConfig;
1240
- d[p] != 1 && (d.nextSearchAfter = V), s.value = !0;
1241
- const { code: F, data: T = {} } = await l.api(d).finally(() => {
1242
- s.value = !1, l.searchForm.selections = [];
1243
- });
1244
- if (F == 200) {
1245
- let B = [];
1246
- for (const q of o.responseDataKeys.rows)
1247
- if (T[q]) {
1248
- B = T[q];
1249
- break;
1250
- }
1251
- let G = 0;
1252
- for (const q of o.responseDataKeys.total)
1253
- if (T[q] !== void 0) {
1254
- G = T[q];
1255
- break;
1256
- }
1257
- i.value = u ? u(B) : B, h.total = G, V = T.nextSearchAfter, (l.searchForm.enableCellCopy || o.enableCellCopy) && be(() => {
1258
- setTimeout(() => {
1259
- C();
1260
- }, 100);
1261
- });
1262
- }
1263
- }
1264
- function I(d = {}) {
1265
- const { searchData: u = () => ({}) } = l.tableConfig, F = u();
1266
- K({
1267
- ...h,
1268
- ...je(l.searchForm.items),
1269
- ...d,
1270
- ...F
1271
- });
1272
- }
1273
- function A() {
1274
- const { reset: d } = l.tableConfig;
1275
- d && d(), l.searchForm.items.forEach((u) => {
1276
- const F = m.find((T) => Qe(u.key) && Qe(T.key) ? u.key.join(",") == T.key.join(",") : T.key == u.key);
1277
- F && (u.value = F.value);
1278
- }), I();
1279
- }
1280
- l.api && l.immediate && I();
1281
- function $() {
1282
- return { ...h, ...je(l.searchForm.items) };
1283
- }
1284
- const ee = () => {
1285
- const d = f.value;
1286
- d && d.clearSort();
1287
- }, b = Ee({
1288
- storage: !0
1289
- }), k = Ee({
1290
- drag: !0,
1291
- resizable: !0,
1292
- maxFixedSize: 0
1293
- }), R = ue(() => {
1294
- const { customConfig: d, columnConfig: u, ...F } = l.tableConfig;
1295
- return {
1296
- headerAlign: "left",
1297
- align: "center",
1298
- customConfig: { ...b, ...d },
1299
- columnConfig: { ...k, ...u },
1300
- // 列过多时 自动宽度 虚拟滚动会闪屏 关闭虚拟滚动
1301
- "virtual-x-config": {
1302
- enabled: !1,
1303
- scrollToLeftOnChange: !1
1304
- },
1305
- // 纵向虚拟滚动 大于100条开启
1306
- "virtual-y-config": { enabled: !0, gt: 100 },
1307
- ...F
1308
- };
1309
- }), _ = Ee({
1310
- isSelecting: !1,
1311
- // 是否正在选择
1312
- startCell: null,
1313
- // 起始单元格 { rowIndex, colIndex }
1314
- endCell: null,
1315
- // 结束单元格
1316
- selectedCells: []
1317
- // 选中的单元格列表 [{ rowIndex, colIndex }]
1318
- }), oe = (d) => {
1319
- const u = d.closest(".vxe-body--column");
1320
- if (!u || u.classList.contains("col--checkbox") || u.classList.contains("col--seq"))
1321
- return null;
1322
- const F = u.closest(".vxe-body--row");
1323
- if (!F)
1324
- return null;
1325
- const T = f.value;
1326
- if (!T)
1327
- return null;
1328
- let B = -1;
1329
- const G = F.getAttribute("data-rowid");
1330
- if (G != null)
1331
- B = parseInt(G, 10);
1332
- else {
1333
- const P = F.parentElement;
1334
- B = Array.from(P.querySelectorAll(".vxe-body--row")).indexOf(F);
1335
- }
1336
- if (B < 0)
1337
- return null;
1338
- let q = -1;
1339
- const se = u.getAttribute("data-colid");
1340
- if (se && (q = T.getColumns().findIndex((L) => L.id === se)), q < 0) {
1341
- const L = Array.from(F.querySelectorAll(".vxe-body--column")).indexOf(u), H = !!u.closest(".vxe-table--fixed-left-wrapper"), J = !!u.closest(".vxe-table--fixed-right-wrapper"), Y = T.getColumns();
1342
- if (H) {
1343
- const X = Y.filter((Z) => Z.fixed === "left");
1344
- L < X.length && (q = Y.indexOf(X[L]));
1345
- } else if (J) {
1346
- const X = Y.filter((Z) => Z.fixed === "right");
1347
- L < X.length && (q = Y.indexOf(X[L]));
1348
- } else {
1349
- const X = l.searchForm.showCheckBox ? 1 : 0;
1350
- q = Y.filter((le) => le.fixed === "left").length + L - X;
1351
- }
1352
- }
1353
- return q < 0 ? null : { rowIndex: B, colIndex: q, cell: u };
1354
- }, ge = (d) => {
1355
- const u = oe(d.target);
1356
- if (!u) {
1357
- fe();
1358
- return;
1359
- }
1360
- _.isSelecting = !0, _.startCell = {
1361
- rowIndex: u.rowIndex,
1362
- colIndex: u.colIndex
1363
- }, _.endCell = { ..._.startCell }, _e(), Le();
1364
- }, M = (d) => {
1365
- if (!_.isSelecting)
1366
- return;
1367
- const u = oe(d.target);
1368
- u && (_.endCell = {
1369
- rowIndex: u.rowIndex,
1370
- colIndex: u.colIndex
1371
- }, _e(), Le());
1372
- }, pe = () => {
1373
- _.isSelecting = !1;
1374
- }, fe = () => {
1375
- _.selectedCells = [], _.startCell = null, _.endCell = null;
1376
- const d = f.value;
1377
- if (!d)
1378
- return;
1379
- d.$el.querySelectorAll(
1380
- ".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left"
1381
- ).forEach((F) => {
1382
- F.classList.remove(
1383
- "cell-selected",
1384
- "cell-border-top",
1385
- "cell-border-right",
1386
- "cell-border-bottom",
1387
- "cell-border-left"
1388
- );
1389
- });
1390
- }, _e = () => {
1391
- if (!_.startCell || !_.endCell) {
1392
- _.selectedCells = [];
1393
- return;
1394
- }
1395
- const d = _.startCell.rowIndex, u = _.endCell.rowIndex, F = _.startCell.colIndex, T = _.endCell.colIndex, B = Math.min(d, u), G = Math.max(d, u), q = Math.min(F, T), se = Math.max(F, T);
1396
- _.selectedCells = [];
1397
- for (let P = B; P <= G; P++)
1398
- for (let L = q; L <= se; L++)
1399
- _.selectedCells.push({
1400
- rowIndex: P,
1401
- colIndex: L
1402
- });
1403
- }, Le = () => {
1404
- be(() => {
1405
- const d = f.value;
1406
- if (!d)
1407
- return;
1408
- const u = d.$el;
1409
- if (u.querySelectorAll(
1410
- ".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left"
1411
- ).forEach((H) => {
1412
- H.classList.remove(
1413
- "cell-selected",
1414
- "cell-border-top",
1415
- "cell-border-right",
1416
- "cell-border-bottom",
1417
- "cell-border-left"
1418
- );
1419
- }), _.selectedCells.length === 0)
1420
- return;
1421
- const F = d.getColumns(), T = _.selectedCells.map((H) => H.rowIndex), B = _.selectedCells.map((H) => H.colIndex), G = Math.min(...T), q = Math.max(...T), se = Math.min(...B), P = Math.max(...B), L = [
1422
- u.querySelector(".vxe-table--body-wrapper tbody"),
1423
- u.querySelector(".vxe-table--fixed-left-wrapper tbody"),
1424
- u.querySelector(".vxe-table--fixed-right-wrapper tbody")
1425
- ].filter(Boolean);
1426
- _.selectedCells.forEach(({ rowIndex: H, colIndex: J }) => {
1427
- const Y = F[J];
1428
- if (!Y)
1429
- return;
1430
- const X = Y.fixed === "left", Z = Y.fixed === "right";
1431
- for (const le of L) {
1432
- const $e = le.querySelectorAll(".vxe-body--row")[H];
1433
- if (!$e)
1434
- continue;
1435
- const ye = Array.from($e.querySelectorAll(".vxe-body--column"));
1436
- let U = null;
1437
- if (X && le.closest(".vxe-table--fixed-left-wrapper")) {
1438
- const ae = F.filter((re) => re.fixed === "left").indexOf(Y);
1439
- U = ye[ae];
1440
- } else if (Z && le.closest(".vxe-table--fixed-right-wrapper")) {
1441
- const ae = F.filter((re) => re.fixed === "right").indexOf(Y);
1442
- U = ye[ae];
1443
- } else if (!X && !Z && le.closest(".vxe-table--body-wrapper")) {
1444
- const ve = l.searchForm.showCheckBox ? 1 : 0, ae = F.filter((Me) => Me.fixed === "left").length, re = J - ae;
1445
- U = ye[re + ve];
1446
- }
1447
- if (U && !U.classList.contains("col--checkbox") && !U.classList.contains("col--seq")) {
1448
- U.classList.add("cell-selected"), H === G && U.classList.add("cell-border-top"), H === q && U.classList.add("cell-border-bottom"), J === se && U.classList.add("cell-border-left"), J === P && U.classList.add("cell-border-right");
1449
- break;
1450
- }
1451
- }
1452
- });
1453
- });
1454
- }, Ct = async () => {
1455
- if (_.selectedCells.length === 0)
1456
- return;
1457
- const d = f.value;
1458
- if (!d)
1459
- return;
1460
- const u = d.$el, F = d.getColumns(), T = [...new Set(_.selectedCells.map((P) => P.rowIndex))].sort(
1461
- (P, L) => P - L
1462
- ), B = [...new Set(_.selectedCells.map((P) => P.colIndex))].sort(
1463
- (P, L) => P - L
1464
- ), G = [
1465
- u.querySelector(".vxe-table--body-wrapper tbody"),
1466
- u.querySelector(".vxe-table--fixed-left-wrapper tbody"),
1467
- u.querySelector(".vxe-table--fixed-right-wrapper tbody")
1468
- ].filter(Boolean), q = [];
1469
- T.forEach((P) => {
1470
- const L = [];
1471
- B.forEach((H) => {
1472
- const J = F[H];
1473
- if (!J) {
1474
- L.push("");
1475
- return;
1476
- }
1477
- const Y = J.fixed === "left", X = J.fixed === "right";
1478
- let Z = "";
1479
- for (const le of G) {
1480
- const $e = le.querySelectorAll(".vxe-body--row")[P];
1481
- if (!$e)
1482
- continue;
1483
- const ye = Array.from($e.querySelectorAll(".vxe-body--column"));
1484
- let U = null;
1485
- if (Y && le.closest(".vxe-table--fixed-left-wrapper")) {
1486
- const ae = F.filter((re) => re.fixed === "left").indexOf(J);
1487
- U = ye[ae];
1488
- } else if (X && le.closest(".vxe-table--fixed-right-wrapper")) {
1489
- const ae = F.filter((re) => re.fixed === "right").indexOf(J);
1490
- U = ye[ae];
1491
- } else if (!Y && !X && le.closest(".vxe-table--body-wrapper")) {
1492
- const ve = l.searchForm.showCheckBox ? 1 : 0, ae = F.filter((Me) => Me.fixed === "left").length, re = H - ae;
1493
- U = ye[re + ve];
1494
- }
1495
- if (U && !U.classList.contains("col--checkbox") && !U.classList.contains("col--seq")) {
1496
- Z = U.innerText || U.textContent || "", Z = Z.trim(), Z = Z.replace(/\n/g, " ").replace(/\s+/g, " ");
1497
- break;
1498
- }
1499
- }
1500
- L.push(Z);
1501
- }), q.push(L.join(" "));
1502
- });
1503
- const se = q.join(`
1504
- `);
1505
- try {
1506
- await navigator.clipboard.writeText(se);
1507
- } catch (P) {
1508
- console.error("复制失败:", P);
1509
- }
1510
- }, De = (d) => {
1511
- !l.searchForm.enableCellCopy && !o.enableCellCopy || ((d.ctrlKey || d.metaKey) && d.key === "c" ? _.selectedCells.length > 0 && (d.preventDefault(), d.stopPropagation(), Ct()) : d.key === "Escape" && fe());
1512
- }, Ne = () => {
1513
- _.isSelecting = !1;
1514
- }, We = (d) => {
1515
- const u = f.value;
1516
- if (!u || !u.$el)
1517
- return;
1518
- u.$el.contains(d.target) || fe();
1519
- }, xt = (d) => {
1520
- h[p] = d, I();
1521
- }, kt = (d) => {
1522
- h[y] = d, h[p] = 1, I();
1523
- };
1524
- function Ze() {
1525
- const d = f.value.getCheckboxRecords();
1526
- l.searchForm.selections = d;
1527
- }
1528
- const Ge = (d) => {
1529
- const u = f.value;
1530
- if (u) {
1531
- u.toggleCheckboxRow(d);
1532
- const F = f.value.getCheckboxRecords();
1533
- l.searchForm.selections = F;
1534
- }
1535
- };
1536
- return t({ tableRef: f, getList: I, getPrm: $, clearSort: ee, calculateTableHeight: w }), (d, u) => {
1537
- var P;
1538
- const F = O("el-button"), T = O("el-checkbox"), B = O("el-text"), G = O("vxe-column"), q = O("VxeTable"), se = O("el-pagination");
1539
- return E(), ce("div", {
1540
- class: it({ box: e.searchForm.showShadow })
1541
- }, [
1542
- e.searchForm.showSearch ? (E(), W(kn, {
1543
- key: 0,
1544
- form: e.searchForm,
1545
- onReset: A,
1546
- onConfirm: u[1] || (u[1] = (L) => I()),
1547
- onVisibleChange: N(w)
1548
- }, {
1549
- btn: D(() => [
1550
- u[3] || (u[3] = ie("span", { class: "mgr10" }, null, -1)),
1551
- Q(d.$slots, "search-bar-btn", {}, void 0, !0),
1552
- z(F, {
1553
- class: "mgl10",
1554
- round: "",
1555
- onClick: u[0] || (u[0] = (L) => f.value.openCustom())
1556
- }, {
1557
- default: D(() => [
1558
- z(vt, { name: "Tools" })
1559
- ]),
1560
- _: 1
1561
- })
1562
- ]),
1563
- _: 3
1564
- }, 8, ["form", "onVisibleChange"])) : me("", !0),
1565
- Q(d.$slots, "table-header-left", {}, void 0, !0),
1566
- ie("div", {
1567
- ref_key: "tableContentRef",
1568
- ref: c
1569
- }, [
1570
- z(q, de({
1571
- id: g.value,
1572
- ref_key: "tableRef",
1573
- ref: f,
1574
- loading: e.loading || s.value,
1575
- data: e.api ? i.value : e.data,
1576
- border: ""
1577
- }, R.value, {
1578
- height: S.value,
1579
- onCheckboxChange: Ze,
1580
- onCheckboxAll: Ze,
1581
- onSortChange: (P = R.value["sort-config"]) == null ? void 0 : P.sortChange
1582
- }), {
1583
- default: D(() => [
1584
- e.searchForm.showCheckBox == null || e.searchForm.showCheckBox ? (E(), W(G, {
1585
- key: 0,
1586
- type: "checkbox",
1587
- width: N(a) == "zh_cn" ? 80 : 150,
1588
- title: d.$t("xu-hao"),
1589
- fixed: "left"
1590
- }, {
1591
- checkbox: D(({ rowIndex: L, row: H, checked: J, disabled: Y, indeterminate: X }) => [
1592
- ie("div", $n, [
1593
- J ? (E(), W(T, {
1594
- key: 0,
1595
- checked: !0,
1596
- disabled: Y,
1597
- size: "default",
1598
- onClick: qe((Z) => !Y && Ge(H), ["stop"])
1599
- }, null, 8, ["disabled", "onClick"])) : (E(), W(T, {
1600
- key: 1,
1601
- disabled: Y,
1602
- checked: !1,
1603
- size: "default",
1604
- onClick: qe((Z) => !Y && Ge(H), ["stop"])
1605
- }, null, 8, ["disabled", "onClick"])),
1606
- z(B, {
1607
- type: "info",
1608
- class: "mgl5"
1609
- }, {
1610
- default: D(() => [
1611
- ne(te(L + 1), 1)
1612
- ]),
1613
- _: 2
1614
- }, 1024)
1615
- ])
1616
- ]),
1617
- _: 1
1618
- }, 8, ["width", "title"])) : me("", !0),
1619
- Q(d.$slots, "default", {}, void 0, !0)
1620
- ]),
1621
- _: 3
1622
- }, 16, ["id", "loading", "data", "height", "onSortChange"])
1623
- ], 512),
1624
- e.searchForm.showPage ? (E(), W(se, {
1625
- key: 1,
1626
- "current-page": h[N(p)],
1627
- "onUpdate:currentPage": u[2] || (u[2] = (L) => h[N(p)] = L),
1628
- class: "myPagination mgt10",
1629
- background: "",
1630
- layout: "total, sizes, prev, pager, next",
1631
- total: h.total,
1632
- "page-size": h[N(y)],
1633
- "page-sizes": e.searchForm.pageSizes || N(o).pageSizes,
1634
- onCurrentChange: xt,
1635
- onSizeChange: kt
1636
- }, null, 8, ["current-page", "total", "page-size", "page-sizes"])) : me("", !0)
1637
- ], 2);
1638
- };
1639
- }
1640
- }, io = /* @__PURE__ */ ke(Sn, [["__scopeId", "data-v-c022c16d"]]), co = {
1641
- __name: "index",
1642
- props: {
1643
- sheetsConfig: {
1644
- type: Object,
1645
- required: !0
1646
- },
1647
- fileName: {
1648
- type: String,
1649
- required: !0
1650
- }
1651
- },
1652
- setup(e) {
1653
- const t = e;
1654
- function n() {
1655
- ln(t.fileName, t.sheetsConfig);
1656
- }
1657
- return (a, r) => {
1658
- const o = O("el-link");
1659
- return E(), W(o, de({
1660
- type: "primary",
1661
- underline: "never"
1662
- }, a.$attrs, { onClick: n }), {
1663
- default: D(() => [
1664
- Q(a.$slots, "default", {}, () => [
1665
- ne(te(a.$t("xia-zai-dao-ru-mo-ban")), 1)
1666
- ])
1667
- ]),
1668
- _: 3
1669
- }, 16);
1670
- };
1671
- }
1672
- }, Fn = {
1673
- mounted(e, t) {
1674
- t.value && tt(e);
1675
- },
1676
- updated(e, t) {
1677
- t.value ? tt(e) : nt(e);
1678
- },
1679
- beforeUnmount(e) {
1680
- nt(e);
1681
- }
1064
+ //#endregion
1065
+ //#region src/components/ListPage/index.vue
1066
+ var bt = { class: "center" }, xt = /* @__PURE__ */ Q({
1067
+ __name: "index",
1068
+ props: {
1069
+ id: {
1070
+ type: String,
1071
+ required: !1
1072
+ },
1073
+ loading: {
1074
+ type: Boolean,
1075
+ default: !1
1076
+ },
1077
+ immediate: {
1078
+ type: Boolean,
1079
+ default: !0
1080
+ },
1081
+ searchForm: {
1082
+ type: Object,
1083
+ default: () => ({
1084
+ items: [],
1085
+ selections: []
1086
+ })
1087
+ },
1088
+ api: { type: Function },
1089
+ data: { type: Array },
1090
+ tableConfig: {
1091
+ type: Object,
1092
+ default: () => ({})
1093
+ }
1094
+ },
1095
+ setup(e, { expose: t }) {
1096
+ let { t: n, locale: r } = G(), i = ae(), a = vt(), o = e, s = k(!1), p = k([]);
1097
+ o.searchForm.showSearch === void 0 && (o.searchForm.showSearch = a.showSearch), o.searchForm.showPage === void 0 && (o.searchForm.showPage = a.showPage), o.searchForm.showShadow === void 0 && (o.searchForm.showShadow = a.showShadow), o.searchForm.showCheckBox === void 0 && (o.searchForm.showCheckBox = a.showCheckBox), o.searchForm.enableCellCopy === void 0 && (o.searchForm.enableCellCopy = a.enableCellCopy), o.searchForm.selections || (o.searchForm.selections = []);
1098
+ let g = c(() => {
1099
+ let e = i.path.replace(/\//g, "-").replace(/^-/, "") || "default-table";
1100
+ return o.id ? `listPageId-${e}-${o.id}` : `listPageId-${e}`;
1101
+ }), _ = ne(o.searchForm.items), v = o.searchForm.pageNoKey || a.pageNoKey, y = o.searchForm.pageSizeKey || a.pageSizeKey, C = O({
1102
+ [v]: 1,
1103
+ [y]: o.searchForm.defaultPageSize || a.defaultPageSize,
1104
+ total: 0
1105
+ }), A = k(null), N = k(null), ee = k(450), I = re(() => {
1106
+ x(() => {
1107
+ if (!N.value) return;
1108
+ let e = N.value.getBoundingClientRect(), t = window.innerHeight - e.top - 100;
1109
+ ee.value = Math.max(t, 200);
1110
+ });
1111
+ }, 100), L = () => {
1112
+ I();
1113
+ }, z = () => {
1114
+ if (!o.searchForm.enableCellCopy && !a.enableCellCopy) return !1;
1115
+ let e = A.value;
1116
+ if (!e || !e.$el) return !1;
1117
+ let t = e.$el;
1118
+ return t.classList.add("cell-copy-enabled"), t.setAttribute("tabindex", "-1"), t.removeEventListener("mousedown", J), t.removeEventListener("mousemove", Y), t.removeEventListener("mouseup", X), t.removeEventListener("keydown", he), t.addEventListener("mousedown", J), t.addEventListener("mousemove", Y), t.addEventListener("mouseup", X), t.addEventListener("keydown", he), !0;
1119
+ };
1120
+ w(() => {
1121
+ I(), window.addEventListener("resize", L), (o.searchForm.enableCellCopy || a.enableCellCopy) && (document.addEventListener("mouseup", ge), document.addEventListener("mousedown", _e), setTimeout(() => {
1122
+ z();
1123
+ }, 500));
1124
+ }), E(() => {
1125
+ (o.searchForm.enableCellCopy || a.enableCellCopy) && setTimeout(() => {
1126
+ z();
1127
+ }, 500);
1128
+ }), T(() => {
1129
+ if (window.removeEventListener("resize", L), o.searchForm.enableCellCopy || a.enableCellCopy) {
1130
+ document.removeEventListener("mouseup", ge), document.removeEventListener("mousedown", _e);
1131
+ let e = A.value;
1132
+ if (e && e.$el) {
1133
+ let t = e.$el;
1134
+ t.removeEventListener("mousedown", J), t.removeEventListener("mousemove", Y), t.removeEventListener("mouseup", X), t.removeEventListener("keydown", he);
1135
+ }
1136
+ }
1137
+ });
1138
+ let B = c(() => ue.value.height || ee.value), V;
1139
+ async function H(e) {
1140
+ let { dataFormat: t } = o.tableConfig;
1141
+ e[v] != 1 && (e.nextSearchAfter = V), s.value = !0;
1142
+ let { code: n, data: r = {} } = await o.api(e).finally(() => {
1143
+ s.value = !1, o.searchForm.selections = [];
1144
+ });
1145
+ if (n == 200) {
1146
+ let e = [];
1147
+ for (let t of a.responseDataKeys.rows) if (r[t]) {
1148
+ e = r[t];
1149
+ break;
1150
+ }
1151
+ let n = 0;
1152
+ for (let e of a.responseDataKeys.total) if (r[e] !== void 0) {
1153
+ n = r[e];
1154
+ break;
1155
+ }
1156
+ p.value = t ? t(e) : e, C.total = n, V = r.nextSearchAfter, (o.searchForm.enableCellCopy || a.enableCellCopy) && x(() => {
1157
+ setTimeout(() => {
1158
+ z();
1159
+ }, 100);
1160
+ });
1161
+ }
1162
+ }
1163
+ function U(e = {}) {
1164
+ let { searchData: t = () => ({}) } = o.tableConfig, n = t();
1165
+ H({
1166
+ ...C,
1167
+ ...ut(o.searchForm.items),
1168
+ ...e,
1169
+ ...n
1170
+ });
1171
+ }
1172
+ function W() {
1173
+ let { reset: e } = o.tableConfig;
1174
+ e && e(), o.searchForm.items.forEach((e) => {
1175
+ let t = _.find((t) => ie(e.key) && ie(t.key) ? e.key.join(",") == t.key.join(",") : t.key == e.key);
1176
+ t && (e.value = t.value);
1177
+ }), U();
1178
+ }
1179
+ o.api && o.immediate && U();
1180
+ function oe() {
1181
+ return {
1182
+ ...C,
1183
+ ...ut(o.searchForm.items)
1184
+ };
1185
+ }
1186
+ let se = () => {
1187
+ let e = A.value;
1188
+ e && e.clearSort();
1189
+ }, ce = O({ storage: !0 }), le = O({
1190
+ drag: !0,
1191
+ resizable: !0,
1192
+ maxFixedSize: 0
1193
+ }), ue = c(() => {
1194
+ let { customConfig: e, columnConfig: t, ...n } = o.tableConfig;
1195
+ return {
1196
+ headerAlign: "left",
1197
+ align: "center",
1198
+ customConfig: {
1199
+ ...ce,
1200
+ ...e
1201
+ },
1202
+ columnConfig: {
1203
+ ...le,
1204
+ ...t
1205
+ },
1206
+ "virtual-x-config": {
1207
+ enabled: !1,
1208
+ scrollToLeftOnChange: !1
1209
+ },
1210
+ "virtual-y-config": {
1211
+ enabled: !0,
1212
+ gt: 100
1213
+ },
1214
+ ...n
1215
+ };
1216
+ }), K = O({
1217
+ isSelecting: !1,
1218
+ startCell: null,
1219
+ endCell: null,
1220
+ selectedCells: []
1221
+ }), q = (e) => {
1222
+ let t = e.closest(".vxe-body--column");
1223
+ if (!t || t.classList.contains("col--checkbox") || t.classList.contains("col--seq")) return null;
1224
+ let n = t.closest(".vxe-body--row");
1225
+ if (!n) return null;
1226
+ let r = A.value;
1227
+ if (!r) return null;
1228
+ let i = -1, a = n.getAttribute("data-rowid");
1229
+ if (a != null) i = parseInt(a, 10);
1230
+ else {
1231
+ let e = n.parentElement;
1232
+ i = Array.from(e.querySelectorAll(".vxe-body--row")).indexOf(n);
1233
+ }
1234
+ if (i < 0) return null;
1235
+ let s = -1, c = t.getAttribute("data-colid");
1236
+ if (c && (s = r.getColumns().findIndex((e) => e.id === c)), s < 0) {
1237
+ let e = Array.from(n.querySelectorAll(".vxe-body--column")).indexOf(t), i = !!t.closest(".vxe-table--fixed-left-wrapper"), a = !!t.closest(".vxe-table--fixed-right-wrapper"), c = r.getColumns();
1238
+ if (i) {
1239
+ let t = c.filter((e) => e.fixed === "left");
1240
+ e < t.length && (s = c.indexOf(t[e]));
1241
+ } else if (a) {
1242
+ let t = c.filter((e) => e.fixed === "right");
1243
+ e < t.length && (s = c.indexOf(t[e]));
1244
+ } else {
1245
+ let t = o.searchForm.showCheckBox ? 1 : 0;
1246
+ s = c.filter((e) => e.fixed === "left").length + e - t;
1247
+ }
1248
+ }
1249
+ return s < 0 ? null : {
1250
+ rowIndex: i,
1251
+ colIndex: s,
1252
+ cell: t
1253
+ };
1254
+ }, J = (e) => {
1255
+ let t = q(e.target);
1256
+ if (!t) {
1257
+ de();
1258
+ return;
1259
+ }
1260
+ K.isSelecting = !0, K.startCell = {
1261
+ rowIndex: t.rowIndex,
1262
+ colIndex: t.colIndex
1263
+ }, K.endCell = { ...K.startCell }, fe(), pe();
1264
+ }, Y = (e) => {
1265
+ if (!K.isSelecting) return;
1266
+ let t = q(e.target);
1267
+ t && (K.endCell = {
1268
+ rowIndex: t.rowIndex,
1269
+ colIndex: t.colIndex
1270
+ }, fe(), pe());
1271
+ }, X = () => {
1272
+ K.isSelecting = !1;
1273
+ }, de = () => {
1274
+ K.selectedCells = [], K.startCell = null, K.endCell = null;
1275
+ let e = A.value;
1276
+ e && e.$el.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach((e) => {
1277
+ e.classList.remove("cell-selected", "cell-border-top", "cell-border-right", "cell-border-bottom", "cell-border-left");
1278
+ });
1279
+ }, fe = () => {
1280
+ if (!K.startCell || !K.endCell) {
1281
+ K.selectedCells = [];
1282
+ return;
1283
+ }
1284
+ let e = K.startCell.rowIndex, t = K.endCell.rowIndex, n = K.startCell.colIndex, r = K.endCell.colIndex, i = Math.min(e, t), a = Math.max(e, t), o = Math.min(n, r), s = Math.max(n, r);
1285
+ K.selectedCells = [];
1286
+ for (let e = i; e <= a; e++) for (let t = o; t <= s; t++) K.selectedCells.push({
1287
+ rowIndex: e,
1288
+ colIndex: t
1289
+ });
1290
+ }, pe = () => {
1291
+ x(() => {
1292
+ let e = A.value;
1293
+ if (!e) return;
1294
+ let t = e.$el;
1295
+ if (t.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach((e) => {
1296
+ e.classList.remove("cell-selected", "cell-border-top", "cell-border-right", "cell-border-bottom", "cell-border-left");
1297
+ }), K.selectedCells.length === 0) return;
1298
+ let n = e.getColumns(), r = K.selectedCells.map((e) => e.rowIndex), i = K.selectedCells.map((e) => e.colIndex), a = Math.min(...r), s = Math.max(...r), c = Math.min(...i), l = Math.max(...i), u = [
1299
+ t.querySelector(".vxe-table--body-wrapper tbody"),
1300
+ t.querySelector(".vxe-table--fixed-left-wrapper tbody"),
1301
+ t.querySelector(".vxe-table--fixed-right-wrapper tbody")
1302
+ ].filter(Boolean);
1303
+ K.selectedCells.forEach(({ rowIndex: e, colIndex: t }) => {
1304
+ let r = n[t];
1305
+ if (!r) return;
1306
+ let i = r.fixed === "left", d = r.fixed === "right";
1307
+ for (let f of u) {
1308
+ let u = f.querySelectorAll(".vxe-body--row")[e];
1309
+ if (!u) continue;
1310
+ let p = Array.from(u.querySelectorAll(".vxe-body--column")), m = null;
1311
+ if (i && f.closest(".vxe-table--fixed-left-wrapper")) m = p[n.filter((e) => e.fixed === "left").indexOf(r)];
1312
+ else if (d && f.closest(".vxe-table--fixed-right-wrapper")) m = p[n.filter((e) => e.fixed === "right").indexOf(r)];
1313
+ else if (!i && !d && f.closest(".vxe-table--body-wrapper")) {
1314
+ let e = o.searchForm.showCheckBox ? 1 : 0;
1315
+ m = p[t - n.filter((e) => e.fixed === "left").length + e];
1316
+ }
1317
+ if (m && !m.classList.contains("col--checkbox") && !m.classList.contains("col--seq")) {
1318
+ m.classList.add("cell-selected"), e === a && m.classList.add("cell-border-top"), e === s && m.classList.add("cell-border-bottom"), t === c && m.classList.add("cell-border-left"), t === l && m.classList.add("cell-border-right");
1319
+ break;
1320
+ }
1321
+ }
1322
+ });
1323
+ });
1324
+ }, me = async () => {
1325
+ if (K.selectedCells.length === 0) return;
1326
+ let e = A.value;
1327
+ if (!e) return;
1328
+ let t = e.$el, n = e.getColumns(), r = [...new Set(K.selectedCells.map((e) => e.rowIndex))].sort((e, t) => e - t), i = [...new Set(K.selectedCells.map((e) => e.colIndex))].sort((e, t) => e - t), a = [
1329
+ t.querySelector(".vxe-table--body-wrapper tbody"),
1330
+ t.querySelector(".vxe-table--fixed-left-wrapper tbody"),
1331
+ t.querySelector(".vxe-table--fixed-right-wrapper tbody")
1332
+ ].filter(Boolean), s = [];
1333
+ r.forEach((e) => {
1334
+ let t = [];
1335
+ i.forEach((r) => {
1336
+ let i = n[r];
1337
+ if (!i) {
1338
+ t.push("");
1339
+ return;
1340
+ }
1341
+ let s = i.fixed === "left", c = i.fixed === "right", l = "";
1342
+ for (let t of a) {
1343
+ let a = t.querySelectorAll(".vxe-body--row")[e];
1344
+ if (!a) continue;
1345
+ let u = Array.from(a.querySelectorAll(".vxe-body--column")), d = null;
1346
+ if (s && t.closest(".vxe-table--fixed-left-wrapper")) d = u[n.filter((e) => e.fixed === "left").indexOf(i)];
1347
+ else if (c && t.closest(".vxe-table--fixed-right-wrapper")) d = u[n.filter((e) => e.fixed === "right").indexOf(i)];
1348
+ else if (!s && !c && t.closest(".vxe-table--body-wrapper")) {
1349
+ let e = o.searchForm.showCheckBox ? 1 : 0;
1350
+ d = u[r - n.filter((e) => e.fixed === "left").length + e];
1351
+ }
1352
+ if (d && !d.classList.contains("col--checkbox") && !d.classList.contains("col--seq")) {
1353
+ l = d.innerText || d.textContent || "", l = l.trim(), l = l.replace(/\n/g, " ").replace(/\s+/g, " ");
1354
+ break;
1355
+ }
1356
+ }
1357
+ t.push(l);
1358
+ }), s.push(t.join(" "));
1359
+ });
1360
+ let c = s.join("\n");
1361
+ try {
1362
+ await navigator.clipboard.writeText(c);
1363
+ } catch (e) {
1364
+ console.error("复制失败:", e);
1365
+ }
1366
+ }, he = (e) => {
1367
+ !o.searchForm.enableCellCopy && !a.enableCellCopy || ((e.ctrlKey || e.metaKey) && e.key === "c" ? K.selectedCells.length > 0 && (e.preventDefault(), e.stopPropagation(), me()) : e.key === "Escape" && de());
1368
+ }, ge = () => {
1369
+ K.isSelecting = !1;
1370
+ }, _e = (e) => {
1371
+ let t = A.value;
1372
+ !t || !t.$el || t.$el.contains(e.target) || de();
1373
+ }, ve = (e) => {
1374
+ C[v] = e, U();
1375
+ }, ye = (e) => {
1376
+ C[y] = e, C[v] = 1, U();
1377
+ };
1378
+ function be() {
1379
+ let e = A.value.getCheckboxRecords();
1380
+ o.searchForm.selections = e;
1381
+ }
1382
+ let xe = (e) => {
1383
+ let t = A.value;
1384
+ if (t) {
1385
+ t.toggleCheckboxRow(e);
1386
+ let n = A.value.getCheckboxRecords();
1387
+ o.searchForm.selections = n;
1388
+ }
1389
+ };
1390
+ return t({
1391
+ tableRef: A,
1392
+ getList: U,
1393
+ getPrm: oe,
1394
+ clearSort: se,
1395
+ calculateTableHeight: I
1396
+ }), (t, n) => {
1397
+ let i = M("el-button"), o = M("el-checkbox"), c = M("el-text"), _ = M("vxe-column"), x = M("VxeTable"), w = M("el-pagination");
1398
+ return D(), d("div", { class: S({ box: e.searchForm.showShadow }) }, [
1399
+ e.searchForm.showSearch ? (D(), l(ht, {
1400
+ key: 0,
1401
+ form: e.searchForm,
1402
+ onReset: W,
1403
+ onConfirm: n[1] ||= (e) => U(),
1404
+ onVisibleChange: F(I)
1405
+ }, {
1406
+ btn: R(() => [
1407
+ n[3] ||= f("span", { class: "mgr10" }, null, -1),
1408
+ j(t.$slots, "search-bar-btn", {}, void 0, !0),
1409
+ h(i, {
1410
+ class: "mgl10",
1411
+ round: "",
1412
+ onClick: n[0] ||= (e) => A.value.openCustom()
1413
+ }, {
1414
+ default: R(() => [h(it, { name: "Tools" })]),
1415
+ _: 1
1416
+ })
1417
+ ]),
1418
+ _: 3
1419
+ }, 8, ["form", "onVisibleChange"])) : u("", !0),
1420
+ j(t.$slots, "table-header-left", {}, void 0, !0),
1421
+ f("div", {
1422
+ ref_key: "tableContentRef",
1423
+ ref: N
1424
+ }, [h(x, b({
1425
+ id: g.value,
1426
+ ref_key: "tableRef",
1427
+ ref: A,
1428
+ loading: e.loading || s.value,
1429
+ data: e.api ? p.value : e.data,
1430
+ border: ""
1431
+ }, ue.value, {
1432
+ height: B.value,
1433
+ onCheckboxChange: be,
1434
+ onCheckboxAll: be,
1435
+ onSortChange: ue.value["sort-config"]?.sortChange
1436
+ }), {
1437
+ default: R(() => [e.searchForm.showCheckBox == null || e.searchForm.showCheckBox ? (D(), l(_, {
1438
+ key: 0,
1439
+ type: "checkbox",
1440
+ width: F(r) == "zh_cn" ? 80 : 150,
1441
+ title: t.$t("xu-hao"),
1442
+ fixed: "left"
1443
+ }, {
1444
+ checkbox: R(({ rowIndex: e, row: t, checked: n, disabled: r, indeterminate: i }) => [f("div", bt, [n ? (D(), l(o, {
1445
+ key: 0,
1446
+ checked: !0,
1447
+ disabled: r,
1448
+ size: "default",
1449
+ onClick: te((e) => !r && xe(t), ["stop"])
1450
+ }, null, 8, ["disabled", "onClick"])) : (D(), l(o, {
1451
+ key: 1,
1452
+ disabled: r,
1453
+ checked: !1,
1454
+ size: "default",
1455
+ onClick: te((e) => !r && xe(t), ["stop"])
1456
+ }, null, 8, ["disabled", "onClick"])), h(c, {
1457
+ type: "info",
1458
+ class: "mgl5"
1459
+ }, {
1460
+ default: R(() => [m(P(e + 1), 1)]),
1461
+ _: 2
1462
+ }, 1024)])]),
1463
+ _: 1
1464
+ }, 8, ["width", "title"])) : u("", !0), j(t.$slots, "default", {}, void 0, !0)]),
1465
+ _: 3
1466
+ }, 16, [
1467
+ "id",
1468
+ "loading",
1469
+ "data",
1470
+ "height",
1471
+ "onSortChange"
1472
+ ])], 512),
1473
+ e.searchForm.showPage ? (D(), l(w, {
1474
+ key: 1,
1475
+ "current-page": C[F(v)],
1476
+ "onUpdate:currentPage": n[2] ||= (e) => C[F(v)] = e,
1477
+ class: "myPagination mgt10",
1478
+ background: "",
1479
+ layout: "total, sizes, prev, pager, next",
1480
+ total: C.total,
1481
+ "page-size": C[F(y)],
1482
+ "page-sizes": e.searchForm.pageSizes || F(a).pageSizes,
1483
+ onCurrentChange: ve,
1484
+ onSizeChange: ye
1485
+ }, null, 8, [
1486
+ "current-page",
1487
+ "total",
1488
+ "page-size",
1489
+ "page-sizes"
1490
+ ])) : u("", !0)
1491
+ ], 2);
1492
+ };
1493
+ }
1494
+ }, [["__scopeId", "data-v-c022c16d"]]), St = {
1495
+ __name: "index",
1496
+ props: {
1497
+ sheetsConfig: {
1498
+ type: Object,
1499
+ required: !0
1500
+ },
1501
+ fileName: {
1502
+ type: String,
1503
+ required: !0
1504
+ }
1505
+ },
1506
+ setup(e) {
1507
+ let t = e;
1508
+ function n() {
1509
+ ze(t.fileName, t.sheetsConfig);
1510
+ }
1511
+ return (e, t) => {
1512
+ let r = M("el-link");
1513
+ return D(), l(r, b({
1514
+ type: "primary",
1515
+ underline: "never"
1516
+ }, e.$attrs, { onClick: n }), {
1517
+ default: R(() => [j(e.$slots, "default", {}, () => [m(P(e.$t("xia-zai-dao-ru-mo-ban")), 1)])]),
1518
+ _: 3
1519
+ }, 16);
1520
+ };
1521
+ }
1522
+ }, Ct = {
1523
+ mounted(e, t) {
1524
+ t.value && wt(e);
1525
+ },
1526
+ updated(e, t) {
1527
+ t.value ? wt(e) : Tt(e);
1528
+ },
1529
+ beforeUnmount(e) {
1530
+ Tt(e);
1531
+ }
1682
1532
  };
1683
- async function tt(e) {
1684
- await y();
1685
- const t = e.querySelector(".el-dialog");
1686
- if (!t)
1687
- return;
1688
- const n = e.querySelector(".el-dialog__header"), a = e.querySelector(".el-overlay");
1689
- a.style.cssText += "overflow: hidden;", n.style.cursor = "move";
1690
- let r = !1, o = {
1691
- // 数据源,不变部分为:window信息、dialog信息、mouse初始值信息,可变部分为:拖拽坐标位移
1692
- window: {
1693
- // window信息
1694
- width: 0,
1695
- height: 0
1696
- },
1697
- dialog: {
1698
- x: 0,
1699
- y: 0,
1700
- width: 0,
1701
- height: 0,
1702
- marginTop: ""
1703
- },
1704
- // dialog信息
1705
- mouse: {
1706
- // 鼠标初始信息
1707
- x: 0,
1708
- y: 0
1709
- },
1710
- drag: {
1711
- // 拖拽过程信息
1712
- x: 0,
1713
- y: 0
1714
- }
1715
- };
1716
- n.addEventListener("mousedown", i), document.addEventListener("mousemove", g), document.addEventListener("mouseup", m), window.addEventListener("resize", p);
1717
- function l() {
1718
- o.mouse.x - o.drag.x >= o.dialog.x && (o.drag.x = o.mouse.x - o.dialog.x), o.drag.x - o.mouse.x >= o.window.width - (o.dialog.x + o.dialog.width) && (o.drag.x = o.mouse.x + o.window.width - o.dialog.x - o.dialog.width), o.mouse.y - o.drag.y >= o.dialog.y && (o.drag.y = o.mouse.y - o.dialog.y), o.drag.y - o.mouse.y >= o.window.height - (o.dialog.y + o.dialog.height) && (o.drag.y = o.mouse.y + o.window.height - o.dialog.y - o.dialog.height), s();
1719
- }
1720
- function s() {
1721
- let h = o.drag.y - o.mouse.y + o.dialog.y, f = o.drag.x - o.mouse.x + o.dialog.x;
1722
- t.style.cssText += `position: absolute; top: calc(${h}px - ${o.dialog.marginTop}); left: ${f}px;`;
1723
- }
1724
- function i(h) {
1725
- h.button === 0 && (o.window = {
1726
- width: document.body.clientWidth,
1727
- height: document.body.clientHeight
1728
- }, o.dialog = t.getBoundingClientRect(), o.dialog.marginTop = window.getComputedStyle(t).marginTop, o.mouse = {
1729
- x: h.clientX,
1730
- y: h.clientY
1731
- }, r = !0);
1732
- }
1733
- function g(h) {
1734
- r && (o.drag = {
1735
- x: h.clientX,
1736
- y: h.clientY
1737
- }, a.style.userSelect = "none", l());
1738
- }
1739
- function m(h) {
1740
- a.style.userSelect = "auto", r = !1;
1741
- }
1742
- function p(h) {
1743
- }
1744
- function y() {
1745
- return new Promise((h, f) => {
1746
- setTimeout(() => {
1747
- h();
1748
- }, 500);
1749
- });
1750
- }
1751
- e.__mouseDown__ = i, e.__mouseUp__ = m, e.__mouseMove__ = g, e.__sizeChange__ = p;
1533
+ async function wt(e) {
1534
+ await f();
1535
+ let t = e.querySelector(".el-dialog");
1536
+ if (!t) return;
1537
+ let n = e.querySelector(".el-dialog__header"), r = e.querySelector(".el-overlay");
1538
+ r.style.cssText += "overflow: hidden;", n.style.cursor = "move";
1539
+ let i = !1, a = {
1540
+ window: {
1541
+ width: 0,
1542
+ height: 0
1543
+ },
1544
+ dialog: {
1545
+ x: 0,
1546
+ y: 0,
1547
+ width: 0,
1548
+ height: 0,
1549
+ marginTop: ""
1550
+ },
1551
+ mouse: {
1552
+ x: 0,
1553
+ y: 0
1554
+ },
1555
+ drag: {
1556
+ x: 0,
1557
+ y: 0
1558
+ }
1559
+ };
1560
+ n.addEventListener("mousedown", c), document.addEventListener("mousemove", l), document.addEventListener("mouseup", u), window.addEventListener("resize", d);
1561
+ function o() {
1562
+ a.mouse.x - a.drag.x >= a.dialog.x && (a.drag.x = a.mouse.x - a.dialog.x), a.drag.x - a.mouse.x >= a.window.width - (a.dialog.x + a.dialog.width) && (a.drag.x = a.mouse.x + a.window.width - a.dialog.x - a.dialog.width), a.mouse.y - a.drag.y >= a.dialog.y && (a.drag.y = a.mouse.y - a.dialog.y), a.drag.y - a.mouse.y >= a.window.height - (a.dialog.y + a.dialog.height) && (a.drag.y = a.mouse.y + a.window.height - a.dialog.y - a.dialog.height), s();
1563
+ }
1564
+ function s() {
1565
+ let e = a.drag.y - a.mouse.y + a.dialog.y, n = a.drag.x - a.mouse.x + a.dialog.x;
1566
+ t.style.cssText += `position: absolute; top: calc(${e}px - ${a.dialog.marginTop}); left: ${n}px;`;
1567
+ }
1568
+ function c(e) {
1569
+ e.button === 0 && (a.window = {
1570
+ width: document.body.clientWidth,
1571
+ height: document.body.clientHeight
1572
+ }, a.dialog = t.getBoundingClientRect(), a.dialog.marginTop = window.getComputedStyle(t).marginTop, a.mouse = {
1573
+ x: e.clientX,
1574
+ y: e.clientY
1575
+ }, i = !0);
1576
+ }
1577
+ function l(e) {
1578
+ i && (a.drag = {
1579
+ x: e.clientX,
1580
+ y: e.clientY
1581
+ }, r.style.userSelect = "none", o());
1582
+ }
1583
+ function u(e) {
1584
+ r.style.userSelect = "auto", i = !1;
1585
+ }
1586
+ function d(e) {}
1587
+ function f() {
1588
+ return new Promise((e, t) => {
1589
+ setTimeout(() => {
1590
+ e();
1591
+ }, 500);
1592
+ });
1593
+ }
1594
+ e.__mouseDown__ = c, e.__mouseUp__ = u, e.__mouseMove__ = l, e.__sizeChange__ = d;
1752
1595
  }
1753
- function nt(e) {
1754
- document.removeEventListener("mousedown", e.__mouseDown__), document.removeEventListener("mousemove", e.__mouseMove__), document.removeEventListener("mouseup", e.__mouseUp__), window.removeEventListener("resize", e.__sizeChange__);
1596
+ function Tt(e) {
1597
+ document.removeEventListener("mousedown", e.__mouseDown__), document.removeEventListener("mousemove", e.__mouseMove__), document.removeEventListener("mouseup", e.__mouseUp__), window.removeEventListener("resize", e.__sizeChange__);
1755
1598
  }
1756
- const Ln = {
1757
- key: 0,
1758
- class: "drawer-btn"
1759
- }, En = { key: 1 }, uo = {
1760
- __name: "index",
1761
- props: {
1762
- layer: {
1763
- type: Object,
1764
- default: () => ({
1765
- show: !1,
1766
- type: "layer",
1767
- title: "",
1768
- showButton: !1
1769
- }),
1770
- required: !0
1771
- },
1772
- loading: {
1773
- type: Boolean,
1774
- default: !1
1775
- }
1776
- },
1777
- emits: ["confirm"],
1778
- setup(e, { emit: t }) {
1779
- const n = e, a = t, { t: r } = we(), o = Be(() => {
1780
- a("confirm");
1781
- }, 300);
1782
- async function l() {
1783
- n.layer.type == "drawer" ? n.layer.onClose ? n.layer.onClose() : n.layer.closeConfirm ? await Lt.confirm(r("que-ding-guan-bi-ma"), {
1784
- confirmButtonText: r("que-ding"),
1785
- cancelButtonText: r("qu-xiao"),
1786
- type: "warning"
1787
- }).catch(() => {
1788
- }) == "confirm" && (n.layer.show = !1) : n.layer.show = !1 : n.layer.show = !1;
1789
- }
1790
- return (s, i) => {
1791
- const g = O("el-button"), m = O("el-drawer"), p = O("el-dialog");
1792
- return e.layer.type ? (E(), W(m, {
1793
- key: 0,
1794
- modelValue: e.layer.show,
1795
- "onUpdate:modelValue": i[0] || (i[0] = (y) => e.layer.show = y),
1796
- size: e.layer.width || "100%",
1797
- title: e.layer.title,
1798
- direction: "rtl",
1799
- "append-to-body": "",
1800
- "before-close": l,
1801
- class: "drawer-content"
1802
- }, {
1803
- default: D(() => [
1804
- Q(s.$slots, "default"),
1805
- i[2] || (i[2] = ie("p", { class: "mgt50" }, null, -1)),
1806
- e.layer.showButton ? (E(), ce("div", Ln, [
1807
- Q(s.$slots, "btn", {}, () => [
1808
- z(g, { onClick: l }, {
1809
- default: D(() => [
1810
- ne(te(s.$t("qu-xiao")), 1)
1811
- ]),
1812
- _: 1
1813
- }),
1814
- z(g, {
1815
- type: "primary",
1816
- loading: e.loading,
1817
- onClick: N(o)
1818
- }, {
1819
- default: D(() => [
1820
- ne(te(s.$t("ti-jiao")), 1)
1821
- ]),
1822
- _: 1
1823
- }, 8, ["loading", "onClick"])
1824
- ])
1825
- ])) : me("", !0)
1826
- ]),
1827
- _: 3
1828
- }, 8, ["modelValue", "size", "title"])) : qt((E(), ce("div", En, [
1829
- z(p, {
1830
- "close-on-click-modal": !1,
1831
- modelValue: e.layer.show,
1832
- "onUpdate:modelValue": i[1] || (i[1] = (y) => e.layer.show = y),
1833
- title: e.layer.title,
1834
- width: e.layer.width || 500,
1835
- center: ""
1836
- }, at({
1837
- default: D(() => [
1838
- Q(s.$slots, "default")
1839
- ]),
1840
- _: 2
1841
- }, [
1842
- e.layer.showButton ? {
1843
- name: "footer",
1844
- fn: D(() => [
1845
- Q(s.$slots, "btn", {}, () => [
1846
- z(g, { onClick: l }, {
1847
- default: D(() => [
1848
- ne(te(s.$t("qu-xiao")), 1)
1849
- ]),
1850
- _: 1
1851
- }),
1852
- z(g, {
1853
- type: "primary",
1854
- onClick: N(o)
1855
- }, {
1856
- default: D(() => [
1857
- ne(te(s.$t("ti-jiao")), 1)
1858
- ]),
1859
- _: 1
1860
- }, 8, ["onClick"])
1861
- ])
1862
- ]),
1863
- key: "0"
1864
- } : void 0
1865
- ]), 1032, ["modelValue", "title", "width"])
1866
- ])), [
1867
- [N(Fn), e.layer.show]
1868
- ]);
1869
- };
1870
- }
1599
+ //#endregion
1600
+ //#region src/components/Layer/index.vue
1601
+ var Et = {
1602
+ key: 0,
1603
+ class: "drawer-btn"
1604
+ }, Dt = { key: 1 }, Ot = {
1605
+ __name: "index",
1606
+ props: {
1607
+ layer: {
1608
+ type: Object,
1609
+ default: () => ({
1610
+ show: !1,
1611
+ type: "layer",
1612
+ title: "",
1613
+ showButton: !1
1614
+ }),
1615
+ required: !0
1616
+ },
1617
+ loading: {
1618
+ type: Boolean,
1619
+ default: !1
1620
+ }
1621
+ },
1622
+ emits: ["confirm"],
1623
+ setup(e, { emit: t }) {
1624
+ let n = e, r = t, { t: a } = G(), o = re(() => {
1625
+ r("confirm");
1626
+ }, 300);
1627
+ async function s() {
1628
+ n.layer.type == "drawer" ? n.layer.onClose ? n.layer.onClose() : n.layer.closeConfirm ? await i.confirm(a("que-ding-guan-bi-ma"), {
1629
+ confirmButtonText: a("que-ding"),
1630
+ cancelButtonText: a("qu-xiao"),
1631
+ type: "warning"
1632
+ }).catch(() => {}) == "confirm" && (n.layer.show = !1) : n.layer.show = !1 : n.layer.show = !1;
1633
+ }
1634
+ return (t, n) => {
1635
+ let r = M("el-button"), i = M("el-drawer"), a = M("el-dialog");
1636
+ return e.layer.type ? (D(), l(i, {
1637
+ key: 0,
1638
+ modelValue: e.layer.show,
1639
+ "onUpdate:modelValue": n[0] ||= (t) => e.layer.show = t,
1640
+ size: e.layer.width || "100%",
1641
+ title: e.layer.title,
1642
+ direction: "rtl",
1643
+ "append-to-body": "",
1644
+ "before-close": s,
1645
+ class: "drawer-content"
1646
+ }, {
1647
+ default: R(() => [
1648
+ j(t.$slots, "default"),
1649
+ n[2] ||= f("p", { class: "mgt50" }, null, -1),
1650
+ e.layer.showButton ? (D(), d("div", Et, [j(t.$slots, "btn", {}, () => [h(r, { onClick: s }, {
1651
+ default: R(() => [m(P(t.$t("qu-xiao")), 1)]),
1652
+ _: 1
1653
+ }), h(r, {
1654
+ type: "primary",
1655
+ loading: e.loading,
1656
+ onClick: F(o)
1657
+ }, {
1658
+ default: R(() => [m(P(t.$t("ti-jiao")), 1)]),
1659
+ _: 1
1660
+ }, 8, ["loading", "onClick"])])])) : u("", !0)
1661
+ ]),
1662
+ _: 3
1663
+ }, 8, [
1664
+ "modelValue",
1665
+ "size",
1666
+ "title"
1667
+ ])) : z((D(), d("div", Dt, [h(a, {
1668
+ "close-on-click-modal": !1,
1669
+ modelValue: e.layer.show,
1670
+ "onUpdate:modelValue": n[1] ||= (t) => e.layer.show = t,
1671
+ title: e.layer.title,
1672
+ width: e.layer.width || 500,
1673
+ center: ""
1674
+ }, p({
1675
+ default: R(() => [j(t.$slots, "default")]),
1676
+ _: 2
1677
+ }, [e.layer.showButton ? {
1678
+ name: "footer",
1679
+ fn: R(() => [j(t.$slots, "btn", {}, () => [h(r, { onClick: s }, {
1680
+ default: R(() => [m(P(t.$t("qu-xiao")), 1)]),
1681
+ _: 1
1682
+ }), h(r, {
1683
+ type: "primary",
1684
+ onClick: F(o)
1685
+ }, {
1686
+ default: R(() => [m(P(t.$t("ti-jiao")), 1)]),
1687
+ _: 1
1688
+ }, 8, ["onClick"])])]),
1689
+ key: "0"
1690
+ } : void 0]), 1032, [
1691
+ "modelValue",
1692
+ "title",
1693
+ "width"
1694
+ ])])), [[F(Ct), e.layer.show]]);
1695
+ };
1696
+ }
1871
1697
  };
1872
- function fo(e, t = {}) {
1873
- const n = xe(), a = {
1874
- inForm: !0,
1875
- required: !0,
1876
- ...t
1877
- }, r = {
1878
- 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}$/,
1879
- password: /(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,
1880
- email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
1881
- }[e], { inForm: o, value: l, required: s, msg: i = n("validate.invalidInput") } = a;
1882
- return o ? function(g, m, p) {
1883
- if (s) {
1884
- r.test(m) ? p() : p(new Error(i));
1885
- return;
1886
- }
1887
- m && !r.test(m) ? p(new Error(i)) : p();
1888
- } : r.test(l);
1889
- }
1890
- class ho {
1891
- constructor(t = {}) {
1892
- this.config = {
1893
- clientCode: t.clientCode || "one-portal",
1894
- casServerUrl: `https://one-portal${t.isTest ? "-test" : ""}.joy-group.com/api`,
1895
- casPortalUrl: `https://one-portal${t.isTest ? "-test" : ""}.joy-group.com`,
1896
- serviceUrl: t.serviceUrl || window.location.origin + "/cas/callback",
1897
- tokenKey: t.tokenKey || "one_portal_token",
1898
- userKey: t.userKey || "one_portal_user",
1899
- debug: t.debug || !1,
1900
- autoLogin: t.autoLogin !== !1,
1901
- // 默认开启自动登录
1902
- loginCallback: t.loginCallback || null,
1903
- logoutCallback: t.logoutCallback || null,
1904
- errorCallback: t.errorCallback || null
1905
- }, this.token = null, this.user = null, this.init();
1906
- }
1907
- /**
1908
- * 初始化SDK
1909
- */
1910
- init() {
1911
- this.log("OnePortal CAS SDK 初始化中..."), this.loadFromStorage();
1912
- const n = new URLSearchParams(window.location.search).get("ticket");
1913
- this.isLoggedIn() && this.config.loginCallback ? this.config.loginCallback(this.user, this.token) : n ? (this.log("检测到ST票据:", n), this.validateTicket(n)) : this.config.autoLogin && !this.isLoggedIn() && (this.log("用户未登录,准备跳转到CAS登录页面"), this.login());
1914
- }
1915
- /**
1916
- * 从本地存储加载数据
1917
- */
1918
- loadFromStorage() {
1919
- try {
1920
- this.token = localStorage.getItem(this.config.tokenKey);
1921
- const t = localStorage.getItem(this.config.userKey);
1922
- t && (this.user = JSON.parse(t)), this.log("从本地存储加载数据:", { token: !!this.token, user: !!this.user });
1923
- } catch (t) {
1924
- this.log("加载本地存储数据失败:", t);
1925
- }
1926
- }
1927
- /**
1928
- * 保存到本地存储
1929
- */
1930
- saveToStorage() {
1931
- try {
1932
- this.token && localStorage.setItem(this.config.tokenKey, this.token), this.user && localStorage.setItem(this.config.userKey, JSON.stringify(this.user)), this.log("数据已保存到本地存储");
1933
- } catch (t) {
1934
- this.log("保存到本地存储失败:", t);
1935
- }
1936
- }
1937
- /**
1938
- * 清除本地存储
1939
- */
1940
- clearStorage() {
1941
- try {
1942
- localStorage.removeItem(this.config.tokenKey), localStorage.removeItem(this.config.userKey), this.log("本地存储已清除");
1943
- } catch (t) {
1944
- this.log("清除本地存储失败:", t);
1945
- }
1946
- }
1947
- /**
1948
- * 检查用户是否已登录
1949
- */
1950
- isLoggedIn() {
1951
- return !!(this.token && this.user);
1952
- }
1953
- /**
1954
- * 获取当前用户信息
1955
- */
1956
- getUser() {
1957
- return this.user;
1958
- }
1959
- /**
1960
- * 获取当前token
1961
- */
1962
- getToken() {
1963
- return this.token;
1964
- }
1965
- /**
1966
- * 登录 - 跳转到CAS登录页面
1967
- */
1968
- login() {
1969
- const t = `${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;
1970
- this.log("跳转到CAS登录页面:", t), window.location.href = t;
1971
- }
1972
- /**
1973
- * 验证ST票据
1974
- */
1975
- async validateTicket(t) {
1976
- try {
1977
- this.log("验证ST票据:", t);
1978
- const n = await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${t}`, {
1979
- method: "GET",
1980
- headers: {
1981
- "Content-Type": "application/json"
1982
- }
1983
- });
1984
- if (!n.ok)
1985
- throw new Error(`HTTP ${n.status}: ${n.statusText}`);
1986
- const a = await n.json();
1987
- if (a.success && a.data)
1988
- return this.token = a.data.token, this.user = a.data.user, this.saveToStorage(), this.clearTicketFromUrl(), this.log("ST票据验证成功,用户登录成功:", this.user), this.config.loginCallback && this.config.loginCallback(this.user, this.token), !0;
1989
- throw new Error(a.message || "ST票据验证失败");
1990
- } catch (n) {
1991
- return this.log("ST票据验证失败:", n), this.handleError(n), !1;
1992
- }
1993
- }
1994
- /**
1995
- * 清除URL中的ticket参数
1996
- */
1997
- clearTicketFromUrl() {
1998
- const t = new URL(window.location);
1999
- t.searchParams.delete("ticket"), window.history.replaceState({}, document.title, t.toString());
2000
- }
2001
- /**
2002
- * 登出
2003
- */
2004
- async logout(t = !0) {
2005
- try {
2006
- if (this.log("用户登出"), this.token)
2007
- try {
2008
- await fetch(`${this.config.casServerUrl}/auth/logout`, {
2009
- method: "POST",
2010
- headers: {
2011
- AppId: this.config.clientCode,
2012
- Authorization: `Bearer ${this.token}`,
2013
- "Content-Type": "application/json"
2014
- }
2015
- });
2016
- } catch (n) {
2017
- this.log("调用服务端登出接口失败:", n);
2018
- }
2019
- this.token = null, this.user = null, this.clearStorage(), this.config.logoutCallback && this.config.logoutCallback(), t && this.login();
2020
- } catch (n) {
2021
- this.log("登出失败:", n), this.handleError(n);
2022
- }
2023
- }
2024
- /**
2025
- * 发送带认证的HTTP请求
2026
- */
2027
- async request(t, n = {}) {
2028
- const a = {
2029
- headers: {
2030
- "Content-Type": "application/json",
2031
- ...n.headers
2032
- },
2033
- ...n
2034
- };
2035
- a.headers.appId = this.config.clientCode, this.token && (a.headers.Authorization = `Bearer ${this.token}`);
2036
- try {
2037
- const r = await fetch(t, a);
2038
- return r.status === 401 ? (this.log("Token已过期,需要重新登录"), this.logout(), null) : r;
2039
- } catch (r) {
2040
- throw this.log("请求失败:", r), r;
2041
- }
2042
- }
2043
- /**
2044
- * 获取用户信息(从服务端)
2045
- */
2046
- async fetchUserInfo() {
2047
- try {
2048
- const t = await this.request(`${this.config.casServerUrl}/auth/user`);
2049
- if (t && t.ok) {
2050
- const n = await t.json();
2051
- if (n.success && n.data)
2052
- return this.user = n.data, this.saveToStorage(), this.user;
2053
- }
2054
- return null;
2055
- } catch (t) {
2056
- return this.log("获取用户信息失败:", t), null;
2057
- }
2058
- }
2059
- /**
2060
- * 刷新token
2061
- */
2062
- async refreshToken() {
2063
- this.log("Token刷新功能暂未实现");
2064
- }
2065
- /**
2066
- * 错误处理
2067
- */
2068
- handleError(t) {
2069
- this.log("发生错误:", t), this.config.errorCallback && this.config.errorCallback(t);
2070
- }
2071
- /**
2072
- * 日志输出
2073
- */
2074
- log(...t) {
2075
- this.config.debug && console.log("[OnePortal CAS SDK]", ...t);
2076
- }
2077
- /**
2078
- * 检查登录状态并自动处理
2079
- */
2080
- checkLoginStatus() {
2081
- return !this.isLoggedIn() && this.config.autoLogin ? (this.login(), !1) : this.isLoggedIn();
2082
- }
2083
- /**
2084
- * 设置配置
2085
- */
2086
- setConfig(t, n) {
2087
- this.config[t] = n;
2088
- }
2089
- /**
2090
- * 获取配置
2091
- */
2092
- getConfig(t) {
2093
- return this.config[t];
2094
- }
1698
+ //#endregion
1699
+ //#region src/utils/tools/validate.js
1700
+ function kt(e, t = {}) {
1701
+ let n = Z(), r = {
1702
+ inForm: !0,
1703
+ required: !0,
1704
+ ...t
1705
+ }, i = {
1706
+ 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}$/,
1707
+ password: /(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,
1708
+ email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
1709
+ }[e], { inForm: a, value: o, required: s, msg: c = n("validate.invalidInput") } = r;
1710
+ return a ? function(e, t, n) {
1711
+ if (s) {
1712
+ i.test(t) ? n() : n(Error(c));
1713
+ return;
1714
+ }
1715
+ t && !i.test(t) ? n(Error(c)) : n();
1716
+ } : i.test(o);
2095
1717
  }
2096
- function He(e, t = 2, n = ".", a = ",") {
2097
- (e == null || e === "") && (e = 0);
2098
- const r = Number(e);
2099
- isNaN(r) ? e = 0 : e = r, t = Math.max(0, Math.floor(t));
2100
- const l = e.toFixed(t).split(".");
2101
- let s = l[0];
2102
- const i = l[1], g = s.startsWith("-");
2103
- return g && (s = s.slice(1)), s = s.replace(/\B(?=(\d{3})+(?!\d))/g, a), g && (s = "-" + s), t > 0 ? s + n + i : s;
1718
+ //#endregion
1719
+ //#region src/utils/tools/one-portal-cas-sdk.js
1720
+ var At = class {
1721
+ constructor(e = {}) {
1722
+ this.config = {
1723
+ clientCode: e.clientCode || "one-portal",
1724
+ casServerUrl: `https://one-portal${e.isTest ? "-test" : ""}.joy-group.com/api`,
1725
+ casPortalUrl: `https://one-portal${e.isTest ? "-test" : ""}.joy-group.com`,
1726
+ serviceUrl: e.serviceUrl || window.location.origin + "/cas/callback",
1727
+ tokenKey: e.tokenKey || "one_portal_token",
1728
+ userKey: e.userKey || "one_portal_user",
1729
+ debug: e.debug || !1,
1730
+ autoLogin: e.autoLogin !== !1,
1731
+ loginCallback: e.loginCallback || null,
1732
+ logoutCallback: e.logoutCallback || null,
1733
+ errorCallback: e.errorCallback || null
1734
+ }, this.token = null, this.user = null, this.init();
1735
+ }
1736
+ init() {
1737
+ this.log("OnePortal CAS SDK 初始化中..."), this.loadFromStorage();
1738
+ let e = new URLSearchParams(window.location.search).get("ticket");
1739
+ this.isLoggedIn() && this.config.loginCallback ? this.config.loginCallback(this.user, this.token) : e ? (this.log("检测到ST票据:", e), this.validateTicket(e)) : this.config.autoLogin && !this.isLoggedIn() && (this.log("用户未登录,准备跳转到CAS登录页面"), this.login());
1740
+ }
1741
+ loadFromStorage() {
1742
+ try {
1743
+ this.token = localStorage.getItem(this.config.tokenKey);
1744
+ let e = localStorage.getItem(this.config.userKey);
1745
+ e && (this.user = JSON.parse(e)), this.log("从本地存储加载数据:", {
1746
+ token: !!this.token,
1747
+ user: !!this.user
1748
+ });
1749
+ } catch (e) {
1750
+ this.log("加载本地存储数据失败:", e);
1751
+ }
1752
+ }
1753
+ saveToStorage() {
1754
+ try {
1755
+ this.token && localStorage.setItem(this.config.tokenKey, this.token), this.user && localStorage.setItem(this.config.userKey, JSON.stringify(this.user)), this.log("数据已保存到本地存储");
1756
+ } catch (e) {
1757
+ this.log("保存到本地存储失败:", e);
1758
+ }
1759
+ }
1760
+ clearStorage() {
1761
+ try {
1762
+ localStorage.removeItem(this.config.tokenKey), localStorage.removeItem(this.config.userKey), this.log("本地存储已清除");
1763
+ } catch (e) {
1764
+ this.log("清除本地存储失败:", e);
1765
+ }
1766
+ }
1767
+ isLoggedIn() {
1768
+ return !!(this.token && this.user);
1769
+ }
1770
+ getUser() {
1771
+ return this.user;
1772
+ }
1773
+ getToken() {
1774
+ return this.token;
1775
+ }
1776
+ login() {
1777
+ let e = `${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;
1778
+ this.log("跳转到CAS登录页面:", e), window.location.href = e;
1779
+ }
1780
+ async validateTicket(e) {
1781
+ try {
1782
+ this.log("验证ST票据:", e);
1783
+ let t = await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${e}`, {
1784
+ method: "GET",
1785
+ headers: { "Content-Type": "application/json" }
1786
+ });
1787
+ if (!t.ok) throw Error(`HTTP ${t.status}: ${t.statusText}`);
1788
+ let n = await t.json();
1789
+ if (n.success && n.data) return this.token = n.data.token, this.user = n.data.user, this.saveToStorage(), this.clearTicketFromUrl(), this.log("ST票据验证成功,用户登录成功:", this.user), this.config.loginCallback && this.config.loginCallback(this.user, this.token), !0;
1790
+ throw Error(n.message || "ST票据验证失败");
1791
+ } catch (e) {
1792
+ return this.log("ST票据验证失败:", e), this.handleError(e), !1;
1793
+ }
1794
+ }
1795
+ clearTicketFromUrl() {
1796
+ let e = new URL(window.location);
1797
+ e.searchParams.delete("ticket"), window.history.replaceState({}, document.title, e.toString());
1798
+ }
1799
+ async logout(e = !0) {
1800
+ try {
1801
+ if (this.log("用户登出"), this.token) try {
1802
+ await fetch(`${this.config.casServerUrl}/auth/logout`, {
1803
+ method: "POST",
1804
+ headers: {
1805
+ AppId: this.config.clientCode,
1806
+ Authorization: `Bearer ${this.token}`,
1807
+ "Content-Type": "application/json"
1808
+ }
1809
+ });
1810
+ } catch (e) {
1811
+ this.log("调用服务端登出接口失败:", e);
1812
+ }
1813
+ this.token = null, this.user = null, this.clearStorage(), this.config.logoutCallback && this.config.logoutCallback(), e && this.login();
1814
+ } catch (e) {
1815
+ this.log("登出失败:", e), this.handleError(e);
1816
+ }
1817
+ }
1818
+ async request(e, t = {}) {
1819
+ let n = {
1820
+ headers: {
1821
+ "Content-Type": "application/json",
1822
+ ...t.headers
1823
+ },
1824
+ ...t
1825
+ };
1826
+ n.headers.appId = this.config.clientCode, this.token && (n.headers.Authorization = `Bearer ${this.token}`);
1827
+ try {
1828
+ let t = await fetch(e, n);
1829
+ return t.status === 401 ? (this.log("Token已过期,需要重新登录"), this.logout(), null) : t;
1830
+ } catch (e) {
1831
+ throw this.log("请求失败:", e), e;
1832
+ }
1833
+ }
1834
+ async fetchUserInfo() {
1835
+ try {
1836
+ let e = await this.request(`${this.config.casServerUrl}/auth/user`);
1837
+ if (e && e.ok) {
1838
+ let t = await e.json();
1839
+ if (t.success && t.data) return this.user = t.data, this.saveToStorage(), this.user;
1840
+ }
1841
+ return null;
1842
+ } catch (e) {
1843
+ return this.log("获取用户信息失败:", e), null;
1844
+ }
1845
+ }
1846
+ async refreshToken() {
1847
+ this.log("Token刷新功能暂未实现");
1848
+ }
1849
+ handleError(e) {
1850
+ this.log("发生错误:", e), this.config.errorCallback && this.config.errorCallback(e);
1851
+ }
1852
+ log(...e) {
1853
+ this.config.debug && console.log("[OnePortal CAS SDK]", ...e);
1854
+ }
1855
+ checkLoginStatus() {
1856
+ return !this.isLoggedIn() && this.config.autoLogin ? (this.login(), !1) : this.isLoggedIn();
1857
+ }
1858
+ setConfig(e, t) {
1859
+ this.config[e] = t;
1860
+ }
1861
+ getConfig(e) {
1862
+ return this.config[e];
1863
+ }
1864
+ };
1865
+ //#endregion
1866
+ //#region src/utils/tools/format.js
1867
+ function jt(e, t = 2, n = ".", r = ",") {
1868
+ (e == null || e === "") && (e = 0);
1869
+ let i = Number(e);
1870
+ e = isNaN(i) ? 0 : i, t = Math.max(0, Math.floor(t));
1871
+ let a = e.toFixed(t).split("."), o = a[0], s = a[1], c = o.startsWith("-");
1872
+ return c && (o = o.slice(1)), o = o.replace(/\B(?=(\d{3})+(?!\d))/g, r), c && (o = "-" + o), t > 0 ? o + n + s : o;
2104
1873
  }
2105
- function In(e, t = 2) {
2106
- return He(e, t);
1874
+ function Mt(e, t = 2) {
1875
+ return jt(e, t);
2107
1876
  }
2108
- function Tn(e, t = 2) {
2109
- (e == null || e === "") && (e = 0);
2110
- const n = Number(e);
2111
- isNaN(n) ? e = 0 : e = n;
2112
- const a = e * 100;
2113
- return He(a, t) + "%";
1877
+ function Nt(e, t = 2) {
1878
+ (e == null || e === "") && (e = 0);
1879
+ let n = Number(e);
1880
+ return e = isNaN(n) ? 0 : n, jt(e * 100, t) + "%";
2114
1881
  }
2115
- function mo(e, t = {}) {
2116
- const a = Object.assign({
2117
- manual: !1,
2118
- // 手动执行
2119
- log: !1,
2120
- params: null,
2121
- format: null
2122
- }, t), { manual: r, log: o, params: l = {}, cb: s, format: i } = a, g = j([]), m = j(!1), p = (y) => {
2123
- const h = y || l;
2124
- m.value = !0, e(h).then((f) => {
2125
- const { code: c, data: v, msg: w } = f;
2126
- if (s) {
2127
- const { records: x, rows: C } = v || {}, S = x || C ? x || C : v;
2128
- g.value = Oe(S, i), s(f);
2129
- }
2130
- if (v) {
2131
- if (v.records != null || v.rows != null) {
2132
- const { records: x, rows: C, total: S = 0 } = v || {};
2133
- h && h.total != null && (l.total = parseInt(S)), g.value = Oe(x || C || [], i);
2134
- } else
2135
- g.value = Oe(v, i);
2136
- o && console.log("useRequest-res", g.value);
2137
- }
2138
- }).catch((f) => {
2139
- s && (console.log("useRequestErr", f), s({ code: 500 }));
2140
- }).finally(() => {
2141
- m.value = !1;
2142
- });
2143
- };
2144
- return r || p(), [m, g, p];
1882
+ //#endregion
1883
+ //#region src/utils/hook/common.js
1884
+ function Pt(e, t = {}) {
1885
+ let { manual: n, log: r, params: i = {}, cb: a, format: o } = Object.assign({
1886
+ manual: !1,
1887
+ log: !1,
1888
+ params: null,
1889
+ format: null
1890
+ }, t), s = k([]), c = k(!1), l = (t) => {
1891
+ let n = t || i;
1892
+ c.value = !0, e(n).then((e) => {
1893
+ let { code: t, data: c, msg: l } = e;
1894
+ if (a) {
1895
+ let { records: t, rows: n } = c || {};
1896
+ s.value = Lt(t || n ? t || n : c, o), a(e);
1897
+ }
1898
+ if (c) {
1899
+ if (c.records != null || c.rows != null) {
1900
+ let { records: e, rows: t, total: r = 0 } = c || {};
1901
+ n && n.total != null && (i.total = parseInt(r)), s.value = Lt(e || t || [], o);
1902
+ } else s.value = Lt(c, o);
1903
+ r && console.log("useRequest-res", s.value);
1904
+ }
1905
+ }).catch((e) => {
1906
+ a && (console.log("useRequestErr", e), a({ code: 500 }));
1907
+ }).finally(() => {
1908
+ c.value = !1;
1909
+ });
1910
+ };
1911
+ return n || l(), [
1912
+ c,
1913
+ s,
1914
+ l
1915
+ ];
2145
1916
  }
2146
- function go(e) {
2147
- const t = j(e), n = j(""), a = j("");
2148
- return Re(t, (r) => {
2149
- const o = r || ["", ""];
2150
- n.value = o[0], a.value = o[1];
2151
- }), [t, n, a];
1917
+ function Ft(e) {
1918
+ let t = k(e), n = k(""), r = k("");
1919
+ return L(t, (e) => {
1920
+ let t = e || ["", ""];
1921
+ n.value = t[0], r.value = t[1];
1922
+ }), [
1923
+ t,
1924
+ n,
1925
+ r
1926
+ ];
2152
1927
  }
2153
- function po(e) {
2154
- return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
1928
+ function It(e) {
1929
+ return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
2155
1930
  }
2156
- function Oe(e, t) {
2157
- if (!t)
2158
- return e;
2159
- if (e instanceof Array)
2160
- return e.map((a) => {
2161
- let r = {};
2162
- return t.forEach((o) => r[o] = a[o]), r;
2163
- });
2164
- let n = {};
2165
- return t.forEach((a) => n[a] = e[a]), n;
1931
+ function Lt(e, t) {
1932
+ if (!t) return e;
1933
+ if (e instanceof Array) return e.map((e) => {
1934
+ let n = {};
1935
+ return t.forEach((t) => n[t] = e[t]), n;
1936
+ });
1937
+ let n = {};
1938
+ return t.forEach((t) => n[t] = e[t]), n;
2166
1939
  }
2167
- function yo(e, t = []) {
2168
- const { locale: n } = we(), a = j(e());
2169
- return Re(
2170
- [n, ...t],
2171
- () => {
2172
- a.value = e();
2173
- },
2174
- { immediate: !0 }
2175
- ), a;
1940
+ //#endregion
1941
+ //#region src/utils/hook/i18n.js
1942
+ function Rt(e, t = []) {
1943
+ let { locale: n } = G(), r = k(e());
1944
+ return L([n, ...t], () => {
1945
+ r.value = e();
1946
+ }, { immediate: !0 }), r;
2176
1947
  }
2177
- function vo(e, t = "zh_cn", n = "en_us") {
2178
- if (!e)
2179
- return "-";
2180
- const a = { en_us: n, zh_cn: t }, o = Ke().global.locale.value;
2181
- return e[a[o]] || e[t] || "-";
1948
+ function zt(e, t = "zh_cn", n = "en_us") {
1949
+ return e && (e[{
1950
+ en_us: n,
1951
+ zh_cn: t
1952
+ }[De().global.locale.value]] || e[t]) || "-";
2182
1953
  }
2183
- function bo(e, t) {
2184
- let n = Rt;
2185
- return typeof e == "string" && e.length > 0 && (n = Ye(e).mapState), wt(t, n);
1954
+ //#endregion
1955
+ //#region src/utils/hook/storeHook.js
1956
+ function Bt(e, t) {
1957
+ let n = ue;
1958
+ return typeof e == "string" && e.length > 0 && (n = se(e).mapState), Ut(t, n);
2186
1959
  }
2187
- function wo(e, t) {
2188
- let n = Bt;
2189
- return typeof e == "string" && e.length > 0 && (n = Ye(e).mapGetters), wt(t, n);
1960
+ function Vt(e, t) {
1961
+ let n = le;
1962
+ return typeof e == "string" && e.length > 0 && (n = se(e).mapGetters), Ut(t, n);
2190
1963
  }
2191
- function Co(e, t) {
2192
- let n = Yt;
2193
- return typeof e == "string" && e.length > 0 && (n = Ye(e).mapActions), Dn(t, n);
1964
+ function Ht(e, t) {
1965
+ let n = ce;
1966
+ return typeof e == "string" && e.length > 0 && (n = se(e).mapActions), Wt(t, n);
2194
1967
  }
2195
- function wt(e, t) {
2196
- const n = dt(), a = t(e), r = {};
2197
- return Object.keys(a).forEach((o) => {
2198
- const l = a[o].bind({ $store: n });
2199
- r[o] = ue(l);
2200
- }), r;
1968
+ function Ut(e, t) {
1969
+ let n = K(), r = t(e), i = {};
1970
+ return Object.keys(r).forEach((e) => {
1971
+ i[e] = c(r[e].bind({ $store: n }));
1972
+ }), i;
2201
1973
  }
2202
- function Dn(e, t) {
2203
- const n = dt(), a = t(e), r = {};
2204
- return Object.keys(a).forEach((o) => {
2205
- r[o] = a[o].bind({ $store: n });
2206
- }), r;
1974
+ function Wt(e, t) {
1975
+ let n = K(), r = t(e), i = {};
1976
+ return Object.keys(r).forEach((e) => {
1977
+ i[e] = r[e].bind({ $store: n });
1978
+ }), i;
2207
1979
  }
2208
- function Ie(e) {
2209
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Pt(e);
1980
+ //#endregion
1981
+ //#region src/components/VxeTable/index.jsx
1982
+ function Gt(e) {
1983
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !v(e);
2210
1984
  }
2211
- function Mn() {
2212
- he.formats.add("formatNumber", {
2213
- cellFormatMethod({
2214
- cellValue: e
2215
- }, t = 2) {
2216
- return He(e, t);
2217
- }
2218
- }), he.formats.add("formatMoney", {
2219
- cellFormatMethod({
2220
- cellValue: e
2221
- }, t = 2) {
2222
- return In(e, t);
2223
- }
2224
- }), he.formats.add("formatPercent", {
2225
- cellFormatMethod({
2226
- cellValue: e
2227
- }, t = 2) {
2228
- return Tn(e, t);
2229
- }
2230
- });
1985
+ function Kt() {
1986
+ q.formats.add("formatNumber", { cellFormatMethod({ cellValue: e }, t = 2) {
1987
+ return jt(e, t);
1988
+ } }), q.formats.add("formatMoney", { cellFormatMethod({ cellValue: e }, t = 2) {
1989
+ return Mt(e, t);
1990
+ } }), q.formats.add("formatPercent", { cellFormatMethod({ cellValue: e }, t = 2) {
1991
+ return Nt(e, t);
1992
+ } });
2231
1993
  }
2232
- function zn() {
2233
- he.renderer.add("Enum", {
2234
- // 默认显示模板
2235
- renderTableDefault(e, t) {
2236
- let n;
2237
- if ([null, void 0].includes(t.row[t.column.field]))
2238
- return "-";
2239
- const a = t.row[t.column.field];
2240
- if (e.type == "tag") {
2241
- let r;
2242
- return z(O("el-text"), {
2243
- type: e.enum.getTag(a)
2244
- }, Ie(r = e.enum.getName(a)) ? r : {
2245
- default: () => [r]
2246
- });
2247
- }
2248
- return z(O("el-text"), null, Ie(n = e.enum.getName(a)) ? n : {
2249
- default: () => [n]
2250
- });
2251
- }
2252
- }), he.renderer.add("InputNumber", {
2253
- // 默认显示模板
2254
- renderTableDefault(e, t) {
2255
- return z(Et, de({
2256
- modelValue: t.row[t.column.field],
2257
- "onUpdate:modelValue": (n) => t.row[t.column.field] = n
2258
- }, e.props, {
2259
- "step-strictly": !0,
2260
- "value-on-clear": 0
2261
- }), null);
2262
- }
2263
- }), he.renderer.add("TrueFalse", {
2264
- // 默认显示模板
2265
- renderTableDefault(e, t) {
2266
- const {
2267
- locale: n
2268
- } = we();
2269
- let a = n.value == "zh_cn";
2270
- return z(It, {
2271
- type: t.row[t.column.field] ? "success" : "danger"
2272
- }, {
2273
- default: () => [t.row[t.column.field] ? a ? "" : "YES" : a ? "否" : "NO"]
2274
- });
2275
- }
2276
- }), he.renderer.add("I18n", {
2277
- // 默认显示模板
2278
- renderTableDefault(e, t) {
2279
- const {
2280
- locale: n
2281
- } = we();
2282
- let a = n.value == "zh_cn" ? t.column.field : e.fieldEn;
2283
- return t.row[a] || t.row[t.column.field];
2284
- }
2285
- }), he.renderer.add("Link", {
2286
- // 默认显示模板
2287
- renderTableDefault(e, t) {
2288
- let n = t.column.field;
2289
- const a = jt(), {
2290
- multiple: r,
2291
- to: o,
2292
- openType: l = "system"
2293
- } = e, s = t.row[n];
2294
- function i(g, m) {
2295
- l == "blank" ? window.open(g) : a.push({
2296
- path: g,
2297
- query: {
2298
- [n]: m
2299
- }
2300
- });
2301
- }
2302
- if (r) {
2303
- const g = (s == null ? void 0 : s.split(",")) || [];
2304
- return g.map((m, p) => z("span", null, [z(Je, {
2305
- underline: "never",
2306
- type: "primary",
2307
- onclick: () => i(l == "stystem" ? o : m, m)
2308
- }, Ie(m) ? m : {
2309
- default: () => [m]
2310
- }), p < g.length - 1 ? "," : ""]));
2311
- }
2312
- return z(Je, {
2313
- underline: "never",
2314
- type: "primary",
2315
- onclick: () => i(l == "stystem" ? o : s, s)
2316
- }, Ie(s) ? s : {
2317
- default: () => [s]
2318
- });
2319
- }
2320
- });
1994
+ function qt() {
1995
+ q.renderer.add("Enum", { renderTableDefault(e, t) {
1996
+ let n;
1997
+ if ([null, void 0].includes(t.row[t.column.field])) return "-";
1998
+ let r = t.row[t.column.field];
1999
+ if (e.type == "tag") {
2000
+ let t;
2001
+ return h(M("el-text"), { type: e.enum.getTag(r) }, Gt(t = e.enum.getName(r)) ? t : { default: () => [t] });
2002
+ }
2003
+ return h(M("el-text"), null, Gt(n = e.enum.getName(r)) ? n : { default: () => [n] });
2004
+ } }), q.renderer.add("InputNumber", { renderTableDefault(e, t) {
2005
+ return h(n, b({
2006
+ modelValue: t.row[t.column.field],
2007
+ "onUpdate:modelValue": (e) => t.row[t.column.field] = e
2008
+ }, e.props, {
2009
+ "step-strictly": !0,
2010
+ "value-on-clear": 0
2011
+ }), null);
2012
+ } }), q.renderer.add("TrueFalse", { renderTableDefault(e, t) {
2013
+ let { locale: n } = G(), r = n.value == "zh_cn";
2014
+ return h(o, { type: t.row[t.column.field] ? "success" : "danger" }, { default: () => [t.row[t.column.field] ? r ? "是" : "YES" : r ? "否" : "NO"] });
2015
+ } }), q.renderer.add("I18n", { renderTableDefault(e, t) {
2016
+ let { locale: n } = G(), r = n.value == "zh_cn" ? t.column.field : e.fieldEn;
2017
+ return t.row[r] || t.row[t.column.field];
2018
+ } }), q.renderer.add("Link", { renderTableDefault(e, t) {
2019
+ let n = t.column.field, i = oe(), { multiple: a, to: o, openType: s = "system" } = e, c = t.row[n];
2020
+ function l(e, t) {
2021
+ s == "blank" ? window.open(e) : i.push({
2022
+ path: e,
2023
+ query: { [n]: t }
2024
+ });
2025
+ }
2026
+ if (a) {
2027
+ let e = c?.split(",") || [];
2028
+ return e.map((t, n) => h("span", null, [h(r, {
2029
+ underline: "never",
2030
+ type: "primary",
2031
+ onclick: () => l(s == "stystem" ? o : t, t)
2032
+ }, Gt(t) ? t : { default: () => [t] }), n < e.length - 1 ? "," : ""]));
2033
+ }
2034
+ return h(r, {
2035
+ underline: "never",
2036
+ type: "primary",
2037
+ onclick: () => l(s == "stystem" ? o : c, c)
2038
+ }, Gt(c) ? c : { default: () => [c] });
2039
+ } });
2321
2040
  }
2322
- function xo() {
2323
- Mn(), zn();
2041
+ function Jt() {
2042
+ Kt(), qt();
2324
2043
  }
2325
- export {
2326
- un as CmpDictionary,
2327
- vt as CmpIcon,
2328
- lo as ConfrimButton,
2329
- co as DownExcelTemp,
2330
- ao as ImportButton,
2331
- Kn as LayOutForm,
2332
- uo as Layer,
2333
- io as ListPage,
2334
- ho as OnePortalCasSDK,
2335
- kn as SearchBar,
2336
- et as StatusMap,
2337
- Zn as _toRaw,
2338
- po as _typeOf,
2339
- Jn as arrToStatusMap,
2340
- Gn as arrayToTree,
2341
- eo as checkFileSize,
2342
- fo as creatValidator,
2343
- no as createImportFields,
2344
- to as createListPageId,
2345
- Ae as en_us,
2346
- Nn as exportExcel,
2347
- ln as exportExcelMuilti,
2348
- In as formatMoney,
2349
- He as formatNumber,
2350
- Tn as formatPercent,
2351
- Ke as getI18n,
2352
- xe as getI18nT,
2353
- _n as getListPageConfig,
2354
- vo as getLocaleValue,
2355
- oo as getValueBykey,
2356
- Hn as importExcel,
2357
- nn as importExcelMuilti,
2358
- Zt as messages,
2359
- Mn as registerVxeFormatters,
2360
- xo as registerVxePlugins,
2361
- zn as registerVxeRenderers,
2362
- so as resetListPageConfig,
2363
- ro as setListPageConfig,
2364
- Gt as setupI18n,
2365
- Wn as sleep,
2366
- yt as stringToArray,
2367
- Xn as stripHtmlTags,
2368
- Qn as unicode2Str,
2369
- Co as useActions,
2370
- go as useDatePicker,
2371
- wo as useGetters,
2372
- yo as useI18nReState,
2373
- mo as useRequest,
2374
- bo as useState,
2375
- Pe as zh_cn
2376
- };
2044
+ //#endregion
2045
+ export { tt as CmpDictionary, it as CmpIcon, ot as ConfrimButton, St as DownExcelTemp, lt as ImportButton, _e as LayOutForm, Ot as Layer, xt as ListPage, At as OnePortalCasSDK, ht as SearchBar, Ke as StatusMap, Ue as _toRaw, It as _typeOf, qe as arrToStatusMap, We as arrayToTree, Xe as checkFileSize, kt as creatValidator, Qe as createImportFields, Ze as createListPageId, Ce as en_us, Ae as exportExcel, ze as exportExcelMuilti, Mt as formatMoney, jt as formatNumber, Nt as formatPercent, De as getI18n, Z as getI18nT, vt as getListPageConfig, zt as getLocaleValue, $e as getValueBykey, Oe as importExcel, Le as importExcelMuilti, we as messages, Kt as registerVxeFormatters, Jt as registerVxePlugins, qt as registerVxeRenderers, yt as resetListPageConfig, _t as setListPageConfig, Ee as setupI18n, He as sleep, Ge as stringToArray, Je as stripHtmlTags, Ye as unicode2Str, Ht as useActions, Ft as useDatePicker, Vt as useGetters, Rt as useI18nReState, Pt as useRequest, Bt as useState, Se as zh_cn };