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