@amaoaaaaa/search-table 0.2.2 → 0.2.3
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 +33 -0
- package/dist/search-table.js +274 -271
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,6 +135,39 @@ const columns = [{ label: '姓名', prop: 'name' }];
|
|
|
135
135
|
| `getSelectionRows` | `() => TableRow[]` | 获取已勾选的行 |
|
|
136
136
|
| `selectRows` | `(rows: TableRow[]) => void` | 勾选指定行 |
|
|
137
137
|
|
|
138
|
+
### SearchTable 样式定制
|
|
139
|
+
|
|
140
|
+
组件内部按 BEM 规范预留了类名,块名为 `search-table`,可在外层通过 `:deep()` 覆盖样式:
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<template>
|
|
144
|
+
<SearchTable class="my-search-table" :columns="columns" :fetch-fn="fetchData" />
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<style scoped>
|
|
148
|
+
.my-search-table :deep(.search-table__search-button) {
|
|
149
|
+
border-radius: 9999px;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| 类名 | 说明 |
|
|
155
|
+
| -------------------------------------- | ------------------------------------------ |
|
|
156
|
+
| `search-table` | 根容器 |
|
|
157
|
+
| `search-table__toolbar` | 顶部区域(搜索区 + 操作区) |
|
|
158
|
+
| `search-table__search` | 左侧搜索组(搜索框 + 搜索表单 + 搜索按钮) |
|
|
159
|
+
| `search-table__search-input` | 搜索输入框 |
|
|
160
|
+
| `search-table__search-button` | 搜索按钮 |
|
|
161
|
+
| `search-table__actions` | 右侧操作按钮组(新增 / 批量删除 / 插槽) |
|
|
162
|
+
| `search-table__add-button` | 新增按钮 |
|
|
163
|
+
| `search-table__batch-delete-button` | 批量删除按钮 |
|
|
164
|
+
| `search-table__body` | 表格区域(ProTable 根节点) |
|
|
165
|
+
| `search-table__footer` | 底部分页区域 |
|
|
166
|
+
| `search-table__selection` | 已选条数提示区域 |
|
|
167
|
+
| `search-table__clear-selection-button` | 清空勾选按钮 |
|
|
168
|
+
| `search-table__pagination` | 分页组件 |
|
|
169
|
+
| `search-table__footer-spacer` | 分页区域右侧占位(用于保持分页居中) |
|
|
170
|
+
|
|
138
171
|
## 导出清单
|
|
139
172
|
|
|
140
173
|
**组件:** `SearchTable`, `ProTable`
|
package/dist/search-table.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var re = (l, t, f) =>
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { ElLoading as Ae, ElTable as Oe, ElTableColumn as de, ElPopover as Ue, ElScrollbar as we, ElRadioGroup as Ne, ElRadio as je, ElCheckboxGroup as We, ElCheckbox as Ge, ElDatePicker as Ie, ElButton as
|
|
6
|
-
import { isFunction as A, isBoolean as ke, cloneDeep as Q, isString as Ze, keys as
|
|
1
|
+
var Ve = Object.defineProperty;
|
|
2
|
+
var Be = (l, t, f) => t in l ? Ve(l, t, { enumerable: !0, configurable: !0, writable: !0, value: f }) : l[t] = f;
|
|
3
|
+
var re = (l, t, f) => Be(l, typeof t != "symbol" ? t + "" : t, f);
|
|
4
|
+
import { defineComponent as pe, computed as I, isVNode as ze, openBlock as s, createBlock as _, resolveDynamicComponent as Pe, createElementBlock as x, markRaw as q, createElementVNode as $, useModel as He, useTemplateRef as Se, ref as B, withDirectives as ee, createVNode as C, unref as a, withCtx as b, createCommentVNode as H, createTextVNode as R, toDisplayString as O, Fragment as U, renderList as te, mergeProps as fe, createSlots as Fe, isRef as _e, normalizeClass as De, toValue as ge, withModifiers as oe, withKeys as ve, normalizeStyle as be, mergeModels as xe, reactive as me, nextTick as le, toRef as Me, watch as Ce, onMounted as Ke, onUnmounted as Le, renderSlot as ue } from "vue";
|
|
5
|
+
import { ElLoading as Ae, ElTable as Oe, ElTableColumn as de, ElPopover as Ue, ElScrollbar as we, ElRadioGroup as Ne, ElRadio as je, ElCheckboxGroup as We, ElCheckbox as Ge, ElDatePicker as Ie, ElButton as D, ElInput as Ee, ElPopconfirm as qe, ElText as Ye, ElTooltip as Qe, ElPagination as Je, ElMessage as Xe } from "element-plus";
|
|
6
|
+
import { isFunction as A, isBoolean as ke, cloneDeep as Q, isString as Ze, keys as he, merge as et, isEqual as tt, sortBy as lt, uniq as at, pickBy as nt, countBy as it } from "lodash-es";
|
|
7
7
|
import { vTextEllipsis as ce } from "@amaoaaaaa/v-text-ellipsis";
|
|
8
|
-
import { isCancel as
|
|
9
|
-
const st = ["innerHTML"], rt = /* @__PURE__ */
|
|
8
|
+
import { isCancel as Te } from "axios";
|
|
9
|
+
const st = ["innerHTML"], rt = /* @__PURE__ */ pe({
|
|
10
10
|
__name: "RenderFormatterResult",
|
|
11
11
|
props: {
|
|
12
12
|
col: {},
|
|
@@ -16,11 +16,11 @@ const st = ["innerHTML"], rt = /* @__PURE__ */ me({
|
|
|
16
16
|
},
|
|
17
17
|
setup(l) {
|
|
18
18
|
const t = l, f = I(() => {
|
|
19
|
-
var r,
|
|
19
|
+
var r, h;
|
|
20
20
|
const o = t.col.prop ? t.row[t.col.prop] : void 0;
|
|
21
|
-
return (
|
|
21
|
+
return (h = (r = t.col).formatter) == null ? void 0 : h.call(r, t.row, t.column, o, t.index);
|
|
22
22
|
});
|
|
23
|
-
return (o, r) =>
|
|
23
|
+
return (o, r) => ze(f.value) ? (s(), _(Pe(f.value), { key: 0 })) : (s(), x("span", {
|
|
24
24
|
key: 1,
|
|
25
25
|
innerHTML: f.value
|
|
26
26
|
}, null, 8, st));
|
|
@@ -32,7 +32,7 @@ const st = ["innerHTML"], rt = /* @__PURE__ */ me({
|
|
|
32
32
|
};
|
|
33
33
|
function ut(l, t) {
|
|
34
34
|
return s(), x("svg", ot, [...t[0] || (t[0] = [
|
|
35
|
-
|
|
35
|
+
$("path", {
|
|
36
36
|
fill: "none",
|
|
37
37
|
stroke: "currentColor",
|
|
38
38
|
"stroke-linecap": "round",
|
|
@@ -49,7 +49,7 @@ const dt = q({ name: "tabler-filter", render: ut }), ct = {
|
|
|
49
49
|
};
|
|
50
50
|
function ft(l, t) {
|
|
51
51
|
return s(), x("svg", ct, [...t[0] || (t[0] = [
|
|
52
|
-
|
|
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 vt = q({ name: "tabler-filter-check", render: ft }),
|
|
62
|
+
const vt = q({ name: "tabler-filter-check", render: ft }), ht = { "element-loading-text": "加载中..." }, pt = { class: "flex justify-center" }, mt = { class: "-mx-3 flex w-[150px] items-center justify-evenly" }, yt = {
|
|
63
63
|
key: 0,
|
|
64
64
|
class: "h-[23px]"
|
|
65
|
-
}, gt = ["onDblclick"], bt = { key: 1 }, xt = /* @__PURE__ */
|
|
65
|
+
}, gt = ["onDblclick"], bt = { key: 1 }, xt = /* @__PURE__ */ pe({
|
|
66
66
|
__name: "index",
|
|
67
67
|
props: /* @__PURE__ */ xe({
|
|
68
68
|
data: {},
|
|
@@ -75,50 +75,50 @@ 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: () => me({})
|
|
79
79
|
},
|
|
80
80
|
filterDataModifiers: {}
|
|
81
81
|
}),
|
|
82
82
|
emits: /* @__PURE__ */ xe(["applyFilter", "selectionChange", "cell-edit"], ["update:filterData"]),
|
|
83
83
|
setup(l, { expose: t, emit: f }) {
|
|
84
|
-
const o = Ae.directive, r = l,
|
|
85
|
-
function
|
|
86
|
-
g.value[
|
|
84
|
+
const o = Ae.directive, r = l, h = He(l, "filterData"), k = f, V = Se("elTableRef"), g = B({}), w = B({});
|
|
85
|
+
function ae(n) {
|
|
86
|
+
g.value[n] = Q(h.value[n]);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
g.value[
|
|
88
|
+
function ne(n) {
|
|
89
|
+
g.value[n] = Q(h.value[n]);
|
|
90
90
|
}
|
|
91
|
-
function J(
|
|
92
|
-
g.value[
|
|
91
|
+
function J(n, v, e) {
|
|
92
|
+
g.value[n] = void 0, h.value[n] = void 0, N(n, v, e);
|
|
93
93
|
}
|
|
94
|
-
function N(
|
|
95
|
-
|
|
94
|
+
function N(n, v, e) {
|
|
95
|
+
h.value[n] = g.value[n], w.value[n] = !1, k("applyFilter", {
|
|
96
96
|
col: e,
|
|
97
|
-
prop:
|
|
97
|
+
prop: n,
|
|
98
98
|
type: v,
|
|
99
|
-
value:
|
|
100
|
-
filterData:
|
|
99
|
+
value: h.value[n],
|
|
100
|
+
filterData: h.value
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
function j(
|
|
104
|
-
const e = A(
|
|
103
|
+
function j(n, v) {
|
|
104
|
+
const e = A(n.actions) ? n.actions(v) : n.actions;
|
|
105
105
|
return e == null ? void 0 : e.map((c) => {
|
|
106
|
-
const
|
|
107
|
-
return { ...c, visibility:
|
|
106
|
+
const m = A(c.visibility) ? c.visibility(v) : c.visibility ?? !0;
|
|
107
|
+
return { ...c, visibility: m };
|
|
108
108
|
}).filter((c) => c.visibility !== !1);
|
|
109
109
|
}
|
|
110
|
-
function S(
|
|
111
|
-
return
|
|
110
|
+
function S(n) {
|
|
111
|
+
return n.filterFieldName ?? n.prop;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function M(n, v) {
|
|
114
114
|
return {
|
|
115
|
-
color:
|
|
115
|
+
color: n.text.includes("删除") ? "var(--el-color-danger)" : "",
|
|
116
116
|
visibility: ke(v) ? void 0 : v
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
const
|
|
119
|
+
const E = B([]);
|
|
120
120
|
function W() {
|
|
121
|
-
|
|
121
|
+
E.value = Array.from(
|
|
122
122
|
{ length: r.data.length },
|
|
123
123
|
() => Array.from({ length: r.columns.length }, () => ({
|
|
124
124
|
editing: !1,
|
|
@@ -127,32 +127,32 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
127
127
|
}))
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
|
-
function ie(
|
|
131
|
-
return A(
|
|
130
|
+
function ie(n, v) {
|
|
131
|
+
return A(n.editable) ? n.editable(v) : n.editable ?? !1;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
const c =
|
|
133
|
+
function z(n, v, e) {
|
|
134
|
+
const c = E.value[n][v];
|
|
135
135
|
c && (c.value = e, c.editing = !0, le(() => {
|
|
136
|
-
var
|
|
137
|
-
(
|
|
136
|
+
var m;
|
|
137
|
+
(m = c.inputRef) == null || m.focus();
|
|
138
138
|
}));
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const v =
|
|
140
|
+
function P(n) {
|
|
141
|
+
const v = E.value[n.rowIndex][n.colIndex];
|
|
142
142
|
if (!v) return;
|
|
143
143
|
v.editing = !1;
|
|
144
|
-
const e =
|
|
145
|
-
e !== c && (
|
|
144
|
+
const e = n.newValue, c = n.row[n.prop];
|
|
145
|
+
e !== c && (n.row[n.prop] = e, k("cell-edit", n));
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const e =
|
|
147
|
+
function K(n, v) {
|
|
148
|
+
const e = E.value[n][v];
|
|
149
149
|
e && (e.editing = !1);
|
|
150
150
|
}
|
|
151
151
|
return t({
|
|
152
|
-
tableInstance:
|
|
152
|
+
tableInstance: V,
|
|
153
153
|
resetCells: W
|
|
154
|
-
}), (
|
|
155
|
-
|
|
154
|
+
}), (n, v) => ee((s(), x("section", ht, [
|
|
155
|
+
C(a(Oe), {
|
|
156
156
|
ref: "elTableRef",
|
|
157
157
|
data: l.data,
|
|
158
158
|
border: "",
|
|
@@ -162,13 +162,13 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
162
162
|
onSelectionChange: v[1] || (v[1] = (e) => k("selectionChange", e))
|
|
163
163
|
}, {
|
|
164
164
|
default: b(() => [
|
|
165
|
-
l.selectable ? (s(),
|
|
165
|
+
l.selectable ? (s(), _(a(de), {
|
|
166
166
|
key: 0,
|
|
167
167
|
type: "selection",
|
|
168
168
|
width: "55",
|
|
169
|
-
selectable:
|
|
170
|
-
}, null, 8, ["selectable"])) :
|
|
171
|
-
l.showIndex ? (s(),
|
|
169
|
+
selectable: a(A)(l.selectable) ? l.selectable : void 0
|
|
170
|
+
}, null, 8, ["selectable"])) : H("", !0),
|
|
171
|
+
l.showIndex ? (s(), _(a(de), {
|
|
172
172
|
key: 1,
|
|
173
173
|
class: "index-cell",
|
|
174
174
|
align: "center",
|
|
@@ -176,23 +176,23 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
176
176
|
label: "序号"
|
|
177
177
|
}, {
|
|
178
178
|
default: b(({ $index: e }) => [
|
|
179
|
-
|
|
179
|
+
R(O(e + 1 + (l.indexOffset || 0)), 1)
|
|
180
180
|
]),
|
|
181
181
|
_: 1
|
|
182
|
-
}, 8, ["width"])) :
|
|
183
|
-
(s(!0), x(U, null, te(l.columns, (e, c) => (s(),
|
|
182
|
+
}, 8, ["width"])) : H("", !0),
|
|
183
|
+
(s(!0), x(U, null, te(l.columns, (e, c) => (s(), _(a(de), fe({ key: c }, { ref_for: !0 }, e, {
|
|
184
184
|
align: e.align ?? "center",
|
|
185
185
|
fixed: e.label === "操作" ? "right" : !1
|
|
186
|
-
}),
|
|
187
|
-
e.filterable ?? (e.filterType || e.filterOptions ||
|
|
186
|
+
}), Fe({ _: 2 }, [
|
|
187
|
+
e.filterable ?? (e.filterType || e.filterOptions || _e(e.filterOptions)) ? {
|
|
188
188
|
name: "header",
|
|
189
|
-
fn: b(({ column:
|
|
190
|
-
|
|
191
|
-
class:
|
|
192
|
-
"text-[--el-color-primary]": S(e) &&
|
|
189
|
+
fn: b(({ column: m }) => [
|
|
190
|
+
$("span", {
|
|
191
|
+
class: De(["inline-flex items-center", {
|
|
192
|
+
"text-[--el-color-primary]": S(e) && h.value[S(e)] !== void 0
|
|
193
193
|
}])
|
|
194
194
|
}, [
|
|
195
|
-
S(e) ? (s(),
|
|
195
|
+
S(e) ? (s(), _(a(Ue), {
|
|
196
196
|
key: 0,
|
|
197
197
|
visible: w.value[S(e)],
|
|
198
198
|
"onUpdate:visible": (u) => w.value[S(e)] = u,
|
|
@@ -202,32 +202,32 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
202
202
|
"show-after": 0,
|
|
203
203
|
width: e.filterPopoverWidth ?? (e.filterType === "datetimerange" ? 424 : void 0),
|
|
204
204
|
"popper-class": "reset",
|
|
205
|
-
onShow: (u) =>
|
|
206
|
-
onHide: (u) =>
|
|
205
|
+
onShow: (u) => ae(S(e)),
|
|
206
|
+
onHide: (u) => ne(S(e))
|
|
207
207
|
}, {
|
|
208
208
|
reference: b(() => [
|
|
209
|
-
|
|
209
|
+
$("div", {
|
|
210
210
|
class: "inline-flex cursor-pointer items-center gap-x-0.5 duration-100 hover:text-[--el-color-primary]",
|
|
211
211
|
onClick: v[0] || (v[0] = oe(() => {
|
|
212
212
|
}, ["stop"]))
|
|
213
213
|
}, [
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
R(O(m.label) + " ", 1),
|
|
215
|
+
h.value[S(e)] !== void 0 ? (s(), _(a(vt), { key: 0 })) : (s(), _(a(dt), { key: 1 }))
|
|
216
216
|
])
|
|
217
217
|
]),
|
|
218
218
|
default: b(() => [
|
|
219
|
-
!e.filterType || e.filterType === "radio" ? (s(),
|
|
219
|
+
!e.filterType || e.filterType === "radio" ? (s(), _(a(we), {
|
|
220
220
|
key: 0,
|
|
221
221
|
always: "",
|
|
222
222
|
"max-height": "34vh"
|
|
223
223
|
}, {
|
|
224
224
|
default: b(() => [
|
|
225
|
-
|
|
225
|
+
C(a(Ne), {
|
|
226
226
|
modelValue: g.value[S(e)],
|
|
227
227
|
"onUpdate:modelValue": (u) => g.value[S(e)] = u
|
|
228
228
|
}, {
|
|
229
229
|
default: b(() => [
|
|
230
|
-
(s(!0), x(U, null, te(ge(e.filterOptions), (u) => (s(),
|
|
230
|
+
(s(!0), x(U, null, te(ge(e.filterOptions), (u) => (s(), _(a(je), {
|
|
231
231
|
key: u.value.toString(),
|
|
232
232
|
value: u.value,
|
|
233
233
|
label: u.label,
|
|
@@ -238,18 +238,18 @@ 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)) : e.filterType === "checkbox" ? (s(),
|
|
241
|
+
}, 1024)) : e.filterType === "checkbox" ? (s(), _(a(we), {
|
|
242
242
|
key: 1,
|
|
243
243
|
always: "",
|
|
244
244
|
"max-height": "34vh"
|
|
245
245
|
}, {
|
|
246
246
|
default: b(() => [
|
|
247
|
-
|
|
247
|
+
C(a(We), {
|
|
248
248
|
modelValue: g.value[S(e)],
|
|
249
249
|
"onUpdate:modelValue": (u) => g.value[S(e)] = u
|
|
250
250
|
}, {
|
|
251
251
|
default: b(() => [
|
|
252
|
-
(s(!0), x(U, null, te(ge(e.filterOptions), (u) => (s(),
|
|
252
|
+
(s(!0), x(U, null, te(ge(e.filterOptions), (u) => (s(), _(a(Ge), {
|
|
253
253
|
key: u.value.toString(),
|
|
254
254
|
value: u.value,
|
|
255
255
|
label: u.label,
|
|
@@ -260,7 +260,7 @@ 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)) : e.filterType === "datetimerange" ? (s(),
|
|
263
|
+
}, 1024)) : e.filterType === "datetimerange" ? (s(), _(a(Ie), {
|
|
264
264
|
key: 2,
|
|
265
265
|
modelValue: g.value[S(e)],
|
|
266
266
|
"onUpdate:modelValue": (u) => g.value[S(e)] = u,
|
|
@@ -270,11 +270,11 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
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
|
-
v[4] || (v[4] =
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : H("", !0),
|
|
274
|
+
v[4] || (v[4] = $("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
|
|
275
|
+
$("div", pt, [
|
|
276
|
+
$("div", mt, [
|
|
277
|
+
C(a(D), {
|
|
278
278
|
type: "primary",
|
|
279
279
|
plain: "",
|
|
280
280
|
size: "small",
|
|
@@ -285,11 +285,11 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
285
285
|
)
|
|
286
286
|
}, {
|
|
287
287
|
default: b(() => [...v[2] || (v[2] = [
|
|
288
|
-
|
|
288
|
+
R("重置", -1)
|
|
289
289
|
])]),
|
|
290
290
|
_: 1
|
|
291
291
|
}, 8, ["onClick"]),
|
|
292
|
-
|
|
292
|
+
C(a(D), {
|
|
293
293
|
type: "primary",
|
|
294
294
|
size: "small",
|
|
295
295
|
class: "!m-0",
|
|
@@ -300,7 +300,7 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
300
300
|
)
|
|
301
301
|
}, {
|
|
302
302
|
default: b(() => [...v[3] || (v[3] = [
|
|
303
|
-
|
|
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"])) : H("", !0)
|
|
312
312
|
], 2)
|
|
313
313
|
]),
|
|
314
314
|
key: "0"
|
|
315
315
|
} : void 0,
|
|
316
316
|
e.formatter ? {
|
|
317
317
|
name: "default",
|
|
318
|
-
fn: b(({ row:
|
|
318
|
+
fn: b(({ row: m, column: u, $index: F }) => [
|
|
319
319
|
ee((s(), x("div", null, [
|
|
320
|
-
|
|
320
|
+
C(rt, {
|
|
321
321
|
col: e,
|
|
322
|
-
row:
|
|
322
|
+
row: m,
|
|
323
323
|
column: u,
|
|
324
|
-
index:
|
|
324
|
+
index: F
|
|
325
325
|
}, null, 8, ["col", "row", "column", "index"])
|
|
326
326
|
])), [
|
|
327
|
-
[
|
|
327
|
+
[a(ce), e.truncate ?? !0]
|
|
328
328
|
])
|
|
329
329
|
]),
|
|
330
330
|
key: "1"
|
|
331
331
|
} : {
|
|
332
332
|
name: "default",
|
|
333
|
-
fn: b(({ row:
|
|
334
|
-
var
|
|
333
|
+
fn: b(({ row: m, $index: u }) => {
|
|
334
|
+
var F, Y;
|
|
335
335
|
return [
|
|
336
336
|
e.prop ? (s(), x("div", yt, [
|
|
337
|
-
ie(e,
|
|
338
|
-
(Y = (
|
|
337
|
+
ie(e, m) ? (s(), x(U, { key: 0 }, [
|
|
338
|
+
(Y = (F = E.value[u]) == null ? void 0 : F[c]) != null && Y.editing ? (s(), _(a(Ee), {
|
|
339
339
|
key: 0,
|
|
340
340
|
ref_for: !0,
|
|
341
|
-
ref: (d) =>
|
|
342
|
-
modelValue:
|
|
343
|
-
"onUpdate:modelValue": (d) =>
|
|
341
|
+
ref: (d) => E.value[u][c].inputRef = d,
|
|
342
|
+
modelValue: E.value[u][c].value,
|
|
343
|
+
"onUpdate:modelValue": (d) => E.value[u][c].value = d,
|
|
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: (d) =>
|
|
348
|
+
onBlur: (d) => P({
|
|
349
349
|
rowIndex: u,
|
|
350
350
|
colIndex: c,
|
|
351
|
-
row:
|
|
351
|
+
row: m,
|
|
352
352
|
prop: e.prop,
|
|
353
|
-
oldValue:
|
|
354
|
-
newValue:
|
|
353
|
+
oldValue: m[e.prop],
|
|
354
|
+
newValue: E.value[u][c].value
|
|
355
355
|
}),
|
|
356
356
|
onKeydown: [
|
|
357
|
-
ve(oe((d) =>
|
|
357
|
+
ve(oe((d) => P({
|
|
358
358
|
rowIndex: u,
|
|
359
359
|
colIndex: c,
|
|
360
|
-
row:
|
|
360
|
+
row: m,
|
|
361
361
|
prop: e.prop,
|
|
362
|
-
oldValue:
|
|
363
|
-
newValue:
|
|
362
|
+
oldValue: m[e.prop],
|
|
363
|
+
newValue: E.value[u][c].value
|
|
364
364
|
}), ["stop", "prevent"]), ["enter"]),
|
|
365
|
-
ve(oe((d) =>
|
|
365
|
+
ve(oe((d) => K(u, c), ["stop", "prevent"]), ["esc"])
|
|
366
366
|
]
|
|
367
367
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) : ee((s(), x("div", {
|
|
368
368
|
key: 1,
|
|
369
369
|
class: "h-[23px] cursor-pointer",
|
|
370
|
-
onDblclick: (d) =>
|
|
370
|
+
onDblclick: (d) => z(u, c, m[e.prop])
|
|
371
371
|
}, [
|
|
372
|
-
|
|
372
|
+
R(O(m[e.prop]), 1)
|
|
373
373
|
], 40, gt)), [
|
|
374
|
-
[
|
|
374
|
+
[a(ce), e.truncate ?? !0]
|
|
375
375
|
])
|
|
376
376
|
], 64)) : ee((s(), x("div", bt, [
|
|
377
|
-
|
|
377
|
+
R(O(m[e.prop]), 1)
|
|
378
378
|
])), [
|
|
379
|
-
[
|
|
379
|
+
[a(ce), e.truncate ?? !0]
|
|
380
380
|
])
|
|
381
|
-
])) :
|
|
382
|
-
(s(!0), x(U, null, te(j(e,
|
|
381
|
+
])) : H("", !0),
|
|
382
|
+
(s(!0), x(U, null, te(j(e, m), (d) => (s(), x(U, {
|
|
383
383
|
key: d.text
|
|
384
384
|
}, [
|
|
385
|
-
d.text === "删除" || d.confirmText ? (s(),
|
|
385
|
+
d.text === "删除" || d.confirmText ? (s(), _(a(qe), {
|
|
386
386
|
key: 0,
|
|
387
387
|
placement: "top",
|
|
388
388
|
"hide-after": 0,
|
|
389
389
|
"popper-style": "width: unset; min-width: 150px;",
|
|
390
|
-
title:
|
|
391
|
-
onConfirm: (se) => d.visibility === "hidden" ? void 0 : d.handler(
|
|
390
|
+
title: a(ke)(d.confirmText) ? `是否确认${d.text}?` : a(A)(d.confirmText) ? d.confirmText(m) : d.confirmText ?? `是否确认${d.text}?`,
|
|
391
|
+
onConfirm: (se) => d.visibility === "hidden" ? void 0 : d.handler(m)
|
|
392
392
|
}, {
|
|
393
393
|
reference: b(() => [
|
|
394
|
-
|
|
394
|
+
C(a(D), {
|
|
395
395
|
link: "",
|
|
396
396
|
type: d.type ?? "primary",
|
|
397
|
-
style: be(
|
|
398
|
-
disabled:
|
|
397
|
+
style: be(M(d, d.visibility)),
|
|
398
|
+
disabled: a(A)(d.disabled) ? d.disabled(m) : d.disabled
|
|
399
399
|
}, {
|
|
400
400
|
default: b(() => [
|
|
401
|
-
|
|
401
|
+
R(O(d.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(), _(a(D), {
|
|
408
408
|
key: 1,
|
|
409
409
|
link: "",
|
|
410
410
|
type: d.type ?? "primary",
|
|
411
|
-
style: be(
|
|
412
|
-
disabled:
|
|
413
|
-
onClick: (se) => d.visibility === "hidden" ? void 0 : d.handler(
|
|
411
|
+
style: be(M(d, d.visibility)),
|
|
412
|
+
disabled: a(A)(d.disabled) ? d.disabled(m) : d.disabled,
|
|
413
|
+
onClick: (se) => d.visibility === "hidden" ? void 0 : d.handler(m)
|
|
414
414
|
}, {
|
|
415
415
|
default: b(() => [
|
|
416
|
-
|
|
416
|
+
R(O(d.text), 1)
|
|
417
417
|
]),
|
|
418
418
|
_: 2
|
|
419
419
|
}, 1032, ["type", "style", "disabled", "onClick"]))
|
|
@@ -427,20 +427,20 @@ const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loadi
|
|
|
427
427
|
_: 1
|
|
428
428
|
}, 8, ["data", "row-key"])
|
|
429
429
|
])), [
|
|
430
|
-
[
|
|
430
|
+
[a(o), l.loading]
|
|
431
431
|
]);
|
|
432
432
|
}
|
|
433
|
-
}),
|
|
433
|
+
}), $e = (l, t) => {
|
|
434
434
|
const f = l.__vccOpts || l;
|
|
435
435
|
for (const [o, r] of t)
|
|
436
436
|
f[o] = r;
|
|
437
437
|
return f;
|
|
438
|
-
}, wt = /* @__PURE__ */
|
|
438
|
+
}, wt = /* @__PURE__ */ $e(xt, [["__scopeId", "data-v-476baef5"]]);
|
|
439
439
|
function kt(l) {
|
|
440
|
-
var t, f, o, r,
|
|
440
|
+
var t, f, o, r, h, k, V;
|
|
441
441
|
if (Ze(l))
|
|
442
442
|
return l.includes("database") || l.includes("java.sql.") ? "接口异常" : l;
|
|
443
|
-
if (
|
|
443
|
+
if (Te(l)) return "请求已取消";
|
|
444
444
|
if (l.code === "ECONNABORTED" || (t = l.message) != null && t.includes("timeout"))
|
|
445
445
|
return "请求超时,请稍后重试";
|
|
446
446
|
if (!window.navigator.onLine || l.message === "Network Error")
|
|
@@ -467,7 +467,7 @@ function kt(l) {
|
|
|
467
467
|
return `网络异常 (${g})`;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
return l instanceof SyntaxError ? "数据解析异常" : l instanceof TypeError ? "程序运行异常" : l instanceof Object && ((r = (o = l[(f =
|
|
470
|
+
return l instanceof SyntaxError ? "数据解析异常" : l instanceof TypeError ? "程序运行异常" : l instanceof Object && ((r = (o = l[(f = he(l)) == null ? void 0 : f[0]]) == null ? void 0 : o[0]) != null && r.message) ? (V = (k = l[(h = he(l)) == null ? void 0 : h[0]]) == null ? void 0 : k[0]) == null ? void 0 : V.message : l.message || "未知错误";
|
|
471
471
|
}
|
|
472
472
|
class St {
|
|
473
473
|
/**
|
|
@@ -539,100 +539,100 @@ class St {
|
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function _t(l, t, f) {
|
|
543
543
|
let o, r;
|
|
544
|
-
|
|
545
|
-
const
|
|
544
|
+
_e(l) ? (o = l, r = t) : (o = Me(l, t), r = 300);
|
|
545
|
+
const h = B(o.value);
|
|
546
546
|
let k = null;
|
|
547
|
-
const
|
|
547
|
+
const V = () => {
|
|
548
548
|
k !== null && (clearTimeout(k), k = null);
|
|
549
549
|
};
|
|
550
|
-
return
|
|
550
|
+
return Ce(
|
|
551
551
|
o,
|
|
552
552
|
(g) => {
|
|
553
|
-
g ? (
|
|
554
|
-
|
|
555
|
-
}, r)) : (
|
|
553
|
+
g ? (V(), k = setTimeout(() => {
|
|
554
|
+
h.value = !0;
|
|
555
|
+
}, r)) : (V(), h.value = !1);
|
|
556
556
|
},
|
|
557
557
|
{ immediate: !1 }
|
|
558
|
-
),
|
|
558
|
+
), h;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Ct({ defaultSort: l, fetchFn: t, onReset: f }) {
|
|
561
561
|
const o = et(
|
|
562
562
|
{
|
|
563
563
|
order: "",
|
|
564
564
|
sort: ""
|
|
565
565
|
},
|
|
566
566
|
l
|
|
567
|
-
), r =
|
|
568
|
-
let
|
|
567
|
+
), r = me(Q(o));
|
|
568
|
+
let h = Q(r);
|
|
569
569
|
function k({
|
|
570
|
-
prop:
|
|
570
|
+
prop: V,
|
|
571
571
|
order: g
|
|
572
572
|
}) {
|
|
573
|
-
g ? (r.sort =
|
|
573
|
+
g ? (r.sort = V || "", r.order = g === "ascending" ? "asc" : "desc", t()) : (r.sort = o.sort, r.order = o.order, tt(r, h) && (r.order = r.order === "asc" ? "desc" : "asc"), f ? f() : t()), h = Q(r);
|
|
574
574
|
}
|
|
575
575
|
return {
|
|
576
576
|
sortState: r,
|
|
577
577
|
onSortChange: k
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
|
-
const
|
|
580
|
+
const Et = {
|
|
581
581
|
viewBox: "0 0 24 24",
|
|
582
582
|
width: "1.2em",
|
|
583
583
|
height: "1.2em"
|
|
584
584
|
};
|
|
585
|
-
function
|
|
586
|
-
return s(), x("svg",
|
|
587
|
-
|
|
585
|
+
function Tt(l, t) {
|
|
586
|
+
return s(), x("svg", Et, [...t[0] || (t[0] = [
|
|
587
|
+
$("path", {
|
|
588
588
|
fill: "currentColor",
|
|
589
589
|
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
590
|
}, null, -1)
|
|
591
591
|
])]);
|
|
592
592
|
}
|
|
593
|
-
const
|
|
593
|
+
const $t = q({ name: "ri-search-line", render: Tt }), Rt = {
|
|
594
594
|
viewBox: "0 0 24 24",
|
|
595
595
|
width: "1.2em",
|
|
596
596
|
height: "1.2em"
|
|
597
597
|
};
|
|
598
|
-
function
|
|
599
|
-
return s(), x("svg",
|
|
600
|
-
|
|
598
|
+
function Vt(l, t) {
|
|
599
|
+
return s(), x("svg", Rt, [...t[0] || (t[0] = [
|
|
600
|
+
$("path", {
|
|
601
601
|
fill: "currentColor",
|
|
602
602
|
d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"
|
|
603
603
|
}, null, -1)
|
|
604
604
|
])]);
|
|
605
605
|
}
|
|
606
|
-
const
|
|
606
|
+
const Bt = q({ name: "ri-add-line", render: Vt }), zt = {
|
|
607
607
|
viewBox: "0 0 24 24",
|
|
608
608
|
width: "1.2em",
|
|
609
609
|
height: "1.2em"
|
|
610
610
|
};
|
|
611
|
-
function
|
|
612
|
-
return s(), x("svg",
|
|
613
|
-
|
|
611
|
+
function Pt(l, t) {
|
|
612
|
+
return s(), x("svg", zt, [...t[0] || (t[0] = [
|
|
613
|
+
$("path", {
|
|
614
614
|
fill: "currentColor",
|
|
615
615
|
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
616
|
}, null, -1)
|
|
617
617
|
])]);
|
|
618
618
|
}
|
|
619
|
-
const
|
|
619
|
+
const Ht = q({ name: "ri-delete-bin-line", render: Pt }), Ft = {
|
|
620
620
|
viewBox: "0 0 24 24",
|
|
621
621
|
width: "1.2em",
|
|
622
622
|
height: "1.2em"
|
|
623
623
|
};
|
|
624
|
-
function
|
|
625
|
-
return s(), x("svg",
|
|
626
|
-
|
|
624
|
+
function Dt(l, t) {
|
|
625
|
+
return s(), x("svg", Ft, [...t[0] || (t[0] = [
|
|
626
|
+
$("path", {
|
|
627
627
|
fill: "currentColor",
|
|
628
628
|
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
629
|
}, null, -1)
|
|
630
630
|
])]);
|
|
631
631
|
}
|
|
632
|
-
const
|
|
632
|
+
const Mt = q({ name: "ri-delete-back2-line", render: Dt }), Kt = { class: "search-table flex h-full flex-col" }, Lt = {
|
|
633
633
|
key: 0,
|
|
634
|
-
class: "mb-6 flex flex-shrink-0 items-center justify-between"
|
|
635
|
-
}, At = { class: "flex items-center gap-x-3" }, Ot = { class: "mt-5 flex flex-shrink-0 items-center justify-between" },
|
|
634
|
+
class: "search-table__toolbar mb-6 flex flex-shrink-0 items-center justify-between"
|
|
635
|
+
}, At = { class: "search-table__search flex items-center gap-x-3" }, Ot = { class: "search-table__actions" }, Ut = { class: "search-table__footer mt-5 flex flex-shrink-0 items-center justify-between" }, Nt = { class: "search-table__selection flex w-[164px] items-center" }, jt = /* @__PURE__ */ pe({
|
|
636
636
|
__name: "index",
|
|
637
637
|
props: {
|
|
638
638
|
columns: {},
|
|
@@ -655,100 +655,100 @@ const Kt = q({ name: "ri-delete-back2-line", render: Mt }), _t = { class: "flex
|
|
|
655
655
|
},
|
|
656
656
|
emits: ["add", "batch-delete", "cell-edit"],
|
|
657
657
|
setup(l, { expose: t, emit: f }) {
|
|
658
|
-
const o = l, r = f,
|
|
658
|
+
const o = l, r = f, h = Se("proTableRef"), { sortState: k, onSortChange: V } = Ct({
|
|
659
659
|
defaultSort: o.defaultSort,
|
|
660
|
-
fetchFn:
|
|
660
|
+
fetchFn: P,
|
|
661
661
|
onReset() {
|
|
662
|
-
var y,
|
|
663
|
-
const
|
|
664
|
-
o.columns.some((G) => G.prop ===
|
|
662
|
+
var y, T;
|
|
663
|
+
const p = k.sort, i = k.order === "asc" ? "ascending" : "descending";
|
|
664
|
+
o.columns.some((G) => G.prop === p) ? (T = (y = h.value) == null ? void 0 : y.tableInstance) == null || T.sort(p, i) : P();
|
|
665
665
|
}
|
|
666
|
-
}), g =
|
|
666
|
+
}), g = B(o.pageSize ?? 0), w = B({
|
|
667
667
|
pageSize: g.value,
|
|
668
668
|
currPage: 1,
|
|
669
669
|
total: 0
|
|
670
|
-
}),
|
|
670
|
+
}), ae = I(() => lt(at([g.value, 10, 20, 30, 40, 50, 100]))), ne = I(() => (w.value.currPage - 1) * w.value.pageSize), J = B(0), N = I(() => o.searchField ?? "search"), j = B({
|
|
671
671
|
[N.value]: ""
|
|
672
672
|
}), S = I({
|
|
673
673
|
get: () => j.value[N.value] ?? "",
|
|
674
|
-
set: (
|
|
675
|
-
j.value[N.value] =
|
|
674
|
+
set: (p) => {
|
|
675
|
+
j.value[N.value] = p;
|
|
676
676
|
}
|
|
677
|
-
}),
|
|
678
|
-
let
|
|
679
|
-
async function
|
|
680
|
-
|
|
681
|
-
const
|
|
677
|
+
}), M = me({}), E = B([]), W = B(!1), ie = _t(W, 100);
|
|
678
|
+
let z = null;
|
|
679
|
+
async function P() {
|
|
680
|
+
z == null || z.abort(), z = new AbortController(), W.value = !0;
|
|
681
|
+
const p = ne.value;
|
|
682
682
|
try {
|
|
683
683
|
const i = {
|
|
684
684
|
...j.value,
|
|
685
|
-
...
|
|
685
|
+
...M,
|
|
686
686
|
...k,
|
|
687
687
|
limit: w.value.pageSize,
|
|
688
|
-
offset:
|
|
689
|
-
}, y = o.searchParamsHandler ? o.searchParamsHandler(i) : i, { data:
|
|
690
|
-
signal:
|
|
688
|
+
offset: p
|
|
689
|
+
}, y = o.searchParamsHandler ? o.searchParamsHandler(i) : i, { data: T = [], totalCount: G = 0 } = await o.fetchFn(y, {
|
|
690
|
+
signal: z.signal
|
|
691
691
|
});
|
|
692
|
-
|
|
692
|
+
E.value = T, J.value = p, w.value.total = G, await le(() => {
|
|
693
693
|
var L, X, Z;
|
|
694
|
-
(X = (L =
|
|
695
|
-
}), o.selectable &&
|
|
694
|
+
(X = (L = h.value) == null ? void 0 : L.tableInstance) == null || X.setScrollTop(0), (Z = h.value) == null || Z.resetCells();
|
|
695
|
+
}), o.selectable && Re(T);
|
|
696
696
|
} catch (i) {
|
|
697
|
-
if (
|
|
697
|
+
if (Te(i)) return;
|
|
698
698
|
console.error("[SearchTable] 获取数据失败", i), Xe.error("表格数据加载失败:" + kt(i));
|
|
699
699
|
}
|
|
700
700
|
W.value = !1;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
703
|
-
w.value.currPage = 1,
|
|
702
|
+
function K() {
|
|
703
|
+
w.value.currPage = 1, P();
|
|
704
704
|
}
|
|
705
|
-
function
|
|
706
|
-
if (
|
|
707
|
-
const [G = `${y}Start`, L = `${y}End`] =
|
|
708
|
-
|
|
705
|
+
function n({ type: p, value: i, prop: y, col: T }) {
|
|
706
|
+
if (p === "datetimerange") {
|
|
707
|
+
const [G = `${y}Start`, L = `${y}End`] = T.datetimerangeFilterFieldNames || [], [X, Z] = i || [];
|
|
708
|
+
M[G] = X, M[L] = Z;
|
|
709
709
|
} else
|
|
710
|
-
|
|
711
|
-
|
|
710
|
+
M[y] = i;
|
|
711
|
+
K();
|
|
712
712
|
}
|
|
713
713
|
const v = async () => {
|
|
714
|
-
W.value || (ye(), await
|
|
714
|
+
W.value || (ye(), await P());
|
|
715
715
|
};
|
|
716
716
|
function e() {
|
|
717
717
|
var L;
|
|
718
|
-
const
|
|
719
|
-
return Math.floor(
|
|
718
|
+
const T = ((L = h.value) == null ? void 0 : L.$el).offsetHeight - 40;
|
|
719
|
+
return Math.floor(T / 40);
|
|
720
720
|
}
|
|
721
|
-
const c =
|
|
722
|
-
let
|
|
723
|
-
const Y = (
|
|
724
|
-
|
|
725
|
-
}, d = () => c.value, se = (
|
|
726
|
-
Y(
|
|
721
|
+
const c = B([]), m = I(() => c.value), u = new St(o.rowKey);
|
|
722
|
+
let F = !1;
|
|
723
|
+
const Y = (p) => {
|
|
724
|
+
F || (u.syncPage(E.value, p), c.value = u.values);
|
|
725
|
+
}, d = () => c.value, se = (p) => {
|
|
726
|
+
Y(p);
|
|
727
727
|
}, ye = () => {
|
|
728
|
-
var
|
|
729
|
-
(i = (
|
|
728
|
+
var p, i;
|
|
729
|
+
(i = (p = h.value) == null ? void 0 : p.tableInstance) == null || i.clearSelection(), c.value = [], u.clear();
|
|
730
730
|
};
|
|
731
|
-
o.selectable &&
|
|
732
|
-
|
|
733
|
-
var y,
|
|
734
|
-
(
|
|
735
|
-
}), await le(),
|
|
731
|
+
o.selectable && Ce(E, async () => {
|
|
732
|
+
F = !0, await le(), u.restorePageSelection(E.value, (p, i) => {
|
|
733
|
+
var y, T;
|
|
734
|
+
(T = (y = h.value) == null ? void 0 : y.tableInstance) == null || T.toggleRowSelection(p, i);
|
|
735
|
+
}), await le(), F = !1;
|
|
736
736
|
});
|
|
737
|
-
function
|
|
738
|
-
const i =
|
|
737
|
+
function Re(p) {
|
|
738
|
+
const i = p.map((T) => T[o.rowKey]), y = he(nt(it(i), (T) => T > 1));
|
|
739
739
|
y.length && console.error(
|
|
740
740
|
"[SearchTable] 表格数据存在重复的 rowKey,将会导致勾选功能异常!",
|
|
741
741
|
y
|
|
742
742
|
);
|
|
743
743
|
}
|
|
744
|
-
return
|
|
744
|
+
return Ke(() => {
|
|
745
745
|
if (!w.value.pageSize) {
|
|
746
|
-
const
|
|
747
|
-
g.value =
|
|
746
|
+
const p = e();
|
|
747
|
+
g.value = p, w.value.pageSize = p;
|
|
748
748
|
}
|
|
749
|
-
|
|
749
|
+
P();
|
|
750
750
|
}), Le(() => {
|
|
751
|
-
|
|
751
|
+
z == null || z.abort();
|
|
752
752
|
}), t({
|
|
753
753
|
/**
|
|
754
754
|
* 刷新当前页
|
|
@@ -757,7 +757,7 @@ const Kt = q({ name: "ri-delete-back2-line", render: Mt }), _t = { class: "flex
|
|
|
757
757
|
/**
|
|
758
758
|
* 已勾选的行
|
|
759
759
|
*/
|
|
760
|
-
selectedRows:
|
|
760
|
+
selectedRows: m,
|
|
761
761
|
/**
|
|
762
762
|
* 获取已勾选的行
|
|
763
763
|
*/
|
|
@@ -766,86 +766,89 @@ const Kt = q({ name: "ri-delete-back2-line", render: Mt }), _t = { class: "flex
|
|
|
766
766
|
* 勾选指定行
|
|
767
767
|
*/
|
|
768
768
|
selectRows: se
|
|
769
|
-
}), (
|
|
769
|
+
}), (p, i) => (s(), x("div", Kt, [
|
|
770
770
|
l.showSearch ? (s(), x("section", Lt, [
|
|
771
|
-
|
|
772
|
-
|
|
771
|
+
$("div", At, [
|
|
772
|
+
C(a(Ee), {
|
|
773
773
|
modelValue: S.value,
|
|
774
774
|
"onUpdate:modelValue": i[0] || (i[0] = (y) => S.value = y),
|
|
775
775
|
modelModifiers: { trim: !0 },
|
|
776
|
-
class: "!w-[260px] flex-shrink-0",
|
|
776
|
+
class: "search-table__search-input !w-[260px] flex-shrink-0",
|
|
777
777
|
placeholder: l.searchInputPlaceholder,
|
|
778
778
|
clearable: "",
|
|
779
|
-
onKeyup: ve(
|
|
780
|
-
onClear:
|
|
779
|
+
onKeyup: ve(K, ["enter"]),
|
|
780
|
+
onClear: K
|
|
781
781
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
782
|
-
ue(
|
|
782
|
+
ue(p.$slots, "search-form", {
|
|
783
783
|
query: j.value,
|
|
784
|
-
search:
|
|
784
|
+
search: K
|
|
785
785
|
}, void 0, !0),
|
|
786
|
-
|
|
786
|
+
C(a(D), {
|
|
787
|
+
class: "search-table__search-button",
|
|
787
788
|
type: "primary",
|
|
788
|
-
onClick:
|
|
789
|
+
onClick: K
|
|
789
790
|
}, {
|
|
790
791
|
default: b(() => [
|
|
791
|
-
|
|
792
|
-
i[6] || (i[6] =
|
|
792
|
+
C(a($t)),
|
|
793
|
+
i[6] || (i[6] = R(" 搜索 ", -1))
|
|
793
794
|
]),
|
|
794
795
|
_: 1
|
|
795
796
|
})
|
|
796
797
|
]),
|
|
797
|
-
ue(
|
|
798
|
-
|
|
799
|
-
l.showAddButton ? (s(),
|
|
798
|
+
ue(p.$slots, "top-center", {}, void 0, !0),
|
|
799
|
+
$("div", Ot, [
|
|
800
|
+
l.showAddButton ? (s(), _(a(D), {
|
|
800
801
|
key: 0,
|
|
802
|
+
class: "search-table__add-button",
|
|
801
803
|
type: "primary",
|
|
802
804
|
onClick: i[1] || (i[1] = (y) => r("add"))
|
|
803
805
|
}, {
|
|
804
806
|
default: b(() => [
|
|
805
|
-
|
|
806
|
-
i[7] || (i[7] =
|
|
807
|
+
C(a(Bt)),
|
|
808
|
+
i[7] || (i[7] = R("新增 ", -1))
|
|
807
809
|
]),
|
|
808
810
|
_: 1
|
|
809
|
-
})) :
|
|
810
|
-
l.showBatchDeleteButton ? (s(),
|
|
811
|
+
})) : H("", !0),
|
|
812
|
+
l.showBatchDeleteButton ? (s(), _(a(D), {
|
|
811
813
|
key: 1,
|
|
814
|
+
class: "search-table__batch-delete-button",
|
|
812
815
|
disabled: !c.value.length,
|
|
813
816
|
type: "danger",
|
|
814
817
|
onClick: i[2] || (i[2] = (y) => r("batch-delete", c.value))
|
|
815
818
|
}, {
|
|
816
819
|
default: b(() => [
|
|
817
|
-
|
|
818
|
-
i[8] || (i[8] =
|
|
820
|
+
C(a(Ht)),
|
|
821
|
+
i[8] || (i[8] = R("批量删除 ", -1))
|
|
819
822
|
]),
|
|
820
823
|
_: 1
|
|
821
|
-
}, 8, ["disabled"])) :
|
|
822
|
-
ue(
|
|
824
|
+
}, 8, ["disabled"])) : H("", !0),
|
|
825
|
+
ue(p.$slots, "btns", {}, void 0, !0)
|
|
823
826
|
])
|
|
824
|
-
])) :
|
|
825
|
-
|
|
826
|
-
class: "flex-1 overflow-hidden",
|
|
827
|
+
])) : H("", !0),
|
|
828
|
+
C(wt, fe({ ref: "proTableRef" }, o, {
|
|
829
|
+
class: "search-table__body flex-1 overflow-hidden",
|
|
827
830
|
"index-offset": J.value,
|
|
828
|
-
data:
|
|
829
|
-
loading:
|
|
831
|
+
data: E.value,
|
|
832
|
+
loading: a(ie),
|
|
830
833
|
"default-sort": {
|
|
831
|
-
prop:
|
|
832
|
-
order:
|
|
834
|
+
prop: a(k).sort,
|
|
835
|
+
order: a(k).order === "asc" ? "ascending" : "descending"
|
|
833
836
|
},
|
|
834
|
-
onApplyFilter:
|
|
837
|
+
onApplyFilter: n,
|
|
835
838
|
onSelectionChange: Y,
|
|
836
839
|
onCellEdit: i[3] || (i[3] = (...y) => r("cell-edit", ...y)),
|
|
837
|
-
onSortChange:
|
|
840
|
+
onSortChange: a(V)
|
|
838
841
|
}), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"]),
|
|
839
|
-
|
|
840
|
-
|
|
842
|
+
$("section", Ut, [
|
|
843
|
+
$("div", Nt, [
|
|
841
844
|
l.selectable ? (s(), x(U, { key: 0 }, [
|
|
842
|
-
|
|
845
|
+
C(a(Ye), { type: "info" }, {
|
|
843
846
|
default: b(() => [
|
|
844
|
-
|
|
847
|
+
R("已选 " + O(c.value.length) + " 条", 1)
|
|
845
848
|
]),
|
|
846
849
|
_: 1
|
|
847
850
|
}),
|
|
848
|
-
c.value.length ? (s(),
|
|
851
|
+
c.value.length ? (s(), _(a(Qe), {
|
|
849
852
|
key: 0,
|
|
850
853
|
content: "清空勾选",
|
|
851
854
|
placement: "top",
|
|
@@ -853,41 +856,41 @@ const Kt = q({ name: "ri-delete-back2-line", render: Mt }), _t = { class: "flex
|
|
|
853
856
|
"hide-after": 0
|
|
854
857
|
}, {
|
|
855
858
|
default: b(() => [
|
|
856
|
-
|
|
859
|
+
C(a(D), {
|
|
857
860
|
type: "danger",
|
|
858
861
|
text: "",
|
|
859
|
-
class: "ml-1 !px-2",
|
|
862
|
+
class: "search-table__clear-selection-button ml-1 !px-2",
|
|
860
863
|
onClick: ye
|
|
861
864
|
}, {
|
|
862
865
|
default: b(() => [
|
|
863
|
-
|
|
866
|
+
C(a(Mt))
|
|
864
867
|
]),
|
|
865
868
|
_: 1
|
|
866
869
|
})
|
|
867
870
|
]),
|
|
868
871
|
_: 1
|
|
869
|
-
})) :
|
|
870
|
-
], 64)) :
|
|
872
|
+
})) : H("", !0)
|
|
873
|
+
], 64)) : H("", !0)
|
|
871
874
|
]),
|
|
872
|
-
|
|
875
|
+
C(a(Je), fe(l.elPaginationProps, {
|
|
873
876
|
"page-size": w.value.pageSize,
|
|
874
877
|
"onUpdate:pageSize": i[4] || (i[4] = (y) => w.value.pageSize = y),
|
|
875
878
|
"current-page": w.value.currPage,
|
|
876
879
|
"onUpdate:currentPage": i[5] || (i[5] = (y) => w.value.currPage = y),
|
|
877
880
|
total: w.value.total,
|
|
878
881
|
background: "",
|
|
879
|
-
"page-sizes":
|
|
882
|
+
"page-sizes": ae.value,
|
|
880
883
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
881
|
-
class: "flex-shrink-0",
|
|
882
|
-
onSizeChange:
|
|
883
|
-
onCurrentChange:
|
|
884
|
+
class: "search-table__pagination flex-shrink-0",
|
|
885
|
+
onSizeChange: P,
|
|
886
|
+
onCurrentChange: P
|
|
884
887
|
}), null, 16, ["page-size", "current-page", "total", "page-sizes"]),
|
|
885
|
-
i[9] || (i[9] =
|
|
888
|
+
i[9] || (i[9] = $("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
|
|
886
889
|
])
|
|
887
890
|
]));
|
|
888
891
|
}
|
|
889
|
-
}),
|
|
892
|
+
}), Jt = /* @__PURE__ */ $e(jt, [["__scopeId", "data-v-4e564d86"]]);
|
|
890
893
|
export {
|
|
891
894
|
wt as ProTable,
|
|
892
|
-
|
|
895
|
+
Jt as SearchTable
|
|
893
896
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.fixed{position:fixed}.\!m-0{margin:0!important}.-mx-3{margin-left:-.75rem;margin-right:-.75rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-\[23px\]{height:23px}.h-full{height:100%}.\!w-\[260px\]{width:260px!important}.w-\[150px\]{width:150px}.w-\[164px\]{width:164px}.w-full{width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-x-0{-moz-column-gap:0px;column-gap:0px}.gap-x-0\.5{-moz-column-gap:.125rem;column-gap:.125rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.border{border-width:1px}.border-t{border-top-width:1px}.\!px-2{padding-left:.5rem!important;padding-right:.5rem!important}.text-\[--el-color-primary\]{color:var(--el-color-primary)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.duration-100{transition-duration:.1s}.hover\:text-\[--el-color-primary\]:hover{color:var(--el-color-primary)}[data-v-476baef5] .pro-table{--el-table-header-bg-color: #f7f8fa;--el-table-header-text-color: var(--el-text-color-regular);--el-table-text-color: var(--el-text-color-primary)}[data-v-476baef5] .pro-table thead th{font-weight:400}[data-v-
|
|
1
|
+
.fixed{position:fixed}.\!m-0{margin:0!important}.-mx-3{margin-left:-.75rem;margin-right:-.75rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-\[23px\]{height:23px}.h-full{height:100%}.\!w-\[260px\]{width:260px!important}.w-\[150px\]{width:150px}.w-\[164px\]{width:164px}.w-full{width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-x-0{-moz-column-gap:0px;column-gap:0px}.gap-x-0\.5{-moz-column-gap:.125rem;column-gap:.125rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.border{border-width:1px}.border-t{border-top-width:1px}.\!px-2{padding-left:.5rem!important;padding-right:.5rem!important}.text-\[--el-color-primary\]{color:var(--el-color-primary)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.duration-100{transition-duration:.1s}.hover\:text-\[--el-color-primary\]:hover{color:var(--el-color-primary)}[data-v-476baef5] .pro-table{--el-table-header-bg-color: #f7f8fa;--el-table-header-text-color: var(--el-text-color-regular);--el-table-text-color: var(--el-text-color-primary)}[data-v-476baef5] .pro-table thead th{font-weight:400}[data-v-4e564d86] .el-table .el-table-column--selection.el-table__cell{display:flex;align-items:center;justify-content:center}[data-v-4e564d86] .el-button>span{gap:0 4px}.el-pagination[data-v-4e564d86] .el-pagination__sizes .el-select{width:110px}
|