@amaoaaaaa/search-table 0.4.0 → 0.5.1
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/CHANGELOG.md +126 -0
- package/README.md +150 -30
- package/dist/ProTable/index.vue.d.ts +10 -4
- package/dist/ProTable/types.d.ts +7 -0
- package/dist/SearchTable/index.d.ts +32 -2
- package/dist/SearchTable/index.vue.d.ts +103 -3962
- package/dist/SearchTable/types.d.ts +6 -1
- package/dist/SearchTable/useTableSort.d.ts +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/search-table.js +492 -470
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/search-table.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { ElLoading as
|
|
6
|
-
import { isFunction as
|
|
7
|
-
import { vTextEllipsis as
|
|
8
|
-
import { isCancel as
|
|
9
|
-
const
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Ie = (e, l, d) => l in e ? je(e, l, { enumerable: !0, configurable: !0, writable: !0, value: d }) : e[l] = d;
|
|
3
|
+
var he = (e, l, d) => Ie(e, typeof l != "symbol" ? l + "" : l, d);
|
|
4
|
+
import { defineComponent as de, computed as z, isVNode as qe, openBlock as s, createBlock as k, resolveDynamicComponent as Ge, createElementBlock as x, markRaw as Q, createElementVNode as _, useModel as We, useTemplateRef as $e, ref as V, withDirectives as ie, createVNode as C, unref as n, withCtx as y, createCommentVNode as F, createTextVNode as R, toDisplayString as L, Fragment as q, renderList as oe, mergeProps as ge, createSlots as Ye, isRef as Re, normalizeClass as Qe, toValue as Se, withModifiers as pe, withKeys as ye, normalizeStyle as ke, mergeModels as Ce, reactive as xe, nextTick as ue, toRef as Ze, watch as Ve, useSlots as Je, inject as Xe, onMounted as et, onUnmounted as tt, renderSlot as J, provide as lt } from "vue";
|
|
5
|
+
import { ElLoading as at, ElTable as nt, ElTableColumn as ve, ElPopover as rt, ElScrollbar as Te, ElRadioGroup as st, ElRadio as it, ElCheckboxGroup as ot, ElCheckbox as ut, ElDatePicker as dt, ElButton as M, ElInput as Be, ElPopconfirm as ct, ElText as ft, ElTooltip as ht, ElPagination as pt, ElMessage as vt } from "element-plus";
|
|
6
|
+
import { isFunction as I, isBoolean as _e, cloneDeep as Y, isString as mt, keys as be, isEqual as gt, pickBy as Fe, sortBy as yt, uniq as bt, countBy as xt } from "lodash-es";
|
|
7
|
+
import { vTextEllipsis as me } from "@amaoaaaaa/v-text-ellipsis";
|
|
8
|
+
import { isCancel as He } from "axios";
|
|
9
|
+
const wt = ["innerHTML"], St = /* @__PURE__ */ de({
|
|
10
10
|
__name: "RenderFormatterResult",
|
|
11
11
|
props: {
|
|
12
12
|
col: {},
|
|
@@ -15,24 +15,24 @@ const gt = ["innerHTML"], yt = /* @__PURE__ */ se({
|
|
|
15
15
|
index: {}
|
|
16
16
|
},
|
|
17
17
|
setup(e) {
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
const r =
|
|
21
|
-
return (
|
|
18
|
+
const l = e, d = z(() => {
|
|
19
|
+
var i, g;
|
|
20
|
+
const r = l.col.prop ? l.row[l.col.prop] : void 0;
|
|
21
|
+
return (g = (i = l.col).formatter) == null ? void 0 : g.call(i, l.row, l.column, r, l.index);
|
|
22
22
|
});
|
|
23
|
-
return (r,
|
|
23
|
+
return (r, i) => qe(d.value) ? (s(), k(Ge(d.value), { key: 0 })) : (s(), x("span", {
|
|
24
24
|
key: 1,
|
|
25
|
-
innerHTML:
|
|
26
|
-
}, null, 8,
|
|
25
|
+
innerHTML: d.value
|
|
26
|
+
}, null, 8, wt));
|
|
27
27
|
}
|
|
28
|
-
}),
|
|
28
|
+
}), kt = {
|
|
29
29
|
viewBox: "0 0 24 24",
|
|
30
30
|
width: "1.2em",
|
|
31
31
|
height: "1.2em"
|
|
32
32
|
};
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
-
|
|
33
|
+
function Ct(e, l) {
|
|
34
|
+
return s(), x("svg", kt, [...l[0] || (l[0] = [
|
|
35
|
+
_("path", {
|
|
36
36
|
fill: "none",
|
|
37
37
|
stroke: "currentColor",
|
|
38
38
|
"stroke-linecap": "round",
|
|
@@ -42,14 +42,14 @@ function xt(e, t) {
|
|
|
42
42
|
}, null, -1)
|
|
43
43
|
])]);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const Tt = Q({ name: "tabler-filter", render: Ct }), _t = {
|
|
46
46
|
viewBox: "0 0 24 24",
|
|
47
47
|
width: "1.2em",
|
|
48
48
|
height: "1.2em"
|
|
49
49
|
};
|
|
50
|
-
function
|
|
51
|
-
return
|
|
52
|
-
|
|
50
|
+
function Pt(e, l) {
|
|
51
|
+
return s(), x("svg", _t, [...l[0] || (l[0] = [
|
|
52
|
+
_("path", {
|
|
53
53
|
fill: "none",
|
|
54
54
|
stroke: "currentColor",
|
|
55
55
|
"stroke-linecap": "round",
|
|
@@ -59,14 +59,15 @@ function St(e, t) {
|
|
|
59
59
|
}, null, -1)
|
|
60
60
|
])]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const Et = Q({ name: "tabler-filter-check", render: Pt }), $t = { "element-loading-text": "加载中..." }, Rt = { class: "flex justify-center" }, Vt = { class: "-mx-3 flex w-[150px] items-center justify-evenly" }, Bt = {
|
|
63
63
|
key: 0,
|
|
64
64
|
class: "h-[23px]"
|
|
65
|
-
},
|
|
65
|
+
}, Ft = ["onDblclick"], Ht = { key: 1 }, zt = /* @__PURE__ */ de({
|
|
66
66
|
__name: "index",
|
|
67
|
-
props: /* @__PURE__ */
|
|
67
|
+
props: /* @__PURE__ */ Ce({
|
|
68
68
|
data: {},
|
|
69
69
|
columns: {},
|
|
70
|
+
defaultSort: {},
|
|
70
71
|
rowKey: { default: "id" },
|
|
71
72
|
selectable: { type: [Boolean, Function] },
|
|
72
73
|
showIndex: { type: Boolean, default: !0 },
|
|
@@ -75,162 +76,164 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
|
|
|
75
76
|
loading: { type: Boolean, default: !1 }
|
|
76
77
|
}, {
|
|
77
78
|
filterData: {
|
|
78
|
-
default: () =>
|
|
79
|
+
default: () => xe({})
|
|
79
80
|
},
|
|
80
81
|
filterDataModifiers: {}
|
|
81
82
|
}),
|
|
82
|
-
emits: /* @__PURE__ */
|
|
83
|
-
setup(e, { expose:
|
|
84
|
-
const r =
|
|
85
|
-
function
|
|
86
|
-
|
|
83
|
+
emits: /* @__PURE__ */ Ce(["applyFilter", "selectionChange", "cell-edit", "sortChange"], ["update:filterData"]),
|
|
84
|
+
setup(e, { expose: l, emit: d }) {
|
|
85
|
+
const r = at.directive, i = e, g = We(e, "filterData"), b = d, $ = $e("elTableRef"), w = V({}), H = V({});
|
|
86
|
+
function O(a) {
|
|
87
|
+
w.value[a] = Y(g.value[a]);
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
-
|
|
89
|
+
function X(a) {
|
|
90
|
+
w.value[a] = Y(g.value[a]);
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
92
|
+
function ee(a, f, t) {
|
|
93
|
+
w.value[a] = void 0, g.value[a] = void 0, D(a, f, t);
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
col:
|
|
95
|
+
function D(a, f, t) {
|
|
96
|
+
g.value[a] = w.value[a], H.value[a] = !1, b("applyFilter", {
|
|
97
|
+
col: t,
|
|
97
98
|
prop: a,
|
|
98
|
-
type:
|
|
99
|
-
value:
|
|
100
|
-
filterData:
|
|
99
|
+
type: f,
|
|
100
|
+
value: g.value[a],
|
|
101
|
+
filterData: g.value
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
const
|
|
107
|
-
return { ...
|
|
108
|
-
}).filter((
|
|
104
|
+
function P(a, f) {
|
|
105
|
+
const t = I(a.actions) ? a.actions(f) : a.actions;
|
|
106
|
+
return t == null ? void 0 : t.map((h) => {
|
|
107
|
+
const v = I(h.visibility) ? h.visibility(f) : h.visibility ?? !0;
|
|
108
|
+
return { ...h, visibility: v };
|
|
109
|
+
}).filter((h) => h.visibility !== !1);
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function S(a) {
|
|
111
112
|
return a.filterFieldName ?? a.prop;
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
+
function te(a, f) {
|
|
114
115
|
return {
|
|
115
116
|
color: a.text.includes("删除") ? "var(--el-color-danger)" : "",
|
|
116
|
-
visibility: _e(
|
|
117
|
+
visibility: _e(f) ? void 0 : f
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
|
-
const
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
{ length:
|
|
123
|
-
() => Array.from({ length:
|
|
120
|
+
const E = V([]);
|
|
121
|
+
function Z() {
|
|
122
|
+
E.value = Array.from(
|
|
123
|
+
{ length: i.data.length },
|
|
124
|
+
() => Array.from({ length: i.columns.length }, () => ({
|
|
124
125
|
editing: !1,
|
|
125
126
|
inputRef: void 0,
|
|
126
127
|
value: void 0
|
|
127
128
|
}))
|
|
128
129
|
);
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
131
|
+
function G(a, f) {
|
|
132
|
+
return I(a.editable) ? a.editable(f) : a.editable ?? !1;
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
var
|
|
137
|
-
(
|
|
134
|
+
function le(a, f, t) {
|
|
135
|
+
const h = E.value[a][f];
|
|
136
|
+
h && (h.value = t, h.editing = !0, ue(() => {
|
|
137
|
+
var v;
|
|
138
|
+
(v = h.inputRef) == null || v.focus();
|
|
138
139
|
}));
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
|
|
141
|
+
function U(a) {
|
|
142
|
+
const f = E.value[a.rowIndex][a.colIndex];
|
|
143
|
+
if (!f) return;
|
|
144
|
+
f.editing = !1;
|
|
145
|
+
const t = a.newValue, h = a.row[a.prop];
|
|
146
|
+
t !== h && (a.row[a.prop] = t, b("cell-edit", a));
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
-
const
|
|
149
|
-
|
|
148
|
+
function A(a, f) {
|
|
149
|
+
const t = E.value[a][f];
|
|
150
|
+
t && (t.editing = !1);
|
|
150
151
|
}
|
|
151
|
-
return
|
|
152
|
-
tableInstance:
|
|
153
|
-
resetCells:
|
|
154
|
-
}), (a,
|
|
155
|
-
|
|
152
|
+
return l({
|
|
153
|
+
tableInstance: $,
|
|
154
|
+
resetCells: Z
|
|
155
|
+
}), (a, f) => ie((s(), x("section", $t, [
|
|
156
|
+
C(n(nt), {
|
|
156
157
|
ref: "elTableRef",
|
|
157
158
|
data: e.data,
|
|
159
|
+
"default-sort": e.defaultSort,
|
|
158
160
|
border: "",
|
|
159
161
|
class: "pro-table",
|
|
160
162
|
height: "100%",
|
|
161
163
|
"row-key": e.rowKey,
|
|
162
|
-
onSelectionChange:
|
|
164
|
+
onSelectionChange: f[1] || (f[1] = (t) => b("selectionChange", t)),
|
|
165
|
+
onSortChange: f[2] || (f[2] = (t) => b("sortChange", { prop: t.prop ?? "", order: t.order }))
|
|
163
166
|
}, {
|
|
164
167
|
default: y(() => [
|
|
165
|
-
e.selectable ? (
|
|
168
|
+
e.selectable ? (s(), k(n(ve), {
|
|
166
169
|
key: 0,
|
|
167
170
|
type: "selection",
|
|
168
171
|
width: "55",
|
|
169
|
-
selectable: n(
|
|
170
|
-
}, null, 8, ["selectable"])) :
|
|
171
|
-
e.showIndex ? (
|
|
172
|
+
selectable: n(I)(e.selectable) ? e.selectable : void 0
|
|
173
|
+
}, null, 8, ["selectable"])) : F("", !0),
|
|
174
|
+
e.showIndex ? (s(), k(n(ve), {
|
|
172
175
|
key: 1,
|
|
173
176
|
class: "index-cell",
|
|
174
177
|
align: "center",
|
|
175
178
|
width: e.indexWidth,
|
|
176
179
|
label: "序号"
|
|
177
180
|
}, {
|
|
178
|
-
default: y(({ $index:
|
|
179
|
-
|
|
181
|
+
default: y(({ $index: t }) => [
|
|
182
|
+
R(L(t + 1 + (e.indexOffset || 0)), 1)
|
|
180
183
|
]),
|
|
181
184
|
_: 1
|
|
182
|
-
}, 8, ["width"])) :
|
|
183
|
-
(
|
|
184
|
-
align:
|
|
185
|
-
fixed:
|
|
186
|
-
}),
|
|
187
|
-
|
|
185
|
+
}, 8, ["width"])) : F("", !0),
|
|
186
|
+
(s(!0), x(q, null, oe(e.columns, (t, h) => (s(), k(n(ve), ge({ key: h }, { ref_for: !0 }, t, {
|
|
187
|
+
align: t.align ?? "center",
|
|
188
|
+
fixed: t.label === "操作" ? "right" : !1
|
|
189
|
+
}), Ye({ _: 2 }, [
|
|
190
|
+
t.filterable ?? (t.filterType || t.filterOptions || Re(t.filterOptions)) ? {
|
|
188
191
|
name: "header",
|
|
189
|
-
fn: y(({ column:
|
|
190
|
-
|
|
191
|
-
class:
|
|
192
|
-
"text-[--el-color-primary]":
|
|
192
|
+
fn: y(({ column: v }) => [
|
|
193
|
+
_("span", {
|
|
194
|
+
class: Qe(["inline-flex items-center", {
|
|
195
|
+
"text-[--el-color-primary]": S(t) && g.value[S(t)] !== void 0
|
|
193
196
|
}])
|
|
194
197
|
}, [
|
|
195
|
-
|
|
198
|
+
S(t) ? (s(), k(n(rt), {
|
|
196
199
|
key: 0,
|
|
197
|
-
visible:
|
|
198
|
-
"onUpdate:visible": (
|
|
200
|
+
visible: H.value[S(t)],
|
|
201
|
+
"onUpdate:visible": (c) => H.value[S(t)] = c,
|
|
199
202
|
placement: "bottom",
|
|
200
203
|
trigger: "click",
|
|
201
204
|
"hide-after": 0,
|
|
202
205
|
"show-after": 0,
|
|
203
|
-
width:
|
|
206
|
+
width: t.filterPopoverWidth ?? (t.filterType === "datetimerange" ? 424 : void 0),
|
|
204
207
|
"popper-class": "reset",
|
|
205
|
-
onShow: (
|
|
206
|
-
onHide: (
|
|
208
|
+
onShow: (c) => O(S(t)),
|
|
209
|
+
onHide: (c) => X(S(t))
|
|
207
210
|
}, {
|
|
208
211
|
reference: y(() => [
|
|
209
|
-
|
|
212
|
+
_("div", {
|
|
210
213
|
class: "inline-flex cursor-pointer items-center gap-x-0.5 duration-100 hover:text-[--el-color-primary]",
|
|
211
|
-
onClick:
|
|
214
|
+
onClick: f[0] || (f[0] = pe(() => {
|
|
212
215
|
}, ["stop"]))
|
|
213
216
|
}, [
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
R(L(v.label) + " ", 1),
|
|
218
|
+
g.value[S(t)] !== void 0 ? (s(), k(n(Et), { key: 0 })) : (s(), k(n(Tt), { key: 1 }))
|
|
216
219
|
])
|
|
217
220
|
]),
|
|
218
221
|
default: y(() => [
|
|
219
|
-
!
|
|
222
|
+
!t.filterType || t.filterType === "radio" ? (s(), k(n(Te), {
|
|
220
223
|
key: 0,
|
|
221
224
|
always: "",
|
|
222
225
|
"max-height": "34vh"
|
|
223
226
|
}, {
|
|
224
227
|
default: y(() => [
|
|
225
|
-
|
|
226
|
-
modelValue:
|
|
227
|
-
"onUpdate:modelValue": (
|
|
228
|
+
C(n(st), {
|
|
229
|
+
modelValue: w.value[S(t)],
|
|
230
|
+
"onUpdate:modelValue": (c) => w.value[S(t)] = c
|
|
228
231
|
}, {
|
|
229
232
|
default: y(() => [
|
|
230
|
-
(
|
|
231
|
-
key:
|
|
232
|
-
value:
|
|
233
|
-
label:
|
|
233
|
+
(s(!0), x(q, null, oe(Se(t.filterOptions), (c) => (s(), k(n(it), {
|
|
234
|
+
key: c.value.toString(),
|
|
235
|
+
value: c.value,
|
|
236
|
+
label: c.label,
|
|
234
237
|
class: "!m-0 w-full"
|
|
235
238
|
}, null, 8, ["value", "label"]))), 128))
|
|
236
239
|
]),
|
|
@@ -238,21 +241,21 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
|
|
|
238
241
|
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
239
242
|
]),
|
|
240
243
|
_: 2
|
|
241
|
-
}, 1024)) :
|
|
244
|
+
}, 1024)) : t.filterType === "checkbox" ? (s(), k(n(Te), {
|
|
242
245
|
key: 1,
|
|
243
246
|
always: "",
|
|
244
247
|
"max-height": "34vh"
|
|
245
248
|
}, {
|
|
246
249
|
default: y(() => [
|
|
247
|
-
|
|
248
|
-
modelValue:
|
|
249
|
-
"onUpdate:modelValue": (
|
|
250
|
+
C(n(ot), {
|
|
251
|
+
modelValue: w.value[S(t)],
|
|
252
|
+
"onUpdate:modelValue": (c) => w.value[S(t)] = c
|
|
250
253
|
}, {
|
|
251
254
|
default: y(() => [
|
|
252
|
-
(
|
|
253
|
-
key:
|
|
254
|
-
value:
|
|
255
|
-
label:
|
|
255
|
+
(s(!0), x(q, null, oe(Se(t.filterOptions), (c) => (s(), k(n(ut), {
|
|
256
|
+
key: c.value.toString(),
|
|
257
|
+
value: c.value,
|
|
258
|
+
label: c.label,
|
|
256
259
|
class: "!m-0 w-full"
|
|
257
260
|
}, null, 8, ["value", "label"]))), 128))
|
|
258
261
|
]),
|
|
@@ -260,47 +263,47 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
|
|
|
260
263
|
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
261
264
|
]),
|
|
262
265
|
_: 2
|
|
263
|
-
}, 1024)) :
|
|
266
|
+
}, 1024)) : t.filterType === "datetimerange" ? (s(), k(n(dt), {
|
|
264
267
|
key: 2,
|
|
265
|
-
modelValue:
|
|
266
|
-
"onUpdate:modelValue": (
|
|
268
|
+
modelValue: w.value[S(t)],
|
|
269
|
+
"onUpdate:modelValue": (c) => w.value[S(t)] = c,
|
|
267
270
|
type: "datetimerange",
|
|
268
271
|
"start-placeholder": "开始时间",
|
|
269
272
|
"end-placeholder": "结束时间",
|
|
270
273
|
"range-separator": "至",
|
|
271
274
|
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
272
275
|
teleported: !1
|
|
273
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue"])) :
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : F("", !0),
|
|
277
|
+
f[5] || (f[5] = _("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
|
|
278
|
+
_("div", Rt, [
|
|
279
|
+
_("div", Vt, [
|
|
280
|
+
C(n(M), {
|
|
278
281
|
type: "primary",
|
|
279
282
|
plain: "",
|
|
280
283
|
size: "small",
|
|
281
|
-
onClick: (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
onClick: (c) => ee(
|
|
285
|
+
S(t),
|
|
286
|
+
t.filterType || "radio",
|
|
287
|
+
t
|
|
285
288
|
)
|
|
286
289
|
}, {
|
|
287
|
-
default: y(() => [...
|
|
288
|
-
|
|
290
|
+
default: y(() => [...f[3] || (f[3] = [
|
|
291
|
+
R("重置", -1)
|
|
289
292
|
])]),
|
|
290
293
|
_: 1
|
|
291
294
|
}, 8, ["onClick"]),
|
|
292
|
-
|
|
295
|
+
C(n(M), {
|
|
293
296
|
type: "primary",
|
|
294
297
|
size: "small",
|
|
295
298
|
class: "!m-0",
|
|
296
|
-
onClick: (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
onClick: (c) => D(
|
|
300
|
+
S(t),
|
|
301
|
+
t.filterType || "radio",
|
|
302
|
+
t
|
|
300
303
|
)
|
|
301
304
|
}, {
|
|
302
|
-
default: y(() => [...
|
|
303
|
-
|
|
305
|
+
default: y(() => [...f[4] || (f[4] = [
|
|
306
|
+
R("确定", -1)
|
|
304
307
|
])]),
|
|
305
308
|
_: 1
|
|
306
309
|
}, 8, ["onClick"])
|
|
@@ -308,112 +311,112 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
|
|
|
308
311
|
])
|
|
309
312
|
]),
|
|
310
313
|
_: 2
|
|
311
|
-
}, 1032, ["visible", "onUpdate:visible", "width", "onShow", "onHide"])) :
|
|
314
|
+
}, 1032, ["visible", "onUpdate:visible", "width", "onShow", "onHide"])) : F("", !0)
|
|
312
315
|
], 2)
|
|
313
316
|
]),
|
|
314
317
|
key: "0"
|
|
315
318
|
} : void 0,
|
|
316
|
-
|
|
319
|
+
t.formatter ? {
|
|
317
320
|
name: "default",
|
|
318
|
-
fn: y(({ row:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
col:
|
|
322
|
-
row:
|
|
323
|
-
column:
|
|
324
|
-
index:
|
|
321
|
+
fn: y(({ row: v, column: c, $index: N }) => [
|
|
322
|
+
ie((s(), x("div", null, [
|
|
323
|
+
C(St, {
|
|
324
|
+
col: t,
|
|
325
|
+
row: v,
|
|
326
|
+
column: c,
|
|
327
|
+
index: N
|
|
325
328
|
}, null, 8, ["col", "row", "column", "index"])
|
|
326
329
|
])), [
|
|
327
|
-
[n(
|
|
330
|
+
[n(me), t.truncate ?? !0]
|
|
328
331
|
])
|
|
329
332
|
]),
|
|
330
333
|
key: "1"
|
|
331
334
|
} : {
|
|
332
335
|
name: "default",
|
|
333
|
-
fn: y(({ row:
|
|
334
|
-
var
|
|
336
|
+
fn: y(({ row: v, $index: c }) => {
|
|
337
|
+
var N, ae;
|
|
335
338
|
return [
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
(
|
|
339
|
+
t.prop ? (s(), x("div", Bt, [
|
|
340
|
+
G(t, v) ? (s(), x(q, { key: 0 }, [
|
|
341
|
+
(ae = (N = E.value[c]) == null ? void 0 : N[h]) != null && ae.editing ? (s(), k(n(Be), {
|
|
339
342
|
key: 0,
|
|
340
343
|
ref_for: !0,
|
|
341
|
-
ref: (
|
|
342
|
-
modelValue:
|
|
343
|
-
"onUpdate:modelValue": (
|
|
344
|
+
ref: (o) => E.value[c][h].inputRef = o,
|
|
345
|
+
modelValue: E.value[c][h].value,
|
|
346
|
+
"onUpdate:modelValue": (o) => E.value[c][h].value = o,
|
|
344
347
|
style: { "--el-input-height": "23px" },
|
|
345
348
|
clearable: "",
|
|
346
349
|
size: "small",
|
|
347
350
|
"input-style": "--el-input-inner-height: 20px",
|
|
348
|
-
onBlur: (
|
|
349
|
-
rowIndex:
|
|
350
|
-
colIndex:
|
|
351
|
-
row:
|
|
352
|
-
prop:
|
|
353
|
-
oldValue:
|
|
354
|
-
newValue:
|
|
351
|
+
onBlur: (o) => U({
|
|
352
|
+
rowIndex: c,
|
|
353
|
+
colIndex: h,
|
|
354
|
+
row: v,
|
|
355
|
+
prop: t.prop,
|
|
356
|
+
oldValue: v[t.prop],
|
|
357
|
+
newValue: E.value[c][h].value
|
|
355
358
|
}),
|
|
356
359
|
onKeydown: [
|
|
357
|
-
|
|
358
|
-
rowIndex:
|
|
359
|
-
colIndex:
|
|
360
|
-
row:
|
|
361
|
-
prop:
|
|
362
|
-
oldValue:
|
|
363
|
-
newValue:
|
|
360
|
+
ye(pe((o) => U({
|
|
361
|
+
rowIndex: c,
|
|
362
|
+
colIndex: h,
|
|
363
|
+
row: v,
|
|
364
|
+
prop: t.prop,
|
|
365
|
+
oldValue: v[t.prop],
|
|
366
|
+
newValue: E.value[c][h].value
|
|
364
367
|
}), ["stop", "prevent"]), ["enter"]),
|
|
365
|
-
|
|
368
|
+
ye(pe((o) => A(c, h), ["stop", "prevent"]), ["esc"])
|
|
366
369
|
]
|
|
367
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) :
|
|
370
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) : ie((s(), x("div", {
|
|
368
371
|
key: 1,
|
|
369
372
|
class: "h-[23px] cursor-pointer",
|
|
370
|
-
onDblclick: (
|
|
373
|
+
onDblclick: (o) => le(c, h, v[t.prop])
|
|
371
374
|
}, [
|
|
372
|
-
|
|
373
|
-
], 40,
|
|
374
|
-
[n(
|
|
375
|
+
R(L(v[t.prop]), 1)
|
|
376
|
+
], 40, Ft)), [
|
|
377
|
+
[n(me), t.truncate ?? !0]
|
|
375
378
|
])
|
|
376
|
-
], 64)) :
|
|
377
|
-
|
|
379
|
+
], 64)) : ie((s(), x("div", Ht, [
|
|
380
|
+
R(L(v[t.prop]), 1)
|
|
378
381
|
])), [
|
|
379
|
-
[n(
|
|
382
|
+
[n(me), t.truncate ?? !0]
|
|
380
383
|
])
|
|
381
|
-
])) :
|
|
382
|
-
(
|
|
383
|
-
key:
|
|
384
|
+
])) : F("", !0),
|
|
385
|
+
(s(!0), x(q, null, oe(P(t, v), (o) => (s(), x(q, {
|
|
386
|
+
key: o.text
|
|
384
387
|
}, [
|
|
385
|
-
|
|
388
|
+
o.text === "删除" || o.confirmText ? (s(), k(n(ct), {
|
|
386
389
|
key: 0,
|
|
387
390
|
placement: "top",
|
|
388
391
|
"hide-after": 0,
|
|
389
392
|
"popper-style": "width: unset; min-width: 150px;",
|
|
390
|
-
title: n(_e)(
|
|
391
|
-
onConfirm: (
|
|
393
|
+
title: n(_e)(o.confirmText) ? `是否确认${o.text}?` : n(I)(o.confirmText) ? o.confirmText(v) : o.confirmText ?? `是否确认${o.text}?`,
|
|
394
|
+
onConfirm: (B) => o.visibility === "hidden" ? void 0 : o.handler(v)
|
|
392
395
|
}, {
|
|
393
396
|
reference: y(() => [
|
|
394
|
-
|
|
397
|
+
C(n(M), {
|
|
395
398
|
link: "",
|
|
396
|
-
type:
|
|
397
|
-
style:
|
|
398
|
-
disabled: n(
|
|
399
|
+
type: o.type ?? "primary",
|
|
400
|
+
style: ke(te(o, o.visibility)),
|
|
401
|
+
disabled: n(I)(o.disabled) ? o.disabled(v) : o.disabled
|
|
399
402
|
}, {
|
|
400
403
|
default: y(() => [
|
|
401
|
-
|
|
404
|
+
R(L(o.text), 1)
|
|
402
405
|
]),
|
|
403
406
|
_: 2
|
|
404
407
|
}, 1032, ["type", "style", "disabled"])
|
|
405
408
|
]),
|
|
406
409
|
_: 2
|
|
407
|
-
}, 1032, ["title", "onConfirm"])) : (
|
|
410
|
+
}, 1032, ["title", "onConfirm"])) : (s(), k(n(M), {
|
|
408
411
|
key: 1,
|
|
409
412
|
link: "",
|
|
410
|
-
type:
|
|
411
|
-
style:
|
|
412
|
-
disabled: n(
|
|
413
|
-
onClick: (
|
|
413
|
+
type: o.type ?? "primary",
|
|
414
|
+
style: ke(te(o, o.visibility)),
|
|
415
|
+
disabled: n(I)(o.disabled) ? o.disabled(v) : o.disabled,
|
|
416
|
+
onClick: (B) => o.visibility === "hidden" ? void 0 : o.handler(v)
|
|
414
417
|
}, {
|
|
415
418
|
default: y(() => [
|
|
416
|
-
|
|
419
|
+
R(L(o.text), 1)
|
|
417
420
|
]),
|
|
418
421
|
_: 2
|
|
419
422
|
}, 1032, ["type", "style", "disabled", "onClick"]))
|
|
@@ -425,30 +428,30 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
|
|
|
425
428
|
]), 1040, ["align", "fixed"]))), 128))
|
|
426
429
|
]),
|
|
427
430
|
_: 1
|
|
428
|
-
}, 8, ["data", "row-key"])
|
|
431
|
+
}, 8, ["data", "default-sort", "row-key"])
|
|
429
432
|
])), [
|
|
430
433
|
[n(r), e.loading]
|
|
431
434
|
]);
|
|
432
435
|
}
|
|
433
|
-
}),
|
|
434
|
-
const
|
|
435
|
-
for (const [r,
|
|
436
|
-
|
|
437
|
-
return
|
|
438
|
-
},
|
|
439
|
-
function
|
|
440
|
-
var
|
|
441
|
-
if (
|
|
436
|
+
}), ze = (e, l) => {
|
|
437
|
+
const d = e.__vccOpts || e;
|
|
438
|
+
for (const [r, i] of l)
|
|
439
|
+
d[r] = i;
|
|
440
|
+
return d;
|
|
441
|
+
}, Dt = /* @__PURE__ */ ze(zt, [["__scopeId", "data-v-455222f2"]]);
|
|
442
|
+
function At(e) {
|
|
443
|
+
var l, d, r, i, g, b, $;
|
|
444
|
+
if (mt(e))
|
|
442
445
|
return e.includes("database") || e.includes("java.sql.") ? "接口异常" : e;
|
|
443
|
-
if (
|
|
444
|
-
if (e.code === "ECONNABORTED" || (
|
|
446
|
+
if (He(e)) return "请求已取消";
|
|
447
|
+
if (e.code === "ECONNABORTED" || (l = e.message) != null && l.includes("timeout"))
|
|
445
448
|
return "请求超时,请稍后重试";
|
|
446
449
|
if (!window.navigator.onLine || e.message === "Network Error")
|
|
447
450
|
return "网络连接断开,请检查网络设置";
|
|
448
451
|
if (e.response) {
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
451
|
-
switch (
|
|
452
|
+
const w = e.response.status, H = e.response.data;
|
|
453
|
+
if (H && H.message) return H.message;
|
|
454
|
+
switch (w) {
|
|
452
455
|
case 400:
|
|
453
456
|
return "请求参数错误 (400)";
|
|
454
457
|
case 401:
|
|
@@ -464,23 +467,23 @@ function Ht(e) {
|
|
|
464
467
|
case 503:
|
|
465
468
|
return "服务不可用 (503)";
|
|
466
469
|
default:
|
|
467
|
-
return `网络异常 (${
|
|
470
|
+
return `网络异常 (${w})`;
|
|
468
471
|
}
|
|
469
472
|
}
|
|
470
|
-
return e instanceof SyntaxError ? "数据解析异常" : e instanceof TypeError ? "程序运行异常" : e instanceof Object && ((
|
|
473
|
+
return e instanceof SyntaxError ? "数据解析异常" : e instanceof TypeError ? "程序运行异常" : e instanceof Object && ((i = (r = e[(d = be(e)) == null ? void 0 : d[0]]) == null ? void 0 : r[0]) != null && i.message) ? ($ = (b = e[(g = be(e)) == null ? void 0 : g[0]]) == null ? void 0 : b[0]) == null ? void 0 : $.message : e.message || "未知错误";
|
|
471
474
|
}
|
|
472
|
-
class
|
|
475
|
+
class Lt {
|
|
473
476
|
/**
|
|
474
477
|
* 实例化 SelectionStore
|
|
475
478
|
*
|
|
476
479
|
* @param rowKey 作为 id 的字段名,默认为 `'id'`
|
|
477
480
|
*/
|
|
478
|
-
constructor(
|
|
481
|
+
constructor(l = "id") {
|
|
479
482
|
/** 存储选中的行 */
|
|
480
|
-
|
|
483
|
+
he(this, "map", /* @__PURE__ */ new Map());
|
|
481
484
|
/** 行数据的 Key */
|
|
482
|
-
|
|
483
|
-
this.rowKey =
|
|
485
|
+
he(this, "rowKey");
|
|
486
|
+
this.rowKey = l;
|
|
484
487
|
}
|
|
485
488
|
/** 获取所有选中行 */
|
|
486
489
|
get values() {
|
|
@@ -491,24 +494,24 @@ class zt {
|
|
|
491
494
|
return [...this.map.keys()];
|
|
492
495
|
}
|
|
493
496
|
/** 是否选中 */
|
|
494
|
-
has(
|
|
495
|
-
return this.map.has(
|
|
497
|
+
has(l) {
|
|
498
|
+
return this.map.has(l);
|
|
496
499
|
}
|
|
497
500
|
/** 选中一行 */
|
|
498
|
-
select(
|
|
499
|
-
this.map.set(
|
|
501
|
+
select(l) {
|
|
502
|
+
this.map.set(l[this.rowKey], l);
|
|
500
503
|
}
|
|
501
504
|
/** 取消选中 */
|
|
502
|
-
unselect(
|
|
503
|
-
this.map.delete(
|
|
505
|
+
unselect(l) {
|
|
506
|
+
this.map.delete(l);
|
|
504
507
|
}
|
|
505
508
|
/** 批量选中 */
|
|
506
|
-
selectMany(
|
|
507
|
-
|
|
509
|
+
selectMany(l) {
|
|
510
|
+
l.forEach((d) => this.select(d));
|
|
508
511
|
}
|
|
509
512
|
/** 批量取消 */
|
|
510
|
-
unselectMany(
|
|
511
|
-
|
|
513
|
+
unselectMany(l) {
|
|
514
|
+
l.forEach((d) => this.unselect(d));
|
|
512
515
|
}
|
|
513
516
|
/** 清空 */
|
|
514
517
|
clear() {
|
|
@@ -519,167 +522,168 @@ class zt {
|
|
|
519
522
|
* @param pageRows 当前页数据
|
|
520
523
|
* @param selected 当前页勾选行
|
|
521
524
|
*/
|
|
522
|
-
syncPage(
|
|
523
|
-
const r = new Set(
|
|
524
|
-
|
|
525
|
-
r.has(
|
|
526
|
-
}),
|
|
525
|
+
syncPage(l, d) {
|
|
526
|
+
const r = new Set(d.map((i) => i[this.rowKey]));
|
|
527
|
+
l.forEach((i) => {
|
|
528
|
+
r.has(i[this.rowKey]) || this.map.delete(i[this.rowKey]);
|
|
529
|
+
}), d.forEach((i) => this.map.set(i[this.rowKey], i));
|
|
527
530
|
}
|
|
528
531
|
/**
|
|
529
532
|
* 同步表格 UI 勾选状态
|
|
530
533
|
* @param pageRows 当前页数据
|
|
531
534
|
* @param toggleFn el-table toggleRowSelection
|
|
532
535
|
*/
|
|
533
|
-
restorePageSelection(
|
|
534
|
-
|
|
536
|
+
restorePageSelection(l, d) {
|
|
537
|
+
l.forEach((r) => {
|
|
535
538
|
Object.hasOwn(r, this.rowKey) || console.error(
|
|
536
539
|
"[SelectionStore]",
|
|
537
540
|
`表格数据缺少配置的 rowKey 属性:'${this.rowKey}'`
|
|
538
|
-
), this.map.has(r[this.rowKey]) &&
|
|
541
|
+
), this.map.has(r[this.rowKey]) && d(r, !0);
|
|
539
542
|
});
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
|
-
function
|
|
543
|
-
let r,
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
let
|
|
547
|
-
const
|
|
548
|
-
|
|
545
|
+
function Mt(e, l, d) {
|
|
546
|
+
let r, i;
|
|
547
|
+
Re(e) ? (r = e, i = l) : (r = Ze(e, l), i = 300);
|
|
548
|
+
const g = V(r.value);
|
|
549
|
+
let b = null;
|
|
550
|
+
const $ = () => {
|
|
551
|
+
b !== null && (clearTimeout(b), b = null);
|
|
549
552
|
};
|
|
550
|
-
return
|
|
553
|
+
return Ve(
|
|
551
554
|
r,
|
|
552
|
-
(
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
},
|
|
555
|
+
(w) => {
|
|
556
|
+
w ? ($(), b = setTimeout(() => {
|
|
557
|
+
g.value = !0;
|
|
558
|
+
}, i)) : ($(), g.value = !1);
|
|
556
559
|
},
|
|
557
560
|
{ immediate: !1 }
|
|
558
|
-
),
|
|
561
|
+
), g;
|
|
559
562
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
563
|
+
function Kt({
|
|
564
|
+
defaultSort: e,
|
|
565
|
+
fetchFn: l,
|
|
566
|
+
onReset: d
|
|
567
|
+
}) {
|
|
568
|
+
const r = e ? Y(e) : {
|
|
569
|
+
order: "",
|
|
570
|
+
sort: ""
|
|
571
|
+
}, i = xe(Y(r));
|
|
572
|
+
let g = Y(i);
|
|
573
|
+
function b({
|
|
574
|
+
prop: $,
|
|
575
|
+
order: w
|
|
572
576
|
}) {
|
|
573
|
-
|
|
577
|
+
w ? (i.sort = $ || "", i.order = w === "ascending" ? "asc" : "desc", l()) : (i.sort = r.sort, i.order = r.order, gt(i, g) && (i.order = i.order === "asc" ? "desc" : "asc"), d ? d() : l()), g = Y(i);
|
|
574
578
|
}
|
|
575
579
|
return {
|
|
576
|
-
sortState:
|
|
577
|
-
onSortChange:
|
|
580
|
+
sortState: i,
|
|
581
|
+
onSortChange: b
|
|
578
582
|
};
|
|
579
583
|
}
|
|
580
|
-
const
|
|
584
|
+
const De = {
|
|
581
585
|
background: !0,
|
|
582
586
|
layout: "total, sizes, prev, pager, next, jumper"
|
|
583
|
-
},
|
|
587
|
+
}, Ae = {
|
|
584
588
|
buttonText: "搜索"
|
|
585
|
-
},
|
|
589
|
+
}, K = {
|
|
586
590
|
rowHeight: 40,
|
|
587
591
|
headerHeight: 40,
|
|
588
|
-
paginationProps:
|
|
589
|
-
searchProps:
|
|
592
|
+
paginationProps: De,
|
|
593
|
+
searchProps: Ae
|
|
590
594
|
};
|
|
591
|
-
function
|
|
592
|
-
if (e == null) return
|
|
593
|
-
const
|
|
594
|
-
if (!Number.isFinite(
|
|
595
|
-
const r = Math.round(
|
|
596
|
-
return r > 0 ? r :
|
|
595
|
+
function Pe(e, l) {
|
|
596
|
+
if (e == null) return l;
|
|
597
|
+
const d = typeof e == "number" ? e : Number.parseFloat(e);
|
|
598
|
+
if (!Number.isFinite(d)) return l;
|
|
599
|
+
const r = Math.round(d);
|
|
600
|
+
return r > 0 ? r : l;
|
|
597
601
|
}
|
|
598
|
-
function
|
|
599
|
-
return typeof e == "string" && e.trim() ? e :
|
|
602
|
+
function Ot(e, l) {
|
|
603
|
+
return typeof e == "string" && e.trim() ? e : l;
|
|
600
604
|
}
|
|
601
|
-
function
|
|
602
|
-
return
|
|
605
|
+
function Le(...e) {
|
|
606
|
+
return Fe(Object.assign({}, ...e), (l) => l !== void 0);
|
|
603
607
|
}
|
|
604
|
-
function
|
|
608
|
+
function Ut(e) {
|
|
605
609
|
return {
|
|
606
|
-
buttonText: (e == null ? void 0 : e.buttonText) ??
|
|
610
|
+
buttonText: (e == null ? void 0 : e.buttonText) ?? Ae.buttonText
|
|
607
611
|
};
|
|
608
612
|
}
|
|
609
|
-
function
|
|
610
|
-
const
|
|
611
|
-
|
|
613
|
+
function Nt(e) {
|
|
614
|
+
const l = Le(
|
|
615
|
+
K.paginationProps,
|
|
612
616
|
e == null ? void 0 : e.paginationProps
|
|
613
617
|
);
|
|
614
618
|
return {
|
|
615
|
-
rowHeight:
|
|
616
|
-
headerHeight:
|
|
619
|
+
rowHeight: Pe(e == null ? void 0 : e.rowHeight, K.rowHeight),
|
|
620
|
+
headerHeight: Pe(e == null ? void 0 : e.headerHeight, K.headerHeight),
|
|
617
621
|
paginationProps: {
|
|
618
|
-
...
|
|
619
|
-
layout:
|
|
620
|
-
|
|
621
|
-
|
|
622
|
+
...l,
|
|
623
|
+
layout: Ot(
|
|
624
|
+
l.layout,
|
|
625
|
+
De.layout
|
|
622
626
|
)
|
|
623
627
|
},
|
|
624
|
-
searchProps:
|
|
628
|
+
searchProps: Ut(e == null ? void 0 : e.searchProps)
|
|
625
629
|
};
|
|
626
630
|
}
|
|
627
|
-
const
|
|
631
|
+
const Me = Symbol("searchTableConfig"), jt = {
|
|
628
632
|
viewBox: "0 0 24 24",
|
|
629
633
|
width: "1.2em",
|
|
630
634
|
height: "1.2em"
|
|
631
635
|
};
|
|
632
|
-
function
|
|
633
|
-
return
|
|
634
|
-
|
|
636
|
+
function It(e, l) {
|
|
637
|
+
return s(), x("svg", jt, [...l[0] || (l[0] = [
|
|
638
|
+
_("path", {
|
|
635
639
|
fill: "currentColor",
|
|
636
640
|
d: "m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975z"
|
|
637
641
|
}, null, -1)
|
|
638
642
|
])]);
|
|
639
643
|
}
|
|
640
|
-
const
|
|
644
|
+
const qt = Q({ name: "ri-search-line", render: It }), Gt = {
|
|
641
645
|
viewBox: "0 0 24 24",
|
|
642
646
|
width: "1.2em",
|
|
643
647
|
height: "1.2em"
|
|
644
648
|
};
|
|
645
|
-
function
|
|
646
|
-
return
|
|
647
|
-
|
|
649
|
+
function Wt(e, l) {
|
|
650
|
+
return s(), x("svg", Gt, [...l[0] || (l[0] = [
|
|
651
|
+
_("path", {
|
|
648
652
|
fill: "currentColor",
|
|
649
653
|
d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"
|
|
650
654
|
}, null, -1)
|
|
651
655
|
])]);
|
|
652
656
|
}
|
|
653
|
-
const
|
|
657
|
+
const Yt = Q({ name: "ri-add-line", render: Wt }), Qt = {
|
|
654
658
|
viewBox: "0 0 24 24",
|
|
655
659
|
width: "1.2em",
|
|
656
660
|
height: "1.2em"
|
|
657
661
|
};
|
|
658
|
-
function
|
|
659
|
-
return
|
|
660
|
-
|
|
662
|
+
function Zt(e, l) {
|
|
663
|
+
return s(), x("svg", Qt, [...l[0] || (l[0] = [
|
|
664
|
+
_("path", {
|
|
661
665
|
fill: "currentColor",
|
|
662
666
|
d: "M17 6h5v2h-2v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8H2V6h5V3a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1zm1 2H6v12h12zm-9 3h2v6H9zm4 0h2v6h-2zM9 4v2h6V4z"
|
|
663
667
|
}, null, -1)
|
|
664
668
|
])]);
|
|
665
669
|
}
|
|
666
|
-
const
|
|
670
|
+
const Jt = Q({ name: "ri-delete-bin-line", render: Zt }), Xt = {
|
|
667
671
|
viewBox: "0 0 24 24",
|
|
668
672
|
width: "1.2em",
|
|
669
673
|
height: "1.2em"
|
|
670
674
|
};
|
|
671
|
-
function
|
|
672
|
-
return
|
|
673
|
-
|
|
675
|
+
function el(e, l) {
|
|
676
|
+
return s(), x("svg", Xt, [...l[0] || (l[0] = [
|
|
677
|
+
_("path", {
|
|
674
678
|
fill: "currentColor",
|
|
675
679
|
d: "M6.535 3h14.464a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H6.535a1 1 0 0 1-.833-.445l-5.333-8a1 1 0 0 1 0-1.11l5.333-8A1 1 0 0 1 6.535 3m.535 2l-4.667 7l4.667 7H20V5zM13 10.586l2.828-2.829l1.414 1.415L14.414 12l2.828 2.828l-1.414 1.415l-2.829-2.829l-2.828 2.829l-1.414-1.415L11.585 12L8.757 9.172l1.414-1.415z"
|
|
676
680
|
}, null, -1)
|
|
677
681
|
])]);
|
|
678
682
|
}
|
|
679
|
-
const
|
|
683
|
+
const tl = Q({ name: "ri-delete-back2-line", render: el }), ll = { class: "search-table flex h-full flex-col" }, al = {
|
|
680
684
|
key: 0,
|
|
681
685
|
class: "search-table__toolbar mb-6 flex flex-shrink-0 items-center justify-between"
|
|
682
|
-
},
|
|
686
|
+
}, nl = { class: "search-table__search flex items-center gap-x-3" }, rl = { class: "search-table__actions" }, sl = { class: "search-table__footer mt-5 flex flex-shrink-0 items-center justify-between" }, il = { class: "search-table__selection flex w-[164px] items-center" }, Ee = 10, ol = /* @__PURE__ */ de({
|
|
683
687
|
__name: "index",
|
|
684
688
|
props: {
|
|
685
689
|
columns: {},
|
|
@@ -702,205 +706,223 @@ const Jt = I({ name: "ri-delete-back2-line", render: Qt }), Xt = { class: "searc
|
|
|
702
706
|
searchParamsHandler: {}
|
|
703
707
|
},
|
|
704
708
|
emits: ["add", "batch-delete", "cell-edit"],
|
|
705
|
-
setup(e, { expose:
|
|
706
|
-
const r = e,
|
|
707
|
-
() =>
|
|
708
|
-
),
|
|
709
|
-
() => r.searchButtonText ??
|
|
710
|
-
), { sortState:
|
|
709
|
+
setup(e, { expose: l, emit: d }) {
|
|
710
|
+
const r = e, i = d, g = Je(), b = $e("proTableRef"), $ = Xe(Me, K), w = z(
|
|
711
|
+
() => Le($.paginationProps, r.elPaginationProps)
|
|
712
|
+
), H = z(
|
|
713
|
+
() => r.searchButtonText ?? $.searchProps.buttonText
|
|
714
|
+
), { sortState: O, onSortChange: X } = Kt({
|
|
711
715
|
defaultSort: r.defaultSort,
|
|
712
|
-
fetchFn:
|
|
716
|
+
fetchFn: h,
|
|
713
717
|
onReset() {
|
|
714
|
-
var
|
|
715
|
-
const
|
|
716
|
-
r.columns.some((
|
|
718
|
+
var m, T;
|
|
719
|
+
const p = O.sort, u = O.order === "asc" ? "ascending" : "descending";
|
|
720
|
+
r.columns.some((W) => W.prop === p) ? (T = (m = b.value) == null ? void 0 : m.tableInstance) == null || T.sort(p, u) : h();
|
|
717
721
|
}
|
|
718
|
-
}),
|
|
719
|
-
|
|
722
|
+
}), ee = z(() => {
|
|
723
|
+
const p = O.order === "asc" ? "ascending" : "descending";
|
|
724
|
+
return {
|
|
725
|
+
prop: O.sort,
|
|
726
|
+
order: p
|
|
727
|
+
};
|
|
728
|
+
}), D = V(r.pageSize ?? 0), P = V({
|
|
729
|
+
pageSize: D.value,
|
|
720
730
|
currPage: 1,
|
|
721
731
|
total: 0
|
|
722
|
-
}),
|
|
723
|
-
[
|
|
724
|
-
}),
|
|
725
|
-
get: () =>
|
|
726
|
-
set: (
|
|
727
|
-
|
|
732
|
+
}), S = z(() => yt(bt([D.value, 10, 20, 30, 40, 50, 100]))), te = z(() => (P.value.currPage - 1) * P.value.pageSize), E = V(0), Z = z(() => r.searchField ?? "search"), G = V({
|
|
733
|
+
[Z.value]: ""
|
|
734
|
+
}), le = z({
|
|
735
|
+
get: () => G.value[Z.value] ?? "",
|
|
736
|
+
set: (p) => {
|
|
737
|
+
G.value[Z.value] = p;
|
|
728
738
|
}
|
|
729
|
-
}),
|
|
730
|
-
let
|
|
731
|
-
async function
|
|
732
|
-
|
|
733
|
-
const
|
|
739
|
+
}), U = xe({}), A = V([]), a = V(!1), f = Mt(a, 100);
|
|
740
|
+
let t = null;
|
|
741
|
+
async function h() {
|
|
742
|
+
t == null || t.abort(), t = new AbortController(), a.value = !0;
|
|
743
|
+
const p = te.value;
|
|
734
744
|
try {
|
|
735
|
-
const
|
|
736
|
-
...
|
|
737
|
-
...
|
|
738
|
-
|
|
739
|
-
limit:
|
|
740
|
-
offset:
|
|
741
|
-
},
|
|
742
|
-
signal:
|
|
745
|
+
const u = {
|
|
746
|
+
...G.value,
|
|
747
|
+
...U,
|
|
748
|
+
...O,
|
|
749
|
+
limit: P.value.pageSize,
|
|
750
|
+
offset: p
|
|
751
|
+
}, m = r.searchParamsHandler ? r.searchParamsHandler(u) : u, { data: T = [], totalCount: W = 0 } = await r.fetchFn(m, {
|
|
752
|
+
signal: t.signal
|
|
743
753
|
});
|
|
744
|
-
A.value = T,
|
|
745
|
-
var
|
|
746
|
-
(
|
|
747
|
-
}), r.selectable &&
|
|
748
|
-
} catch (
|
|
749
|
-
if (
|
|
750
|
-
console.error("[SearchTable] 获取数据失败",
|
|
754
|
+
A.value = T, E.value = p, P.value.total = W, await ue(() => {
|
|
755
|
+
var j, re, se;
|
|
756
|
+
(re = (j = b.value) == null ? void 0 : j.tableInstance) == null || re.setScrollTop(0), (se = b.value) == null || se.resetCells();
|
|
757
|
+
}), r.selectable && Ne(T);
|
|
758
|
+
} catch (u) {
|
|
759
|
+
if (He(u)) return;
|
|
760
|
+
console.error("[SearchTable] 获取数据失败", u), vt.error("表格数据加载失败:" + At(u));
|
|
751
761
|
}
|
|
752
|
-
|
|
762
|
+
a.value = !1;
|
|
753
763
|
}
|
|
754
|
-
function
|
|
755
|
-
|
|
764
|
+
function v() {
|
|
765
|
+
P.value.currPage = 1, h();
|
|
756
766
|
}
|
|
757
|
-
function
|
|
758
|
-
if (
|
|
759
|
-
const [
|
|
760
|
-
W
|
|
767
|
+
function c({ type: p, value: u, prop: m, col: T }) {
|
|
768
|
+
if (p === "datetimerange") {
|
|
769
|
+
const [W = `${m}Start`, j = `${m}End`] = T.datetimerangeFilterFieldNames || [], [re, se] = u || [];
|
|
770
|
+
U[W] = re, U[j] = se;
|
|
761
771
|
} else
|
|
762
|
-
|
|
763
|
-
|
|
772
|
+
U[m] = u;
|
|
773
|
+
v();
|
|
764
774
|
}
|
|
765
|
-
|
|
766
|
-
|
|
775
|
+
function N(p) {
|
|
776
|
+
i("cell-edit", p);
|
|
777
|
+
}
|
|
778
|
+
const ae = async () => {
|
|
779
|
+
a.value || (we(), await h());
|
|
767
780
|
};
|
|
768
|
-
function
|
|
769
|
-
var
|
|
770
|
-
const { rowHeight:
|
|
771
|
-
|
|
781
|
+
function o() {
|
|
782
|
+
var j;
|
|
783
|
+
const { rowHeight: p, headerHeight: u } = $, m = (j = b.value) == null ? void 0 : j.$el;
|
|
784
|
+
if (!m) return 0;
|
|
785
|
+
const T = m.offsetHeight - u;
|
|
786
|
+
return Math.floor(T / p);
|
|
772
787
|
}
|
|
773
|
-
const
|
|
774
|
-
let
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
},
|
|
778
|
-
|
|
779
|
-
},
|
|
780
|
-
var
|
|
781
|
-
(
|
|
788
|
+
const B = V([]), Ke = z(() => B.value), ne = new Lt(r.rowKey);
|
|
789
|
+
let ce = !1;
|
|
790
|
+
const fe = (p) => {
|
|
791
|
+
ce || (ne.syncPage(A.value, p), B.value = ne.values);
|
|
792
|
+
}, Oe = () => B.value, Ue = (p) => {
|
|
793
|
+
fe(p);
|
|
794
|
+
}, we = () => {
|
|
795
|
+
var p, u;
|
|
796
|
+
(u = (p = b.value) == null ? void 0 : p.tableInstance) == null || u.clearSelection(), B.value = [], ne.clear();
|
|
782
797
|
};
|
|
783
|
-
r.selectable &&
|
|
784
|
-
|
|
785
|
-
var
|
|
786
|
-
(T = (
|
|
787
|
-
}), await
|
|
798
|
+
r.selectable && Ve(A, async () => {
|
|
799
|
+
ce = !0, await ue(), ne.restorePageSelection(A.value, (p, u) => {
|
|
800
|
+
var m, T;
|
|
801
|
+
(T = (m = b.value) == null ? void 0 : m.tableInstance) == null || T.toggleRowSelection(p, u);
|
|
802
|
+
}), await ue(), ce = !1;
|
|
788
803
|
});
|
|
789
|
-
function
|
|
790
|
-
const
|
|
791
|
-
|
|
804
|
+
function Ne(p) {
|
|
805
|
+
const u = p.map((T) => T[r.rowKey]), m = be(Fe(xt(u), (T) => T > 1));
|
|
806
|
+
m.length && console.error(
|
|
792
807
|
"[SearchTable] 表格数据存在重复的 rowKey,将会导致勾选功能异常!",
|
|
793
|
-
|
|
808
|
+
m
|
|
794
809
|
);
|
|
795
810
|
}
|
|
796
|
-
return
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}),
|
|
803
|
-
a == null || a.abort();
|
|
804
|
-
}), t({
|
|
811
|
+
return et(() => {
|
|
812
|
+
P.value.pageSize || (g.table ? (console.warn(
|
|
813
|
+
`[SearchTable] 使用 table 插槽替换表格时无法自动计算每页条数,将使用默认值 ${Ee},可通过 pageSize 指定`
|
|
814
|
+
), D.value = Ee) : D.value = o(), P.value.pageSize = D.value), h();
|
|
815
|
+
}), tt(() => {
|
|
816
|
+
t == null || t.abort();
|
|
817
|
+
}), l({
|
|
805
818
|
/**
|
|
806
819
|
* 刷新当前页
|
|
807
820
|
*/
|
|
808
|
-
refresh:
|
|
821
|
+
refresh: ae,
|
|
809
822
|
/**
|
|
810
823
|
* 已勾选的行
|
|
811
824
|
*/
|
|
812
|
-
selectedRows:
|
|
825
|
+
selectedRows: Ke,
|
|
813
826
|
/**
|
|
814
827
|
* 获取已勾选的行
|
|
815
828
|
*/
|
|
816
|
-
getSelectionRows:
|
|
829
|
+
getSelectionRows: Oe,
|
|
817
830
|
/**
|
|
818
831
|
* 勾选指定行
|
|
819
832
|
*/
|
|
820
|
-
selectRows:
|
|
821
|
-
}), (
|
|
822
|
-
e.showSearch ? (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
modelValue:
|
|
826
|
-
"onUpdate:modelValue":
|
|
833
|
+
selectRows: Ue
|
|
834
|
+
}), (p, u) => (s(), x("div", ll, [
|
|
835
|
+
e.showSearch ? (s(), x("section", al, [
|
|
836
|
+
_("div", nl, [
|
|
837
|
+
C(n(Be), {
|
|
838
|
+
modelValue: le.value,
|
|
839
|
+
"onUpdate:modelValue": u[0] || (u[0] = (m) => le.value = m),
|
|
827
840
|
modelModifiers: { trim: !0 },
|
|
828
841
|
class: "search-table__search-input !w-[260px] flex-shrink-0",
|
|
829
842
|
placeholder: e.searchInputPlaceholder,
|
|
830
843
|
clearable: "",
|
|
831
|
-
onKeyup:
|
|
832
|
-
onClear:
|
|
844
|
+
onKeyup: ye(v, ["enter"]),
|
|
845
|
+
onClear: v
|
|
833
846
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
834
|
-
|
|
835
|
-
query:
|
|
836
|
-
search:
|
|
847
|
+
J(p.$slots, "search-form", {
|
|
848
|
+
query: G.value,
|
|
849
|
+
search: v
|
|
837
850
|
}, void 0, !0),
|
|
838
|
-
|
|
851
|
+
C(n(M), {
|
|
839
852
|
class: "search-table__search-button",
|
|
840
853
|
type: "primary",
|
|
841
|
-
onClick:
|
|
854
|
+
onClick: v
|
|
842
855
|
}, {
|
|
843
856
|
default: y(() => [
|
|
844
|
-
|
|
845
|
-
|
|
857
|
+
C(n(qt)),
|
|
858
|
+
R(" " + L(H.value), 1)
|
|
846
859
|
]),
|
|
847
860
|
_: 1
|
|
848
861
|
})
|
|
849
862
|
]),
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
e.showAddButton ? (
|
|
863
|
+
J(p.$slots, "top-center", {}, void 0, !0),
|
|
864
|
+
_("div", rl, [
|
|
865
|
+
e.showAddButton ? (s(), k(n(M), {
|
|
853
866
|
key: 0,
|
|
854
867
|
class: "search-table__add-button",
|
|
855
868
|
type: "primary",
|
|
856
|
-
onClick:
|
|
869
|
+
onClick: u[1] || (u[1] = (m) => i("add"))
|
|
857
870
|
}, {
|
|
858
871
|
default: y(() => [
|
|
859
|
-
|
|
860
|
-
|
|
872
|
+
C(n(Yt)),
|
|
873
|
+
u[5] || (u[5] = R("新增 ", -1))
|
|
861
874
|
]),
|
|
862
875
|
_: 1
|
|
863
|
-
})) :
|
|
864
|
-
e.showBatchDeleteButton ? (
|
|
876
|
+
})) : F("", !0),
|
|
877
|
+
e.showBatchDeleteButton ? (s(), k(n(M), {
|
|
865
878
|
key: 1,
|
|
866
879
|
class: "search-table__batch-delete-button",
|
|
867
|
-
disabled: !
|
|
880
|
+
disabled: !B.value.length,
|
|
868
881
|
type: "danger",
|
|
869
|
-
onClick:
|
|
882
|
+
onClick: u[2] || (u[2] = (m) => i("batch-delete", B.value))
|
|
870
883
|
}, {
|
|
871
884
|
default: y(() => [
|
|
872
|
-
|
|
873
|
-
|
|
885
|
+
C(n(Jt)),
|
|
886
|
+
u[6] || (u[6] = R("批量删除 ", -1))
|
|
874
887
|
]),
|
|
875
888
|
_: 1
|
|
876
|
-
}, 8, ["disabled"])) :
|
|
877
|
-
|
|
889
|
+
}, 8, ["disabled"])) : F("", !0),
|
|
890
|
+
J(p.$slots, "btns", {}, void 0, !0)
|
|
878
891
|
])
|
|
879
|
-
])) :
|
|
880
|
-
|
|
881
|
-
class: "search-table__body flex-1 overflow-hidden",
|
|
882
|
-
"index-offset": w.value,
|
|
892
|
+
])) : F("", !0),
|
|
893
|
+
J(p.$slots, "table", {
|
|
883
894
|
data: A.value,
|
|
884
|
-
loading: n(
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
895
|
+
loading: n(f),
|
|
896
|
+
columns: r.columns,
|
|
897
|
+
indexOffset: E.value,
|
|
898
|
+
defaultSort: ee.value,
|
|
899
|
+
applyFilter: c,
|
|
900
|
+
selectionChange: fe,
|
|
901
|
+
cellEdit: N,
|
|
902
|
+
sortChange: n(X)
|
|
903
|
+
}, () => [
|
|
904
|
+
C(Dt, ge({ ref: "proTableRef" }, r, {
|
|
905
|
+
class: "search-table__body flex-1 overflow-hidden",
|
|
906
|
+
"index-offset": E.value,
|
|
907
|
+
data: A.value,
|
|
908
|
+
loading: n(f),
|
|
909
|
+
"default-sort": ee.value,
|
|
910
|
+
onApplyFilter: c,
|
|
911
|
+
onSelectionChange: fe,
|
|
912
|
+
onCellEdit: N,
|
|
913
|
+
onSortChange: n(X)
|
|
914
|
+
}), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"])
|
|
915
|
+
], !0),
|
|
916
|
+
_("section", sl, [
|
|
917
|
+
_("div", il, [
|
|
918
|
+
e.selectable ? (s(), x(q, { key: 0 }, [
|
|
919
|
+
C(n(ft), { type: "info" }, {
|
|
898
920
|
default: y(() => [
|
|
899
|
-
|
|
921
|
+
R("已选 " + L(B.value.length) + " 条", 1)
|
|
900
922
|
]),
|
|
901
923
|
_: 1
|
|
902
924
|
}),
|
|
903
|
-
|
|
925
|
+
B.value.length ? (s(), k(n(ht), {
|
|
904
926
|
key: 0,
|
|
905
927
|
content: "清空勾选",
|
|
906
928
|
placement: "top",
|
|
@@ -908,52 +930,52 @@ const Jt = I({ name: "ri-delete-back2-line", render: Qt }), Xt = { class: "searc
|
|
|
908
930
|
"hide-after": 0
|
|
909
931
|
}, {
|
|
910
932
|
default: y(() => [
|
|
911
|
-
|
|
933
|
+
C(n(M), {
|
|
912
934
|
type: "danger",
|
|
913
935
|
text: "",
|
|
914
936
|
class: "search-table__clear-selection-button ml-1 !px-2",
|
|
915
|
-
onClick:
|
|
937
|
+
onClick: we
|
|
916
938
|
}, {
|
|
917
939
|
default: y(() => [
|
|
918
|
-
|
|
940
|
+
C(n(tl))
|
|
919
941
|
]),
|
|
920
942
|
_: 1
|
|
921
943
|
})
|
|
922
944
|
]),
|
|
923
945
|
_: 1
|
|
924
|
-
})) :
|
|
925
|
-
], 64)) :
|
|
946
|
+
})) : F("", !0)
|
|
947
|
+
], 64)) : F("", !0)
|
|
926
948
|
]),
|
|
927
|
-
|
|
928
|
-
"page-size":
|
|
929
|
-
"onUpdate:pageSize":
|
|
930
|
-
"current-page":
|
|
931
|
-
"onUpdate:currentPage":
|
|
932
|
-
total:
|
|
933
|
-
"page-sizes":
|
|
949
|
+
C(n(pt), ge(w.value, {
|
|
950
|
+
"page-size": P.value.pageSize,
|
|
951
|
+
"onUpdate:pageSize": u[3] || (u[3] = (m) => P.value.pageSize = m),
|
|
952
|
+
"current-page": P.value.currPage,
|
|
953
|
+
"onUpdate:currentPage": u[4] || (u[4] = (m) => P.value.currPage = m),
|
|
954
|
+
total: P.value.total,
|
|
955
|
+
"page-sizes": S.value,
|
|
934
956
|
class: "search-table__pagination flex-shrink-0",
|
|
935
|
-
onSizeChange:
|
|
936
|
-
onCurrentChange:
|
|
957
|
+
onSizeChange: h,
|
|
958
|
+
onCurrentChange: h
|
|
937
959
|
}), null, 16, ["page-size", "current-page", "total", "page-sizes"]),
|
|
938
|
-
|
|
960
|
+
u[7] || (u[7] = _("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
|
|
939
961
|
])
|
|
940
962
|
]));
|
|
941
963
|
}
|
|
942
|
-
}),
|
|
964
|
+
}), vl = /* @__PURE__ */ ze(ol, [["__scopeId", "data-v-56484700"]]), ml = /* @__PURE__ */ de({
|
|
943
965
|
name: "SearchTableConfigProvider",
|
|
944
966
|
__name: "ConfigProvider",
|
|
945
967
|
props: {
|
|
946
|
-
rowHeight: { default:
|
|
947
|
-
headerHeight: { default:
|
|
948
|
-
paginationProps: { default: () =>
|
|
949
|
-
searchProps: { default: () =>
|
|
968
|
+
rowHeight: { default: K.rowHeight },
|
|
969
|
+
headerHeight: { default: K.headerHeight },
|
|
970
|
+
paginationProps: { default: () => K.paginationProps },
|
|
971
|
+
searchProps: { default: () => K.searchProps }
|
|
950
972
|
},
|
|
951
973
|
setup(e) {
|
|
952
|
-
return
|
|
974
|
+
return lt(Me, Nt(e)), (d, r) => J(d.$slots, "default");
|
|
953
975
|
}
|
|
954
976
|
});
|
|
955
977
|
export {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
978
|
+
Dt as ProTable,
|
|
979
|
+
vl as SearchTable,
|
|
980
|
+
ml as SearchTableConfigProvider
|
|
959
981
|
};
|