zhihao-ui 1.2.13 → 1.2.14

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,1111 +0,0 @@
1
- import { reactive as Y, computed as F, toRefs as Ve, ref as B, defineComponent as ae, useCssVars as rt, inject as Fe, openBlock as S, createElementBlock as R, createBlock as M, resolveDynamicComponent as ce, mergeProps as X, withKeys as st, unref as g, createSlots as de, withCtx as C, Fragment as Z, renderList as pe, renderSlot as W, createElementVNode as E, toDisplayString as Q, createVNode as k, withModifiers as ut, normalizeClass as Oe, createCommentVNode as $, createTextVNode as G, resolveComponent as ie, useSlots as xe, normalizeProps as it, guardReactiveProps as ct, nextTick as he, onMounted as dt, onActivated as pt, onDeactivated as ht, onUnmounted as mt, watch as ft, provide as gt, resolveDirective as vt, withDirectives as be, vShow as bt, toHandlers as yt } from "vue";
2
- import { N as Ue, Q as Ct, R as St, U as Ke, Y as _t, f as wt, Z as kt, j as Pt, _ as Tt, K as me, E as ze, $ as _e, a0 as Et, a1 as Ae, e as j, g as Ne, a2 as $t, a3 as He, a4 as Bt, a5 as Rt, a6 as zt, i as It, a7 as Mt, a8 as Lt, m as ye, a9 as Dt, d as Vt, aa as Ft, ab as Ie, ac as Me } from "./vendor-CUDSGmu_.js";
3
- import { D as ee, C as Ot } from "./DatePicker-Cc2HzfbO.js";
4
- import { _ as oe, Z as Ce } from "./Button-B9P_SsZw.js";
5
- import { _ as xt } from "./Dialog-CPGMb7bN.js";
6
- import { w as Ut } from "./utils-BbabHGt0.js";
7
- const Kt = (y, d = {}, a = !0, c, p, _ = (t) => t) => {
8
- const t = Y({
9
- // 表格数据
10
- tableData: [],
11
- // 分页数据
12
- pageable: {
13
- // 当前页数
14
- page: 1,
15
- // 每页显示条数
16
- size: 10,
17
- // 总条数
18
- total: 0
19
- },
20
- // 查询参数(只包括查询)
21
- searchParam: {},
22
- // 初始化默认的查询参数
23
- searchInitParam: {},
24
- // 总参数(包含分页和查询参数)
25
- totalParam: {},
26
- // 是否在加载中
27
- loading: !1
28
- }), v = F({
29
- get: () => ({
30
- page: t.pageable.page,
31
- size: t.pageable.size
32
- }),
33
- set: (T) => {
34
- console.log("我是分页更新之后的值", T);
35
- }
36
- }), o = async () => {
37
- if (t.loading = !0, !y) {
38
- t.loading = !1;
39
- return;
40
- }
41
- try {
42
- const T = localStorage.getItem("MytaskGotoListPageQuery");
43
- if (T) {
44
- d = {}, t.totalParam = {};
45
- const r = JSON.parse(T);
46
- d = { ...d, ...r }, t.searchParam = { ...r };
47
- }
48
- Object.assign(t.totalParam, d, a ? v.value : {}), console.log(d, t.totalParam, "totalParam");
49
- for (const r in t.searchParam)
50
- t.searchParam[r] === "" && delete t.searchParam[r];
51
- let e = await y(_({ ...t.searchInitParam, ...t.totalParam }));
52
- if (c && (e = await c(e)), t.tableData = a ? e.list : e, a) {
53
- const { currentPage: r, pageSize: s, total: m } = e;
54
- N({ page: r, size: s, total: m });
55
- }
56
- } catch (T) {
57
- p && p(T);
58
- } finally {
59
- t.loading = !1;
60
- }
61
- }, h = () => {
62
- t.totalParam = {}, t.searchInitParam = {}, d = {};
63
- const T = {};
64
- for (const e in t.searchParam)
65
- (t.searchParam[e] || t.searchParam[e] === !1 || t.searchParam[e] === 0) && (T[e] = t.searchParam[e]);
66
- Object.assign(t.totalParam, T, a ? v.value : {});
67
- }, N = (T) => {
68
- Object.assign(t.pageable, T);
69
- }, O = () => {
70
- t.pageable.page = 1, h(), o().then();
71
- }, x = () => {
72
- t.pageable.page = 1, t.searchParam = { ...t.searchInitParam }, h(), o().then();
73
- }, H = (T) => {
74
- t.pageable.page = 1, t.pageable.size = T, o().then();
75
- }, V = (T) => {
76
- t.pageable.page = T, o().then();
77
- };
78
- return {
79
- ...Ve(t),
80
- getTableList: o,
81
- search: O,
82
- reset: x,
83
- handleSizeChange: H,
84
- handleCurrentChange: V,
85
- updatedTotalParam: h
86
- };
87
- }, At = (y = "id", d) => {
88
- const a = B(!1), c = B([]), p = F(() => {
89
- let t = [];
90
- return c.value.forEach((v) => t.push(Ue(v, y))), t;
91
- });
92
- return {
93
- isSelected: a,
94
- selectedList: c,
95
- selectedListIds: p,
96
- selectionChange: (t) => {
97
- t.length ? a.value = !0 : a.value = !1, c.value = t, d && d(t);
98
- }
99
- };
100
- }, Nt = 12;
101
- function We(y, d, a, c) {
102
- return y.reduce((p, _) => {
103
- if (p) return p;
104
- if (_[a] === d) return _;
105
- if (_[c]) return We(_[c], d, a, c);
106
- }, null);
107
- }
108
- function Ht(y, d, a) {
109
- const c = St(a) ? ee : a, p = Ue(y, d);
110
- return Ct(p) || p === "" ? c : p;
111
- }
112
- const Le = Ht;
113
- function A(y) {
114
- const d = y.split(".");
115
- return d.length == 1 ? y : d[d.length - 1];
116
- }
117
- function De(y, d, a, c) {
118
- const p = (a == null ? void 0 : a.value) ?? "value", _ = (a == null ? void 0 : a.label) ?? "label", t = (a == null ? void 0 : a.children) ?? "children";
119
- let v = {};
120
- return Array.isArray(d) && (v = We(d, y, p, t)), c == "tag" ? v != null && v.tagType ? v.tagType : "" : v ? v[_] : ee;
121
- }
122
- function Wt(y) {
123
- return Ke(y) ? y.length ? y.join(" / ") : ee : y ?? ee;
124
- }
125
- function Se(y, d) {
126
- return d.includes(".") ? (d.split(".").forEach((a) => y = y[a] ?? ee), y) : y[d] ?? ee;
127
- }
128
- const te = (y, d) => {
129
- const a = d || Nt, p = document.createElement("canvas").getContext("2d");
130
- return p.font = `${a}px Microsoft YaHei`, p.measureText(y).width;
131
- }, jt = (y) => {
132
- const d = y || "zhihao-col-setting", a = () => {
133
- const v = localStorage.getItem(d);
134
- return v ? JSON.parse(v) : {};
135
- }, c = (v) => {
136
- localStorage.setItem(d, JSON.stringify(v));
137
- };
138
- return {
139
- getMap: a,
140
- setMap: c,
141
- getColumnCache: (v) => a()[v] || [],
142
- setColumnCache: (v, o) => {
143
- const h = a();
144
- h[v] = o, c(h);
145
- },
146
- removeColumnCache: (v) => {
147
- const o = a();
148
- delete o[v], c(o);
149
- }
150
- };
151
- }, qt = { class: "search-form-item" }, Zt = /* @__PURE__ */ ae({
152
- __name: "SearchFormItem",
153
- props: {
154
- column: {},
155
- searchParam: {}
156
- },
157
- emits: ["search"],
158
- setup(y, { emit: d }) {
159
- rt((e) => ({
160
- "00203d4e": O.value
161
- }));
162
- const a = y, c = d, p = F(() => a.searchParam), _ = F(() => {
163
- var e, r, s;
164
- return {
165
- label: ((e = a.column.fieldNames) == null ? void 0 : e.label) ?? "label",
166
- value: ((r = a.column.fieldNames) == null ? void 0 : r.value) ?? "value",
167
- children: ((s = a.column.fieldNames) == null ? void 0 : s.children) ?? "children"
168
- };
169
- }), t = Fe("enumMap", B(/* @__PURE__ */ new Map())), v = F(() => {
170
- var r;
171
- let e = t.value.get(a.column.prop);
172
- return e ? (((r = a.column.search) == null ? void 0 : r.el) === "select-v2" && a.column.fieldNames && (e = e.map((s) => ({ ...s, label: s[_.value.label], value: s[_.value.value] }))), e) : [];
173
- }), o = F(() => {
174
- var e, r;
175
- return ((r = (e = a.column.search) == null ? void 0 : e.props) == null ? void 0 : r.options) ?? v.value ?? [];
176
- }), h = F(() => {
177
- var w, l;
178
- const e = _.value.label, r = _.value.value, s = _.value.children, m = (w = a.column.search) == null ? void 0 : w.el;
179
- let f = ((l = a.column.search) == null ? void 0 : l.props) ?? {};
180
- return m === "tree-select" && (f = { ...f, props: { ...f.props, label: e, children: s }, nodeKey: r }), m === "cascader" && (f = { ...f, props: { ...f.props, label: e, value: r, children: s } }), f;
181
- }), N = F(() => {
182
- var s, m, f, w, l, P, z;
183
- const e = a.column.search;
184
- return ["datetimerange", "daterange", "monthrange"].includes((s = e == null ? void 0 : e.props) == null ? void 0 : s.type) || (m = e == null ? void 0 : e.props) != null && m.isRange ? {
185
- rangeSeparator: ((f = e == null ? void 0 : e.props) == null ? void 0 : f.rangeSeparator) ?? "-",
186
- startPlaceholder: ((w = e == null ? void 0 : e.props) == null ? void 0 : w.startPlaceholder) ?? "开始时间",
187
- endPlaceholder: ((l = e == null ? void 0 : e.props) == null ? void 0 : l.endPlaceholder) ?? "结束时间"
188
- } : { placeholder: ((P = e == null ? void 0 : e.props) == null ? void 0 : P.placeholder) ?? ((z = e == null ? void 0 : e.el) != null && z.includes("input") ? "请输入" : "请选择") };
189
- }), O = F(() => {
190
- var f, w;
191
- const e = a.column.search, r = p.value[(e == null ? void 0 : e.key) ?? A(a.column.prop)], s = e == null ? void 0 : e.el, m = (f = e == null ? void 0 : e.props) == null ? void 0 : f.placeholder;
192
- if (e != null && e.width)
193
- if (_t(e == null ? void 0 : e.width)) {
194
- if (e == null ? void 0 : e.width(r))
195
- return (e == null ? void 0 : e.width(r)) + "px";
196
- } else
197
- return (e == null ? void 0 : e.width) + "px";
198
- if (r && r.length !== 0 && ["select", "select-v2", "tree-select", "cascader"].includes(s || "")) {
199
- if (Ke(r)) {
200
- let z = o.value;
201
- const D = [];
202
- if (r.forEach((L) => {
203
- const U = z.find((fe) => fe[_.value.value] === L);
204
- D.push(U ? U[_.value.label] : L);
205
- const q = U[_.value.children] ?? o.value;
206
- z = U ? q : [];
207
- }), (w = e == null ? void 0 : e.props) != null && w.multiple) {
208
- const q = te(D[0]) + 42;
209
- return r.length > 1 ? q + 26 + te("+ " + (r.length - 1)) + "px" : q + "px";
210
- }
211
- return te(D.join(" / ")) + "px";
212
- }
213
- let l = o.value.find((z) => z[_.value.value] === r);
214
- const P = l ? l[_.value.label] : r;
215
- return te(P) + "px";
216
- } else return m ? te(m) + "px" : "100px";
217
- }), x = F(() => {
218
- var e, r, s, m, f;
219
- return (s = (r = (e = a.column) == null ? void 0 : e.search) == null ? void 0 : r.props) != null && s.multiple && ((f = (m = a.column) == null ? void 0 : m.search) == null ? void 0 : f.el) === "select" ? {
220
- collapseTags: !0,
221
- collapseTagsTooltip: !0
222
- } : {};
223
- }), H = F(() => {
224
- var r;
225
- const e = a.column.search;
226
- return ((r = e == null ? void 0 : e.props) == null ? void 0 : r.clearable) ?? ((e == null ? void 0 : e.defaultValue) == null || !1);
227
- }), V = (e) => {
228
- var r, s, m, f, w, l, P, z, D;
229
- if (((m = (s = (r = a.column) == null ? void 0 : r.search) == null ? void 0 : s.props) == null ? void 0 : m.type) === "daterange") {
230
- const { searchParam: L } = Ve(a);
231
- if (e != null && e.length) {
232
- const U = ((l = (w = (f = a.column) == null ? void 0 : f.search) == null ? void 0 : w.props) == null ? void 0 : l.beginTime) || "beginTime", q = ((D = (z = (P = a.column) == null ? void 0 : P.search) == null ? void 0 : z.props) == null ? void 0 : D.endTime) || "endTime";
233
- L.value[U] = e[0], L.value[q] = e[1];
234
- } else
235
- delete L.value.beginTime, delete L.value.endTime;
236
- }
237
- (e == null || e === "") && c("search"), e instanceof Array && !e.length && c("search");
238
- }, T = () => {
239
- var e;
240
- ["input", "input-number"].includes(((e = a.column.search) == null ? void 0 : e.el) || "") && c("search");
241
- };
242
- return (e, r) => {
243
- var s, m, f, w, l, P, z;
244
- return S(), R("div", qt, [
245
- (S(), M(ce(((s = e.column.search) == null ? void 0 : s.render) ?? `el-${(m = e.column.search) == null ? void 0 : m.el}`), X({ ...h.value, ...N.value, searchParam: p.value, clearable: H.value, ...x.value }, {
246
- modelValue: p.value[((f = e.column.search) == null ? void 0 : f.key) ?? g(A)(e.column.prop)],
247
- "onUpdate:modelValue": r[0] || (r[0] = (D) => {
248
- var L;
249
- return p.value[((L = e.column.search) == null ? void 0 : L.key) ?? g(A)(e.column.prop)] = D;
250
- }),
251
- modelModifiers: { trim: !0 },
252
- data: ((w = e.column.search) == null ? void 0 : w.el) === "tree-select" ? v.value : [],
253
- options: o.value,
254
- "prefix-icon": (P = (l = e.column.search) == null ? void 0 : l.props) == null ? void 0 : P.prefixIcon,
255
- onChange: V,
256
- onKeyup: st(T, ["enter"])
257
- }), de({
258
- default: C(() => {
259
- var D;
260
- return [
261
- ((D = e.column.search) == null ? void 0 : D.el) === "select" ? (S(!0), R(Z, { key: 0 }, pe(v.value, (L, U) => (S(), M(ce("el-option"), {
262
- key: U,
263
- label: L[_.value.label] ?? "",
264
- value: L[_.value.value]
265
- }, null, 8, ["label", "value"]))), 128)) : W(e.$slots, "default", { key: 1 }, void 0, !0)
266
- ];
267
- }),
268
- _: 2
269
- }, [
270
- ((z = e.column.search) == null ? void 0 : z.el) === "cascader" ? {
271
- name: "default",
272
- fn: C(({ data: D }) => [
273
- E("span", null, Q(D[_.value.label]), 1)
274
- ]),
275
- key: "0"
276
- } : void 0
277
- ]), 1040, ["modelValue", "data", "options", "prefix-icon"]))
278
- ]);
279
- };
280
- }
281
- }), Gt = /* @__PURE__ */ oe(Zt, [["__scopeId", "data-v-b34b8b6d"]]), Qt = { class: "table-search" }, Jt = { key: 0 }, Yt = {
282
- key: 0,
283
- class: "operation"
284
- }, Xt = /* @__PURE__ */ ae({
285
- __name: "SearchForm",
286
- props: {
287
- columns: { default: () => [] },
288
- searchParam: { default: () => ({}) },
289
- search: {},
290
- reset: {},
291
- isShowResetBtn: { type: Boolean, default: !0 },
292
- isShowSearchBtn: { type: Boolean, default: !0 }
293
- },
294
- setup(y) {
295
- const d = y;
296
- return (a, c) => (S(), R("div", Qt, [
297
- k(g(wt), {
298
- ref: "formRef",
299
- model: a.searchParam,
300
- class: "table-search--left",
301
- onSubmit: c[0] || (c[0] = ut(() => {
302
- }, ["prevent"]))
303
- }, {
304
- default: C(() => [
305
- W(a.$slots, "default", {}, void 0, !0),
306
- a.columns.length ? (S(), R(Z, { key: 0 }, [
307
- (S(!0), R(Z, null, pe(a.columns, (p) => {
308
- var _, t, v;
309
- return S(), R(Z, {
310
- key: p.prop
311
- }, [
312
- !g(kt)((_ = p.search) == null ? void 0 : _.isShow) || (t = p.search) != null && t.isShow ? (S(), R("div", Jt, [
313
- k(g(Pt), null, de({
314
- default: C(() => [
315
- k(Gt, {
316
- column: p,
317
- "search-param": a.searchParam,
318
- onSearch: a.search
319
- }, null, 8, ["column", "search-param", "onSearch"])
320
- ]),
321
- _: 2
322
- }, [
323
- (v = p.search) != null && v.label ? {
324
- name: "label",
325
- fn: C(() => [
326
- k(g(Tt), { size: 4 }, {
327
- default: C(() => {
328
- var o, h;
329
- return [
330
- E("span", null, Q(`${p.search.label}`), 1),
331
- (o = p.search) != null && o.tooltip ? (S(), M(g(me), {
332
- key: 0,
333
- effect: "dark",
334
- content: (h = p.search) == null ? void 0 : h.tooltip,
335
- placement: "top"
336
- }, {
337
- default: C(() => c[1] || (c[1] = [
338
- E("i", {
339
- class: Oe("iconfont icon-yiwen")
340
- }, null, -1)
341
- ])),
342
- _: 2
343
- }, 1032, ["content"])) : $("", !0)
344
- ];
345
- }),
346
- _: 2
347
- }, 1024),
348
- c[2] || (c[2] = E("span", null, ":", -1))
349
- ]),
350
- key: "0"
351
- } : void 0
352
- ]), 1024)
353
- ])) : $("", !0)
354
- ], 64);
355
- }), 128)),
356
- d.isShowSearchBtn ? (S(), M(g(ze), {
357
- key: 0,
358
- type: "primary",
359
- class: "table-search--search-btn",
360
- onClick: a.search
361
- }, {
362
- icon: C(() => c[3] || (c[3] = [
363
- E("i", { class: "iconfont icon-search" }, null, -1)
364
- ])),
365
- default: C(() => [
366
- c[4] || (c[4] = G(" 搜索 "))
367
- ]),
368
- _: 1
369
- }, 8, ["onClick"])) : $("", !0)
370
- ], 64)) : $("", !0)
371
- ]),
372
- _: 3
373
- }, 8, ["model"]),
374
- d.isShowResetBtn && a.columns.length ? (S(), R("div", Yt, [
375
- k(g(me), {
376
- class: "box-item",
377
- effect: "light",
378
- content: "重置",
379
- placement: "top"
380
- }, {
381
- default: C(() => {
382
- var p;
383
- return [
384
- a.columns.length > 1 || ((p = a.columns[0].search) == null ? void 0 : p.el) !== "input" ? (S(), M(g(ze), {
385
- key: 0,
386
- class: "table-search--reset-btn",
387
- onClick: a.reset
388
- }, {
389
- icon: C(() => [
390
- k(g(_e), { size: 14 }, {
391
- default: C(() => [
392
- k(g(Et))
393
- ]),
394
- _: 1
395
- })
396
- ]),
397
- _: 1
398
- }, 8, ["onClick"])) : $("", !0)
399
- ];
400
- }),
401
- _: 1
402
- })
403
- ])) : $("", !0)
404
- ]));
405
- }
406
- }), ea = /* @__PURE__ */ oe(Xt, [["__scopeId", "data-v-2e2396eb"]]), ta = { class: "el-pagination__total zh-page-total" }, aa = /* @__PURE__ */ ae({
407
- __name: "tablePagination",
408
- props: {
409
- pageable: {},
410
- handleSizeChange: { type: Function },
411
- handleCurrentChange: { type: Function }
412
- },
413
- setup(y) {
414
- return (d, a) => {
415
- const c = ie("el-pagination");
416
- return d.pageable.total ? (S(), M(c, {
417
- key: 0,
418
- class: "zh-pagination",
419
- background: !0,
420
- "current-page": d.pageable.page,
421
- "page-size": d.pageable.size,
422
- total: d.pageable.total,
423
- layout: "slot, sizes, prev, pager, next, jumper",
424
- onSizeChange: d.handleSizeChange,
425
- onCurrentChange: d.handleCurrentChange
426
- }, {
427
- default: C(() => [
428
- E("div", ta, "共" + Q(d.pageable.total) + "条数据", 1)
429
- ]),
430
- _: 1
431
- }, 8, ["current-page", "page-size", "total", "onSizeChange", "onCurrentChange"])) : $("", !0);
432
- };
433
- }
434
- }), na = /* @__PURE__ */ oe(aa, [["__scopeId", "data-v-7e4152cd"]]), oa = /* @__PURE__ */ ae({
435
- __name: "TableColumn",
436
- props: {
437
- column: {}
438
- },
439
- setup(y) {
440
- const a = B(y.column), c = xe(), p = Fe("enumMap", B(/* @__PURE__ */ new Map())), _ = (o, h) => p.value.get(o.prop) && o.isFilterEnum ? De(Se(h.row, o.prop), p.value.get(o.prop), o.fieldNames) : Wt(Se(h.row, o.prop)), t = (o, h) => De(Se(h.row, o.prop), p.value.get(o.prop), o.fieldNames, "tag"), v = (o) => /* @__PURE__ */ React.createElement(React.Fragment, null, o.isShow && /* @__PURE__ */ React.createElement(
441
- "el-table-column",
442
- {
443
- ...o,
444
- "class-name": o.wrap && "table-column--wrap",
445
- showOverflowTooltip: o.showOverflowTooltip ?? o.prop !== "operation"
446
- },
447
- {
448
- default: (h) => {
449
- var N, O;
450
- if (o._children) return o._children.map((x) => v(x));
451
- if (o.render) return o.render(h);
452
- if (o.prop === "operation") {
453
- if (!c[A(o.prop)]) {
454
- a.value.width = 0;
455
- return;
456
- }
457
- const x = ((O = (N = c[A(o.prop)](h)) == null ? void 0 : N.at(0)) == null ? void 0 : O.children) || [], H = (w) => Array.from(w).map((l) => {
458
- var P, z;
459
- return ((P = l.type) == null ? void 0 : P.name) === "ElButton" && l.children !== "v-if" ? l : (z = l.children) != null && z.length ? H(l.children) : null;
460
- }).filter(Boolean).flat(), V = H(x), T = (w) => {
461
- let l = "";
462
- return w.forEach((P) => {
463
- l += P.children.default()[0].children;
464
- }), te(l, 14) + 6 * w.length + +(8 * w.length - 1);
465
- }, e = (w) => {
466
- a.value.hasOperationMaxWidth || (a.value.width = 0, a.value.hasOperationMaxWidth = !0);
467
- const l = a.value.width;
468
- let P = 0;
469
- w > 0 && (P = Math.round(w) + 32), P > Number.parseInt((l == null ? void 0 : l.toString()) || "0") && (a.value.width = P, a.value.hasOperationMaxWidth = !0);
470
- };
471
- if (V.length <= 3) {
472
- const w = T(V);
473
- return e(w), /* @__PURE__ */ React.createElement("div", { class: "operation-container" }, V);
474
- }
475
- const r = [], s = V.slice(0, 2), m = /* @__PURE__ */ React.createElement("el-button", { link: !0, type: "primary" }, "更多");
476
- r.push(...s), r[3] = /* @__PURE__ */ React.createElement("el-dropdown", null, {
477
- default: () => m,
478
- dropdown: () => /* @__PURE__ */ React.createElement("el-dropdown-menu", null, V.slice(2).map((w) => /* @__PURE__ */ React.createElement("el-dropdown-item", null, w)))
479
- });
480
- const f = T([...s, m]);
481
- return e(f), /* @__PURE__ */ React.createElement("div", { class: "operation-container" }, r);
482
- }
483
- return c[A(o.prop)] ? c[A(o.prop)](h) : o.tag ? /* @__PURE__ */ React.createElement("el-tag", { type: t(o, h) }, _(o, h)) : o.click && _(o, h) !== ee ? /* @__PURE__ */ React.createElement(
484
- "span",
485
- {
486
- class: "el-link el-link--primary scan-link",
487
- onClick: function() {
488
- o.click(h == null ? void 0 : h.row);
489
- }
490
- },
491
- o.formatter ? o.formatter(h.row, h.column, h.row[o.prop], h.$index) : _(o, h)
492
- ) : /* @__PURE__ */ React.createElement(
493
- "span",
494
- {
495
- class: "text"
496
- },
497
- o.formatter ? o.formatter(h.row, h.column, h.row[o.prop], h.$index) : _(o, h)
498
- );
499
- },
500
- header: (h) => o.headerRender ? o.headerRender(h) : c[`${A(o.prop)}Header`] ? c[`${A(o.prop)}Header`](h) : o.label
501
- }
502
- ));
503
- return (o, h) => (S(), M(v, it(ct(a.value)), null, 16));
504
- }
505
- }), la = { class: "custom-column-dialog" }, ra = { class: "table-body" }, sa = { class: "name" }, ua = {
506
- key: 0,
507
- class: "ml-10"
508
- }, ia = { class: "custom-width-label text" }, ca = {
509
- key: 0,
510
- class: "custom-width-input-box"
511
- }, da = { class: "custom-column-footer" }, pa = { class: "flex-1" }, ha = /* @__PURE__ */ ae({
512
- __name: "ColSetting",
513
- props: {
514
- originTableColumns: { default: () => [] }
515
- },
516
- emits: ["close", "submit", "dragSort"],
517
- setup(y, { expose: d, emit: a }) {
518
- const c = B(), p = B(!1), _ = y, t = B([]), v = B((/* @__PURE__ */ new Date()).getTime()), o = B(!1), h = B(), N = (r) => {
519
- t.value = r, o.value = !0, he(() => {
520
- V();
521
- });
522
- }, O = (r) => {
523
- p.value = r;
524
- }, x = a, H = async () => {
525
- x("submit", t.value), o.value = !1;
526
- }, V = () => {
527
- h.value && (h.value.destroy(), v.value = (/* @__PURE__ */ new Date()).getTime(), c.value.doLayout()), he(() => {
528
- const r = document.querySelector(".custom-column-dialog tbody");
529
- h.value = Ae.create(r, {
530
- handle: ".move",
531
- animation: 300,
532
- filter: ".operation",
533
- onEnd({ newIndex: s, oldIndex: m }) {
534
- if (!s || !m) return;
535
- let f = j(t.value);
536
- const w = f[m];
537
- if (s < m)
538
- for (let l = s; l < m; l++)
539
- f[l].order = String(Number(f[l].order) + 1);
540
- else
541
- for (let l = m + 1; l <= s; l++)
542
- f[l].order = String(Number(f[l].order) - 1);
543
- w.order = String(s), t.value = j(f);
544
- }
545
- });
546
- });
547
- }, T = () => {
548
- const r = j(_.originTableColumns);
549
- p.value ? t.value = r : t.value = t.value.map((s) => {
550
- const m = t.value.find((f) => f.prop === s.prop);
551
- return !(m != null && m.isShow) || m.prop === "operation" ? s : r.find((f) => f.prop === s.prop);
552
- }), V();
553
- }, e = () => {
554
- o.value = !1;
555
- };
556
- return d({
557
- openColSetting: N
558
- }), (r, s) => {
559
- const m = ie("el-checkbox"), f = ie("el-table-column"), w = ie("el-icon");
560
- return S(), R("div", la, [
561
- k(xt, {
562
- modelValue: o.value,
563
- "onUpdate:modelValue": s[1] || (s[1] = (l) => o.value = l),
564
- size: "middle"
565
- }, {
566
- header: C(() => s[2] || (s[2] = [
567
- E("div", { class: "title" }, "自定义列", -1),
568
- E("div", { class: "sub-title" }, "勾选需要展示的列,拖动列名进行排序", -1)
569
- ])),
570
- footer: C(() => [
571
- E("div", da, [
572
- k(m, {
573
- modelValue: p.value,
574
- "onUpdate:modelValue": s[0] || (s[0] = (l) => p.value = l),
575
- class: "checkbox",
576
- label: "全局",
577
- onChange: O
578
- }, null, 8, ["modelValue"]),
579
- E("div", pa, [
580
- k(Ce, {
581
- plain: "",
582
- onClick: e
583
- }, {
584
- default: C(() => s[4] || (s[4] = [
585
- G("取消")
586
- ])),
587
- _: 1
588
- }),
589
- k(Ce, {
590
- plain: "",
591
- class: "w-auto",
592
- onClick: T
593
- }, {
594
- default: C(() => [
595
- G(Q(p.value ? "全局恢复默认" : "恢复默认"), 1)
596
- ]),
597
- _: 1
598
- }),
599
- k(Ce, {
600
- type: "primary",
601
- onClick: H
602
- }, {
603
- default: C(() => s[5] || (s[5] = [
604
- G("保存")
605
- ])),
606
- _: 1
607
- })
608
- ])
609
- ])
610
- ]),
611
- default: C(() => [
612
- E("div", ra, [
613
- (S(), M(g(Ne), {
614
- ref_key: "tableRef",
615
- ref: c,
616
- class: "custom-colum-table",
617
- key: v.value,
618
- data: t.value,
619
- "row-class-name": (l) => l.row.prop === "operation" ? "operation" : ""
620
- }, {
621
- default: C(() => [
622
- k(f, {
623
- width: "100",
624
- label: "选择"
625
- }, {
626
- default: C(({ row: l }) => [
627
- k(m, {
628
- class: "custom-column-check",
629
- modelValue: l.isShow,
630
- "onUpdate:modelValue": (P) => l.isShow = P,
631
- disabled: l.readonly
632
- }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"])
633
- ]),
634
- _: 1
635
- }),
636
- k(f, {
637
- prop: "label",
638
- label: "名称"
639
- }, {
640
- default: C(({ row: l }) => [
641
- E("div", sa, [
642
- G(Q(l.label) + " ", 1),
643
- l.readonly ? (S(), R("span", ua, "(必选)")) : $("", !0),
644
- l.prop !== "operation" ? (S(), M(w, {
645
- key: 1,
646
- class: "move move-icon"
647
- }, {
648
- default: C(() => [
649
- k(g($t))
650
- ]),
651
- _: 1
652
- })) : $("", !0)
653
- ])
654
- ]),
655
- _: 1
656
- }),
657
- k(f, {
658
- prop: "width",
659
- label: "宽度",
660
- width: "180"
661
- }, {
662
- default: C(({ row: l }) => [
663
- E("div", {
664
- class: Oe(`custom-width-box ${l.readonly && "readonly"}`)
665
- }, [
666
- s[3] || (s[3] = E("span", { class: "text" }, "宽度", -1)),
667
- E("span", ia, Q(l.width) + " px", 1),
668
- l.readonly ? $("", !0) : (S(), R("div", ca, [
669
- k(g(He), {
670
- modelValue: l.width,
671
- "onUpdate:modelValue": (P) => l.width = P,
672
- class: "custom-width-input",
673
- min: 10,
674
- max: 1e3,
675
- controls: !1
676
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
677
- ]))
678
- ], 2)
679
- ]),
680
- _: 1
681
- })
682
- ]),
683
- _: 1
684
- }, 8, ["data", "row-class-name"]))
685
- ])
686
- ]),
687
- _: 1
688
- }, 8, ["modelValue"])
689
- ]);
690
- };
691
- }
692
- }), ma = /* @__PURE__ */ oe(ha, [["__scopeId", "data-v-0ae65c5f"]]), fa = { class: "no-card table-main zh-table" }, ga = { class: "table-title-container" }, va = {
693
- key: 0,
694
- class: "table-title"
695
- }, ba = {
696
- key: 1,
697
- class: "table-header-tip"
698
- }, ya = { class: "table-header-container" }, Ca = {
699
- key: 0,
700
- class: "table-header"
701
- }, Sa = { class: "header-button-ri" }, _a = { class: "table-body-container" }, wa = { class: "text d-flex inline-input-text pointer" }, ka = {
702
- key: 1,
703
- class: "inline-input-box d-flex"
704
- }, Pa = { class: "table-empty" }, Ta = ["src"], Ea = /* @__PURE__ */ ae({
705
- __name: "index",
706
- props: {
707
- columns: { default: () => [] },
708
- data: {},
709
- requestApi: {},
710
- requestAuto: { type: Boolean, default: !0 },
711
- requestError: { type: Function, default: (y) => {
712
- console.error("protable中请求数据错误", y);
713
- } },
714
- handleParam: {},
715
- dataCallback: {},
716
- selectChangeCallback: {},
717
- title: {},
718
- pagination: { type: Boolean, default: !0 },
719
- initParam: { default: {} },
720
- border: { type: Boolean, default: !1 },
721
- rowKey: { default: "id" },
722
- isShowSearch: { type: Boolean, default: !0 },
723
- maxHeight: {},
724
- isShowSearchBtn: { type: Boolean, default: !0 },
725
- isShowResetBtn: { type: Boolean, default: !0 },
726
- customColumn: { type: Boolean, default: !0 },
727
- onSortChange: {},
728
- offset: {},
729
- customColumnCacheKey: {},
730
- customColumnPageCacheKey: {}
731
- },
732
- emits: ["search", "reset", "dargSort"],
733
- setup(y, { expose: d, emit: a }) {
734
- var Re;
735
- const c = B((/* @__PURE__ */ new Date()).getTime()), p = {
736
- mounted(n) {
737
- var u;
738
- (u = n.querySelector("input")) == null || u.focus();
739
- }
740
- }, _ = xe(), t = y, v = B(), o = ["selection", "radio", "index", "expand", "sort", "input"], h = B(t.isShowSearch), N = B(""), O = B({}), x = B(t.maxHeight || "1000px"), { selectionChange: H, selectedList: V, selectedListIds: T, isSelected: e } = At(t.rowKey, t.selectChangeCallback), {
741
- loading: r,
742
- tableData: s,
743
- pageable: m,
744
- searchParam: f,
745
- searchInitParam: w,
746
- getTableList: l,
747
- search: P,
748
- reset: z,
749
- handleSizeChange: D,
750
- handleCurrentChange: L
751
- } = Kt(t.requestApi, t.initParam, t.pagination, t.dataCallback, t.requestError, t.handleParam), U = (n) => {
752
- function u(ot) {
753
- return ot.replace(/[A-Z]/g, (lt) => "_" + lt.toLowerCase());
754
- }
755
- const b = {
756
- ascending: "asc",
757
- descending: "desc"
758
- }, { prop: i, order: I } = n, K = u(A(i)), ue = b[I];
759
- f.value = {
760
- ...f.value,
761
- sortKey: K,
762
- sortOrder: ue
763
- }, m.value.page = 1, P();
764
- }, q = () => v.value.clearSelection(), fe = () => v.value.clearSort(), we = B(!1), ke = () => {
765
- Je(), at(), t.requestAuto && l(), t.data && (m.value.total = t.data.length);
766
- };
767
- dt(() => {
768
- ke(), he(() => {
769
- we.value = !0;
770
- });
771
- }), pt(() => {
772
- we.value && ke();
773
- }), ht(() => {
774
- }), mt(() => {
775
- });
776
- const le = F(() => t.data ? t.pagination ? t.data.slice((m.value.page - 1) * m.value.size, m.value.size * m.value.page) : t.data : s.value), je = (n) => {
777
- m.value.total = n;
778
- };
779
- ft(() => t.initParam, l, { deep: !0 });
780
- let ne = Y(t.columns);
781
- const qe = F(() => Pe(ne)), J = B(/* @__PURE__ */ new Map()), Ze = async ({ prop: n, enum: u }) => {
782
- if (!u || J.value.has(n) && (typeof u == "function" || J.value.get(n) === u)) return;
783
- if (typeof u != "function") return J.value.set(n, g(u));
784
- J.value.set(n, []);
785
- const { data: b } = await u();
786
- J.value.set(n, b);
787
- };
788
- gt("enumMap", J);
789
- const Pe = (n, u = []) => (n.forEach(async (b) => {
790
- var i;
791
- (i = b._children) != null && i.length && u.push(...Pe(b._children)), u.push(b), b.isShow = b.isShow ?? !0, b.isFilterEnum = b.isFilterEnum ?? !0, await Ze(b);
792
- }), u.filter((b) => {
793
- var i;
794
- return !((i = b._children) != null && i.length);
795
- })), Te = F(() => {
796
- var n;
797
- return (n = qe.value) == null ? void 0 : n.filter((u) => {
798
- var b, i;
799
- return ((b = u.search) == null ? void 0 : b.el) || ((i = u.search) == null ? void 0 : i.render);
800
- }).sort((u, b) => u.search.order - b.search.order);
801
- });
802
- (Re = Te.value) == null || Re.forEach((n, u) => {
803
- var I, K, ue;
804
- n.search.order = ((I = n.search) == null ? void 0 : I.order) ?? u + 2;
805
- const b = ((K = n.search) == null ? void 0 : K.key) ?? A(n.prop), i = (ue = n.search) == null ? void 0 : ue.defaultValue;
806
- i != null && (w.value[b] = i, f.value[b] = i);
807
- });
808
- const ge = a, Ge = () => {
809
- var n;
810
- (n = v.value) == null || n.clearSelection(), P(), ge("search");
811
- }, Qe = () => {
812
- z(), fe(), ge("reset");
813
- }, Je = () => {
814
- const n = document.querySelector(".el-table__body-wrapper tbody");
815
- Ae.create(n, {
816
- handle: ".move",
817
- animation: 300,
818
- onEnd({ newIndex: u, oldIndex: b }) {
819
- const [i] = le.value.splice(b, 1);
820
- le.value.splice(u, 0, i), ge("dargSort", { newIndex: u, oldIndex: b });
821
- }
822
- });
823
- }, re = B(0), Ye = (n, u) => {
824
- const b = s.value.findIndex((i) => i.$showInput);
825
- b > -1 && (s.value[b] = j(O.value), s.value[b].$showInput = !1), re.value = Le(n, String(u)), n.$showInput = !0, O.value = j(n);
826
- }, Xe = async (n, u, b) => {
827
- Dt(n, u, re.value), b && await b(n), n.$showInput = !1, Vt.success("更新成功"), await l();
828
- }, et = async (n) => {
829
- const u = s.value.findIndex((b) => Ft(Ie(b, Me), Ie(n, Me)));
830
- u > -1 && (s.value[u] = j(O.value), s.value[u].$showInput = !1);
831
- }, Ee = jt(t.customColumnCacheKey), $e = B(null), ve = () => ne.map(
832
- (n, u) => ({
833
- readonly: n.isCustomDisable || ["id", "operation"].includes(String(n.prop)),
834
- order: u,
835
- index: u,
836
- width: n.width || n.minWidth,
837
- ...n
838
- })
839
- ).sort((n, u) => {
840
- const b = Number(n.order), i = Number(u.order);
841
- return b - i;
842
- }), tt = () => {
843
- se = Y(ve()), he(() => {
844
- $e.value.openColSetting(j(se));
845
- });
846
- }, at = () => {
847
- if (!t.customColumnPageCacheKey) return;
848
- const n = Ee.getColumnCache(t.customColumnPageCacheKey);
849
- n != null && n.length && (se = Y(n), ne = Y(se));
850
- };
851
- let se = Y(ve());
852
- const Be = j(ve()), nt = (n) => {
853
- t.customColumnPageCacheKey && (n = n.map((u) => {
854
- const b = Be.find((i) => i.prop === u.prop);
855
- return b && b.minWidth && (u.minWidth = u.width, delete u.width), u;
856
- }), ne = Y(j(n)), Ee.setColumnCache(t.customColumnPageCacheKey, n), c.value = (/* @__PURE__ */ new Date()).getTime(), v.value.doLayout());
857
- };
858
- return d({
859
- element: v,
860
- tableData: le,
861
- radio: N,
862
- pageable: m,
863
- searchParam: f,
864
- searchInitParam: w,
865
- setPageTotal: je,
866
- getTableList: l,
867
- search: P,
868
- reset: z,
869
- handleSizeChange: D,
870
- handleCurrentChange: L,
871
- clearSelection: q,
872
- enumMap: J,
873
- isSelected: e,
874
- selectedList: V,
875
- selectedListIds: T
876
- }), (n, u) => {
877
- const b = vt("loading");
878
- return S(), M(g(Bt), { locale: g(Rt) }, {
879
- default: C(() => [
880
- E("div", fa, [
881
- E("div", ga, [
882
- n.title ? (S(), R("div", va, Q(n.title), 1)) : $("", !0),
883
- g(_).headerTip ? (S(), R("div", ba, [
884
- W(n.$slots, "headerTip", {}, void 0, !0)
885
- ])) : $("", !0)
886
- ]),
887
- E("div", ya, [
888
- be(k(ea, {
889
- search: Ge,
890
- reset: Qe,
891
- columns: Te.value,
892
- "search-param": g(f),
893
- "is-show-reset-btn": t.isShowResetBtn,
894
- "is-show-search-btn": t.isShowSearchBtn
895
- }, {
896
- default: C(() => [
897
- n.$slots.tableHeader ? (S(), R("div", Ca, [
898
- E("div", Sa, [
899
- W(n.$slots, "tableHeader", {
900
- selectedList: g(V),
901
- selectedListIds: g(T),
902
- isSelected: g(e)
903
- }, void 0, !0)
904
- ])
905
- ])) : $("", !0)
906
- ]),
907
- _: 3
908
- }, 8, ["columns", "search-param", "is-show-reset-btn", "is-show-search-btn"]), [
909
- [bt, h.value]
910
- ])
911
- ]),
912
- E("div", _a, [
913
- t.customColumn ? (S(), R("div", {
914
- key: 0,
915
- class: "col-setting-button",
916
- onClick: tt
917
- }, [
918
- k(g(me), {
919
- class: "box-item",
920
- effect: "dark",
921
- content: "自定义列",
922
- placement: "top"
923
- }, {
924
- default: C(() => [
925
- k(g(_e), {
926
- size: 14,
927
- color: "#000000a6"
928
- }, {
929
- default: C(() => [
930
- k(g(zt))
931
- ]),
932
- _: 1
933
- })
934
- ]),
935
- _: 1
936
- })
937
- ])) : $("", !0),
938
- be((S(), M(g(Ne), X({
939
- ref_key: "tableRef",
940
- ref: v
941
- }, n.$attrs, {
942
- key: c.value,
943
- data: le.value,
944
- border: n.border,
945
- "row-key": n.rowKey,
946
- "max-height": x.value,
947
- "row-style": { height: "42px" },
948
- "tooltip-effect": "light",
949
- "tooltip-options": { showArrow: !1, placement: "bottom-start", offset: t.offset ? t.offset : -20 }
950
- }, yt(n.$attrs), {
951
- onSelectionChange: g(H),
952
- onSortChange: u[1] || (u[1] = (i) => t.onSortChange ? t.onSortChange(i) : U(i))
953
- }), {
954
- append: C(() => [
955
- W(n.$slots, "append", {}, void 0, !0)
956
- ]),
957
- empty: C(() => [
958
- E("div", Pa, [
959
- W(n.$slots, "empty", {}, () => [
960
- E("img", {
961
- src: `${g(Ot)}ghy-components/empty.png`,
962
- alt: "notData"
963
- }, null, 8, Ta),
964
- u[5] || (u[5] = E("div", null, "暂无数据", -1))
965
- ], !0)
966
- ])
967
- ]),
968
- default: C(() => [
969
- (S(!0), R(Z, null, pe(g(ne).sort((i, I) => i.order - I.order), (i) => (S(), R(Z, { key: i }, [
970
- i.type && o.includes(i.type) && i.isShow ? (S(), M(g(It), X({
971
- key: 0,
972
- ref_for: !0
973
- }, i, {
974
- align: i.align ?? "left",
975
- "reserve-selection": i.type == "selection"
976
- }), de({
977
- default: C((I) => [
978
- i.type == "expand" ? (S(), R(Z, { key: 0 }, [
979
- i.render ? (S(), M(ce(i.render), X({
980
- key: 0,
981
- ref_for: !0
982
- }, I), null, 16)) : W(n.$slots, i.type, X({
983
- key: 1,
984
- ref_for: !0
985
- }, I), void 0, !0)
986
- ], 64)) : $("", !0),
987
- i.type == "sort" ? (S(), M(g(Mt), {
988
- key: 1,
989
- class: "move"
990
- }, {
991
- default: C(() => [
992
- k(g(_e), null, {
993
- default: C(() => [
994
- k(g(Lt))
995
- ]),
996
- _: 1
997
- })
998
- ]),
999
- _: 1
1000
- })) : $("", !0),
1001
- i.type == "input" ? (S(), R(Z, { key: 2 }, [
1002
- I.row.$showInput ? (S(), R("div", ka, [
1003
- be(k(g(He), {
1004
- min: 0,
1005
- max: n.MAX_WEIGHT,
1006
- controls: !1,
1007
- modelValue: re.value,
1008
- "onUpdate:modelValue": u[0] || (u[0] = (K) => re.value = K)
1009
- }, null, 8, ["max", "modelValue"]), [
1010
- [p]
1011
- ]),
1012
- k(g(ye), {
1013
- type: "primary",
1014
- underline: !1,
1015
- onClick: (K) => Xe(I.row, String(i.prop), i.blurCallback),
1016
- class: "ml-5"
1017
- }, {
1018
- default: C(() => u[3] || (u[3] = [
1019
- G(" 保存 ")
1020
- ])),
1021
- _: 2
1022
- }, 1032, ["onClick"]),
1023
- k(g(ye), {
1024
- type: "primary",
1025
- underline: !1,
1026
- onClick: (K) => et(I.row),
1027
- class: "ml-5"
1028
- }, {
1029
- default: C(() => u[4] || (u[4] = [
1030
- G(" 取消 ")
1031
- ])),
1032
- _: 2
1033
- }, 1032, ["onClick"])
1034
- ])) : (S(), M(g(me), {
1035
- key: 0,
1036
- content: "编辑",
1037
- placement: "top"
1038
- }, {
1039
- default: C(() => [
1040
- E("span", wa, [
1041
- G(Q(g(Le)(I.row, String(i.prop))) + " ", 1),
1042
- k(g(ye), {
1043
- underline: !1,
1044
- disabled: n.userStore.banButton,
1045
- class: "text d-flex inline-input-text pointer",
1046
- onClick: (K) => Ye(I.row, i.prop)
1047
- }, {
1048
- default: C(() => u[2] || (u[2] = [
1049
- E("i", { class: "iconfont icon-edit" }, null, -1)
1050
- ])),
1051
- _: 2
1052
- }, 1032, ["disabled", "onClick"])
1053
- ])
1054
- ]),
1055
- _: 2
1056
- }, 1024))
1057
- ], 64)) : $("", !0)
1058
- ]),
1059
- _: 2
1060
- }, [
1061
- i.headerRender ? {
1062
- name: "header",
1063
- fn: C((I) => [
1064
- (S(), M(ce(i.headerRender), X({ ref_for: !0 }, I), null, 16))
1065
- ]),
1066
- key: "0"
1067
- } : void 0
1068
- ]), 1040, ["align", "reserve-selection"])) : $("", !0),
1069
- !i.type && i.prop && i.isShow ? (S(), M(oa, {
1070
- key: 1,
1071
- column: i
1072
- }, de({ _: 2 }, [
1073
- pe(Object.keys(n.$slots), (I) => ({
1074
- name: I,
1075
- fn: C((K) => [
1076
- W(n.$slots, I, X({ ref_for: !0 }, K), void 0, !0)
1077
- ])
1078
- }))
1079
- ]), 1032, ["column"])) : $("", !0)
1080
- ], 64))), 128))
1081
- ]),
1082
- _: 3
1083
- }, 16, ["data", "border", "row-key", "max-height", "tooltip-options", "onSelectionChange"])), [
1084
- [b, g(r)]
1085
- ])
1086
- ]),
1087
- W(n.$slots, "pagination", {}, () => [
1088
- n.pagination ? (S(), M(na, {
1089
- key: 0,
1090
- pageable: g(m),
1091
- "handle-size-change": g(D),
1092
- "handle-current-change": g(L)
1093
- }, null, 8, ["pageable", "handle-size-change", "handle-current-change"])) : $("", !0)
1094
- ], !0)
1095
- ]),
1096
- t.customColumn ? (S(), M(ma, {
1097
- key: 0,
1098
- ref_key: "colRef",
1099
- ref: $e,
1100
- "origin-table-columns": g(Be),
1101
- onSubmit: nt
1102
- }, null, 8, ["origin-table-columns"])) : $("", !0)
1103
- ]),
1104
- _: 3
1105
- }, 8, ["locale"]);
1106
- };
1107
- }
1108
- }), $a = /* @__PURE__ */ oe(Ea, [["__scopeId", "data-v-3f0440e2"]]), Da = Ut($a);
1109
- export {
1110
- Da as Z
1111
- };