@amaoaaaaa/search-table 0.1.3 → 0.2.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/README.md +14 -13
- package/dist/SearchTable/index.vue.d.ts +2 -4
- package/dist/SearchTable/types.d.ts +6 -0
- package/dist/search-table.js +355 -349
- package/dist/style.css +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -103,19 +103,20 @@ const columns = [{ label: '姓名', prop: 'name' }];
|
|
|
103
103
|
|
|
104
104
|
### SearchTable Props
|
|
105
105
|
|
|
106
|
-
| 属性 | 类型 | 默认值 | 说明
|
|
107
|
-
| ------------------------ | ------------------------------------ | ------------------ |
|
|
108
|
-
| `columns` | `ProTableColumn[]` | - | 表格列配置
|
|
109
|
-
| `fetchFn` | `SearchTableFetchFn` | **必填** | 数据请求函数
|
|
110
|
-
| `showSearch` | `boolean` | `true` | 是否显示搜索区域
|
|
111
|
-
| `searchInputPlaceholder` | `string` | `"输入搜索关键词"` | 搜索框占位文本
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
106
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
107
|
+
| ------------------------ | ------------------------------------ | ------------------ | ---------------------------- |
|
|
108
|
+
| `columns` | `ProTableColumn[]` | - | 表格列配置 |
|
|
109
|
+
| `fetchFn` | `SearchTableFetchFn` | **必填** | 数据请求函数 |
|
|
110
|
+
| `showSearch` | `boolean` | `true` | 是否显示搜索区域 |
|
|
111
|
+
| `searchInputPlaceholder` | `string` | `"输入搜索关键词"` | 搜索框占位文本 |
|
|
112
|
+
| `searchField` | `string` | `"search"` | 搜索框绑定到查询参数的字段名 |
|
|
113
|
+
| `showAddButton` | `boolean` | `false` | 是否显示新增按钮 |
|
|
114
|
+
| `showBatchDeleteButton` | `boolean` | `false` | 是否显示批量删除按钮 |
|
|
115
|
+
| `pageSize` | `number` | 自动计算 | 每页条数 |
|
|
116
|
+
| `elPaginationProps` | `Partial<PaginationProps>` | - | 分页组件属性 |
|
|
117
|
+
| `defaultSort` | `SortState` | - | 默认排序 |
|
|
118
|
+
| `selectable` | `boolean \| (row, index) => boolean` | - | 是否可勾选 |
|
|
119
|
+
| `searchParamsHandler` | `(params) => params` | - | 搜索参数处理函数 |
|
|
119
120
|
|
|
120
121
|
### SearchTable Events
|
|
121
122
|
|
|
@@ -9,10 +9,7 @@ declare function __VLS_template(): {
|
|
|
9
9
|
attrs: Partial<{}>;
|
|
10
10
|
slots: {
|
|
11
11
|
'search-form'?(_: {
|
|
12
|
-
query:
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
search: string;
|
|
15
|
-
};
|
|
12
|
+
query: Record<string, any>;
|
|
16
13
|
search: typeof resetToFirstPage;
|
|
17
14
|
}): any;
|
|
18
15
|
'top-center'?(_: {}): any;
|
|
@@ -2007,6 +2004,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
|
2007
2004
|
indexWidth: string | number;
|
|
2008
2005
|
showSearch: boolean;
|
|
2009
2006
|
searchInputPlaceholder: string;
|
|
2007
|
+
searchField: string;
|
|
2010
2008
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
2011
2009
|
proTableRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
2012
2010
|
filterData?: Record<string, any>;
|
package/dist/search-table.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var re = (l, t, f) =>
|
|
4
|
-
import { defineComponent as me, computed as
|
|
5
|
-
import { ElLoading as
|
|
6
|
-
import { isFunction as A, isBoolean as
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var ze = (l, t, f) => t in l ? Be(l, t, { enumerable: !0, configurable: !0, writable: !0, value: f }) : l[t] = f;
|
|
3
|
+
var re = (l, t, f) => ze(l, typeof t != "symbol" ? t + "" : t, f);
|
|
4
|
+
import { defineComponent as me, computed as I, isVNode as Pe, openBlock as s, createBlock as C, resolveDynamicComponent as He, createElementBlock as x, markRaw as q, createElementVNode as V, useModel as Fe, useTemplateRef as Se, ref as z, withDirectives as ee, createVNode as E, unref as n, withCtx as b, createCommentVNode as F, createTextVNode as $, toDisplayString as O, Fragment as U, renderList as te, mergeProps as fe, createSlots as De, isRef as Ce, normalizeClass as Me, toValue as ge, withModifiers as oe, withKeys as ve, normalizeStyle as be, mergeModels as xe, reactive as he, nextTick as le, toRef as Ke, watch as Ee, onMounted as _e, 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 M, ElInput as Te, 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 pe, merge as et, isEqual as tt, sortBy as lt, uniq as nt, pickBy as at, countBy as it } from "lodash-es";
|
|
7
7
|
import { vTextEllipsis as ce } from "@amaoaaaaa/v-text-ellipsis";
|
|
8
|
-
import { isCancel as
|
|
9
|
-
const
|
|
8
|
+
import { isCancel as Re } from "axios";
|
|
9
|
+
const st = ["innerHTML"], rt = /* @__PURE__ */ me({
|
|
10
10
|
__name: "RenderFormatterResult",
|
|
11
11
|
props: {
|
|
12
12
|
col: {},
|
|
@@ -15,24 +15,24 @@ const at = ["innerHTML"], it = /* @__PURE__ */ me({
|
|
|
15
15
|
index: {}
|
|
16
16
|
},
|
|
17
17
|
setup(l) {
|
|
18
|
-
const t = l, f =
|
|
18
|
+
const t = l, f = I(() => {
|
|
19
19
|
var r, p;
|
|
20
|
-
const
|
|
21
|
-
return (p = (r = t.col).formatter) == null ? void 0 : p.call(r, t.row, t.column,
|
|
20
|
+
const o = t.col.prop ? t.row[t.col.prop] : void 0;
|
|
21
|
+
return (p = (r = t.col).formatter) == null ? void 0 : p.call(r, t.row, t.column, o, t.index);
|
|
22
22
|
});
|
|
23
|
-
return (
|
|
23
|
+
return (o, r) => Pe(f.value) ? (s(), C(He(f.value), { key: 0 })) : (s(), x("span", {
|
|
24
24
|
key: 1,
|
|
25
25
|
innerHTML: f.value
|
|
26
|
-
}, null, 8,
|
|
26
|
+
}, null, 8, st));
|
|
27
27
|
}
|
|
28
|
-
}),
|
|
28
|
+
}), ot = {
|
|
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 ut(l, t) {
|
|
34
|
+
return s(), x("svg", ot, [...t[0] || (t[0] = [
|
|
35
|
+
V("path", {
|
|
36
36
|
fill: "none",
|
|
37
37
|
stroke: "currentColor",
|
|
38
38
|
"stroke-linecap": "round",
|
|
@@ -42,14 +42,14 @@ function rt(l, t) {
|
|
|
42
42
|
}, null, -1)
|
|
43
43
|
])]);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const dt = q({ name: "tabler-filter", render: ut }), ct = {
|
|
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 ft(l, t) {
|
|
51
|
+
return s(), x("svg", ct, [...t[0] || (t[0] = [
|
|
52
|
+
V("path", {
|
|
53
53
|
fill: "none",
|
|
54
54
|
stroke: "currentColor",
|
|
55
55
|
"stroke-linecap": "round",
|
|
@@ -59,12 +59,12 @@ function dt(l, t) {
|
|
|
59
59
|
}, null, -1)
|
|
60
60
|
])]);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const vt = q({ name: "tabler-filter-check", render: ft }), pt = { "element-loading-text": "加载中..." }, mt = { class: "flex justify-center" }, ht = { class: "-mx-3 flex w-[150px] items-center justify-evenly" }, yt = {
|
|
63
63
|
key: 0,
|
|
64
64
|
class: "h-[23px]"
|
|
65
|
-
},
|
|
65
|
+
}, gt = ["onDblclick"], bt = { key: 1 }, xt = /* @__PURE__ */ me({
|
|
66
66
|
__name: "index",
|
|
67
|
-
props: /* @__PURE__ */
|
|
67
|
+
props: /* @__PURE__ */ xe({
|
|
68
68
|
data: {},
|
|
69
69
|
columns: {},
|
|
70
70
|
rowKey: { default: "id" },
|
|
@@ -79,46 +79,46 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
79
79
|
},
|
|
80
80
|
filterDataModifiers: {}
|
|
81
81
|
}),
|
|
82
|
-
emits: /* @__PURE__ */
|
|
82
|
+
emits: /* @__PURE__ */ xe(["applyFilter", "selectionChange", "cell-edit"], ["update:filterData"]),
|
|
83
83
|
setup(l, { expose: t, emit: f }) {
|
|
84
|
-
const
|
|
84
|
+
const o = Ae.directive, r = l, p = Fe(l, "filterData"), k = f, B = Se("elTableRef"), g = z({}), w = z({});
|
|
85
85
|
function ne(a) {
|
|
86
|
-
g.value[a] =
|
|
86
|
+
g.value[a] = Q(p.value[a]);
|
|
87
87
|
}
|
|
88
88
|
function ae(a) {
|
|
89
|
-
g.value[a] =
|
|
89
|
+
g.value[a] = Q(p.value[a]);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
g.value[a] = void 0, p.value[a] = void 0,
|
|
91
|
+
function J(a, v, e) {
|
|
92
|
+
g.value[a] = void 0, p.value[a] = void 0, N(a, v, e);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
p.value[a] = g.value[a],
|
|
94
|
+
function N(a, v, e) {
|
|
95
|
+
p.value[a] = g.value[a], w.value[a] = !1, k("applyFilter", {
|
|
96
96
|
col: e,
|
|
97
97
|
prop: a,
|
|
98
|
-
type:
|
|
98
|
+
type: v,
|
|
99
99
|
value: p.value[a],
|
|
100
100
|
filterData: p.value
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
const e = A(a.actions) ? a.actions(
|
|
105
|
-
return e == null ? void 0 : e.map((
|
|
106
|
-
const
|
|
107
|
-
return { ...
|
|
108
|
-
}).filter((
|
|
103
|
+
function j(a, v) {
|
|
104
|
+
const e = A(a.actions) ? a.actions(v) : a.actions;
|
|
105
|
+
return e == null ? void 0 : e.map((c) => {
|
|
106
|
+
const h = A(c.visibility) ? c.visibility(v) : c.visibility ?? !0;
|
|
107
|
+
return { ...c, visibility: h };
|
|
108
|
+
}).filter((c) => c.visibility !== !1);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function S(a) {
|
|
111
111
|
return a.filterFieldName ?? a.prop;
|
|
112
112
|
}
|
|
113
|
-
function K(a,
|
|
113
|
+
function K(a, v) {
|
|
114
114
|
return {
|
|
115
115
|
color: a.text.includes("删除") ? "var(--el-color-danger)" : "",
|
|
116
|
-
visibility:
|
|
116
|
+
visibility: ke(v) ? void 0 : v
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
function
|
|
121
|
-
|
|
119
|
+
const T = z([]);
|
|
120
|
+
function W() {
|
|
121
|
+
T.value = Array.from(
|
|
122
122
|
{ length: r.data.length },
|
|
123
123
|
() => Array.from({ length: r.columns.length }, () => ({
|
|
124
124
|
editing: !1,
|
|
@@ -127,47 +127,47 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
127
127
|
}))
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
return A(a.editable) ? a.editable(
|
|
130
|
+
function ie(a, v) {
|
|
131
|
+
return A(a.editable) ? a.editable(v) : a.editable ?? !1;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
var
|
|
137
|
-
(
|
|
133
|
+
function P(a, v, e) {
|
|
134
|
+
const c = T.value[a][v];
|
|
135
|
+
c && (c.value = e, c.editing = !0, le(() => {
|
|
136
|
+
var h;
|
|
137
|
+
(h = c.inputRef) == null || h.focus();
|
|
138
138
|
}));
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
143
|
-
|
|
144
|
-
const e = a.newValue,
|
|
145
|
-
e !==
|
|
140
|
+
function H(a) {
|
|
141
|
+
const v = T.value[a.rowIndex][a.colIndex];
|
|
142
|
+
if (!v) return;
|
|
143
|
+
v.editing = !1;
|
|
144
|
+
const e = a.newValue, c = a.row[a.prop];
|
|
145
|
+
e !== c && (a.row[a.prop] = e, k("cell-edit", a));
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const e =
|
|
147
|
+
function _(a, v) {
|
|
148
|
+
const e = T.value[a][v];
|
|
149
149
|
e && (e.editing = !1);
|
|
150
150
|
}
|
|
151
151
|
return t({
|
|
152
152
|
tableInstance: B,
|
|
153
|
-
resetCells:
|
|
154
|
-
}), (a,
|
|
155
|
-
E(n(
|
|
153
|
+
resetCells: W
|
|
154
|
+
}), (a, v) => ee((s(), x("section", pt, [
|
|
155
|
+
E(n(Oe), {
|
|
156
156
|
ref: "elTableRef",
|
|
157
157
|
data: l.data,
|
|
158
158
|
border: "",
|
|
159
159
|
class: "pro-table",
|
|
160
160
|
height: "100%",
|
|
161
161
|
"row-key": l.rowKey,
|
|
162
|
-
onSelectionChange:
|
|
162
|
+
onSelectionChange: v[1] || (v[1] = (e) => k("selectionChange", e))
|
|
163
163
|
}, {
|
|
164
|
-
default:
|
|
164
|
+
default: b(() => [
|
|
165
165
|
l.selectable ? (s(), C(n(de), {
|
|
166
166
|
key: 0,
|
|
167
167
|
type: "selection",
|
|
168
168
|
width: "55",
|
|
169
169
|
selectable: n(A)(l.selectable) ? l.selectable : void 0
|
|
170
|
-
}, null, 8, ["selectable"])) :
|
|
170
|
+
}, null, 8, ["selectable"])) : F("", !0),
|
|
171
171
|
l.showIndex ? (s(), C(n(de), {
|
|
172
172
|
key: 1,
|
|
173
173
|
class: "index-cell",
|
|
@@ -175,62 +175,62 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
175
175
|
width: l.indexWidth,
|
|
176
176
|
label: "序号"
|
|
177
177
|
}, {
|
|
178
|
-
default:
|
|
178
|
+
default: b(({ $index: e }) => [
|
|
179
179
|
$(O(e + 1 + (l.indexOffset || 0)), 1)
|
|
180
180
|
]),
|
|
181
181
|
_: 1
|
|
182
|
-
}, 8, ["width"])) :
|
|
183
|
-
(s(!0),
|
|
182
|
+
}, 8, ["width"])) : F("", !0),
|
|
183
|
+
(s(!0), x(U, null, te(l.columns, (e, c) => (s(), C(n(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
|
+
}), De({ _: 2 }, [
|
|
187
|
+
e.filterable ?? (e.filterType || e.filterOptions || Ce(e.filterOptions)) ? {
|
|
188
188
|
name: "header",
|
|
189
|
-
fn:
|
|
190
|
-
|
|
191
|
-
class:
|
|
192
|
-
"text-[--el-color-primary]":
|
|
189
|
+
fn: b(({ column: h }) => [
|
|
190
|
+
V("span", {
|
|
191
|
+
class: Me(["inline-flex items-center", {
|
|
192
|
+
"text-[--el-color-primary]": S(e) && p.value[S(e)] !== void 0
|
|
193
193
|
}])
|
|
194
194
|
}, [
|
|
195
|
-
|
|
195
|
+
S(e) ? (s(), C(n(Ue), {
|
|
196
196
|
key: 0,
|
|
197
|
-
visible:
|
|
198
|
-
"onUpdate:visible": (
|
|
197
|
+
visible: w.value[S(e)],
|
|
198
|
+
"onUpdate:visible": (u) => w.value[S(e)] = u,
|
|
199
199
|
placement: "bottom",
|
|
200
200
|
trigger: "click",
|
|
201
201
|
"hide-after": 0,
|
|
202
202
|
"show-after": 0,
|
|
203
203
|
width: e.filterPopoverWidth ?? (e.filterType === "datetimerange" ? 424 : void 0),
|
|
204
204
|
"popper-class": "reset",
|
|
205
|
-
onShow: (
|
|
206
|
-
onHide: (
|
|
205
|
+
onShow: (u) => ne(S(e)),
|
|
206
|
+
onHide: (u) => ae(S(e))
|
|
207
207
|
}, {
|
|
208
|
-
reference:
|
|
209
|
-
|
|
208
|
+
reference: b(() => [
|
|
209
|
+
V("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: v[0] || (v[0] = oe(() => {
|
|
212
212
|
}, ["stop"]))
|
|
213
213
|
}, [
|
|
214
|
-
$(O(
|
|
215
|
-
p.value[
|
|
214
|
+
$(O(h.label) + " ", 1),
|
|
215
|
+
p.value[S(e)] !== void 0 ? (s(), C(n(vt), { key: 0 })) : (s(), C(n(dt), { key: 1 }))
|
|
216
216
|
])
|
|
217
217
|
]),
|
|
218
|
-
default:
|
|
219
|
-
!e.filterType || e.filterType === "radio" ? (s(), C(n(
|
|
218
|
+
default: b(() => [
|
|
219
|
+
!e.filterType || e.filterType === "radio" ? (s(), C(n(we), {
|
|
220
220
|
key: 0,
|
|
221
221
|
always: "",
|
|
222
222
|
"max-height": "34vh"
|
|
223
223
|
}, {
|
|
224
|
-
default:
|
|
225
|
-
E(n(
|
|
226
|
-
modelValue: g.value[
|
|
227
|
-
"onUpdate:modelValue": (
|
|
224
|
+
default: b(() => [
|
|
225
|
+
E(n(Ne), {
|
|
226
|
+
modelValue: g.value[S(e)],
|
|
227
|
+
"onUpdate:modelValue": (u) => g.value[S(e)] = u
|
|
228
228
|
}, {
|
|
229
|
-
default:
|
|
230
|
-
(s(!0),
|
|
231
|
-
key:
|
|
232
|
-
value:
|
|
233
|
-
label:
|
|
229
|
+
default: b(() => [
|
|
230
|
+
(s(!0), x(U, null, te(ge(e.filterOptions), (u) => (s(), C(n(je), {
|
|
231
|
+
key: u.value.toString(),
|
|
232
|
+
value: u.value,
|
|
233
|
+
label: u.label,
|
|
234
234
|
class: "!m-0 w-full"
|
|
235
235
|
}, null, 8, ["value", "label"]))), 128))
|
|
236
236
|
]),
|
|
@@ -238,21 +238,21 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
238
238
|
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
239
239
|
]),
|
|
240
240
|
_: 2
|
|
241
|
-
}, 1024)) : e.filterType === "checkbox" ? (s(), C(n(
|
|
241
|
+
}, 1024)) : e.filterType === "checkbox" ? (s(), C(n(we), {
|
|
242
242
|
key: 1,
|
|
243
243
|
always: "",
|
|
244
244
|
"max-height": "34vh"
|
|
245
245
|
}, {
|
|
246
|
-
default:
|
|
247
|
-
E(n(
|
|
248
|
-
modelValue: g.value[
|
|
249
|
-
"onUpdate:modelValue": (
|
|
246
|
+
default: b(() => [
|
|
247
|
+
E(n(We), {
|
|
248
|
+
modelValue: g.value[S(e)],
|
|
249
|
+
"onUpdate:modelValue": (u) => g.value[S(e)] = u
|
|
250
250
|
}, {
|
|
251
|
-
default:
|
|
252
|
-
(s(!0),
|
|
253
|
-
key:
|
|
254
|
-
value:
|
|
255
|
-
label:
|
|
251
|
+
default: b(() => [
|
|
252
|
+
(s(!0), x(U, null, te(ge(e.filterOptions), (u) => (s(), C(n(Ge), {
|
|
253
|
+
key: u.value.toString(),
|
|
254
|
+
value: u.value,
|
|
255
|
+
label: u.label,
|
|
256
256
|
class: "!m-0 w-full"
|
|
257
257
|
}, null, 8, ["value", "label"]))), 128))
|
|
258
258
|
]),
|
|
@@ -260,46 +260,46 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
260
260
|
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
261
261
|
]),
|
|
262
262
|
_: 2
|
|
263
|
-
}, 1024)) : e.filterType === "datetimerange" ? (s(), C(n(
|
|
263
|
+
}, 1024)) : e.filterType === "datetimerange" ? (s(), C(n(Ie), {
|
|
264
264
|
key: 2,
|
|
265
|
-
modelValue: g.value[
|
|
266
|
-
"onUpdate:modelValue": (
|
|
265
|
+
modelValue: g.value[S(e)],
|
|
266
|
+
"onUpdate:modelValue": (u) => g.value[S(e)] = u,
|
|
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
|
-
E(n(
|
|
273
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : F("", !0),
|
|
274
|
+
v[4] || (v[4] = V("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
|
|
275
|
+
V("div", mt, [
|
|
276
|
+
V("div", ht, [
|
|
277
|
+
E(n(M), {
|
|
278
278
|
type: "primary",
|
|
279
279
|
plain: "",
|
|
280
280
|
size: "small",
|
|
281
|
-
onClick: (
|
|
282
|
-
|
|
281
|
+
onClick: (u) => J(
|
|
282
|
+
S(e),
|
|
283
283
|
e.filterType || "radio",
|
|
284
284
|
e
|
|
285
285
|
)
|
|
286
286
|
}, {
|
|
287
|
-
default:
|
|
287
|
+
default: b(() => [...v[2] || (v[2] = [
|
|
288
288
|
$("重置", -1)
|
|
289
289
|
])]),
|
|
290
290
|
_: 1
|
|
291
291
|
}, 8, ["onClick"]),
|
|
292
|
-
E(n(
|
|
292
|
+
E(n(M), {
|
|
293
293
|
type: "primary",
|
|
294
294
|
size: "small",
|
|
295
295
|
class: "!m-0",
|
|
296
|
-
onClick: (
|
|
297
|
-
|
|
296
|
+
onClick: (u) => N(
|
|
297
|
+
S(e),
|
|
298
298
|
e.filterType || "radio",
|
|
299
299
|
e
|
|
300
300
|
)
|
|
301
301
|
}, {
|
|
302
|
-
default:
|
|
302
|
+
default: b(() => [...v[3] || (v[3] = [
|
|
303
303
|
$("确定", -1)
|
|
304
304
|
])]),
|
|
305
305
|
_: 1
|
|
@@ -308,20 +308,20 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "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"])) : F("", !0)
|
|
312
312
|
], 2)
|
|
313
313
|
]),
|
|
314
314
|
key: "0"
|
|
315
315
|
} : void 0,
|
|
316
316
|
e.formatter ? {
|
|
317
317
|
name: "default",
|
|
318
|
-
fn:
|
|
319
|
-
|
|
320
|
-
E(
|
|
318
|
+
fn: b(({ row: h, column: u, $index: D }) => [
|
|
319
|
+
ee((s(), x("div", null, [
|
|
320
|
+
E(rt, {
|
|
321
321
|
col: e,
|
|
322
|
-
row:
|
|
323
|
-
column:
|
|
324
|
-
index:
|
|
322
|
+
row: h,
|
|
323
|
+
column: u,
|
|
324
|
+
index: D
|
|
325
325
|
}, null, 8, ["col", "row", "column", "index"])
|
|
326
326
|
])), [
|
|
327
327
|
[n(ce), e.truncate ?? !0]
|
|
@@ -330,90 +330,90 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
330
330
|
key: "1"
|
|
331
331
|
} : {
|
|
332
332
|
name: "default",
|
|
333
|
-
fn:
|
|
334
|
-
var
|
|
333
|
+
fn: b(({ row: h, $index: u }) => {
|
|
334
|
+
var D, Y;
|
|
335
335
|
return [
|
|
336
|
-
e.prop ? (s(),
|
|
337
|
-
|
|
338
|
-
(
|
|
336
|
+
e.prop ? (s(), x("div", yt, [
|
|
337
|
+
ie(e, h) ? (s(), x(U, { key: 0 }, [
|
|
338
|
+
(Y = (D = T.value[u]) == null ? void 0 : D[c]) != null && Y.editing ? (s(), C(n(Te), {
|
|
339
339
|
key: 0,
|
|
340
340
|
ref_for: !0,
|
|
341
|
-
ref: (
|
|
342
|
-
modelValue:
|
|
343
|
-
"onUpdate:modelValue": (
|
|
341
|
+
ref: (d) => T.value[u][c].inputRef = d,
|
|
342
|
+
modelValue: T.value[u][c].value,
|
|
343
|
+
"onUpdate:modelValue": (d) => T.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: (
|
|
349
|
-
rowIndex:
|
|
350
|
-
colIndex:
|
|
351
|
-
row:
|
|
348
|
+
onBlur: (d) => H({
|
|
349
|
+
rowIndex: u,
|
|
350
|
+
colIndex: c,
|
|
351
|
+
row: h,
|
|
352
352
|
prop: e.prop,
|
|
353
|
-
oldValue:
|
|
354
|
-
newValue:
|
|
353
|
+
oldValue: h[e.prop],
|
|
354
|
+
newValue: T.value[u][c].value
|
|
355
355
|
}),
|
|
356
356
|
onKeydown: [
|
|
357
|
-
ve(oe((
|
|
358
|
-
rowIndex:
|
|
359
|
-
colIndex:
|
|
360
|
-
row:
|
|
357
|
+
ve(oe((d) => H({
|
|
358
|
+
rowIndex: u,
|
|
359
|
+
colIndex: c,
|
|
360
|
+
row: h,
|
|
361
361
|
prop: e.prop,
|
|
362
|
-
oldValue:
|
|
363
|
-
newValue:
|
|
362
|
+
oldValue: h[e.prop],
|
|
363
|
+
newValue: T.value[u][c].value
|
|
364
364
|
}), ["stop", "prevent"]), ["enter"]),
|
|
365
|
-
ve(oe((
|
|
365
|
+
ve(oe((d) => _(u, c), ["stop", "prevent"]), ["esc"])
|
|
366
366
|
]
|
|
367
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) :
|
|
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: (
|
|
370
|
+
onDblclick: (d) => P(u, c, h[e.prop])
|
|
371
371
|
}, [
|
|
372
|
-
$(O(
|
|
373
|
-
], 40,
|
|
372
|
+
$(O(h[e.prop]), 1)
|
|
373
|
+
], 40, gt)), [
|
|
374
374
|
[n(ce), e.truncate ?? !0]
|
|
375
375
|
])
|
|
376
|
-
], 64)) :
|
|
377
|
-
$(O(
|
|
376
|
+
], 64)) : ee((s(), x("div", bt, [
|
|
377
|
+
$(O(h[e.prop]), 1)
|
|
378
378
|
])), [
|
|
379
379
|
[n(ce), e.truncate ?? !0]
|
|
380
380
|
])
|
|
381
|
-
])) :
|
|
382
|
-
(s(!0),
|
|
383
|
-
key:
|
|
381
|
+
])) : F("", !0),
|
|
382
|
+
(s(!0), x(U, null, te(j(e, h), (d) => (s(), x(U, {
|
|
383
|
+
key: d.text
|
|
384
384
|
}, [
|
|
385
|
-
|
|
385
|
+
d.text === "删除" || d.confirmText ? (s(), C(n(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: n(
|
|
391
|
-
onConfirm: (se) =>
|
|
390
|
+
title: n(ke)(d.confirmText) ? `是否确认${d.text}?` : n(A)(d.confirmText) ? d.confirmText(h) : d.confirmText ?? `是否确认${d.text}?`,
|
|
391
|
+
onConfirm: (se) => d.visibility === "hidden" ? void 0 : d.handler(h)
|
|
392
392
|
}, {
|
|
393
|
-
reference:
|
|
394
|
-
E(n(
|
|
393
|
+
reference: b(() => [
|
|
394
|
+
E(n(M), {
|
|
395
395
|
link: "",
|
|
396
|
-
type:
|
|
397
|
-
style:
|
|
398
|
-
disabled: n(A)(
|
|
396
|
+
type: d.type ?? "primary",
|
|
397
|
+
style: be(K(d, d.visibility)),
|
|
398
|
+
disabled: n(A)(d.disabled) ? d.disabled(h) : d.disabled
|
|
399
399
|
}, {
|
|
400
|
-
default:
|
|
401
|
-
$(O(
|
|
400
|
+
default: b(() => [
|
|
401
|
+
$(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(), C(n(
|
|
407
|
+
}, 1032, ["title", "onConfirm"])) : (s(), C(n(M), {
|
|
408
408
|
key: 1,
|
|
409
409
|
link: "",
|
|
410
|
-
type:
|
|
411
|
-
style:
|
|
412
|
-
disabled: n(A)(
|
|
413
|
-
onClick: (se) =>
|
|
410
|
+
type: d.type ?? "primary",
|
|
411
|
+
style: be(K(d, d.visibility)),
|
|
412
|
+
disabled: n(A)(d.disabled) ? d.disabled(h) : d.disabled,
|
|
413
|
+
onClick: (se) => d.visibility === "hidden" ? void 0 : d.handler(h)
|
|
414
414
|
}, {
|
|
415
|
-
default:
|
|
416
|
-
$(O(
|
|
415
|
+
default: b(() => [
|
|
416
|
+
$(O(d.text), 1)
|
|
417
417
|
]),
|
|
418
418
|
_: 2
|
|
419
419
|
}, 1032, ["type", "style", "disabled", "onClick"]))
|
|
@@ -427,27 +427,27 @@ const ct = G({ name: "tabler-filter-check", render: dt }), ft = { "element-loadi
|
|
|
427
427
|
_: 1
|
|
428
428
|
}, 8, ["data", "row-key"])
|
|
429
429
|
])), [
|
|
430
|
-
[n(
|
|
430
|
+
[n(o), l.loading]
|
|
431
431
|
]);
|
|
432
432
|
}
|
|
433
|
-
}),
|
|
433
|
+
}), Ve = (l, t) => {
|
|
434
434
|
const f = l.__vccOpts || l;
|
|
435
|
-
for (const [
|
|
436
|
-
f[
|
|
435
|
+
for (const [o, r] of t)
|
|
436
|
+
f[o] = r;
|
|
437
437
|
return f;
|
|
438
|
-
},
|
|
439
|
-
function
|
|
440
|
-
var t, f,
|
|
441
|
-
if (
|
|
438
|
+
}, wt = /* @__PURE__ */ Ve(xt, [["__scopeId", "data-v-476baef5"]]);
|
|
439
|
+
function kt(l) {
|
|
440
|
+
var t, f, o, r, p, k, B;
|
|
441
|
+
if (Ze(l))
|
|
442
442
|
return l.includes("database") || l.includes("java.sql.") ? "接口异常" : l;
|
|
443
|
-
if (
|
|
443
|
+
if (Re(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")
|
|
447
447
|
return "网络连接断开,请检查网络设置";
|
|
448
448
|
if (l.response) {
|
|
449
|
-
const g = l.response.status,
|
|
450
|
-
if (
|
|
449
|
+
const g = l.response.status, w = l.response.data;
|
|
450
|
+
if (w && w.message) return w.message;
|
|
451
451
|
switch (g) {
|
|
452
452
|
case 400:
|
|
453
453
|
return "请求参数错误 (400)";
|
|
@@ -467,9 +467,9 @@ function xt(l) {
|
|
|
467
467
|
return `网络异常 (${g})`;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
return l instanceof SyntaxError ? "数据解析异常" : l instanceof TypeError ? "程序运行异常" : l instanceof Object && ((r = (
|
|
470
|
+
return l instanceof SyntaxError ? "数据解析异常" : l instanceof TypeError ? "程序运行异常" : l instanceof Object && ((r = (o = l[(f = pe(l)) == null ? void 0 : f[0]]) == null ? void 0 : o[0]) != null && r.message) ? (B = (k = l[(p = pe(l)) == null ? void 0 : p[0]]) == null ? void 0 : k[0]) == null ? void 0 : B.message : l.message || "未知错误";
|
|
471
471
|
}
|
|
472
|
-
class
|
|
472
|
+
class St {
|
|
473
473
|
/**
|
|
474
474
|
* 实例化 SelectionStore
|
|
475
475
|
*
|
|
@@ -520,9 +520,9 @@ class wt {
|
|
|
520
520
|
* @param selected 当前页勾选行
|
|
521
521
|
*/
|
|
522
522
|
syncPage(t, f) {
|
|
523
|
-
const
|
|
523
|
+
const o = new Set(f.map((r) => r[this.rowKey]));
|
|
524
524
|
t.forEach((r) => {
|
|
525
|
-
|
|
525
|
+
o.has(r[this.rowKey]) || this.map.delete(r[this.rowKey]);
|
|
526
526
|
}), f.forEach((r) => this.map.set(r[this.rowKey], r));
|
|
527
527
|
}
|
|
528
528
|
/**
|
|
@@ -531,108 +531,108 @@ class wt {
|
|
|
531
531
|
* @param toggleFn el-table toggleRowSelection
|
|
532
532
|
*/
|
|
533
533
|
restorePageSelection(t, f) {
|
|
534
|
-
t.forEach((
|
|
535
|
-
Object.hasOwn(
|
|
534
|
+
t.forEach((o) => {
|
|
535
|
+
Object.hasOwn(o, this.rowKey) || console.error(
|
|
536
536
|
"[SelectionStore]",
|
|
537
537
|
`表格数据缺少配置的 rowKey 属性:'${this.rowKey}'`
|
|
538
|
-
), this.map.has(
|
|
538
|
+
), this.map.has(o[this.rowKey]) && f(o, !0);
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
let
|
|
544
|
-
|
|
545
|
-
const p = z(
|
|
546
|
-
let
|
|
542
|
+
function Ct(l, t, f) {
|
|
543
|
+
let o, r;
|
|
544
|
+
Ce(l) ? (o = l, r = t) : (o = Ke(l, t), r = 300);
|
|
545
|
+
const p = z(o.value);
|
|
546
|
+
let k = null;
|
|
547
547
|
const B = () => {
|
|
548
|
-
|
|
548
|
+
k !== null && (clearTimeout(k), k = null);
|
|
549
549
|
};
|
|
550
|
-
return
|
|
551
|
-
|
|
550
|
+
return Ee(
|
|
551
|
+
o,
|
|
552
552
|
(g) => {
|
|
553
|
-
g ? (B(),
|
|
553
|
+
g ? (B(), k = setTimeout(() => {
|
|
554
554
|
p.value = !0;
|
|
555
555
|
}, r)) : (B(), p.value = !1);
|
|
556
556
|
},
|
|
557
557
|
{ immediate: !1 }
|
|
558
558
|
), p;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
560
|
+
function Et({ defaultSort: l, fetchFn: t, onReset: f }) {
|
|
561
|
+
const o = et(
|
|
562
562
|
{
|
|
563
563
|
order: "",
|
|
564
564
|
sort: ""
|
|
565
565
|
},
|
|
566
566
|
l
|
|
567
|
-
), r = he(
|
|
568
|
-
let p =
|
|
569
|
-
function
|
|
567
|
+
), r = he(Q(o));
|
|
568
|
+
let p = Q(r);
|
|
569
|
+
function k({
|
|
570
570
|
prop: B,
|
|
571
571
|
order: g
|
|
572
572
|
}) {
|
|
573
|
-
g ? (r.sort = B || "", r.order = g === "ascending" ? "asc" : "desc", t()) : (r.sort =
|
|
573
|
+
g ? (r.sort = B || "", r.order = g === "ascending" ? "asc" : "desc", t()) : (r.sort = o.sort, r.order = o.order, tt(r, p) && (r.order = r.order === "asc" ? "desc" : "asc"), f ? f() : t()), p = Q(r);
|
|
574
574
|
}
|
|
575
575
|
return {
|
|
576
576
|
sortState: r,
|
|
577
|
-
onSortChange:
|
|
577
|
+
onSortChange: k
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
|
-
const
|
|
580
|
+
const Tt = {
|
|
581
581
|
viewBox: "0 0 24 24",
|
|
582
582
|
width: "1.2em",
|
|
583
583
|
height: "1.2em"
|
|
584
584
|
};
|
|
585
|
-
function
|
|
586
|
-
return s(),
|
|
587
|
-
|
|
585
|
+
function Rt(l, t) {
|
|
586
|
+
return s(), x("svg", Tt, [...t[0] || (t[0] = [
|
|
587
|
+
V("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 Vt = q({ name: "ri-search-line", render: Rt }), $t = {
|
|
594
594
|
viewBox: "0 0 24 24",
|
|
595
595
|
width: "1.2em",
|
|
596
596
|
height: "1.2em"
|
|
597
597
|
};
|
|
598
|
-
function
|
|
599
|
-
return s(),
|
|
600
|
-
|
|
598
|
+
function Bt(l, t) {
|
|
599
|
+
return s(), x("svg", $t, [...t[0] || (t[0] = [
|
|
600
|
+
V("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 zt = q({ name: "ri-add-line", render: Bt }), Pt = {
|
|
607
607
|
viewBox: "0 0 24 24",
|
|
608
608
|
width: "1.2em",
|
|
609
609
|
height: "1.2em"
|
|
610
610
|
};
|
|
611
|
-
function
|
|
612
|
-
return s(),
|
|
613
|
-
|
|
611
|
+
function Ht(l, t) {
|
|
612
|
+
return s(), x("svg", Pt, [...t[0] || (t[0] = [
|
|
613
|
+
V("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 Ft = q({ name: "ri-delete-bin-line", render: Ht }), Dt = {
|
|
620
620
|
viewBox: "0 0 24 24",
|
|
621
621
|
width: "1.2em",
|
|
622
622
|
height: "1.2em"
|
|
623
623
|
};
|
|
624
|
-
function
|
|
625
|
-
return s(),
|
|
626
|
-
|
|
624
|
+
function Mt(l, t) {
|
|
625
|
+
return s(), x("svg", Dt, [...t[0] || (t[0] = [
|
|
626
|
+
V("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 Kt = q({ name: "ri-delete-back2-line", render: Mt }), _t = { class: "flex h-full flex-col" }, Lt = {
|
|
633
633
|
key: 0,
|
|
634
634
|
class: "mb-6 flex flex-shrink-0 items-center justify-between"
|
|
635
|
-
},
|
|
635
|
+
}, At = { class: "flex items-center gap-x-3" }, Ot = { class: "mt-5 flex flex-shrink-0 items-center justify-between" }, Ut = { class: "flex w-[164px] items-center" }, Nt = /* @__PURE__ */ me({
|
|
636
636
|
__name: "index",
|
|
637
637
|
props: {
|
|
638
638
|
columns: {},
|
|
@@ -644,6 +644,7 @@ const Ft = G({ name: "ri-delete-back2-line", render: Dt }), Mt = { class: "flex
|
|
|
644
644
|
loading: { type: Boolean },
|
|
645
645
|
showSearch: { type: Boolean, default: !0 },
|
|
646
646
|
searchInputPlaceholder: { default: "输入搜索关键词" },
|
|
647
|
+
searchField: { default: "search" },
|
|
647
648
|
showAddButton: { type: Boolean },
|
|
648
649
|
showBatchDeleteButton: { type: Boolean },
|
|
649
650
|
pageSize: {},
|
|
@@ -654,118 +655,123 @@ const Ft = G({ name: "ri-delete-back2-line", render: Dt }), Mt = { class: "flex
|
|
|
654
655
|
},
|
|
655
656
|
emits: ["add", "batch-delete", "cell-edit"],
|
|
656
657
|
setup(l, { expose: t, emit: f }) {
|
|
657
|
-
const
|
|
658
|
-
defaultSort:
|
|
659
|
-
fetchFn:
|
|
658
|
+
const o = l, r = f, p = Se("proTableRef"), { sortState: k, onSortChange: B } = Et({
|
|
659
|
+
defaultSort: o.defaultSort,
|
|
660
|
+
fetchFn: H,
|
|
660
661
|
onReset() {
|
|
661
|
-
var y,
|
|
662
|
-
const
|
|
663
|
-
|
|
662
|
+
var y, R;
|
|
663
|
+
const m = k.sort, i = k.order === "asc" ? "ascending" : "descending";
|
|
664
|
+
o.columns.some((G) => G.prop === m) ? (R = (y = p.value) == null ? void 0 : y.tableInstance) == null || R.sort(m, i) : H();
|
|
664
665
|
}
|
|
665
|
-
}), g = z(
|
|
666
|
+
}), g = z(o.pageSize ?? 0), w = z({
|
|
666
667
|
pageSize: g.value,
|
|
667
668
|
currPage: 1,
|
|
668
669
|
total: 0
|
|
669
|
-
}), ne =
|
|
670
|
-
|
|
671
|
-
}),
|
|
670
|
+
}), ne = I(() => lt(nt([g.value, 10, 20, 30, 40, 50, 100]))), ae = I(() => (w.value.currPage - 1) * w.value.pageSize), J = z(0), N = I(() => o.searchField ?? "search"), j = z({
|
|
671
|
+
[N.value]: ""
|
|
672
|
+
}), S = I({
|
|
673
|
+
get: () => j.value[N.value] ?? "",
|
|
674
|
+
set: (m) => {
|
|
675
|
+
j.value[N.value] = m;
|
|
676
|
+
}
|
|
677
|
+
}), K = he({}), T = z([]), W = z(!1), ie = Ct(W, 100);
|
|
672
678
|
let P = null;
|
|
673
|
-
async function
|
|
674
|
-
P == null || P.abort(), P = new AbortController(),
|
|
675
|
-
const
|
|
679
|
+
async function H() {
|
|
680
|
+
P == null || P.abort(), P = new AbortController(), W.value = !0;
|
|
681
|
+
const m = ae.value;
|
|
676
682
|
try {
|
|
677
683
|
const i = {
|
|
678
|
-
...
|
|
679
|
-
...
|
|
680
|
-
...
|
|
681
|
-
limit:
|
|
682
|
-
offset:
|
|
683
|
-
}, y =
|
|
684
|
+
...j.value,
|
|
685
|
+
...K,
|
|
686
|
+
...k,
|
|
687
|
+
limit: w.value.pageSize,
|
|
688
|
+
offset: m
|
|
689
|
+
}, y = o.searchParamsHandler ? o.searchParamsHandler(i) : i, { data: R = [], totalCount: G } = await o.fetchFn(y, {
|
|
684
690
|
signal: P.signal
|
|
685
691
|
});
|
|
686
|
-
|
|
687
|
-
var L,
|
|
688
|
-
(
|
|
689
|
-
}),
|
|
692
|
+
T.value = R, J.value = m, w.value.total = G, await le(() => {
|
|
693
|
+
var L, X, Z;
|
|
694
|
+
(X = (L = p.value) == null ? void 0 : L.tableInstance) == null || X.setScrollTop(0), (Z = p.value) == null || Z.resetCells();
|
|
695
|
+
}), o.selectable && $e(R);
|
|
690
696
|
} catch (i) {
|
|
691
|
-
if (
|
|
692
|
-
console.error("[SearchTable] 获取数据失败", i),
|
|
697
|
+
if (Re(i)) return;
|
|
698
|
+
console.error("[SearchTable] 获取数据失败", i), Xe.error("表格数据加载失败:" + kt(i));
|
|
693
699
|
}
|
|
694
|
-
|
|
700
|
+
W.value = !1;
|
|
695
701
|
}
|
|
696
702
|
function _() {
|
|
697
|
-
|
|
703
|
+
w.value.currPage = 1, H();
|
|
698
704
|
}
|
|
699
|
-
function
|
|
700
|
-
if (
|
|
701
|
-
const [
|
|
702
|
-
|
|
705
|
+
function a({ type: m, value: i, prop: y, col: R }) {
|
|
706
|
+
if (m === "datetimerange") {
|
|
707
|
+
const [G = `${y}Start`, L = `${y}End`] = R.datetimerangeFilterFieldNames || [], [X, Z] = i || [];
|
|
708
|
+
K[G] = X, K[L] = Z;
|
|
703
709
|
} else
|
|
704
|
-
|
|
710
|
+
K[y] = i;
|
|
705
711
|
_();
|
|
706
712
|
}
|
|
707
|
-
const
|
|
708
|
-
|
|
713
|
+
const v = async () => {
|
|
714
|
+
W.value || (ye(), await H());
|
|
709
715
|
};
|
|
710
|
-
function
|
|
716
|
+
function e() {
|
|
711
717
|
var L;
|
|
712
|
-
const
|
|
713
|
-
return Math.floor(
|
|
718
|
+
const R = ((L = p.value) == null ? void 0 : L.$el).offsetHeight - 40;
|
|
719
|
+
return Math.floor(R / 40);
|
|
714
720
|
}
|
|
715
|
-
const
|
|
716
|
-
let
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
},
|
|
720
|
-
|
|
721
|
-
},
|
|
722
|
-
var
|
|
723
|
-
(i = (
|
|
721
|
+
const c = z([]), h = I(() => c.value), u = new St(o.rowKey);
|
|
722
|
+
let D = !1;
|
|
723
|
+
const Y = (m) => {
|
|
724
|
+
D || (u.syncPage(T.value, m), c.value = u.values);
|
|
725
|
+
}, d = () => c.value, se = (m) => {
|
|
726
|
+
Y(m);
|
|
727
|
+
}, ye = () => {
|
|
728
|
+
var m, i;
|
|
729
|
+
(i = (m = p.value) == null ? void 0 : m.tableInstance) == null || i.clearSelection(), c.value = [], u.clear();
|
|
724
730
|
};
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
var y,
|
|
728
|
-
(
|
|
729
|
-
}), await le(),
|
|
731
|
+
o.selectable && Ee(T, async () => {
|
|
732
|
+
D = !0, await le(), u.restorePageSelection(T.value, (m, i) => {
|
|
733
|
+
var y, R;
|
|
734
|
+
(R = (y = p.value) == null ? void 0 : y.tableInstance) == null || R.toggleRowSelection(m, i);
|
|
735
|
+
}), await le(), D = !1;
|
|
730
736
|
});
|
|
731
|
-
function
|
|
732
|
-
const i =
|
|
737
|
+
function $e(m) {
|
|
738
|
+
const i = m.map((R) => R[o.rowKey]), y = pe(at(it(i), (R) => R > 1));
|
|
733
739
|
y.length && console.error(
|
|
734
740
|
"[SearchTable] 表格数据存在重复的 rowKey,将会导致勾选功能异常!",
|
|
735
741
|
y
|
|
736
742
|
);
|
|
737
743
|
}
|
|
738
|
-
return
|
|
739
|
-
if (!
|
|
740
|
-
const
|
|
741
|
-
g.value =
|
|
744
|
+
return _e(() => {
|
|
745
|
+
if (!w.value.pageSize) {
|
|
746
|
+
const m = e();
|
|
747
|
+
g.value = m, w.value.pageSize = m;
|
|
742
748
|
}
|
|
743
|
-
|
|
744
|
-
}),
|
|
749
|
+
H();
|
|
750
|
+
}), Le(() => {
|
|
745
751
|
P == null || P.abort();
|
|
746
752
|
}), t({
|
|
747
753
|
/**
|
|
748
754
|
* 刷新当前页
|
|
749
755
|
*/
|
|
750
|
-
refresh:
|
|
756
|
+
refresh: v,
|
|
751
757
|
/**
|
|
752
758
|
* 已勾选的行
|
|
753
759
|
*/
|
|
754
|
-
selectedRows:
|
|
760
|
+
selectedRows: h,
|
|
755
761
|
/**
|
|
756
762
|
* 获取已勾选的行
|
|
757
763
|
*/
|
|
758
|
-
getSelectionRows:
|
|
764
|
+
getSelectionRows: d,
|
|
759
765
|
/**
|
|
760
766
|
* 勾选指定行
|
|
761
767
|
*/
|
|
762
|
-
selectRows:
|
|
763
|
-
}), (
|
|
764
|
-
l.showSearch ? (s(),
|
|
765
|
-
|
|
766
|
-
E(n(
|
|
767
|
-
modelValue:
|
|
768
|
-
"onUpdate:modelValue": i[0] || (i[0] = (y) =>
|
|
768
|
+
selectRows: se
|
|
769
|
+
}), (m, i) => (s(), x("div", _t, [
|
|
770
|
+
l.showSearch ? (s(), x("section", Lt, [
|
|
771
|
+
V("div", At, [
|
|
772
|
+
E(n(Te), {
|
|
773
|
+
modelValue: S.value,
|
|
774
|
+
"onUpdate:modelValue": i[0] || (i[0] = (y) => S.value = y),
|
|
769
775
|
modelModifiers: { trim: !0 },
|
|
770
776
|
class: "!w-[260px] flex-shrink-0",
|
|
771
777
|
placeholder: l.searchInputPlaceholder,
|
|
@@ -773,115 +779,115 @@ const Ft = G({ name: "ri-delete-back2-line", render: Dt }), Mt = { class: "flex
|
|
|
773
779
|
onKeyup: ve(_, ["enter"]),
|
|
774
780
|
onClear: _
|
|
775
781
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
776
|
-
ue(
|
|
777
|
-
query:
|
|
782
|
+
ue(m.$slots, "search-form", {
|
|
783
|
+
query: j.value,
|
|
778
784
|
search: _
|
|
779
785
|
}, void 0, !0),
|
|
780
|
-
E(n(
|
|
786
|
+
E(n(M), {
|
|
781
787
|
type: "primary",
|
|
782
788
|
onClick: _
|
|
783
789
|
}, {
|
|
784
|
-
default:
|
|
785
|
-
E(n(
|
|
790
|
+
default: b(() => [
|
|
791
|
+
E(n(Vt)),
|
|
786
792
|
i[6] || (i[6] = $(" 搜索 ", -1))
|
|
787
793
|
]),
|
|
788
794
|
_: 1
|
|
789
795
|
})
|
|
790
796
|
]),
|
|
791
|
-
ue(
|
|
792
|
-
|
|
793
|
-
l.showAddButton ? (s(), C(n(
|
|
797
|
+
ue(m.$slots, "top-center", {}, void 0, !0),
|
|
798
|
+
V("div", null, [
|
|
799
|
+
l.showAddButton ? (s(), C(n(M), {
|
|
794
800
|
key: 0,
|
|
795
801
|
type: "primary",
|
|
796
802
|
onClick: i[1] || (i[1] = (y) => r("add"))
|
|
797
803
|
}, {
|
|
798
|
-
default:
|
|
799
|
-
E(n(
|
|
804
|
+
default: b(() => [
|
|
805
|
+
E(n(zt)),
|
|
800
806
|
i[7] || (i[7] = $("新增 ", -1))
|
|
801
807
|
]),
|
|
802
808
|
_: 1
|
|
803
|
-
})) :
|
|
804
|
-
l.showBatchDeleteButton ? (s(), C(n(
|
|
809
|
+
})) : F("", !0),
|
|
810
|
+
l.showBatchDeleteButton ? (s(), C(n(M), {
|
|
805
811
|
key: 1,
|
|
806
|
-
disabled: !
|
|
812
|
+
disabled: !c.value.length,
|
|
807
813
|
type: "danger",
|
|
808
|
-
onClick: i[2] || (i[2] = (y) => r("batch-delete",
|
|
814
|
+
onClick: i[2] || (i[2] = (y) => r("batch-delete", c.value))
|
|
809
815
|
}, {
|
|
810
|
-
default:
|
|
811
|
-
E(n(
|
|
816
|
+
default: b(() => [
|
|
817
|
+
E(n(Ft)),
|
|
812
818
|
i[8] || (i[8] = $("批量删除 ", -1))
|
|
813
819
|
]),
|
|
814
820
|
_: 1
|
|
815
|
-
}, 8, ["disabled"])) :
|
|
816
|
-
ue(
|
|
821
|
+
}, 8, ["disabled"])) : F("", !0),
|
|
822
|
+
ue(m.$slots, "btns", {}, void 0, !0)
|
|
817
823
|
])
|
|
818
|
-
])) :
|
|
819
|
-
E(
|
|
824
|
+
])) : F("", !0),
|
|
825
|
+
E(wt, fe({ ref: "proTableRef" }, o, {
|
|
820
826
|
class: "flex-1 overflow-hidden",
|
|
821
|
-
"index-offset":
|
|
822
|
-
data:
|
|
823
|
-
loading: n(
|
|
827
|
+
"index-offset": J.value,
|
|
828
|
+
data: T.value,
|
|
829
|
+
loading: n(ie),
|
|
824
830
|
"default-sort": {
|
|
825
|
-
prop: n(
|
|
826
|
-
order: n(
|
|
831
|
+
prop: n(k).sort,
|
|
832
|
+
order: n(k).order === "asc" ? "ascending" : "descending"
|
|
827
833
|
},
|
|
828
|
-
onApplyFilter:
|
|
829
|
-
onSelectionChange:
|
|
834
|
+
onApplyFilter: a,
|
|
835
|
+
onSelectionChange: Y,
|
|
830
836
|
onCellEdit: i[3] || (i[3] = (...y) => r("cell-edit", ...y)),
|
|
831
837
|
onSortChange: n(B)
|
|
832
838
|
}), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"]),
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
l.selectable ? (s(),
|
|
836
|
-
E(n(
|
|
837
|
-
default:
|
|
838
|
-
$("已选 " + O(
|
|
839
|
+
V("section", Ot, [
|
|
840
|
+
V("div", Ut, [
|
|
841
|
+
l.selectable ? (s(), x(U, { key: 0 }, [
|
|
842
|
+
E(n(Ye), { type: "info" }, {
|
|
843
|
+
default: b(() => [
|
|
844
|
+
$("已选 " + O(c.value.length) + " 条", 1)
|
|
839
845
|
]),
|
|
840
846
|
_: 1
|
|
841
847
|
}),
|
|
842
|
-
|
|
848
|
+
c.value.length ? (s(), C(n(Qe), {
|
|
843
849
|
key: 0,
|
|
844
850
|
content: "清空勾选",
|
|
845
851
|
placement: "top",
|
|
846
852
|
effect: "dark",
|
|
847
853
|
"hide-after": 0
|
|
848
854
|
}, {
|
|
849
|
-
default:
|
|
850
|
-
E(n(
|
|
855
|
+
default: b(() => [
|
|
856
|
+
E(n(M), {
|
|
851
857
|
type: "danger",
|
|
852
858
|
text: "",
|
|
853
859
|
class: "ml-1 !px-2",
|
|
854
|
-
onClick:
|
|
860
|
+
onClick: ye
|
|
855
861
|
}, {
|
|
856
|
-
default:
|
|
857
|
-
E(n(
|
|
862
|
+
default: b(() => [
|
|
863
|
+
E(n(Kt))
|
|
858
864
|
]),
|
|
859
865
|
_: 1
|
|
860
866
|
})
|
|
861
867
|
]),
|
|
862
868
|
_: 1
|
|
863
|
-
})) :
|
|
864
|
-
], 64)) :
|
|
869
|
+
})) : F("", !0)
|
|
870
|
+
], 64)) : F("", !0)
|
|
865
871
|
]),
|
|
866
|
-
E(n(
|
|
867
|
-
"page-size":
|
|
868
|
-
"onUpdate:pageSize": i[4] || (i[4] = (y) =>
|
|
869
|
-
"current-page":
|
|
870
|
-
"onUpdate:currentPage": i[5] || (i[5] = (y) =>
|
|
871
|
-
total:
|
|
872
|
+
E(n(Je), fe(l.elPaginationProps, {
|
|
873
|
+
"page-size": w.value.pageSize,
|
|
874
|
+
"onUpdate:pageSize": i[4] || (i[4] = (y) => w.value.pageSize = y),
|
|
875
|
+
"current-page": w.value.currPage,
|
|
876
|
+
"onUpdate:currentPage": i[5] || (i[5] = (y) => w.value.currPage = y),
|
|
877
|
+
total: w.value.total,
|
|
872
878
|
background: "",
|
|
873
879
|
"page-sizes": ne.value,
|
|
874
880
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
875
881
|
class: "flex-shrink-0",
|
|
876
|
-
onSizeChange:
|
|
877
|
-
onCurrentChange:
|
|
882
|
+
onSizeChange: H,
|
|
883
|
+
onCurrentChange: H
|
|
878
884
|
}), null, 16, ["page-size", "current-page", "total", "page-sizes"]),
|
|
879
|
-
i[9] || (i[9] =
|
|
885
|
+
i[9] || (i[9] = V("div", { class: "w-[164px]" }, null, -1))
|
|
880
886
|
])
|
|
881
887
|
]));
|
|
882
888
|
}
|
|
883
|
-
}),
|
|
889
|
+
}), Qt = /* @__PURE__ */ Ve(Nt, [["__scopeId", "data-v-4c5c7ea3"]]);
|
|
884
890
|
export {
|
|
885
|
-
|
|
886
|
-
|
|
891
|
+
wt as ProTable,
|
|
892
|
+
Qt as SearchTable
|
|
887
893
|
};
|
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-4c5c7ea3] .el-table .el-table-column--selection.el-table__cell{display:flex;align-items:center;justify-content:center}[data-v-4c5c7ea3] .el-button>span{gap:0 4px}.el-pagination[data-v-4c5c7ea3] .el-pagination__sizes .el-select{width:110px}
|
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaoaaaaa/search-table",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "基于 Element Plus 的搜索表格组件,支持分页、排序、筛选、跨页勾选等功能",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/amaoaaaaa/search-table#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/amaoaaaaa/search-table.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/amaoaaaaa/search-table/issues"
|
|
14
|
+
},
|
|
7
15
|
"author": "amaoaaaaa",
|
|
8
16
|
"keywords": [
|
|
9
17
|
"vue3",
|