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