@ys-knife-crud/element-plus 0.0.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 +252 -0
- package/dist/element-plus/src/advancedFilter/advancedConditionGroup.vue.d.ts +29 -0
- package/dist/element-plus/src/advancedFilter/advancedConditionGroup.vue.d.ts.map +1 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterContext.d.ts +45 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterContext.d.ts.map +1 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterPanel.vue.d.ts +117 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterPanel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/advancedFilter/advancedValueEditor.vue.d.ts +86 -0
- package/dist/element-plus/src/advancedFilter/advancedValueEditor.vue.d.ts.map +1 -0
- package/dist/element-plus/src/commandBar/commandBar.vue.d.ts +53 -0
- package/dist/element-plus/src/commandBar/commandBar.vue.d.ts.map +1 -0
- package/dist/element-plus/src/commandBar/tableActionMenuButton.vue.d.ts +28 -0
- package/dist/element-plus/src/commandBar/tableActionMenuButton.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/dateFilterItem.vue.d.ts +81 -0
- package/dist/element-plus/src/filter/dateFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/dateRangeFilterItem.vue.d.ts +92 -0
- package/dist/element-plus/src/filter/dateRangeFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/enumFilterItem.vue.d.ts +120 -0
- package/dist/element-plus/src/filter/enumFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/filterItemLayout.vue.d.ts +55 -0
- package/dist/element-plus/src/filter/filterItemLayout.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/filterPanel.vue.d.ts +185 -0
- package/dist/element-plus/src/filter/filterPanel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/textFilterItem.vue.d.ts +71 -0
- package/dist/element-plus/src/filter/textFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/importExcel/formatCell.d.ts +3 -0
- package/dist/element-plus/src/importExcel/formatCell.d.ts.map +1 -0
- package/dist/element-plus/src/importExcel/importExcel.vue.d.ts +59 -0
- package/dist/element-plus/src/importExcel/importExcel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/importExcel/importRowEditDialog.vue.d.ts +28 -0
- package/dist/element-plus/src/importExcel/importRowEditDialog.vue.d.ts.map +1 -0
- package/dist/element-plus/src/index.d.ts +46 -0
- package/dist/element-plus/src/index.d.ts.map +1 -0
- package/dist/element-plus/src/mainPanel/mainPanel.vue.d.ts +76 -0
- package/dist/element-plus/src/mainPanel/mainPanel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/mainPanel/mainPanelMenuNode.vue.d.ts +7 -0
- package/dist/element-plus/src/mainPanel/mainPanelMenuNode.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/cardView.vue.d.ts +38 -0
- package/dist/element-plus/src/table/cardView.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/columnConfigDialog.vue.d.ts +60 -0
- package/dist/element-plus/src/table/columnConfigDialog.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/contextMenu.vue.d.ts +25 -0
- package/dist/element-plus/src/table/contextMenu.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/exportExcelDialog.vue.d.ts +37 -0
- package/dist/element-plus/src/table/exportExcelDialog.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/listView.vue.d.ts +38 -0
- package/dist/element-plus/src/table/listView.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/rowActionsColumn.vue.d.ts +42 -0
- package/dist/element-plus/src/table/rowActionsColumn.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/selectionBar.vue.d.ts +15 -0
- package/dist/element-plus/src/table/selectionBar.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/table.vue.d.ts +329 -0
- package/dist/element-plus/src/table/table.vue.d.ts.map +1 -0
- package/dist/element-plus/src/tablepage/tablePage.vue.d.ts +406 -0
- package/dist/element-plus/src/tablepage/tablePage.vue.d.ts.map +1 -0
- package/dist/element-plus/src/tablepage/tablePageTypes.d.ts +9 -0
- package/dist/element-plus/src/tablepage/tablePageTypes.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3545 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3545 @@
|
|
|
1
|
+
import { defineComponent as ee, toRef as ve, computed as Q, resolveComponent as w, openBlock as n, createElementBlock as v, Fragment as N, createVNode as c, isRef as Ce, unref as i, withCtx as o, createElementVNode as p, renderList as Z, createBlock as h, createTextVNode as C, toDisplayString as P, createCommentVNode as M, resolveDynamicComponent as Te, normalizeClass as Se, renderSlot as le, Teleport as $t, withModifiers as rt, normalizeStyle as it, ref as I, onMounted as Fe, watch as me, useSlots as Vt, onBeforeUnmount as je, createSlots as Be, Transition as Ft, resolveDirective as ut, withDirectives as Je, mergeProps as Xe, inject as dt, provide as ct, withKeys as Ke, nextTick as He, shallowRef as Rt, normalizeProps as Qe, guardReactiveProps as Ee, createStaticVNode as lt } from "vue";
|
|
2
|
+
import { useExportExcel as At, useCustomConfig as Mt, visibleActions as Ze, isEnabled as pt, useDefault as Pt, useSelection as Bt, useRowActions as Dt, filterNodesByKeyword as zt, collectGroupKeys as Qt, useMainPanelNodes as Et, useMainPanelTabs as Tt, findNode as nt, isGroupNode as ot, useAdvancedFilter as mt, useFilterPanel as It, FilterPanelKey as ft, useTextFilterItem as Yt, useDateFilterItem as Nt, useDateRangeFilterItem as qt, useEnumFilterItem as Ot, useImportExcel as Ut } from "@ys-knife-crud/vue";
|
|
3
|
+
import { ElMessage as fe, ElMessageBox as vt } from "element-plus";
|
|
4
|
+
import { isConditionGroup as et, OPERATOR_LABELS as Lt, isNullOperator as Ht, emptyFilter as tt } from "@ys-knife-crud/core";
|
|
5
|
+
import { fromArray as lo, fromBool as no, fromObjectItems as oo, fromOptions as ao } from "@ys-knife-crud/core";
|
|
6
|
+
import at from "dayjs";
|
|
7
|
+
import './index.css';const Kt = { class: "export-options" }, jt = { class: "export-progress-text" }, Gt = { class: "export-cancelled-text" }, Wt = /* @__PURE__ */ ee({
|
|
8
|
+
__name: "exportExcelDialog",
|
|
9
|
+
props: {
|
|
10
|
+
dataFun: { type: Function },
|
|
11
|
+
exportSelected: { type: Boolean },
|
|
12
|
+
exportorFunc: { type: Function },
|
|
13
|
+
tableName: {},
|
|
14
|
+
columns: {},
|
|
15
|
+
currentRows: {},
|
|
16
|
+
selectedRows: {},
|
|
17
|
+
total: {},
|
|
18
|
+
exportPageSize: {},
|
|
19
|
+
hasMorePage: { type: Boolean }
|
|
20
|
+
},
|
|
21
|
+
setup(e, { expose: f }) {
|
|
22
|
+
const t = e, {
|
|
23
|
+
exportOptions: l,
|
|
24
|
+
exportDialogVisible: a,
|
|
25
|
+
exporting: k,
|
|
26
|
+
exportFetched: u,
|
|
27
|
+
exportTotal: A,
|
|
28
|
+
exportTotalKnown: y,
|
|
29
|
+
exportEtaSeconds: x,
|
|
30
|
+
exportPercent: S,
|
|
31
|
+
exportCancelledVisible: B,
|
|
32
|
+
exportCancelledRows: U,
|
|
33
|
+
onExportClick: R,
|
|
34
|
+
doExport: b,
|
|
35
|
+
cancelExport: _,
|
|
36
|
+
keepPartialExport: q,
|
|
37
|
+
discardPartialExport: T
|
|
38
|
+
} = At({
|
|
39
|
+
props: t,
|
|
40
|
+
// reactive — dataFun/exportSelected/exportorFunc 自动追踪
|
|
41
|
+
tableName: ve(t, "tableName"),
|
|
42
|
+
columns: ve(t, "columns"),
|
|
43
|
+
currentRows: ve(t, "currentRows"),
|
|
44
|
+
selectedRows: ve(t, "selectedRows"),
|
|
45
|
+
total: ve(t, "total"),
|
|
46
|
+
exportPageSize: ve(t, "exportPageSize"),
|
|
47
|
+
hasMorePage: ve(t, "hasMorePage")
|
|
48
|
+
}), X = Q(() => {
|
|
49
|
+
const j = x.value;
|
|
50
|
+
if (j == null) return null;
|
|
51
|
+
if (j < 60) return `${j} 秒`;
|
|
52
|
+
const r = Math.floor(j / 60), m = j % 60;
|
|
53
|
+
return m > 0 ? `${r} 分 ${m} 秒` : `${r} 分`;
|
|
54
|
+
});
|
|
55
|
+
return f({ openExportDialog: R }), (j, r) => {
|
|
56
|
+
const m = w("el-button"), F = w("el-dialog"), Y = w("el-progress");
|
|
57
|
+
return n(), v(N, null, [
|
|
58
|
+
c(F, {
|
|
59
|
+
modelValue: i(a),
|
|
60
|
+
"onUpdate:modelValue": r[0] || (r[0] = (E) => Ce(a) ? a.value = E : null),
|
|
61
|
+
title: "导出 Excel",
|
|
62
|
+
width: "420px"
|
|
63
|
+
}, {
|
|
64
|
+
default: o(() => [
|
|
65
|
+
p("div", Kt, [
|
|
66
|
+
(n(!0), v(N, null, Z(i(l), (E) => (n(), h(m, {
|
|
67
|
+
key: E.value,
|
|
68
|
+
class: "export-option",
|
|
69
|
+
"data-scope": E.value,
|
|
70
|
+
disabled: E.disabled,
|
|
71
|
+
onClick: (ue) => i(b)(E.value)
|
|
72
|
+
}, {
|
|
73
|
+
default: o(() => [
|
|
74
|
+
C(P(E.label), 1)
|
|
75
|
+
]),
|
|
76
|
+
_: 2
|
|
77
|
+
}, 1032, ["data-scope", "disabled", "onClick"]))), 128))
|
|
78
|
+
])
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
}, 8, ["modelValue"]),
|
|
82
|
+
c(F, {
|
|
83
|
+
modelValue: i(k),
|
|
84
|
+
"onUpdate:modelValue": r[1] || (r[1] = (E) => Ce(k) ? k.value = E : null),
|
|
85
|
+
title: "正在导出",
|
|
86
|
+
width: "420px",
|
|
87
|
+
"close-on-click-modal": !1,
|
|
88
|
+
"show-close": !1
|
|
89
|
+
}, {
|
|
90
|
+
footer: o(() => [
|
|
91
|
+
c(m, {
|
|
92
|
+
class: "export-cancel",
|
|
93
|
+
onClick: i(_)
|
|
94
|
+
}, {
|
|
95
|
+
default: o(() => [...r[4] || (r[4] = [
|
|
96
|
+
C("取消", -1)
|
|
97
|
+
])]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["onClick"])
|
|
100
|
+
]),
|
|
101
|
+
default: o(() => [
|
|
102
|
+
c(Y, { percentage: i(S) }, null, 8, ["percentage"]),
|
|
103
|
+
p("p", jt, [
|
|
104
|
+
C(" 已加载 " + P(i(u)), 1),
|
|
105
|
+
i(y) ? (n(), v(N, { key: 0 }, [
|
|
106
|
+
C(" / " + P(i(A)), 1)
|
|
107
|
+
], 64)) : M("", !0),
|
|
108
|
+
r[3] || (r[3] = C(" 条", -1)),
|
|
109
|
+
X.value ? (n(), v(N, { key: 1 }, [
|
|
110
|
+
C(",预计剩余约 " + P(X.value), 1)
|
|
111
|
+
], 64)) : M("", !0)
|
|
112
|
+
])
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, ["modelValue"]),
|
|
116
|
+
c(F, {
|
|
117
|
+
modelValue: i(B),
|
|
118
|
+
"onUpdate:modelValue": r[2] || (r[2] = (E) => Ce(B) ? B.value = E : null),
|
|
119
|
+
title: "导出已取消",
|
|
120
|
+
width: "420px"
|
|
121
|
+
}, {
|
|
122
|
+
footer: o(() => [
|
|
123
|
+
c(m, {
|
|
124
|
+
class: "export-discard",
|
|
125
|
+
onClick: i(T)
|
|
126
|
+
}, {
|
|
127
|
+
default: o(() => [...r[5] || (r[5] = [
|
|
128
|
+
C("丢弃", -1)
|
|
129
|
+
])]),
|
|
130
|
+
_: 1
|
|
131
|
+
}, 8, ["onClick"]),
|
|
132
|
+
c(m, {
|
|
133
|
+
class: "export-keep",
|
|
134
|
+
type: "primary",
|
|
135
|
+
onClick: i(q)
|
|
136
|
+
}, {
|
|
137
|
+
default: o(() => [...r[6] || (r[6] = [
|
|
138
|
+
C("保留部分文件", -1)
|
|
139
|
+
])]),
|
|
140
|
+
_: 1
|
|
141
|
+
}, 8, ["onClick"])
|
|
142
|
+
]),
|
|
143
|
+
default: o(() => [
|
|
144
|
+
p("p", Gt, " 已写入 " + P(i(U)) + " 条数据,是否保留已导出的部分文件? ", 1)
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["modelValue"])
|
|
148
|
+
], 64);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}), ae = (e, f) => {
|
|
152
|
+
const t = e.__vccOpts || e;
|
|
153
|
+
for (const [l, a] of f)
|
|
154
|
+
t[l] = a;
|
|
155
|
+
return t;
|
|
156
|
+
}, Jt = /* @__PURE__ */ ae(Wt, [["__scopeId", "data-v-06458805"]]), Xt = /* @__PURE__ */ ee({
|
|
157
|
+
__name: "columnConfigDialog",
|
|
158
|
+
props: {
|
|
159
|
+
/** 加载自定义配置(含列设置与用户默认分页大小;返回 null 按空配置处理) */
|
|
160
|
+
loadCustomConfigFun: { type: Function, required: !1 },
|
|
161
|
+
/** 保存自定义配置(含列设置与用户默认分页大小) */
|
|
162
|
+
saveCustomConfigFun: { type: Function, required: !1 },
|
|
163
|
+
/** 列元数据(候选列取 meta 中 showForDisplay=true 的列) */
|
|
164
|
+
meta: { type: Object, default: null }
|
|
165
|
+
},
|
|
166
|
+
setup(e, { expose: f }) {
|
|
167
|
+
const t = e, l = {
|
|
168
|
+
get loadCustomConfigFun() {
|
|
169
|
+
return t.loadCustomConfigFun;
|
|
170
|
+
},
|
|
171
|
+
get saveCustomConfigFun() {
|
|
172
|
+
return t.saveCustomConfigFun;
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
// 字段(状态 + 派生)
|
|
176
|
+
columns: a,
|
|
177
|
+
customConfigLoading: k,
|
|
178
|
+
defaultPageSize: u,
|
|
179
|
+
configDialogVisible: A,
|
|
180
|
+
draftColumns: y,
|
|
181
|
+
// 函数
|
|
182
|
+
loadCustomConfigs: x,
|
|
183
|
+
updateDefaultPageSize: S,
|
|
184
|
+
updateColumnWidth: B,
|
|
185
|
+
openConfigDialog: U,
|
|
186
|
+
moveDraft: R,
|
|
187
|
+
resetDraft: b,
|
|
188
|
+
saveConfigDialog: _
|
|
189
|
+
} = Mt(l, ve(t, "meta"));
|
|
190
|
+
return f({
|
|
191
|
+
// 字段
|
|
192
|
+
columns: a,
|
|
193
|
+
defaultPageSize: u,
|
|
194
|
+
customConfigLoading: k,
|
|
195
|
+
// 函数
|
|
196
|
+
updateDefaultPageSize: S,
|
|
197
|
+
updateColumnWidth: B,
|
|
198
|
+
loadCustomConfigs: x,
|
|
199
|
+
openDialog: U
|
|
200
|
+
}), (q, T) => {
|
|
201
|
+
const X = w("el-checkbox"), j = w("el-input"), r = w("el-button"), m = w("el-dialog");
|
|
202
|
+
return n(), h(m, {
|
|
203
|
+
modelValue: i(A),
|
|
204
|
+
"onUpdate:modelValue": T[1] || (T[1] = (F) => Ce(A) ? A.value = F : null),
|
|
205
|
+
title: "列设置",
|
|
206
|
+
width: "480px"
|
|
207
|
+
}, {
|
|
208
|
+
footer: o(() => [
|
|
209
|
+
c(r, { onClick: i(b) }, {
|
|
210
|
+
default: o(() => [...T[4] || (T[4] = [
|
|
211
|
+
C("重置", -1)
|
|
212
|
+
])]),
|
|
213
|
+
_: 1
|
|
214
|
+
}, 8, ["onClick"]),
|
|
215
|
+
c(r, {
|
|
216
|
+
onClick: T[0] || (T[0] = (F) => A.value = !1)
|
|
217
|
+
}, {
|
|
218
|
+
default: o(() => [...T[5] || (T[5] = [
|
|
219
|
+
C("取消", -1)
|
|
220
|
+
])]),
|
|
221
|
+
_: 1
|
|
222
|
+
}),
|
|
223
|
+
c(r, {
|
|
224
|
+
type: "primary",
|
|
225
|
+
class: "col-config-save",
|
|
226
|
+
onClick: i(_)
|
|
227
|
+
}, {
|
|
228
|
+
default: o(() => [...T[6] || (T[6] = [
|
|
229
|
+
C("保存", -1)
|
|
230
|
+
])]),
|
|
231
|
+
_: 1
|
|
232
|
+
}, 8, ["onClick"])
|
|
233
|
+
]),
|
|
234
|
+
default: o(() => [
|
|
235
|
+
(n(!0), v(N, null, Z(i(y), (F, Y) => (n(), v("div", {
|
|
236
|
+
key: F.propertyPath,
|
|
237
|
+
class: "col-config-row"
|
|
238
|
+
}, [
|
|
239
|
+
c(X, {
|
|
240
|
+
modelValue: F.visible,
|
|
241
|
+
"onUpdate:modelValue": (E) => F.visible = E,
|
|
242
|
+
class: "col-config-name"
|
|
243
|
+
}, {
|
|
244
|
+
default: o(() => [
|
|
245
|
+
C(P(F.displayName), 1)
|
|
246
|
+
]),
|
|
247
|
+
_: 2
|
|
248
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"]),
|
|
249
|
+
c(j, {
|
|
250
|
+
modelValue: F.width,
|
|
251
|
+
"onUpdate:modelValue": (E) => F.width = E,
|
|
252
|
+
class: "col-config-width",
|
|
253
|
+
placeholder: "宽度(如 120)",
|
|
254
|
+
size: "small"
|
|
255
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
256
|
+
c(r, {
|
|
257
|
+
link: "",
|
|
258
|
+
type: "primary",
|
|
259
|
+
disabled: Y === 0,
|
|
260
|
+
onClick: (E) => i(R)(Y, -1)
|
|
261
|
+
}, {
|
|
262
|
+
default: o(() => [...T[2] || (T[2] = [
|
|
263
|
+
C("上移", -1)
|
|
264
|
+
])]),
|
|
265
|
+
_: 1
|
|
266
|
+
}, 8, ["disabled", "onClick"]),
|
|
267
|
+
c(r, {
|
|
268
|
+
link: "",
|
|
269
|
+
type: "primary",
|
|
270
|
+
disabled: Y === i(y).length - 1,
|
|
271
|
+
onClick: (E) => i(R)(Y, 1)
|
|
272
|
+
}, {
|
|
273
|
+
default: o(() => [...T[3] || (T[3] = [
|
|
274
|
+
C(" 下移 ", -1)
|
|
275
|
+
])]),
|
|
276
|
+
_: 1
|
|
277
|
+
}, 8, ["disabled", "onClick"])
|
|
278
|
+
]))), 128))
|
|
279
|
+
]),
|
|
280
|
+
_: 1
|
|
281
|
+
}, 8, ["modelValue"]);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}), Zt = /* @__PURE__ */ ae(Xt, [["__scopeId", "data-v-a6f853c4"]]), el = /* @__PURE__ */ ee({
|
|
285
|
+
__name: "rowActionsColumn",
|
|
286
|
+
props: {
|
|
287
|
+
/** 行操作列表(由 Table 的 useRowActions 加载);为空时不渲染操作列 */
|
|
288
|
+
actions: { type: Array, required: !0, default: () => [] },
|
|
289
|
+
/** 当前表格实例(TableApi),传给 action.execute(row, table) 供行操作完成后调用 reload 等刷新 */
|
|
290
|
+
table: { type: Object, required: !0 },
|
|
291
|
+
/** 操作列宽是否可拖动(跟随表格的列宽拖动开关),默认 true */
|
|
292
|
+
resizable: { type: Boolean, default: !0 }
|
|
293
|
+
},
|
|
294
|
+
setup(e) {
|
|
295
|
+
const f = e, t = Q(
|
|
296
|
+
() => f.actions.length === 0 ? void 0 : f.actions.length * 34 + (f.actions.length - 1) * 12 + 30
|
|
297
|
+
);
|
|
298
|
+
return (l, a) => {
|
|
299
|
+
const k = w("el-button"), u = w("el-table-column");
|
|
300
|
+
return f.actions.length > 0 ? (n(), h(u, {
|
|
301
|
+
key: 0,
|
|
302
|
+
label: "操作",
|
|
303
|
+
fixed: "right",
|
|
304
|
+
"min-width": t.value,
|
|
305
|
+
resizable: f.resizable
|
|
306
|
+
}, {
|
|
307
|
+
default: o(({ row: A }) => [
|
|
308
|
+
(n(!0), v(N, null, Z(i(Ze)(f.actions, A), (y) => (n(), h(k, {
|
|
309
|
+
key: y.name,
|
|
310
|
+
link: "",
|
|
311
|
+
type: y.type ?? "primary",
|
|
312
|
+
disabled: !i(pt)(y, A),
|
|
313
|
+
onClick: (x) => y.execute(A, f.table)
|
|
314
|
+
}, {
|
|
315
|
+
default: o(() => [
|
|
316
|
+
y.icon ? (n(), h(Te(y.icon), {
|
|
317
|
+
key: 0,
|
|
318
|
+
class: "yk-row-action__icon"
|
|
319
|
+
})) : M("", !0),
|
|
320
|
+
C(" " + P(y.desc), 1)
|
|
321
|
+
]),
|
|
322
|
+
_: 2
|
|
323
|
+
}, 1032, ["type", "disabled", "onClick"]))), 128))
|
|
324
|
+
]),
|
|
325
|
+
_: 1
|
|
326
|
+
}, 8, ["min-width", "resizable"])) : M("", !0);
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}), tl = /* @__PURE__ */ ae(el, [["__scopeId", "data-v-cc706c9e"]]), ll = { class: "yk-table__cards" }, nl = ["title", "onContextmenu"], ol = { class: "yk-table__card-json" }, al = /* @__PURE__ */ ee({
|
|
330
|
+
__name: "cardView",
|
|
331
|
+
props: {
|
|
332
|
+
rows: {},
|
|
333
|
+
rowKey: {},
|
|
334
|
+
showCheckbox: { type: Boolean },
|
|
335
|
+
loading: { type: Boolean },
|
|
336
|
+
hasActions: { type: Boolean },
|
|
337
|
+
isSelected: { type: Function }
|
|
338
|
+
},
|
|
339
|
+
emits: ["check", "contextmenu"],
|
|
340
|
+
setup(e, { emit: f }) {
|
|
341
|
+
const t = e, l = f;
|
|
342
|
+
return (a, k) => {
|
|
343
|
+
const u = w("el-checkbox"), A = w("el-empty");
|
|
344
|
+
return n(), v("div", ll, [
|
|
345
|
+
(n(!0), v(N, null, Z(t.rows, (y, x) => (n(), v("div", {
|
|
346
|
+
key: String(y[t.rowKey]),
|
|
347
|
+
class: Se(["yk-table__card", {
|
|
348
|
+
"is-selected": t.showCheckbox && t.isSelected(y),
|
|
349
|
+
"has-actions": t.hasActions
|
|
350
|
+
}]),
|
|
351
|
+
title: t.hasActions ? "右键查看行操作" : void 0,
|
|
352
|
+
onContextmenu: (S) => l("contextmenu", S, y)
|
|
353
|
+
}, [
|
|
354
|
+
t.showCheckbox ? (n(), h(u, {
|
|
355
|
+
key: 0,
|
|
356
|
+
class: "yk-table__card-checkbox",
|
|
357
|
+
"model-value": t.isSelected(y),
|
|
358
|
+
onChange: (S) => l("check", y, S)
|
|
359
|
+
}, null, 8, ["model-value", "onChange"])) : M("", !0),
|
|
360
|
+
le(a.$slots, "default", {
|
|
361
|
+
row: y,
|
|
362
|
+
index: x
|
|
363
|
+
}, () => [
|
|
364
|
+
p("pre", ol, P(JSON.stringify(y, null, 2)), 1)
|
|
365
|
+
], !0)
|
|
366
|
+
], 42, nl))), 128)),
|
|
367
|
+
!t.loading && t.rows.length === 0 ? (n(), v(N, { key: 0 }, [
|
|
368
|
+
a.$slots.empty ? le(a.$slots, "empty", {}, void 0, !0, 0) : (n(), h(A, {
|
|
369
|
+
key: 1,
|
|
370
|
+
description: "暂无数据"
|
|
371
|
+
}))
|
|
372
|
+
], 64)) : M("", !0)
|
|
373
|
+
]);
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
}), sl = /* @__PURE__ */ ae(al, [["__scopeId", "data-v-88966e9a"]]), rl = { class: "yk-table__list" }, il = ["title", "onContextmenu"], ul = { class: "yk-table__list-item-body" }, dl = { class: "yk-table__list-item-json" }, cl = /* @__PURE__ */ ee({
|
|
377
|
+
__name: "listView",
|
|
378
|
+
props: {
|
|
379
|
+
rows: {},
|
|
380
|
+
rowKey: {},
|
|
381
|
+
showCheckbox: { type: Boolean },
|
|
382
|
+
loading: { type: Boolean },
|
|
383
|
+
hasActions: { type: Boolean },
|
|
384
|
+
isSelected: { type: Function }
|
|
385
|
+
},
|
|
386
|
+
emits: ["check", "contextmenu"],
|
|
387
|
+
setup(e, { emit: f }) {
|
|
388
|
+
const t = e, l = f;
|
|
389
|
+
return (a, k) => {
|
|
390
|
+
const u = w("el-checkbox"), A = w("el-empty");
|
|
391
|
+
return n(), v("div", rl, [
|
|
392
|
+
(n(!0), v(N, null, Z(t.rows, (y, x) => (n(), v("div", {
|
|
393
|
+
key: String(y[t.rowKey]),
|
|
394
|
+
class: Se(["yk-table__list-item", {
|
|
395
|
+
"is-selected": t.showCheckbox && t.isSelected(y),
|
|
396
|
+
"has-actions": t.hasActions
|
|
397
|
+
}]),
|
|
398
|
+
title: t.hasActions ? "右键查看行操作" : void 0,
|
|
399
|
+
onContextmenu: (S) => l("contextmenu", S, y)
|
|
400
|
+
}, [
|
|
401
|
+
t.showCheckbox ? (n(), h(u, {
|
|
402
|
+
key: 0,
|
|
403
|
+
class: "yk-table__list-item-checkbox",
|
|
404
|
+
"model-value": t.isSelected(y),
|
|
405
|
+
onChange: (S) => l("check", y, S)
|
|
406
|
+
}, null, 8, ["model-value", "onChange"])) : M("", !0),
|
|
407
|
+
p("div", ul, [
|
|
408
|
+
le(a.$slots, "default", {
|
|
409
|
+
row: y,
|
|
410
|
+
index: x
|
|
411
|
+
}, () => [
|
|
412
|
+
p("pre", dl, P(JSON.stringify(y, null, 2)), 1)
|
|
413
|
+
], !0)
|
|
414
|
+
])
|
|
415
|
+
], 42, il))), 128)),
|
|
416
|
+
!t.loading && t.rows.length === 0 ? (n(), v(N, { key: 0 }, [
|
|
417
|
+
a.$slots.empty ? le(a.$slots, "empty", {}, void 0, !0, 0) : (n(), h(A, {
|
|
418
|
+
key: 1,
|
|
419
|
+
description: "暂无数据"
|
|
420
|
+
}))
|
|
421
|
+
], 64)) : M("", !0)
|
|
422
|
+
]);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}), pl = /* @__PURE__ */ ae(cl, [["__scopeId", "data-v-0488eb89"]]), ml = ["onClick"], fl = /* @__PURE__ */ ee({
|
|
426
|
+
__name: "contextMenu",
|
|
427
|
+
props: {
|
|
428
|
+
menu: {},
|
|
429
|
+
actions: {},
|
|
430
|
+
isEnabled: { type: Function }
|
|
431
|
+
},
|
|
432
|
+
emits: ["close", "select"],
|
|
433
|
+
setup(e, { emit: f }) {
|
|
434
|
+
const t = e, l = f;
|
|
435
|
+
return (a, k) => (n(), h($t, { to: "body" }, [
|
|
436
|
+
t.menu ? (n(), v(N, { key: 0 }, [
|
|
437
|
+
p("div", {
|
|
438
|
+
class: "yk-table__menu-mask",
|
|
439
|
+
onClick: k[0] || (k[0] = (u) => l("close")),
|
|
440
|
+
onContextmenu: k[1] || (k[1] = rt((u) => l("close"), ["prevent"]))
|
|
441
|
+
}, null, 32),
|
|
442
|
+
p("ul", {
|
|
443
|
+
class: "yk-table__context-menu",
|
|
444
|
+
style: it({ left: `${t.menu.x}px`, top: `${t.menu.y}px` })
|
|
445
|
+
}, [
|
|
446
|
+
(n(!0), v(N, null, Z(t.actions, (u) => (n(), v("li", {
|
|
447
|
+
key: u.name,
|
|
448
|
+
class: Se(["yk-table__context-menu-item", { "is-disabled": !t.isEnabled(u, t.menu.row) }]),
|
|
449
|
+
onClick: (A) => t.isEnabled(u, t.menu.row) && l("select", u)
|
|
450
|
+
}, [
|
|
451
|
+
u.icon ? (n(), h(Te(u.icon), {
|
|
452
|
+
key: 0,
|
|
453
|
+
class: "yk-table__context-menu-icon"
|
|
454
|
+
})) : M("", !0),
|
|
455
|
+
C(" " + P(u.desc), 1)
|
|
456
|
+
], 10, ml))), 128))
|
|
457
|
+
], 4)
|
|
458
|
+
], 64)) : M("", !0)
|
|
459
|
+
]));
|
|
460
|
+
}
|
|
461
|
+
}), vl = /* @__PURE__ */ ae(fl, [["__scopeId", "data-v-32592dd4"]]), yl = { class: "yk-table" }, gl = { class: "yk-table__view-area" }, kl = {
|
|
462
|
+
key: 0,
|
|
463
|
+
class: "yk-table__loading-mask"
|
|
464
|
+
}, _l = {
|
|
465
|
+
key: 0,
|
|
466
|
+
class: "yk-table__footer"
|
|
467
|
+
}, bl = { class: "yk-table__footer-extra" }, hl = /* @__PURE__ */ ee({
|
|
468
|
+
name: "YsTable",
|
|
469
|
+
__name: "table",
|
|
470
|
+
props: {
|
|
471
|
+
metaFun: { type: Function, required: !0 },
|
|
472
|
+
dataFun: { type: Function, required: !0 },
|
|
473
|
+
/** 可选。存在时在每一行最后一列显示可执行的操作 */
|
|
474
|
+
rowActionsFunc: { type: Function, required: !1 },
|
|
475
|
+
/** 每页条数,默认 20;数据超过一页时表格下方自动出现分页组件 */
|
|
476
|
+
pageSize: { type: Number, default: 20 },
|
|
477
|
+
/** 分页组件「每页条数」下拉的可选项,默认 [10, 20, 50, 100] */
|
|
478
|
+
pageSizes: { type: Array, default: () => [10, 20, 50, 100] },
|
|
479
|
+
/** 为 true 时第一列显示 checkbox(表头含全选/取消全选),默认 false */
|
|
480
|
+
showCheckbox: { type: Boolean, default: !1 },
|
|
481
|
+
/**
|
|
482
|
+
* 是否允许拖动表头列边界调整列宽(透传 el-table-column 的 resizable),默认 true。
|
|
483
|
+
* 受控与非受控皆可:用 v-model:column-resizable 时由父级驱动;不绑定时可经
|
|
484
|
+
* TableApi.setColumnResizable 切换(组件内部维护状态,同时照常派发 update 事件)。
|
|
485
|
+
*/
|
|
486
|
+
columnResizable: { type: Boolean, default: !0 },
|
|
487
|
+
/**
|
|
488
|
+
* 是否锁定表头(sticky header),默认 false。仅表格视图生效:当内容区出现纵向
|
|
489
|
+
* 滚动条时,表头粘在视图区顶部始终可见,不随内容滚走。实现上是给 el-table 的
|
|
490
|
+
* .el-table__header-wrapper 加 position:sticky(table-layout 默认 fixed 下该节点独立
|
|
491
|
+
* 渲染)。卡片 / 列表视图无表头,不受影响。
|
|
492
|
+
* 受控与非受控皆可:用 v-model:sticky-header 时由父级驱动;不绑定时可经
|
|
493
|
+
* TableApi.setStickyHeader 切换(组件内部维护状态,同时照常派发 update 事件)。
|
|
494
|
+
*/
|
|
495
|
+
stickyHeader: { type: Boolean, default: !1 },
|
|
496
|
+
/** 加载自定义配置(含列设置与用户默认分页大小;返回 null 按空配置处理) */
|
|
497
|
+
loadCustomConfigFun: { type: Function, required: !1 },
|
|
498
|
+
/** 保存自定义配置(含列设置与用户默认分页大小) */
|
|
499
|
+
saveCustomConfigFun: { type: Function, required: !1 },
|
|
500
|
+
/** 导出「所有数据」时每次分页拉取的条数,默认 1000(独立于界面分页大小) */
|
|
501
|
+
exportPageSize: { type: Number, default: 1e3 },
|
|
502
|
+
/** 导出实现工厂:每次导出调用它得到一个全新的 ExportApi 实例,组件只经该接口写文件。
|
|
503
|
+
* 缺省使用内置 ExcelJS 实现(createExcelJsExportApiFunc);
|
|
504
|
+
* 将来可替换为其它实现(CSV、服务端导出等),组件无需改动 */
|
|
505
|
+
exportorFunc: { type: Function, required: !1 },
|
|
506
|
+
/** 行 key,默认 "id" */
|
|
507
|
+
rowKey: { type: String, default: "id" },
|
|
508
|
+
/**
|
|
509
|
+
* 展示形态,默认 "table"(表格视图);设为 "card" 时以卡片网格渲染当前页行,
|
|
510
|
+
* 设为 "list" 时以列表渲染(一行一条全宽,内容经 #list 插槽自定义)。
|
|
511
|
+
* 受控与非受控皆可:用 v-model:view-mode 时由父级驱动;不绑定时可经
|
|
512
|
+
* TableApi.setViewMode 切换(组件内部维护状态,同时照常派发 update:viewMode)。
|
|
513
|
+
* Table 不内置任何视图切换控件,切换入口一律由外部实现。
|
|
514
|
+
*/
|
|
515
|
+
viewMode: { type: String, default: "table" }
|
|
516
|
+
},
|
|
517
|
+
emits: ["data-loaded", "update:viewMode", "update:showCheckbox", "update:columnResizable", "update:stickyHeader"],
|
|
518
|
+
setup(e, { expose: f, emit: t }) {
|
|
519
|
+
const l = e, a = t, {
|
|
520
|
+
meta: k,
|
|
521
|
+
paged: u,
|
|
522
|
+
rows: A,
|
|
523
|
+
metaLoading: y,
|
|
524
|
+
dataLoading: x,
|
|
525
|
+
currentPage: S,
|
|
526
|
+
total: B,
|
|
527
|
+
totalKnown: U,
|
|
528
|
+
loadMeta: R
|
|
529
|
+
} = Pt(l), b = I(null), {
|
|
530
|
+
selectedRows: _,
|
|
531
|
+
onSelectionChange: q,
|
|
532
|
+
isRowSelected: T,
|
|
533
|
+
toggleRowSelection: X,
|
|
534
|
+
restoreSelection: j,
|
|
535
|
+
clearSelection: r,
|
|
536
|
+
selectAllOnPage: m,
|
|
537
|
+
invertSelectionOnPage: F
|
|
538
|
+
} = Bt({ tableEl: b, rows: A, rowKey: ve(l, "rowKey") }), Y = {
|
|
539
|
+
get rowActionsFunc() {
|
|
540
|
+
return l.rowActionsFunc;
|
|
541
|
+
}
|
|
542
|
+
}, { actions: E, actionsLoading: ue, loadActions: ce } = Dt(Y), oe = I(null), $ = Q(() => {
|
|
543
|
+
var s;
|
|
544
|
+
return ((s = oe.value) == null ? void 0 : s.columns) ?? [];
|
|
545
|
+
}), g = Q(() => {
|
|
546
|
+
var s;
|
|
547
|
+
return ((s = oe.value) == null ? void 0 : s.defaultPageSize) ?? l.pageSize;
|
|
548
|
+
}), G = Q(() => {
|
|
549
|
+
var s;
|
|
550
|
+
return ((s = oe.value) == null ? void 0 : s.customConfigLoading) ?? !1;
|
|
551
|
+
}), de = I(null);
|
|
552
|
+
async function D(s) {
|
|
553
|
+
x.value = !0;
|
|
554
|
+
try {
|
|
555
|
+
const W = (S.value - 1) * g.value, re = await l.dataFun({ limit: g.value, offset: W }, s);
|
|
556
|
+
u.value = re, a("data-loaded", re);
|
|
557
|
+
} finally {
|
|
558
|
+
x.value = !1;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
const z = Q(() => {
|
|
562
|
+
var W;
|
|
563
|
+
const s = Math.min(g.value, ...l.pageSizes);
|
|
564
|
+
return B.value > s || (((W = u.value) == null ? void 0 : W.hasNext) ?? !1);
|
|
565
|
+
}), H = Q(
|
|
566
|
+
() => y.value || x.value || ue.value || G.value
|
|
567
|
+
);
|
|
568
|
+
function L(s) {
|
|
569
|
+
S.value = s, D();
|
|
570
|
+
}
|
|
571
|
+
function se(s) {
|
|
572
|
+
var W;
|
|
573
|
+
(W = oe.value) == null || W.updateDefaultPageSize(s), S.value = 1, D();
|
|
574
|
+
}
|
|
575
|
+
function K(s, W, re) {
|
|
576
|
+
var ke;
|
|
577
|
+
re.property && ((ke = oe.value) == null || ke.updateColumnWidth(re.property, s));
|
|
578
|
+
}
|
|
579
|
+
async function ne() {
|
|
580
|
+
var s;
|
|
581
|
+
await Promise.all([
|
|
582
|
+
R(),
|
|
583
|
+
ce(),
|
|
584
|
+
(s = oe.value) == null ? void 0 : s.loadCustomConfigs()
|
|
585
|
+
]), S.value = 1, D();
|
|
586
|
+
}
|
|
587
|
+
function ge() {
|
|
588
|
+
D();
|
|
589
|
+
}
|
|
590
|
+
Fe(ne), me(() => l.pageSize, (s) => {
|
|
591
|
+
se(s);
|
|
592
|
+
}), me(() => l.dataFun, () => {
|
|
593
|
+
S.value = 1, D();
|
|
594
|
+
});
|
|
595
|
+
const xe = I(l.viewMode);
|
|
596
|
+
me(() => l.viewMode, (s) => {
|
|
597
|
+
xe.value = s;
|
|
598
|
+
});
|
|
599
|
+
const pe = Q({
|
|
600
|
+
get: () => xe.value,
|
|
601
|
+
set: (s) => {
|
|
602
|
+
xe.value = s, a("update:viewMode", s);
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
me(pe, (s) => {
|
|
606
|
+
s === "table" && j();
|
|
607
|
+
});
|
|
608
|
+
const be = I(l.showCheckbox);
|
|
609
|
+
me(() => l.showCheckbox, (s) => {
|
|
610
|
+
be.value = s;
|
|
611
|
+
});
|
|
612
|
+
const he = Q({
|
|
613
|
+
get: () => be.value,
|
|
614
|
+
set: (s) => {
|
|
615
|
+
be.value = s, a("update:showCheckbox", s), s || r();
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
function $e(s) {
|
|
619
|
+
pe.value = s;
|
|
620
|
+
}
|
|
621
|
+
function Ye(s) {
|
|
622
|
+
he.value = s;
|
|
623
|
+
}
|
|
624
|
+
const Re = I(l.columnResizable);
|
|
625
|
+
me(() => l.columnResizable, (s) => {
|
|
626
|
+
Re.value = s;
|
|
627
|
+
});
|
|
628
|
+
const Ve = Q({
|
|
629
|
+
get: () => Re.value,
|
|
630
|
+
set: (s) => {
|
|
631
|
+
Re.value = s, a("update:columnResizable", s);
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
function Ne(s) {
|
|
635
|
+
Ve.value = s;
|
|
636
|
+
}
|
|
637
|
+
const De = I(l.stickyHeader);
|
|
638
|
+
me(() => l.stickyHeader, (s) => {
|
|
639
|
+
De.value = s;
|
|
640
|
+
});
|
|
641
|
+
const Ae = Q({
|
|
642
|
+
get: () => De.value,
|
|
643
|
+
set: (s) => {
|
|
644
|
+
De.value = s, a("update:stickyHeader", s);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
function qe(s) {
|
|
648
|
+
Ae.value = s;
|
|
649
|
+
}
|
|
650
|
+
const Oe = Vt(), Ue = Q(
|
|
651
|
+
() => Object.keys(Oe).filter((s) => s !== "_" && typeof Oe[s] == "function")
|
|
652
|
+
);
|
|
653
|
+
function ze() {
|
|
654
|
+
var s;
|
|
655
|
+
(s = oe.value) == null || s.openDialog();
|
|
656
|
+
}
|
|
657
|
+
function Me() {
|
|
658
|
+
var s;
|
|
659
|
+
(s = de.value) == null || s.openExportDialog();
|
|
660
|
+
}
|
|
661
|
+
function Pe(s, W) {
|
|
662
|
+
X(s, !!W);
|
|
663
|
+
}
|
|
664
|
+
const ye = I(null), Ge = Q(
|
|
665
|
+
() => ye.value ? Ze(E.value, ye.value.row) : []
|
|
666
|
+
);
|
|
667
|
+
function Le(s, W) {
|
|
668
|
+
if (E.value.length === 0) return;
|
|
669
|
+
s.preventDefault();
|
|
670
|
+
const re = 176, J = We(W) * 34 + 8;
|
|
671
|
+
ye.value = {
|
|
672
|
+
x: Math.min(s.clientX, window.innerWidth - re - 8),
|
|
673
|
+
y: Math.min(s.clientY, window.innerHeight - J - 8),
|
|
674
|
+
row: W
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
function We(s) {
|
|
678
|
+
return Ze(E.value, s).length;
|
|
679
|
+
}
|
|
680
|
+
function d(s) {
|
|
681
|
+
var re;
|
|
682
|
+
const W = (re = ye.value) == null ? void 0 : re.row;
|
|
683
|
+
ye.value = null, W && s.execute(W, te);
|
|
684
|
+
}
|
|
685
|
+
function V(s) {
|
|
686
|
+
s.key === "Escape" && (ye.value = null);
|
|
687
|
+
}
|
|
688
|
+
Fe(() => window.addEventListener("keydown", V)), je(() => window.removeEventListener("keydown", V)), f({
|
|
689
|
+
meta: k,
|
|
690
|
+
paged: u,
|
|
691
|
+
currentPage: S,
|
|
692
|
+
viewMode: pe,
|
|
693
|
+
selectable: he,
|
|
694
|
+
columnResizable: Ve,
|
|
695
|
+
stickyHeader: Ae,
|
|
696
|
+
slotNames: Ue,
|
|
697
|
+
selectedRows: _,
|
|
698
|
+
rows: A,
|
|
699
|
+
reload: ne,
|
|
700
|
+
refresh: ge,
|
|
701
|
+
setViewMode: $e,
|
|
702
|
+
setSelectable: Ye,
|
|
703
|
+
setColumnResizable: Ne,
|
|
704
|
+
setStickyHeader: qe,
|
|
705
|
+
clearSelection: r,
|
|
706
|
+
selectAllOnPage: m,
|
|
707
|
+
invertSelectionOnPage: F,
|
|
708
|
+
openConfigDialog: ze,
|
|
709
|
+
openExportDialog: Me
|
|
710
|
+
});
|
|
711
|
+
const te = {
|
|
712
|
+
get meta() {
|
|
713
|
+
return k.value;
|
|
714
|
+
},
|
|
715
|
+
get paged() {
|
|
716
|
+
return u.value;
|
|
717
|
+
},
|
|
718
|
+
get currentPage() {
|
|
719
|
+
return S.value;
|
|
720
|
+
},
|
|
721
|
+
get viewMode() {
|
|
722
|
+
return pe.value;
|
|
723
|
+
},
|
|
724
|
+
get selectable() {
|
|
725
|
+
return he.value;
|
|
726
|
+
},
|
|
727
|
+
get columnResizable() {
|
|
728
|
+
return Ve.value;
|
|
729
|
+
},
|
|
730
|
+
get stickyHeader() {
|
|
731
|
+
return Ae.value;
|
|
732
|
+
},
|
|
733
|
+
get slotNames() {
|
|
734
|
+
return Ue.value;
|
|
735
|
+
},
|
|
736
|
+
get selectedRows() {
|
|
737
|
+
return _.value;
|
|
738
|
+
},
|
|
739
|
+
get rows() {
|
|
740
|
+
return A.value;
|
|
741
|
+
},
|
|
742
|
+
reload: ne,
|
|
743
|
+
refresh: ge,
|
|
744
|
+
setViewMode: $e,
|
|
745
|
+
setSelectable: Ye,
|
|
746
|
+
setColumnResizable: Ne,
|
|
747
|
+
setStickyHeader: qe,
|
|
748
|
+
clearSelection: r,
|
|
749
|
+
selectAllOnPage: m,
|
|
750
|
+
invertSelectionOnPage: F,
|
|
751
|
+
openConfigDialog: ze,
|
|
752
|
+
openExportDialog: Me
|
|
753
|
+
};
|
|
754
|
+
return (s, W) => {
|
|
755
|
+
var _e;
|
|
756
|
+
const re = w("el-table-column"), ke = w("el-table"), J = w("el-pagination");
|
|
757
|
+
return n(), v("div", yl, [
|
|
758
|
+
p("div", gl, [
|
|
759
|
+
pe.value === "table" ? (n(), v("div", {
|
|
760
|
+
key: 0,
|
|
761
|
+
class: Se(["yk-table__table-wrap", { "yk-table__table-wrap--sticky-header": Ae.value }])
|
|
762
|
+
}, [
|
|
763
|
+
c(ke, {
|
|
764
|
+
ref_key: "tableEl",
|
|
765
|
+
ref: b,
|
|
766
|
+
data: i(A),
|
|
767
|
+
"row-key": e.rowKey,
|
|
768
|
+
border: "",
|
|
769
|
+
onSelectionChange: i(q),
|
|
770
|
+
onHeaderDragend: K
|
|
771
|
+
}, Be({
|
|
772
|
+
default: o(() => [
|
|
773
|
+
he.value ? (n(), h(re, {
|
|
774
|
+
key: 0,
|
|
775
|
+
type: "selection",
|
|
776
|
+
width: "48"
|
|
777
|
+
})) : M("", !0),
|
|
778
|
+
(n(!0), v(N, null, Z($.value, (ie) => (n(), h(re, {
|
|
779
|
+
key: ie.propertyPath,
|
|
780
|
+
prop: ie.propertyPath,
|
|
781
|
+
label: ie.displayName,
|
|
782
|
+
width: ie.width,
|
|
783
|
+
resizable: Ve.value,
|
|
784
|
+
"show-overflow-tooltip": ""
|
|
785
|
+
}, Be({ _: 2 }, [
|
|
786
|
+
ie.render ? {
|
|
787
|
+
name: "default",
|
|
788
|
+
fn: o(({ row: we }) => [
|
|
789
|
+
(n(), h(Te(() => ie.render(we, we[ie.propertyPath]))))
|
|
790
|
+
]),
|
|
791
|
+
key: "0"
|
|
792
|
+
} : void 0
|
|
793
|
+
]), 1032, ["prop", "label", "width", "resizable"]))), 128)),
|
|
794
|
+
l.rowActionsFunc ? (n(), h(tl, {
|
|
795
|
+
key: 1,
|
|
796
|
+
actions: i(E),
|
|
797
|
+
table: te,
|
|
798
|
+
resizable: Ve.value
|
|
799
|
+
}, null, 8, ["actions", "resizable"])) : M("", !0)
|
|
800
|
+
]),
|
|
801
|
+
_: 2
|
|
802
|
+
}, [
|
|
803
|
+
s.$slots.empty ? {
|
|
804
|
+
name: "empty",
|
|
805
|
+
fn: o(() => [
|
|
806
|
+
le(s.$slots, "empty", {}, void 0, !0)
|
|
807
|
+
]),
|
|
808
|
+
key: "0"
|
|
809
|
+
} : void 0
|
|
810
|
+
]), 1032, ["data", "row-key", "onSelectionChange"])
|
|
811
|
+
], 2)) : pe.value === "card" ? (n(), h(sl, {
|
|
812
|
+
key: 1,
|
|
813
|
+
rows: i(A),
|
|
814
|
+
"row-key": e.rowKey,
|
|
815
|
+
"show-checkbox": he.value,
|
|
816
|
+
loading: H.value,
|
|
817
|
+
"has-actions": i(E).length > 0,
|
|
818
|
+
"is-selected": i(T),
|
|
819
|
+
onCheck: Pe,
|
|
820
|
+
onContextmenu: Le
|
|
821
|
+
}, Be({ _: 2 }, [
|
|
822
|
+
s.$slots.card ? {
|
|
823
|
+
name: "default",
|
|
824
|
+
fn: o(({ row: ie, index: we }) => [
|
|
825
|
+
le(s.$slots, "card", {
|
|
826
|
+
row: ie,
|
|
827
|
+
index: we
|
|
828
|
+
}, void 0, !0)
|
|
829
|
+
]),
|
|
830
|
+
key: "0"
|
|
831
|
+
} : void 0,
|
|
832
|
+
s.$slots.empty ? {
|
|
833
|
+
name: "empty",
|
|
834
|
+
fn: o(() => [
|
|
835
|
+
le(s.$slots, "empty", {}, void 0, !0)
|
|
836
|
+
]),
|
|
837
|
+
key: "1"
|
|
838
|
+
} : void 0
|
|
839
|
+
]), 1032, ["rows", "row-key", "show-checkbox", "loading", "has-actions", "is-selected"])) : (n(), h(pl, {
|
|
840
|
+
key: 2,
|
|
841
|
+
rows: i(A),
|
|
842
|
+
"row-key": e.rowKey,
|
|
843
|
+
"show-checkbox": he.value,
|
|
844
|
+
loading: H.value,
|
|
845
|
+
"has-actions": i(E).length > 0,
|
|
846
|
+
"is-selected": i(T),
|
|
847
|
+
onCheck: Pe,
|
|
848
|
+
onContextmenu: Le
|
|
849
|
+
}, Be({ _: 2 }, [
|
|
850
|
+
s.$slots.list ? {
|
|
851
|
+
name: "default",
|
|
852
|
+
fn: o(({ row: ie, index: we }) => [
|
|
853
|
+
le(s.$slots, "list", {
|
|
854
|
+
row: ie,
|
|
855
|
+
index: we
|
|
856
|
+
}, void 0, !0)
|
|
857
|
+
]),
|
|
858
|
+
key: "0"
|
|
859
|
+
} : void 0,
|
|
860
|
+
s.$slots.empty ? {
|
|
861
|
+
name: "empty",
|
|
862
|
+
fn: o(() => [
|
|
863
|
+
le(s.$slots, "empty", {}, void 0, !0)
|
|
864
|
+
]),
|
|
865
|
+
key: "1"
|
|
866
|
+
} : void 0
|
|
867
|
+
]), 1032, ["rows", "row-key", "show-checkbox", "loading", "has-actions", "is-selected"])),
|
|
868
|
+
c(Ft, { name: "yk-loading-fade" }, {
|
|
869
|
+
default: o(() => [
|
|
870
|
+
H.value ? (n(), v("div", kl, [
|
|
871
|
+
le(s.$slots, "loading", {}, () => [
|
|
872
|
+
W[1] || (W[1] = p("span", {
|
|
873
|
+
class: "yk-table__loading-spinner",
|
|
874
|
+
"aria-label": "加载中"
|
|
875
|
+
}, null, -1))
|
|
876
|
+
], !0)
|
|
877
|
+
])) : M("", !0)
|
|
878
|
+
]),
|
|
879
|
+
_: 3
|
|
880
|
+
})
|
|
881
|
+
]),
|
|
882
|
+
c(vl, {
|
|
883
|
+
menu: ye.value,
|
|
884
|
+
actions: Ge.value,
|
|
885
|
+
"is-enabled": i(pt),
|
|
886
|
+
onClose: W[0] || (W[0] = (ie) => ye.value = null),
|
|
887
|
+
onSelect: d
|
|
888
|
+
}, null, 8, ["menu", "actions", "is-enabled"]),
|
|
889
|
+
z.value || s.$slots.footer ? (n(), v("div", _l, [
|
|
890
|
+
p("div", bl, [
|
|
891
|
+
le(s.$slots, "footer", {}, void 0, !0)
|
|
892
|
+
]),
|
|
893
|
+
z.value ? (n(), h(J, {
|
|
894
|
+
key: 0,
|
|
895
|
+
class: "yk-table__pagination",
|
|
896
|
+
layout: i(U) ? "total, sizes, prev, pager, next" : "sizes, prev, pager, next",
|
|
897
|
+
total: i(B),
|
|
898
|
+
"page-sizes": e.pageSizes,
|
|
899
|
+
"page-size": g.value,
|
|
900
|
+
"current-page": i(S),
|
|
901
|
+
onCurrentChange: L,
|
|
902
|
+
onSizeChange: se
|
|
903
|
+
}, null, 8, ["layout", "total", "page-sizes", "page-size", "current-page"])) : M("", !0)
|
|
904
|
+
])) : M("", !0),
|
|
905
|
+
c(Jt, {
|
|
906
|
+
ref_key: "exportDialogRef",
|
|
907
|
+
ref: de,
|
|
908
|
+
"current-rows": i(A),
|
|
909
|
+
"selected-rows": i(_),
|
|
910
|
+
"data-fun": l.dataFun,
|
|
911
|
+
"export-page-size": l.exportPageSize,
|
|
912
|
+
total: i(B),
|
|
913
|
+
"exportor-func": l.exportorFunc,
|
|
914
|
+
"table-name": ((_e = i(k)) == null ? void 0 : _e.displayName) ?? "数据",
|
|
915
|
+
columns: $.value,
|
|
916
|
+
"has-more-page": z.value,
|
|
917
|
+
"export-selected": he.value
|
|
918
|
+
}, null, 8, ["current-rows", "selected-rows", "data-fun", "export-page-size", "total", "exportor-func", "table-name", "columns", "has-more-page", "export-selected"]),
|
|
919
|
+
c(Zt, {
|
|
920
|
+
ref_key: "configDialogRef",
|
|
921
|
+
ref: oe,
|
|
922
|
+
"load-custom-config-fun": e.loadCustomConfigFun,
|
|
923
|
+
"save-custom-config-fun": e.saveCustomConfigFun,
|
|
924
|
+
meta: i(k)
|
|
925
|
+
}, null, 8, ["load-custom-config-fun", "save-custom-config-fun", "meta"])
|
|
926
|
+
]);
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
}), yt = /* @__PURE__ */ ae(hl, [["__scopeId", "data-v-6efda66a"]]), wl = { class: "yk-table-action-menu-button__check" }, xl = { class: "yk-table-action-menu-button__check" }, Cl = { class: "yk-table-action-menu-button__check" }, Sl = { class: "yk-table-action-menu-button__check" }, $l = { class: "yk-table-action-menu-button__check" }, Vl = { class: "yk-table-action-menu-button__check" }, Fl = /* @__PURE__ */ ee({
|
|
930
|
+
__name: "tableActionMenuButton",
|
|
931
|
+
props: {
|
|
932
|
+
table: {}
|
|
933
|
+
},
|
|
934
|
+
setup(e) {
|
|
935
|
+
const f = e;
|
|
936
|
+
function t(l) {
|
|
937
|
+
switch (l) {
|
|
938
|
+
case "refresh":
|
|
939
|
+
f.table.refresh();
|
|
940
|
+
break;
|
|
941
|
+
case "config":
|
|
942
|
+
f.table.openConfigDialog();
|
|
943
|
+
break;
|
|
944
|
+
case "export":
|
|
945
|
+
f.table.openExportDialog();
|
|
946
|
+
break;
|
|
947
|
+
case "view-table":
|
|
948
|
+
f.table.setViewMode("table");
|
|
949
|
+
break;
|
|
950
|
+
case "view-card":
|
|
951
|
+
f.table.setViewMode("card");
|
|
952
|
+
break;
|
|
953
|
+
case "view-list":
|
|
954
|
+
f.table.setViewMode("list");
|
|
955
|
+
break;
|
|
956
|
+
case "toggle-checkbox":
|
|
957
|
+
f.table.setSelectable(!f.table.selectable);
|
|
958
|
+
break;
|
|
959
|
+
case "toggle-column-resize":
|
|
960
|
+
f.table.setColumnResizable(!f.table.columnResizable);
|
|
961
|
+
break;
|
|
962
|
+
case "toggle-sticky-header":
|
|
963
|
+
f.table.setStickyHeader(!f.table.stickyHeader);
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return (l, a) => {
|
|
968
|
+
const k = w("el-button"), u = w("el-dropdown-item"), A = w("el-dropdown-menu"), y = w("el-dropdown");
|
|
969
|
+
return n(), h(y, {
|
|
970
|
+
trigger: "click",
|
|
971
|
+
placement: "bottom-end",
|
|
972
|
+
onCommand: t
|
|
973
|
+
}, {
|
|
974
|
+
dropdown: o(() => [
|
|
975
|
+
c(A, null, {
|
|
976
|
+
default: o(() => [
|
|
977
|
+
c(u, { command: "refresh" }, {
|
|
978
|
+
default: o(() => [...a[1] || (a[1] = [
|
|
979
|
+
p("svg", {
|
|
980
|
+
viewBox: "0 0 24 24",
|
|
981
|
+
width: "14",
|
|
982
|
+
height: "14",
|
|
983
|
+
fill: "none",
|
|
984
|
+
stroke: "currentColor",
|
|
985
|
+
"stroke-width": "2",
|
|
986
|
+
"stroke-linecap": "round",
|
|
987
|
+
"stroke-linejoin": "round",
|
|
988
|
+
class: "yk-table-action-menu-button__icon"
|
|
989
|
+
}, [
|
|
990
|
+
p("polyline", { points: "23 4 23 10 17 10" }),
|
|
991
|
+
p("polyline", { points: "1 20 1 14 7 14" }),
|
|
992
|
+
p("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
|
|
993
|
+
], -1),
|
|
994
|
+
C(" 刷新 ", -1)
|
|
995
|
+
])]),
|
|
996
|
+
_: 1
|
|
997
|
+
}),
|
|
998
|
+
c(u, { command: "export" }, {
|
|
999
|
+
default: o(() => [...a[2] || (a[2] = [
|
|
1000
|
+
p("svg", {
|
|
1001
|
+
viewBox: "0 0 24 24",
|
|
1002
|
+
width: "14",
|
|
1003
|
+
height: "14",
|
|
1004
|
+
fill: "none",
|
|
1005
|
+
stroke: "currentColor",
|
|
1006
|
+
"stroke-width": "2",
|
|
1007
|
+
"stroke-linecap": "round",
|
|
1008
|
+
"stroke-linejoin": "round",
|
|
1009
|
+
class: "yk-table-action-menu-button__icon"
|
|
1010
|
+
}, [
|
|
1011
|
+
p("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1012
|
+
p("polyline", { points: "7 10 12 15 17 10" }),
|
|
1013
|
+
p("line", {
|
|
1014
|
+
x1: "12",
|
|
1015
|
+
y1: "15",
|
|
1016
|
+
x2: "12",
|
|
1017
|
+
y2: "3"
|
|
1018
|
+
})
|
|
1019
|
+
], -1),
|
|
1020
|
+
C(" 导出 Excel ", -1)
|
|
1021
|
+
])]),
|
|
1022
|
+
_: 1
|
|
1023
|
+
}),
|
|
1024
|
+
c(u, { command: "config" }, {
|
|
1025
|
+
default: o(() => [...a[3] || (a[3] = [
|
|
1026
|
+
p("svg", {
|
|
1027
|
+
viewBox: "0 0 24 24",
|
|
1028
|
+
width: "14",
|
|
1029
|
+
height: "14",
|
|
1030
|
+
fill: "none",
|
|
1031
|
+
stroke: "currentColor",
|
|
1032
|
+
"stroke-width": "2",
|
|
1033
|
+
"stroke-linecap": "round",
|
|
1034
|
+
"stroke-linejoin": "round",
|
|
1035
|
+
class: "yk-table-action-menu-button__icon"
|
|
1036
|
+
}, [
|
|
1037
|
+
p("circle", {
|
|
1038
|
+
cx: "12",
|
|
1039
|
+
cy: "12",
|
|
1040
|
+
r: "3"
|
|
1041
|
+
}),
|
|
1042
|
+
p("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
1043
|
+
], -1),
|
|
1044
|
+
C(" 列设置 ", -1)
|
|
1045
|
+
])]),
|
|
1046
|
+
_: 1
|
|
1047
|
+
}),
|
|
1048
|
+
c(u, {
|
|
1049
|
+
command: "view-table",
|
|
1050
|
+
divided: ""
|
|
1051
|
+
}, {
|
|
1052
|
+
default: o(() => [
|
|
1053
|
+
p("span", wl, P(e.table.viewMode === "table" ? "✓" : ""), 1),
|
|
1054
|
+
a[4] || (a[4] = C("表格视图 ", -1))
|
|
1055
|
+
]),
|
|
1056
|
+
_: 1
|
|
1057
|
+
}),
|
|
1058
|
+
e.table.slotNames.includes("card") ? (n(), h(u, {
|
|
1059
|
+
key: 0,
|
|
1060
|
+
command: "view-card"
|
|
1061
|
+
}, {
|
|
1062
|
+
default: o(() => [
|
|
1063
|
+
p("span", xl, P(e.table.viewMode === "card" ? "✓" : ""), 1),
|
|
1064
|
+
a[5] || (a[5] = C("卡片视图 ", -1))
|
|
1065
|
+
]),
|
|
1066
|
+
_: 1
|
|
1067
|
+
})) : M("", !0),
|
|
1068
|
+
e.table.slotNames.includes("list") ? (n(), h(u, {
|
|
1069
|
+
key: 1,
|
|
1070
|
+
command: "view-list"
|
|
1071
|
+
}, {
|
|
1072
|
+
default: o(() => [
|
|
1073
|
+
p("span", Cl, P(e.table.viewMode === "list" ? "✓" : ""), 1),
|
|
1074
|
+
a[6] || (a[6] = C("列表视图 ", -1))
|
|
1075
|
+
]),
|
|
1076
|
+
_: 1
|
|
1077
|
+
})) : M("", !0),
|
|
1078
|
+
c(u, {
|
|
1079
|
+
command: "toggle-checkbox",
|
|
1080
|
+
divided: ""
|
|
1081
|
+
}, {
|
|
1082
|
+
default: o(() => [
|
|
1083
|
+
p("span", Sl, P(e.table.selectable ? "✓" : ""), 1),
|
|
1084
|
+
a[7] || (a[7] = C("选择行 ", -1))
|
|
1085
|
+
]),
|
|
1086
|
+
_: 1
|
|
1087
|
+
}),
|
|
1088
|
+
c(u, { command: "toggle-column-resize" }, {
|
|
1089
|
+
default: o(() => [
|
|
1090
|
+
p("span", $l, P(e.table.columnResizable ? "✓" : ""), 1),
|
|
1091
|
+
a[8] || (a[8] = C("列宽拖动 ", -1))
|
|
1092
|
+
]),
|
|
1093
|
+
_: 1
|
|
1094
|
+
}),
|
|
1095
|
+
c(u, { command: "toggle-sticky-header" }, {
|
|
1096
|
+
default: o(() => [
|
|
1097
|
+
p("span", Vl, P(e.table.stickyHeader ? "✓" : ""), 1),
|
|
1098
|
+
a[9] || (a[9] = C("锁定表头 ", -1))
|
|
1099
|
+
]),
|
|
1100
|
+
_: 1
|
|
1101
|
+
})
|
|
1102
|
+
]),
|
|
1103
|
+
_: 1
|
|
1104
|
+
})
|
|
1105
|
+
]),
|
|
1106
|
+
default: o(() => [
|
|
1107
|
+
le(l.$slots, "trigger", {}, () => [
|
|
1108
|
+
c(k, {
|
|
1109
|
+
class: "yk-table-action-menu-button__btn",
|
|
1110
|
+
title: "表格操作",
|
|
1111
|
+
"aria-label": "表格操作"
|
|
1112
|
+
}, {
|
|
1113
|
+
default: o(() => [...a[0] || (a[0] = [
|
|
1114
|
+
p("svg", {
|
|
1115
|
+
viewBox: "0 0 24 24",
|
|
1116
|
+
width: "16",
|
|
1117
|
+
height: "16",
|
|
1118
|
+
fill: "none",
|
|
1119
|
+
stroke: "currentColor",
|
|
1120
|
+
"stroke-width": "2",
|
|
1121
|
+
"stroke-linecap": "round"
|
|
1122
|
+
}, [
|
|
1123
|
+
p("line", {
|
|
1124
|
+
x1: "3",
|
|
1125
|
+
y1: "6",
|
|
1126
|
+
x2: "21",
|
|
1127
|
+
y2: "6"
|
|
1128
|
+
}),
|
|
1129
|
+
p("circle", {
|
|
1130
|
+
cx: "9",
|
|
1131
|
+
cy: "6",
|
|
1132
|
+
r: "2.4",
|
|
1133
|
+
fill: "var(--el-bg-color, #fff)"
|
|
1134
|
+
}),
|
|
1135
|
+
p("line", {
|
|
1136
|
+
x1: "3",
|
|
1137
|
+
y1: "12",
|
|
1138
|
+
x2: "21",
|
|
1139
|
+
y2: "12"
|
|
1140
|
+
}),
|
|
1141
|
+
p("circle", {
|
|
1142
|
+
cx: "15",
|
|
1143
|
+
cy: "12",
|
|
1144
|
+
r: "2.4",
|
|
1145
|
+
fill: "var(--el-bg-color, #fff)"
|
|
1146
|
+
}),
|
|
1147
|
+
p("line", {
|
|
1148
|
+
x1: "3",
|
|
1149
|
+
y1: "18",
|
|
1150
|
+
x2: "21",
|
|
1151
|
+
y2: "18"
|
|
1152
|
+
}),
|
|
1153
|
+
p("circle", {
|
|
1154
|
+
cx: "9",
|
|
1155
|
+
cy: "18",
|
|
1156
|
+
r: "2.4",
|
|
1157
|
+
fill: "var(--el-bg-color, #fff)"
|
|
1158
|
+
})
|
|
1159
|
+
], -1)
|
|
1160
|
+
])]),
|
|
1161
|
+
_: 1
|
|
1162
|
+
})
|
|
1163
|
+
], !0)
|
|
1164
|
+
]),
|
|
1165
|
+
_: 3
|
|
1166
|
+
});
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
}), gt = /* @__PURE__ */ ae(Fl, [["__scopeId", "data-v-fffcf297"]]), Rl = {
|
|
1170
|
+
key: 0,
|
|
1171
|
+
class: "yk-table__selection-bar"
|
|
1172
|
+
}, Al = { class: "yk-table__selection-bar__count" }, Ml = /* @__PURE__ */ ee({
|
|
1173
|
+
__name: "selectionBar",
|
|
1174
|
+
props: {
|
|
1175
|
+
count: {}
|
|
1176
|
+
},
|
|
1177
|
+
emits: ["select-all", "invert", "clear"],
|
|
1178
|
+
setup(e) {
|
|
1179
|
+
return (f, t) => {
|
|
1180
|
+
const l = w("el-button");
|
|
1181
|
+
return e.count > 0 ? (n(), v("div", Rl, [
|
|
1182
|
+
p("span", Al, "已选 " + P(e.count) + " 项", 1),
|
|
1183
|
+
t[6] || (t[6] = p("span", { class: "yk-table__selection-bar__sep" }, "|", -1)),
|
|
1184
|
+
c(l, {
|
|
1185
|
+
link: "",
|
|
1186
|
+
type: "primary",
|
|
1187
|
+
class: "yk-table__selection-bar__btn",
|
|
1188
|
+
onClick: t[0] || (t[0] = (a) => f.$emit("select-all"))
|
|
1189
|
+
}, {
|
|
1190
|
+
default: o(() => [...t[3] || (t[3] = [
|
|
1191
|
+
C("全选", -1)
|
|
1192
|
+
])]),
|
|
1193
|
+
_: 1
|
|
1194
|
+
}),
|
|
1195
|
+
c(l, {
|
|
1196
|
+
link: "",
|
|
1197
|
+
type: "primary",
|
|
1198
|
+
class: "yk-table__selection-bar__btn",
|
|
1199
|
+
onClick: t[1] || (t[1] = (a) => f.$emit("invert"))
|
|
1200
|
+
}, {
|
|
1201
|
+
default: o(() => [...t[4] || (t[4] = [
|
|
1202
|
+
C("反选", -1)
|
|
1203
|
+
])]),
|
|
1204
|
+
_: 1
|
|
1205
|
+
}),
|
|
1206
|
+
t[7] || (t[7] = p("span", { class: "yk-table__selection-bar__sep" }, "|", -1)),
|
|
1207
|
+
c(l, {
|
|
1208
|
+
link: "",
|
|
1209
|
+
type: "primary",
|
|
1210
|
+
class: "yk-table__selection-bar__btn",
|
|
1211
|
+
onClick: t[2] || (t[2] = (a) => f.$emit("clear"))
|
|
1212
|
+
}, {
|
|
1213
|
+
default: o(() => [...t[5] || (t[5] = [
|
|
1214
|
+
C("清空", -1)
|
|
1215
|
+
])]),
|
|
1216
|
+
_: 1
|
|
1217
|
+
})
|
|
1218
|
+
])) : M("", !0);
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
}), Pl = /* @__PURE__ */ ae(Ml, [["__scopeId", "data-v-3f40dafb"]]), Bl = { class: "yk-command-bar" }, Dl = { class: "yk-command-bar__actions" }, zl = /* @__PURE__ */ ee({
|
|
1222
|
+
__name: "commandBar",
|
|
1223
|
+
props: {
|
|
1224
|
+
/** 表级命令列表,每条渲染为一个 el-button(type/plain/icon/desc),click 调 execute(table) */
|
|
1225
|
+
actions: { type: Array, required: !0, default: () => [] },
|
|
1226
|
+
/** 当前表格实例;允许 null(表格未挂载时按钮仍可渲染,点击不执行,下拉按钮隐藏) */
|
|
1227
|
+
table: { type: Object, default: null },
|
|
1228
|
+
/** 是否显示内置表格操作下拉按钮(刷新/列设置/导出/视图切换/选择行/列宽拖动),默认 true 居右 */
|
|
1229
|
+
showActionMenuButton: { type: Boolean, default: !0 }
|
|
1230
|
+
},
|
|
1231
|
+
setup(e) {
|
|
1232
|
+
const f = e;
|
|
1233
|
+
return (t, l) => {
|
|
1234
|
+
const a = w("el-button");
|
|
1235
|
+
return n(), v("div", Bl, [
|
|
1236
|
+
p("div", Dl, [
|
|
1237
|
+
(n(!0), v(N, null, Z(f.actions, (k) => (n(), h(a, {
|
|
1238
|
+
key: k.name,
|
|
1239
|
+
type: k.type === "default" ? void 0 : k.type,
|
|
1240
|
+
plain: k.plain,
|
|
1241
|
+
onClick: (u) => f.table && k.execute(f.table)
|
|
1242
|
+
}, {
|
|
1243
|
+
default: o(() => [
|
|
1244
|
+
k.icon ? (n(), h(Te(k.icon), {
|
|
1245
|
+
key: 0,
|
|
1246
|
+
class: "yk-command-bar__icon"
|
|
1247
|
+
})) : M("", !0),
|
|
1248
|
+
C(" " + P(k.desc), 1)
|
|
1249
|
+
]),
|
|
1250
|
+
_: 2
|
|
1251
|
+
}, 1032, ["type", "plain", "onClick"]))), 128)),
|
|
1252
|
+
f.table ? (n(), h(Pl, {
|
|
1253
|
+
key: 0,
|
|
1254
|
+
count: f.table.selectedRows.length,
|
|
1255
|
+
onSelectAll: l[0] || (l[0] = (k) => {
|
|
1256
|
+
var u;
|
|
1257
|
+
return (u = f.table) == null ? void 0 : u.selectAllOnPage();
|
|
1258
|
+
}),
|
|
1259
|
+
onInvert: l[1] || (l[1] = (k) => {
|
|
1260
|
+
var u;
|
|
1261
|
+
return (u = f.table) == null ? void 0 : u.invertSelectionOnPage();
|
|
1262
|
+
}),
|
|
1263
|
+
onClear: l[2] || (l[2] = (k) => {
|
|
1264
|
+
var u;
|
|
1265
|
+
return (u = f.table) == null ? void 0 : u.clearSelection();
|
|
1266
|
+
})
|
|
1267
|
+
}, null, 8, ["count"])) : M("", !0),
|
|
1268
|
+
le(t.$slots, "default", {}, void 0, !0)
|
|
1269
|
+
]),
|
|
1270
|
+
f.showActionMenuButton && f.table ? (n(), h(gt, {
|
|
1271
|
+
key: 0,
|
|
1272
|
+
table: f.table,
|
|
1273
|
+
class: "yk-command-bar__menu"
|
|
1274
|
+
}, null, 8, ["table"])) : M("", !0)
|
|
1275
|
+
]);
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
}), kt = /* @__PURE__ */ ae(zl, [["__scopeId", "data-v-cd091888"]]), Ql = {
|
|
1279
|
+
key: 0,
|
|
1280
|
+
class: "ys-main-panel__menu-icon"
|
|
1281
|
+
}, El = { class: "ys-main-panel__menu-text" }, Tl = {
|
|
1282
|
+
key: 0,
|
|
1283
|
+
class: "ys-main-panel__menu-icon"
|
|
1284
|
+
}, Il = { class: "ys-main-panel__menu-text" }, st = /* @__PURE__ */ ee({
|
|
1285
|
+
name: "YsMainPanelMenuNode",
|
|
1286
|
+
__name: "mainPanelMenuNode",
|
|
1287
|
+
props: {
|
|
1288
|
+
node: {}
|
|
1289
|
+
},
|
|
1290
|
+
setup(e) {
|
|
1291
|
+
return (f, t) => {
|
|
1292
|
+
const l = w("main-panel-menu-node", !0), a = w("el-sub-menu"), k = w("el-menu-item");
|
|
1293
|
+
return e.node.children && e.node.children.length > 0 ? (n(), h(a, {
|
|
1294
|
+
key: 0,
|
|
1295
|
+
index: e.node.key
|
|
1296
|
+
}, {
|
|
1297
|
+
title: o(() => [
|
|
1298
|
+
e.node.icon ? (n(), v("i", Ql, P(e.node.icon), 1)) : M("", !0),
|
|
1299
|
+
p("span", El, P(e.node.label), 1)
|
|
1300
|
+
]),
|
|
1301
|
+
default: o(() => [
|
|
1302
|
+
(n(!0), v(N, null, Z(e.node.children, (u) => (n(), h(l, {
|
|
1303
|
+
key: u.key,
|
|
1304
|
+
node: u
|
|
1305
|
+
}, null, 8, ["node"]))), 128))
|
|
1306
|
+
]),
|
|
1307
|
+
_: 1
|
|
1308
|
+
}, 8, ["index"])) : (n(), h(k, {
|
|
1309
|
+
key: 1,
|
|
1310
|
+
index: e.node.key
|
|
1311
|
+
}, {
|
|
1312
|
+
default: o(() => [
|
|
1313
|
+
e.node.icon ? (n(), v("i", Tl, P(e.node.icon), 1)) : M("", !0),
|
|
1314
|
+
p("span", Il, P(e.node.label), 1)
|
|
1315
|
+
]),
|
|
1316
|
+
_: 1
|
|
1317
|
+
}, 8, ["index"]));
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
}), Yl = { class: "ys-main-panel" }, Nl = { class: "ys-main-panel__aside-header" }, ql = ["title"], Ol = {
|
|
1321
|
+
key: 0,
|
|
1322
|
+
class: "ys-main-panel__menu-empty"
|
|
1323
|
+
}, Ul = { class: "ys-main-panel__main" }, Ll = {
|
|
1324
|
+
key: 1,
|
|
1325
|
+
class: "ys-main-panel__empty"
|
|
1326
|
+
}, Hl = /* @__PURE__ */ ee({
|
|
1327
|
+
name: "YsMainPanel",
|
|
1328
|
+
__name: "mainPanel",
|
|
1329
|
+
props: {
|
|
1330
|
+
/** 功能树数据加载函数:异步返回功能树节点数组 */
|
|
1331
|
+
nodesFunc: { type: Function, required: !0 },
|
|
1332
|
+
/**
|
|
1333
|
+
* 组件路径 → 异步加载器的映射,由消费方经 import.meta.glob 生成,例如:
|
|
1334
|
+
* const panels = import.meta.glob("./admin-panels/*.vue");
|
|
1335
|
+
* 叶子节点的 component 字段取值须与该映射的 key 一致(如 "./admin-panels/DashboardPanel.vue")。
|
|
1336
|
+
* 未提供时回退为运行时动态 import(仅 dev 可用,生产构建无法解析)。
|
|
1337
|
+
*/
|
|
1338
|
+
componentMap: {
|
|
1339
|
+
type: Object,
|
|
1340
|
+
default: void 0
|
|
1341
|
+
},
|
|
1342
|
+
/** 初始打开并激活的叶子节点 key(功能树加载完成后应用,仅首次生效),默认不打开任何选项卡 */
|
|
1343
|
+
defaultActive: { type: String, default: "" },
|
|
1344
|
+
/** 是否渲染侧栏顶部内置的功能搜索框(默认 true);false 时外部可自行实现并绑定 v-model:menu-keyword */
|
|
1345
|
+
showMenuSearch: { type: Boolean, default: !0 },
|
|
1346
|
+
/** 功能搜索关键词(受控):与 update:menuKeyword 配合支持 v-model:menu-keyword */
|
|
1347
|
+
menuKeyword: { type: String, default: "" }
|
|
1348
|
+
},
|
|
1349
|
+
emits: ["update:menuKeyword"],
|
|
1350
|
+
setup(e, { emit: f }) {
|
|
1351
|
+
const t = e, l = f, a = I(!1), k = I(t.menuKeyword);
|
|
1352
|
+
me(
|
|
1353
|
+
() => t.menuKeyword,
|
|
1354
|
+
(r) => {
|
|
1355
|
+
k.value = r;
|
|
1356
|
+
}
|
|
1357
|
+
);
|
|
1358
|
+
const u = Q({
|
|
1359
|
+
get: () => k.value,
|
|
1360
|
+
set: (r) => {
|
|
1361
|
+
k.value = r, l("update:menuKeyword", r);
|
|
1362
|
+
}
|
|
1363
|
+
}), A = Q(() => u.value.trim().length > 0), y = Q(() => zt(S.value, u.value)), x = Q(() => Qt(y.value)), { nodes: S, menuLoading: B, loadNodes: U } = Et(t), { openTabs: R, activeKey: b, openTab: _, removeTab: q, getComponent: T } = Tt(t);
|
|
1364
|
+
function X(r) {
|
|
1365
|
+
const m = nt(S.value, r);
|
|
1366
|
+
m && !ot(m) && _(m);
|
|
1367
|
+
}
|
|
1368
|
+
let j = !1;
|
|
1369
|
+
return Fe(async () => {
|
|
1370
|
+
if (await U(), !j && t.defaultActive) {
|
|
1371
|
+
const r = nt(S.value, t.defaultActive);
|
|
1372
|
+
r && !ot(r) && _(r), j = !0;
|
|
1373
|
+
}
|
|
1374
|
+
}), (r, m) => {
|
|
1375
|
+
const F = w("el-input"), Y = w("el-menu"), E = w("el-tab-pane"), ue = w("el-tabs"), ce = w("el-empty"), oe = ut("loading");
|
|
1376
|
+
return n(), v("div", Yl, [
|
|
1377
|
+
p("aside", {
|
|
1378
|
+
class: Se(["ys-main-panel__aside", { "is-collapsed": a.value }])
|
|
1379
|
+
}, [
|
|
1380
|
+
p("div", Nl, [
|
|
1381
|
+
p("button", {
|
|
1382
|
+
class: "ys-main-panel__collapse-btn",
|
|
1383
|
+
type: "button",
|
|
1384
|
+
title: a.value ? "展开菜单" : "折叠菜单",
|
|
1385
|
+
onClick: m[0] || (m[0] = ($) => a.value = !a.value)
|
|
1386
|
+
}, "☰", 8, ql),
|
|
1387
|
+
t.showMenuSearch && !a.value ? (n(), h(F, {
|
|
1388
|
+
key: 0,
|
|
1389
|
+
modelValue: u.value,
|
|
1390
|
+
"onUpdate:modelValue": m[1] || (m[1] = ($) => u.value = $),
|
|
1391
|
+
class: "ys-main-panel__aside-search",
|
|
1392
|
+
size: "small",
|
|
1393
|
+
clearable: "",
|
|
1394
|
+
placeholder: "搜索功能",
|
|
1395
|
+
"aria-label": "搜索功能"
|
|
1396
|
+
}, {
|
|
1397
|
+
prefix: o(() => [...m[3] || (m[3] = [
|
|
1398
|
+
p("svg", {
|
|
1399
|
+
class: "ys-main-panel__search-icon",
|
|
1400
|
+
viewBox: "0 0 1024 1024",
|
|
1401
|
+
width: "14",
|
|
1402
|
+
height: "14",
|
|
1403
|
+
"aria-hidden": "true"
|
|
1404
|
+
}, [
|
|
1405
|
+
p("path", {
|
|
1406
|
+
fill: "currentColor",
|
|
1407
|
+
d: "M909.098 839.904l-181.22-181.248a341.5 341.5 0 1 0-47.734 48.58l180.56 180.588a33.92 0 0 0 48.394-47.92zM454.4 745.6a291.2 291.2 0 1 1 291.2-291.2 291.2 291.2 0 0 1-291.2 291.2z"
|
|
1408
|
+
})
|
|
1409
|
+
], -1)
|
|
1410
|
+
])]),
|
|
1411
|
+
_: 1
|
|
1412
|
+
}, 8, ["modelValue"])) : M("", !0)
|
|
1413
|
+
]),
|
|
1414
|
+
A.value ? Je((n(), h(Y, {
|
|
1415
|
+
key: "search-" + u.value,
|
|
1416
|
+
"default-active": i(b),
|
|
1417
|
+
"default-openeds": x.value,
|
|
1418
|
+
collapse: a.value,
|
|
1419
|
+
class: "ys-main-panel__menu",
|
|
1420
|
+
"element-loading-background": "transparent",
|
|
1421
|
+
onSelect: X
|
|
1422
|
+
}, {
|
|
1423
|
+
default: o(() => [
|
|
1424
|
+
(n(!0), v(N, null, Z(y.value, ($) => (n(), h(st, {
|
|
1425
|
+
key: $.key,
|
|
1426
|
+
node: $
|
|
1427
|
+
}, null, 8, ["node"]))), 128)),
|
|
1428
|
+
y.value.length === 0 && !i(B) ? (n(), v("div", Ol, " 未找到匹配的功能 ")) : M("", !0)
|
|
1429
|
+
]),
|
|
1430
|
+
_: 1
|
|
1431
|
+
}, 8, ["default-active", "default-openeds", "collapse"])), [
|
|
1432
|
+
[oe, i(B)]
|
|
1433
|
+
]) : Je((n(), h(Y, {
|
|
1434
|
+
key: 1,
|
|
1435
|
+
"default-active": i(b),
|
|
1436
|
+
collapse: a.value,
|
|
1437
|
+
class: "ys-main-panel__menu",
|
|
1438
|
+
"element-loading-background": "transparent",
|
|
1439
|
+
onSelect: X
|
|
1440
|
+
}, {
|
|
1441
|
+
default: o(() => [
|
|
1442
|
+
(n(!0), v(N, null, Z(i(S), ($) => (n(), h(st, {
|
|
1443
|
+
key: $.key,
|
|
1444
|
+
node: $
|
|
1445
|
+
}, null, 8, ["node"]))), 128))
|
|
1446
|
+
]),
|
|
1447
|
+
_: 1
|
|
1448
|
+
}, 8, ["default-active", "collapse"])), [
|
|
1449
|
+
[oe, i(B)]
|
|
1450
|
+
])
|
|
1451
|
+
], 2),
|
|
1452
|
+
p("main", Ul, [
|
|
1453
|
+
i(R).length > 0 ? (n(), h(ue, {
|
|
1454
|
+
key: 0,
|
|
1455
|
+
modelValue: i(b),
|
|
1456
|
+
"onUpdate:modelValue": m[2] || (m[2] = ($) => Ce(b) ? b.value = $ : null),
|
|
1457
|
+
type: "card",
|
|
1458
|
+
closable: "",
|
|
1459
|
+
class: "ys-main-panel__tabs",
|
|
1460
|
+
onTabRemove: i(q)
|
|
1461
|
+
}, {
|
|
1462
|
+
default: o(() => [
|
|
1463
|
+
(n(!0), v(N, null, Z(i(R), ($) => (n(), h(E, {
|
|
1464
|
+
key: $.key,
|
|
1465
|
+
name: $.key
|
|
1466
|
+
}, {
|
|
1467
|
+
label: o(() => [
|
|
1468
|
+
C(P($.label), 1)
|
|
1469
|
+
]),
|
|
1470
|
+
default: o(() => [
|
|
1471
|
+
$.componentPath ? (n(), h(Te(i(T)($.componentPath)), Xe({
|
|
1472
|
+
key: 0,
|
|
1473
|
+
ref_for: !0
|
|
1474
|
+
}, $.props), null, 16)) : M("", !0)
|
|
1475
|
+
]),
|
|
1476
|
+
_: 2
|
|
1477
|
+
}, 1032, ["name"]))), 128))
|
|
1478
|
+
]),
|
|
1479
|
+
_: 1
|
|
1480
|
+
}, 8, ["modelValue", "onTabRemove"])) : (n(), v("div", Ll, [
|
|
1481
|
+
c(ce, { description: "暂无打开的功能,从左侧菜单选择" })
|
|
1482
|
+
]))
|
|
1483
|
+
])
|
|
1484
|
+
]);
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
}), Kl = /* @__PURE__ */ ae(Hl, [["__scopeId", "data-v-514e9964"]]), jl = {
|
|
1488
|
+
key: 2,
|
|
1489
|
+
class: "yk-advanced-value-editor yk-advanced-value-editor--range"
|
|
1490
|
+
}, Gl = {
|
|
1491
|
+
key: 4,
|
|
1492
|
+
class: "yk-advanced-value-editor yk-advanced-value-editor--daterange"
|
|
1493
|
+
}, Wl = { class: "yk-advanced-value-editor__recent-pop" }, Jl = /* @__PURE__ */ ee({
|
|
1494
|
+
name: "YsAdvancedValueEditor",
|
|
1495
|
+
__name: "advancedValueEditor",
|
|
1496
|
+
props: {
|
|
1497
|
+
/** 字段类型(决定控件种类) */
|
|
1498
|
+
fieldType: { type: String, required: !0 },
|
|
1499
|
+
/** 当前操作符(决定单值/区间/多值/无值形态) */
|
|
1500
|
+
op: { type: String, required: !0 },
|
|
1501
|
+
/**
|
|
1502
|
+
* 受控值;形态由 fieldType + op 决定(单值/区间数组/多值数组/boolean)。
|
|
1503
|
+
* type:null 是 Vue 官方的「任意类型 prop」通路:runtime 跳过构造器校验,
|
|
1504
|
+
* 类型映射为 any,父级 row.value 可直接 v-model 透传。
|
|
1505
|
+
*/
|
|
1506
|
+
modelValue: { type: null, required: !1, default: null },
|
|
1507
|
+
/** enum 类型的可选项(父组件按字段数据源异步加载后传入) */
|
|
1508
|
+
options: { type: Array, default: () => [] },
|
|
1509
|
+
/** enum 选项加载中(el-select loading) */
|
|
1510
|
+
optionsLoading: { type: Boolean, default: !1 },
|
|
1511
|
+
/** el-date-picker value-format,默认 YYYY-MM-DD */
|
|
1512
|
+
valueFormat: { type: String, default: "YYYY-MM-DD" }
|
|
1513
|
+
},
|
|
1514
|
+
emits: ["update:modelValue"],
|
|
1515
|
+
setup(e, { emit: f }) {
|
|
1516
|
+
const t = e, l = f, a = Q(() => t.op === "between" || t.op === "not_between"), k = Q(() => t.op === "in" || t.op === "not_in"), u = Q({
|
|
1517
|
+
get: () => typeof t.modelValue == "string" ? t.modelValue : "",
|
|
1518
|
+
set: (r) => l("update:modelValue", r)
|
|
1519
|
+
}), A = Q({
|
|
1520
|
+
get: () => typeof t.modelValue == "number" ? t.modelValue : void 0,
|
|
1521
|
+
set: (r) => l("update:modelValue", r ?? null)
|
|
1522
|
+
}), y = Q({
|
|
1523
|
+
get: () => typeof t.modelValue == "string" ? t.modelValue : null,
|
|
1524
|
+
set: (r) => l("update:modelValue", r)
|
|
1525
|
+
}), x = Q({
|
|
1526
|
+
get: () => typeof t.modelValue == "boolean" ? t.modelValue : void 0,
|
|
1527
|
+
set: (r) => l("update:modelValue", r ?? null)
|
|
1528
|
+
}), S = Q({
|
|
1529
|
+
get: () => {
|
|
1530
|
+
const r = t.modelValue;
|
|
1531
|
+
if (typeof r == "string" || typeof r == "number" || typeof r == "boolean") return r;
|
|
1532
|
+
},
|
|
1533
|
+
set: (r) => l("update:modelValue", r ?? null)
|
|
1534
|
+
}), B = Q({
|
|
1535
|
+
get: () => Array.isArray(t.modelValue) ? t.modelValue : [],
|
|
1536
|
+
set: (r) => l("update:modelValue", r)
|
|
1537
|
+
}), U = Q({
|
|
1538
|
+
get: () => {
|
|
1539
|
+
if (!Array.isArray(t.modelValue) || t.modelValue.length !== 2) return null;
|
|
1540
|
+
const r = t.modelValue[0], m = t.modelValue[1];
|
|
1541
|
+
return typeof r == "string" && typeof m == "string" ? [r, m] : null;
|
|
1542
|
+
},
|
|
1543
|
+
set: (r) => l("update:modelValue", r)
|
|
1544
|
+
}), R = Q({
|
|
1545
|
+
get: () => {
|
|
1546
|
+
if (Array.isArray(t.modelValue)) {
|
|
1547
|
+
const r = t.modelValue[0];
|
|
1548
|
+
return typeof r == "number" ? r : void 0;
|
|
1549
|
+
}
|
|
1550
|
+
},
|
|
1551
|
+
set: (r) => {
|
|
1552
|
+
const m = Array.isArray(t.modelValue) && typeof t.modelValue[1] == "number" ? t.modelValue[1] : null;
|
|
1553
|
+
l("update:modelValue", [r ?? null, m]);
|
|
1554
|
+
}
|
|
1555
|
+
}), b = Q({
|
|
1556
|
+
get: () => {
|
|
1557
|
+
if (Array.isArray(t.modelValue)) {
|
|
1558
|
+
const r = t.modelValue[1];
|
|
1559
|
+
return typeof r == "number" ? r : void 0;
|
|
1560
|
+
}
|
|
1561
|
+
},
|
|
1562
|
+
set: (r) => {
|
|
1563
|
+
const m = Array.isArray(t.modelValue) && typeof t.modelValue[0] == "number" ? t.modelValue[0] : null;
|
|
1564
|
+
l("update:modelValue", [m, r ?? null]);
|
|
1565
|
+
}
|
|
1566
|
+
}), _ = [
|
|
1567
|
+
{ label: "是", value: !0 },
|
|
1568
|
+
{ label: "否", value: !1 }
|
|
1569
|
+
];
|
|
1570
|
+
function q(r) {
|
|
1571
|
+
const m = /* @__PURE__ */ new Date(), F = /* @__PURE__ */ new Date();
|
|
1572
|
+
return F.setDate(F.getDate() - r), [F, m];
|
|
1573
|
+
}
|
|
1574
|
+
const T = [
|
|
1575
|
+
{ text: "最近 7 天", value: () => q(7) },
|
|
1576
|
+
{ text: "最近 30 天", value: () => q(30) },
|
|
1577
|
+
{ text: "最近 90 天", value: () => q(90) }
|
|
1578
|
+
], X = I(7);
|
|
1579
|
+
function j() {
|
|
1580
|
+
const r = X.value;
|
|
1581
|
+
if (!r || r < 1) return;
|
|
1582
|
+
const [m, F] = q(r);
|
|
1583
|
+
U.value = [
|
|
1584
|
+
at(m).format(t.valueFormat),
|
|
1585
|
+
at(F).format(t.valueFormat)
|
|
1586
|
+
];
|
|
1587
|
+
}
|
|
1588
|
+
return (r, m) => {
|
|
1589
|
+
const F = w("el-select"), Y = w("el-input"), E = w("el-input-number"), ue = w("el-date-picker"), ce = w("el-button"), oe = w("el-popover"), $ = w("el-option");
|
|
1590
|
+
return e.fieldType === "string" && k.value ? (n(), h(F, {
|
|
1591
|
+
key: 0,
|
|
1592
|
+
modelValue: B.value,
|
|
1593
|
+
"onUpdate:modelValue": m[0] || (m[0] = (g) => B.value = g),
|
|
1594
|
+
class: "yk-advanced-value-editor",
|
|
1595
|
+
multiple: "",
|
|
1596
|
+
filterable: "",
|
|
1597
|
+
"allow-create": "",
|
|
1598
|
+
"default-first-option": "",
|
|
1599
|
+
"reserve-keyword": !1,
|
|
1600
|
+
placeholder: "输入后回车添加"
|
|
1601
|
+
}, null, 8, ["modelValue"])) : e.fieldType === "string" ? (n(), h(Y, {
|
|
1602
|
+
key: 1,
|
|
1603
|
+
modelValue: u.value,
|
|
1604
|
+
"onUpdate:modelValue": m[1] || (m[1] = (g) => u.value = g),
|
|
1605
|
+
placeholder: "请输入",
|
|
1606
|
+
clearable: ""
|
|
1607
|
+
}, null, 8, ["modelValue"])) : e.fieldType === "number" && a.value ? (n(), v("div", jl, [
|
|
1608
|
+
c(E, {
|
|
1609
|
+
modelValue: R.value,
|
|
1610
|
+
"onUpdate:modelValue": m[2] || (m[2] = (g) => R.value = g),
|
|
1611
|
+
placeholder: "最小值",
|
|
1612
|
+
controls: !1,
|
|
1613
|
+
class: "yk-advanced-value-editor__num"
|
|
1614
|
+
}, null, 8, ["modelValue"]),
|
|
1615
|
+
m[11] || (m[11] = p("span", { class: "yk-advanced-value-editor__sep" }, "~", -1)),
|
|
1616
|
+
c(E, {
|
|
1617
|
+
modelValue: b.value,
|
|
1618
|
+
"onUpdate:modelValue": m[3] || (m[3] = (g) => b.value = g),
|
|
1619
|
+
placeholder: "最大值",
|
|
1620
|
+
controls: !1,
|
|
1621
|
+
class: "yk-advanced-value-editor__num"
|
|
1622
|
+
}, null, 8, ["modelValue"])
|
|
1623
|
+
])) : e.fieldType === "number" ? (n(), h(E, {
|
|
1624
|
+
key: 3,
|
|
1625
|
+
modelValue: A.value,
|
|
1626
|
+
"onUpdate:modelValue": m[4] || (m[4] = (g) => A.value = g),
|
|
1627
|
+
placeholder: "请输入数字",
|
|
1628
|
+
controls: !1,
|
|
1629
|
+
class: "yk-advanced-value-editor"
|
|
1630
|
+
}, null, 8, ["modelValue"])) : e.fieldType === "date" && a.value ? (n(), v("div", Gl, [
|
|
1631
|
+
c(ue, {
|
|
1632
|
+
modelValue: U.value,
|
|
1633
|
+
"onUpdate:modelValue": m[5] || (m[5] = (g) => U.value = g),
|
|
1634
|
+
type: "daterange",
|
|
1635
|
+
"value-format": e.valueFormat,
|
|
1636
|
+
"start-placeholder": "开始日期",
|
|
1637
|
+
"end-placeholder": "结束日期",
|
|
1638
|
+
shortcuts: T,
|
|
1639
|
+
class: "yk-advanced-value-editor__daterange-picker"
|
|
1640
|
+
}, null, 8, ["modelValue", "value-format"]),
|
|
1641
|
+
c(oe, {
|
|
1642
|
+
trigger: "click",
|
|
1643
|
+
placement: "bottom",
|
|
1644
|
+
width: 240
|
|
1645
|
+
}, {
|
|
1646
|
+
reference: o(() => [
|
|
1647
|
+
c(ce, { class: "yk-advanced-value-editor__recent-trigger" }, {
|
|
1648
|
+
default: o(() => [...m[12] || (m[12] = [
|
|
1649
|
+
C("最近 N 天", -1)
|
|
1650
|
+
])]),
|
|
1651
|
+
_: 1
|
|
1652
|
+
})
|
|
1653
|
+
]),
|
|
1654
|
+
default: o(() => [
|
|
1655
|
+
p("div", Wl, [
|
|
1656
|
+
m[14] || (m[14] = p("span", null, "最近", -1)),
|
|
1657
|
+
c(E, {
|
|
1658
|
+
modelValue: X.value,
|
|
1659
|
+
"onUpdate:modelValue": m[6] || (m[6] = (g) => X.value = g),
|
|
1660
|
+
min: 1,
|
|
1661
|
+
controls: !1,
|
|
1662
|
+
class: "yk-advanced-value-editor__recent-input"
|
|
1663
|
+
}, null, 8, ["modelValue"]),
|
|
1664
|
+
m[15] || (m[15] = p("span", null, "天", -1)),
|
|
1665
|
+
c(ce, {
|
|
1666
|
+
type: "primary",
|
|
1667
|
+
size: "small",
|
|
1668
|
+
onClick: j
|
|
1669
|
+
}, {
|
|
1670
|
+
default: o(() => [...m[13] || (m[13] = [
|
|
1671
|
+
C("应用", -1)
|
|
1672
|
+
])]),
|
|
1673
|
+
_: 1
|
|
1674
|
+
})
|
|
1675
|
+
])
|
|
1676
|
+
]),
|
|
1677
|
+
_: 1
|
|
1678
|
+
})
|
|
1679
|
+
])) : e.fieldType === "date" ? (n(), h(ue, {
|
|
1680
|
+
key: 5,
|
|
1681
|
+
modelValue: y.value,
|
|
1682
|
+
"onUpdate:modelValue": m[7] || (m[7] = (g) => y.value = g),
|
|
1683
|
+
type: "date",
|
|
1684
|
+
"value-format": e.valueFormat,
|
|
1685
|
+
placeholder: "选择日期",
|
|
1686
|
+
clearable: ""
|
|
1687
|
+
}, null, 8, ["modelValue", "value-format"])) : e.fieldType === "boolean" ? (n(), h(F, {
|
|
1688
|
+
key: 6,
|
|
1689
|
+
modelValue: x.value,
|
|
1690
|
+
"onUpdate:modelValue": m[8] || (m[8] = (g) => x.value = g),
|
|
1691
|
+
placeholder: "请选择",
|
|
1692
|
+
clearable: ""
|
|
1693
|
+
}, {
|
|
1694
|
+
default: o(() => [
|
|
1695
|
+
(n(), v(N, null, Z(_, (g) => c($, {
|
|
1696
|
+
key: String(g.value),
|
|
1697
|
+
label: g.label,
|
|
1698
|
+
value: g.value
|
|
1699
|
+
}, null, 8, ["label", "value"])), 64))
|
|
1700
|
+
]),
|
|
1701
|
+
_: 1
|
|
1702
|
+
}, 8, ["modelValue"])) : e.fieldType === "enum" && k.value ? (n(), h(F, {
|
|
1703
|
+
key: 7,
|
|
1704
|
+
modelValue: B.value,
|
|
1705
|
+
"onUpdate:modelValue": m[9] || (m[9] = (g) => B.value = g),
|
|
1706
|
+
multiple: "",
|
|
1707
|
+
loading: e.optionsLoading,
|
|
1708
|
+
placeholder: "请选择",
|
|
1709
|
+
clearable: ""
|
|
1710
|
+
}, {
|
|
1711
|
+
default: o(() => [
|
|
1712
|
+
(n(!0), v(N, null, Z(e.options, (g) => (n(), h($, {
|
|
1713
|
+
key: String(g.value),
|
|
1714
|
+
label: g.label,
|
|
1715
|
+
value: g.value
|
|
1716
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
1717
|
+
]),
|
|
1718
|
+
_: 1
|
|
1719
|
+
}, 8, ["modelValue", "loading"])) : e.fieldType === "enum" ? (n(), h(F, {
|
|
1720
|
+
key: 8,
|
|
1721
|
+
modelValue: S.value,
|
|
1722
|
+
"onUpdate:modelValue": m[10] || (m[10] = (g) => S.value = g),
|
|
1723
|
+
loading: e.optionsLoading,
|
|
1724
|
+
placeholder: "请选择",
|
|
1725
|
+
clearable: ""
|
|
1726
|
+
}, {
|
|
1727
|
+
default: o(() => [
|
|
1728
|
+
(n(!0), v(N, null, Z(e.options, (g) => (n(), h($, {
|
|
1729
|
+
key: String(g.value),
|
|
1730
|
+
label: g.label,
|
|
1731
|
+
value: g.value
|
|
1732
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
1733
|
+
]),
|
|
1734
|
+
_: 1
|
|
1735
|
+
}, 8, ["modelValue", "loading"])) : M("", !0);
|
|
1736
|
+
};
|
|
1737
|
+
}
|
|
1738
|
+
}), _t = /* @__PURE__ */ ae(Jl, [["__scopeId", "data-v-dda18bcf"]]), bt = Symbol("YsAdvancedFilter"), Xl = { class: "yk-adv-group__header" }, Zl = { class: "yk-adv-group__actions" }, en = { class: "yk-adv-group__children" }, tn = {
|
|
1739
|
+
key: 0,
|
|
1740
|
+
class: "yk-adv-group__nested"
|
|
1741
|
+
}, ln = {
|
|
1742
|
+
key: 1,
|
|
1743
|
+
class: "yk-adv-group__row"
|
|
1744
|
+
}, nn = {
|
|
1745
|
+
key: 0,
|
|
1746
|
+
class: "yk-adv-group__empty"
|
|
1747
|
+
}, on = /* @__PURE__ */ ee({
|
|
1748
|
+
name: "YsAdvancedConditionGroup",
|
|
1749
|
+
__name: "advancedConditionGroup",
|
|
1750
|
+
props: {
|
|
1751
|
+
/** 本分组节点数据 */
|
|
1752
|
+
group: { type: Object, required: !0 },
|
|
1753
|
+
/** 嵌套层级;0 = 根(无边框),>=1 = 嵌套(左侧色条 + 缩进) */
|
|
1754
|
+
level: { type: Number, default: 0 }
|
|
1755
|
+
},
|
|
1756
|
+
setup(e) {
|
|
1757
|
+
const f = e, t = dt(bt);
|
|
1758
|
+
function l(b) {
|
|
1759
|
+
(b === "and" || b === "or") && t.api.setGroupCombinator(f.group.id, b);
|
|
1760
|
+
}
|
|
1761
|
+
function a() {
|
|
1762
|
+
t.api.addLeaf(f.group.id);
|
|
1763
|
+
}
|
|
1764
|
+
function k() {
|
|
1765
|
+
t.api.addNestedGroup(f.group.id);
|
|
1766
|
+
}
|
|
1767
|
+
function u() {
|
|
1768
|
+
t.api.removeNode(f.group.id);
|
|
1769
|
+
}
|
|
1770
|
+
function A(b, _) {
|
|
1771
|
+
typeof _ == "string" && t.api.changeField(b.id, _);
|
|
1772
|
+
}
|
|
1773
|
+
function y(b, _) {
|
|
1774
|
+
t.api.changeOperator(b.id, _);
|
|
1775
|
+
}
|
|
1776
|
+
function x(b) {
|
|
1777
|
+
t.api.removeNode(b);
|
|
1778
|
+
}
|
|
1779
|
+
const S = et;
|
|
1780
|
+
function B(b) {
|
|
1781
|
+
return b;
|
|
1782
|
+
}
|
|
1783
|
+
function U(b) {
|
|
1784
|
+
return t.columns.find((_) => _.propertyPath === b);
|
|
1785
|
+
}
|
|
1786
|
+
function R(b) {
|
|
1787
|
+
var _;
|
|
1788
|
+
return ((_ = U(b)) == null ? void 0 : _.displayFormat) ?? "YYYY-MM-DD";
|
|
1789
|
+
}
|
|
1790
|
+
return (b, _) => {
|
|
1791
|
+
const q = w("el-radio-button"), T = w("el-radio-group"), X = w("el-button"), j = w("YsAdvancedConditionGroup"), r = w("el-option"), m = w("el-select");
|
|
1792
|
+
return n(), v("div", {
|
|
1793
|
+
class: Se(["yk-adv-group", [`level-${e.level}`, { "is-root": e.level === 0 }]])
|
|
1794
|
+
}, [
|
|
1795
|
+
p("div", Xl, [
|
|
1796
|
+
_[5] || (_[5] = p("span", { class: "yk-adv-group__comb-label" }, "满足", -1)),
|
|
1797
|
+
c(T, {
|
|
1798
|
+
"model-value": e.group.combinator,
|
|
1799
|
+
size: "small",
|
|
1800
|
+
"onUpdate:modelValue": l
|
|
1801
|
+
}, {
|
|
1802
|
+
default: o(() => [
|
|
1803
|
+
c(q, { value: "and" }, {
|
|
1804
|
+
default: o(() => [..._[0] || (_[0] = [
|
|
1805
|
+
C("全部", -1)
|
|
1806
|
+
])]),
|
|
1807
|
+
_: 1
|
|
1808
|
+
}),
|
|
1809
|
+
c(q, { value: "or" }, {
|
|
1810
|
+
default: o(() => [..._[1] || (_[1] = [
|
|
1811
|
+
C("任一", -1)
|
|
1812
|
+
])]),
|
|
1813
|
+
_: 1
|
|
1814
|
+
})
|
|
1815
|
+
]),
|
|
1816
|
+
_: 1
|
|
1817
|
+
}, 8, ["model-value"]),
|
|
1818
|
+
_[6] || (_[6] = p("span", { class: "yk-adv-group__comb-label" }, "条件", -1)),
|
|
1819
|
+
p("span", Zl, [
|
|
1820
|
+
c(X, {
|
|
1821
|
+
link: "",
|
|
1822
|
+
type: "primary",
|
|
1823
|
+
onClick: a
|
|
1824
|
+
}, {
|
|
1825
|
+
default: o(() => [..._[2] || (_[2] = [
|
|
1826
|
+
C("+ 条件", -1)
|
|
1827
|
+
])]),
|
|
1828
|
+
_: 1
|
|
1829
|
+
}),
|
|
1830
|
+
c(X, {
|
|
1831
|
+
link: "",
|
|
1832
|
+
type: "primary",
|
|
1833
|
+
onClick: k
|
|
1834
|
+
}, {
|
|
1835
|
+
default: o(() => [..._[3] || (_[3] = [
|
|
1836
|
+
C(" + 嵌套组 ", -1)
|
|
1837
|
+
])]),
|
|
1838
|
+
_: 1
|
|
1839
|
+
}),
|
|
1840
|
+
e.level > 0 ? (n(), h(X, {
|
|
1841
|
+
key: 0,
|
|
1842
|
+
link: "",
|
|
1843
|
+
type: "danger",
|
|
1844
|
+
onClick: u
|
|
1845
|
+
}, {
|
|
1846
|
+
default: o(() => [..._[4] || (_[4] = [
|
|
1847
|
+
C(" 删除组 ", -1)
|
|
1848
|
+
])]),
|
|
1849
|
+
_: 1
|
|
1850
|
+
})) : M("", !0)
|
|
1851
|
+
])
|
|
1852
|
+
]),
|
|
1853
|
+
p("div", en, [
|
|
1854
|
+
(n(!0), v(N, null, Z(e.group.children, (F) => (n(), v(N, {
|
|
1855
|
+
key: F.id
|
|
1856
|
+
}, [
|
|
1857
|
+
i(S)(F) ? (n(), v("div", tn, [
|
|
1858
|
+
c(j, {
|
|
1859
|
+
group: F,
|
|
1860
|
+
level: e.level + 1
|
|
1861
|
+
}, null, 8, ["group", "level"])
|
|
1862
|
+
])) : (n(), v("div", ln, [
|
|
1863
|
+
c(m, {
|
|
1864
|
+
"model-value": F.propertyPath,
|
|
1865
|
+
class: "yk-adv-group__field",
|
|
1866
|
+
placeholder: "选择字段",
|
|
1867
|
+
filterable: "",
|
|
1868
|
+
"onUpdate:modelValue": (Y) => A(F, Y)
|
|
1869
|
+
}, {
|
|
1870
|
+
default: o(() => [
|
|
1871
|
+
(n(!0), v(N, null, Z(i(t).columns, (Y) => (n(), h(r, {
|
|
1872
|
+
key: Y.propertyPath,
|
|
1873
|
+
label: Y.displayName ?? Y.propertyPath,
|
|
1874
|
+
value: Y.propertyPath
|
|
1875
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
1876
|
+
]),
|
|
1877
|
+
_: 1
|
|
1878
|
+
}, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1879
|
+
c(m, {
|
|
1880
|
+
"model-value": F.op,
|
|
1881
|
+
class: "yk-adv-group__op",
|
|
1882
|
+
placeholder: "操作符",
|
|
1883
|
+
filterable: "",
|
|
1884
|
+
"onUpdate:modelValue": (Y) => y(F, Y)
|
|
1885
|
+
}, {
|
|
1886
|
+
default: o(() => [
|
|
1887
|
+
(n(!0), v(N, null, Z(i(t).api.operatorsOf(F.propertyPath), (Y) => (n(), h(r, {
|
|
1888
|
+
key: Y,
|
|
1889
|
+
label: i(Lt)[Y],
|
|
1890
|
+
value: Y
|
|
1891
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
1892
|
+
]),
|
|
1893
|
+
_: 2
|
|
1894
|
+
}, 1032, ["model-value", "onUpdate:modelValue"]),
|
|
1895
|
+
i(Ht)(F.op) ? M("", !0) : (n(), h(_t, {
|
|
1896
|
+
key: 0,
|
|
1897
|
+
"field-type": i(t).api.fieldTypeOf(F.propertyPath),
|
|
1898
|
+
op: F.op,
|
|
1899
|
+
options: i(t).optionsMap.value[F.propertyPath] ?? [],
|
|
1900
|
+
"options-loading": i(t).loadingMap.value[F.propertyPath] === !0,
|
|
1901
|
+
"value-format": R(F.propertyPath),
|
|
1902
|
+
class: Se([
|
|
1903
|
+
"yk-adv-group__value",
|
|
1904
|
+
{ "is-invalid": i(t).api.isConditionEmpty(F) }
|
|
1905
|
+
]),
|
|
1906
|
+
modelValue: F.value,
|
|
1907
|
+
"onUpdate:modelValue": (Y) => F.value = Y
|
|
1908
|
+
}, null, 8, ["field-type", "op", "options", "options-loading", "value-format", "class", "modelValue", "onUpdate:modelValue"])),
|
|
1909
|
+
c(X, {
|
|
1910
|
+
link: "",
|
|
1911
|
+
type: "danger",
|
|
1912
|
+
class: "yk-adv-group__remove",
|
|
1913
|
+
onClick: (Y) => x(F.id)
|
|
1914
|
+
}, {
|
|
1915
|
+
default: o(() => [..._[7] || (_[7] = [
|
|
1916
|
+
C(" 删除 ", -1)
|
|
1917
|
+
])]),
|
|
1918
|
+
_: 1
|
|
1919
|
+
}, 8, ["onClick"])
|
|
1920
|
+
]))
|
|
1921
|
+
], 64))), 128)),
|
|
1922
|
+
e.group.children.length === 0 ? (n(), v("div", nn, " 暂无条件,点击「+ 条件」或「+ 嵌套组」 ")) : M("", !0)
|
|
1923
|
+
])
|
|
1924
|
+
], 2);
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1927
|
+
}), ht = /* @__PURE__ */ ae(on, [["__scopeId", "data-v-518d9c97"]]), an = {
|
|
1928
|
+
key: 0,
|
|
1929
|
+
class: "yk-advanced-filter__actions"
|
|
1930
|
+
}, sn = /* @__PURE__ */ ee({
|
|
1931
|
+
name: "YsAdvancedFilterPanel",
|
|
1932
|
+
__name: "advancedFilterPanel",
|
|
1933
|
+
props: {
|
|
1934
|
+
/** 可供查询的字段列表(通常直接传 Meta.columns;隐藏列也可查询) */
|
|
1935
|
+
columns: { type: Array, required: !0 },
|
|
1936
|
+
/** 枚举字段数据源,按 propertyPath 映射;命中的字段按 enum 渲染 */
|
|
1937
|
+
optionSources: {
|
|
1938
|
+
type: Object,
|
|
1939
|
+
required: !1
|
|
1940
|
+
},
|
|
1941
|
+
/** 是否渲染内置「查询」按钮,默认 true */
|
|
1942
|
+
showSearch: { type: Boolean, default: !0 },
|
|
1943
|
+
/** 是否渲染内置「重置」按钮,默认 true */
|
|
1944
|
+
showReset: { type: Boolean, default: !0 },
|
|
1945
|
+
/** 查询按钮文案,默认 "查询" */
|
|
1946
|
+
searchButtonText: { type: String, default: "查询" },
|
|
1947
|
+
/** 重置按钮文案,默认 "重置" */
|
|
1948
|
+
resetButtonText: { type: String, default: "重置" },
|
|
1949
|
+
/** 是否渲染内置「保存」按钮,默认 true */
|
|
1950
|
+
showSaveQuery: { type: Boolean, default: !0 },
|
|
1951
|
+
/** 已存查询列表(v-model:saved-queries),不传则用内部状态 */
|
|
1952
|
+
savedQueries: {
|
|
1953
|
+
type: Array,
|
|
1954
|
+
default: void 0
|
|
1955
|
+
}
|
|
1956
|
+
},
|
|
1957
|
+
emits: ["search", "reset", "update:savedQueries"],
|
|
1958
|
+
setup(e, { expose: f, emit: t }) {
|
|
1959
|
+
const l = e, a = t, k = mt(l), { rootGroup: u, fieldTypeOf: A, filter: y, reset: x } = k, S = I({}), B = I({});
|
|
1960
|
+
async function U($) {
|
|
1961
|
+
var G;
|
|
1962
|
+
const g = (G = l.optionSources) == null ? void 0 : G[$];
|
|
1963
|
+
if (g && !(S.value[$] || B.value[$])) {
|
|
1964
|
+
B.value[$] = !0;
|
|
1965
|
+
try {
|
|
1966
|
+
S.value[$] = await g();
|
|
1967
|
+
} finally {
|
|
1968
|
+
B.value[$] = !1;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
function R($) {
|
|
1973
|
+
const g = /* @__PURE__ */ new Set();
|
|
1974
|
+
function G(de) {
|
|
1975
|
+
et(de) ? de.children.forEach(G) : A(de.propertyPath) === "enum" && g.add(de.propertyPath);
|
|
1976
|
+
}
|
|
1977
|
+
return $.children.forEach(G), [...g];
|
|
1978
|
+
}
|
|
1979
|
+
me(
|
|
1980
|
+
u,
|
|
1981
|
+
($) => {
|
|
1982
|
+
for (const g of R($))
|
|
1983
|
+
U(g);
|
|
1984
|
+
},
|
|
1985
|
+
{ deep: !0, immediate: !0 }
|
|
1986
|
+
), ct(bt, {
|
|
1987
|
+
columns: l.columns,
|
|
1988
|
+
optionsMap: S,
|
|
1989
|
+
loadingMap: B,
|
|
1990
|
+
api: k
|
|
1991
|
+
});
|
|
1992
|
+
function b() {
|
|
1993
|
+
a("search", y.value);
|
|
1994
|
+
}
|
|
1995
|
+
function _() {
|
|
1996
|
+
x(), a("reset");
|
|
1997
|
+
}
|
|
1998
|
+
const q = I([]), T = Q(
|
|
1999
|
+
() => l.savedQueries ?? q.value
|
|
2000
|
+
);
|
|
2001
|
+
function X($) {
|
|
2002
|
+
q.value = $, a("update:savedQueries", $);
|
|
2003
|
+
}
|
|
2004
|
+
const j = I(!1), r = I(""), m = I("");
|
|
2005
|
+
let F = 0;
|
|
2006
|
+
function Y() {
|
|
2007
|
+
function $(g) {
|
|
2008
|
+
return g.children.some((G) => et(G) ? $(G) : k.isConditionEmpty(G));
|
|
2009
|
+
}
|
|
2010
|
+
return $(u.value);
|
|
2011
|
+
}
|
|
2012
|
+
function E() {
|
|
2013
|
+
r.value = "", m.value = "", j.value = !0;
|
|
2014
|
+
}
|
|
2015
|
+
function ue() {
|
|
2016
|
+
const $ = r.value.trim();
|
|
2017
|
+
if (!$) return;
|
|
2018
|
+
Y() && fe.warning("当前存在未填值的条件行(标红),保存的预设可能不完整");
|
|
2019
|
+
const g = JSON.parse(JSON.stringify(u.value)), G = {
|
|
2020
|
+
id: `sq-${++F}`,
|
|
2021
|
+
name: $,
|
|
2022
|
+
description: m.value.trim(),
|
|
2023
|
+
group: g,
|
|
2024
|
+
filterInfo: y.value
|
|
2025
|
+
};
|
|
2026
|
+
X([...T.value, G]), j.value = !1;
|
|
2027
|
+
}
|
|
2028
|
+
function ce($) {
|
|
2029
|
+
u.value = JSON.parse(JSON.stringify($.group)), b();
|
|
2030
|
+
}
|
|
2031
|
+
function oe($) {
|
|
2032
|
+
X(T.value.filter((g) => g.id !== $));
|
|
2033
|
+
}
|
|
2034
|
+
return f({
|
|
2035
|
+
get filter() {
|
|
2036
|
+
return y.value;
|
|
2037
|
+
},
|
|
2038
|
+
reset: _,
|
|
2039
|
+
openSaveDialog: E,
|
|
2040
|
+
applySavedQuery: ce,
|
|
2041
|
+
removeSavedQuery: oe,
|
|
2042
|
+
get savedQueries() {
|
|
2043
|
+
return T.value;
|
|
2044
|
+
}
|
|
2045
|
+
}), ($, g) => {
|
|
2046
|
+
const G = w("el-button"), de = w("el-input"), D = w("el-form-item"), z = w("el-form"), H = w("el-dialog");
|
|
2047
|
+
return n(), v("div", {
|
|
2048
|
+
class: "yk-advanced-filter",
|
|
2049
|
+
onKeydown: Ke(b, ["enter"])
|
|
2050
|
+
}, [
|
|
2051
|
+
c(ht, {
|
|
2052
|
+
group: i(u),
|
|
2053
|
+
level: 0
|
|
2054
|
+
}, null, 8, ["group"]),
|
|
2055
|
+
e.showSearch || e.showReset || e.showSaveQuery ? (n(), v("div", an, [
|
|
2056
|
+
e.showSearch ? (n(), h(G, {
|
|
2057
|
+
key: 0,
|
|
2058
|
+
type: "primary",
|
|
2059
|
+
onClick: b
|
|
2060
|
+
}, {
|
|
2061
|
+
default: o(() => [
|
|
2062
|
+
C(P(e.searchButtonText), 1)
|
|
2063
|
+
]),
|
|
2064
|
+
_: 1
|
|
2065
|
+
})) : M("", !0),
|
|
2066
|
+
e.showReset ? (n(), h(G, {
|
|
2067
|
+
key: 1,
|
|
2068
|
+
onClick: _
|
|
2069
|
+
}, {
|
|
2070
|
+
default: o(() => [
|
|
2071
|
+
C(P(e.resetButtonText), 1)
|
|
2072
|
+
]),
|
|
2073
|
+
_: 1
|
|
2074
|
+
})) : M("", !0),
|
|
2075
|
+
e.showSaveQuery ? (n(), h(G, {
|
|
2076
|
+
key: 2,
|
|
2077
|
+
onClick: E
|
|
2078
|
+
}, {
|
|
2079
|
+
default: o(() => [...g[4] || (g[4] = [
|
|
2080
|
+
C("保存", -1)
|
|
2081
|
+
])]),
|
|
2082
|
+
_: 1
|
|
2083
|
+
})) : M("", !0)
|
|
2084
|
+
])) : M("", !0),
|
|
2085
|
+
c(H, {
|
|
2086
|
+
modelValue: j.value,
|
|
2087
|
+
"onUpdate:modelValue": g[3] || (g[3] = (L) => j.value = L),
|
|
2088
|
+
title: "保存查询",
|
|
2089
|
+
width: "440px",
|
|
2090
|
+
"append-to-body": ""
|
|
2091
|
+
}, {
|
|
2092
|
+
footer: o(() => [
|
|
2093
|
+
c(G, {
|
|
2094
|
+
onClick: g[2] || (g[2] = (L) => j.value = !1)
|
|
2095
|
+
}, {
|
|
2096
|
+
default: o(() => [...g[5] || (g[5] = [
|
|
2097
|
+
C("取消", -1)
|
|
2098
|
+
])]),
|
|
2099
|
+
_: 1
|
|
2100
|
+
}),
|
|
2101
|
+
c(G, {
|
|
2102
|
+
type: "primary",
|
|
2103
|
+
disabled: !r.value.trim(),
|
|
2104
|
+
onClick: ue
|
|
2105
|
+
}, {
|
|
2106
|
+
default: o(() => [...g[6] || (g[6] = [
|
|
2107
|
+
C(" 确定 ", -1)
|
|
2108
|
+
])]),
|
|
2109
|
+
_: 1
|
|
2110
|
+
}, 8, ["disabled"])
|
|
2111
|
+
]),
|
|
2112
|
+
default: o(() => [
|
|
2113
|
+
c(z, { "label-position": "top" }, {
|
|
2114
|
+
default: o(() => [
|
|
2115
|
+
c(D, { label: "名称" }, {
|
|
2116
|
+
default: o(() => [
|
|
2117
|
+
c(de, {
|
|
2118
|
+
modelValue: r.value,
|
|
2119
|
+
"onUpdate:modelValue": g[0] || (g[0] = (L) => r.value = L),
|
|
2120
|
+
placeholder: "请输入查询名称",
|
|
2121
|
+
maxlength: "50",
|
|
2122
|
+
"show-word-limit": "",
|
|
2123
|
+
onKeydown: Ke(ue, ["enter"])
|
|
2124
|
+
}, null, 8, ["modelValue"])
|
|
2125
|
+
]),
|
|
2126
|
+
_: 1
|
|
2127
|
+
}),
|
|
2128
|
+
c(D, { label: "描述" }, {
|
|
2129
|
+
default: o(() => [
|
|
2130
|
+
c(de, {
|
|
2131
|
+
modelValue: m.value,
|
|
2132
|
+
"onUpdate:modelValue": g[1] || (g[1] = (L) => m.value = L),
|
|
2133
|
+
type: "textarea",
|
|
2134
|
+
rows: 2,
|
|
2135
|
+
placeholder: "可选,描述此查询的用途(hover 标签时显示)",
|
|
2136
|
+
maxlength: "200",
|
|
2137
|
+
"show-word-limit": ""
|
|
2138
|
+
}, null, 8, ["modelValue"])
|
|
2139
|
+
]),
|
|
2140
|
+
_: 1
|
|
2141
|
+
})
|
|
2142
|
+
]),
|
|
2143
|
+
_: 1
|
|
2144
|
+
})
|
|
2145
|
+
]),
|
|
2146
|
+
_: 1
|
|
2147
|
+
}, 8, ["modelValue"])
|
|
2148
|
+
], 32);
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
}), wt = /* @__PURE__ */ ae(sn, [["__scopeId", "data-v-0563cef9"]]), rn = {
|
|
2152
|
+
key: 0,
|
|
2153
|
+
viewBox: "0 0 24 24",
|
|
2154
|
+
width: "16",
|
|
2155
|
+
height: "16",
|
|
2156
|
+
fill: "none",
|
|
2157
|
+
stroke: "currentColor",
|
|
2158
|
+
"stroke-width": "2",
|
|
2159
|
+
"stroke-linecap": "round",
|
|
2160
|
+
"stroke-linejoin": "round"
|
|
2161
|
+
}, un = {
|
|
2162
|
+
key: 1,
|
|
2163
|
+
viewBox: "0 0 24 24",
|
|
2164
|
+
width: "16",
|
|
2165
|
+
height: "16",
|
|
2166
|
+
fill: "none",
|
|
2167
|
+
stroke: "currentColor",
|
|
2168
|
+
"stroke-width": "2",
|
|
2169
|
+
"stroke-linecap": "round",
|
|
2170
|
+
"stroke-linejoin": "round"
|
|
2171
|
+
}, dn = {
|
|
2172
|
+
key: 1,
|
|
2173
|
+
class: "yk-filter-panel__actions"
|
|
2174
|
+
}, cn = {
|
|
2175
|
+
key: 2,
|
|
2176
|
+
class: "yk-filter-panel__saved"
|
|
2177
|
+
}, pn = { class: "yk-filter-panel__mode-bar" }, mn = {
|
|
2178
|
+
key: 0,
|
|
2179
|
+
class: "yk-filter-panel__saved"
|
|
2180
|
+
}, fn = /* @__PURE__ */ ee({
|
|
2181
|
+
name: "YsFilterPanel",
|
|
2182
|
+
__name: "filterPanel",
|
|
2183
|
+
props: {
|
|
2184
|
+
/** 是否渲染内置「查询」按钮,默认 true */
|
|
2185
|
+
showSearch: { type: Boolean, default: !0 },
|
|
2186
|
+
/** 是否渲染内置「重置」按钮,默认 true */
|
|
2187
|
+
showReset: { type: Boolean, default: !0 },
|
|
2188
|
+
/** 查询按钮文案,默认 "查询" */
|
|
2189
|
+
searchButtonText: { type: String, default: "查询" },
|
|
2190
|
+
/** 重置按钮文案,默认 "重置" */
|
|
2191
|
+
resetButtonText: { type: String, default: "重置" },
|
|
2192
|
+
/** 是否启用高级查询切换(显示切换按钮,允许切到高级查询面板) */
|
|
2193
|
+
enableAdvancedFilter: { type: Boolean, default: !1 },
|
|
2194
|
+
/** 高级查询模式所需的字段列表(enableAdvancedFilter=true 时必传) */
|
|
2195
|
+
advancedColumns: {
|
|
2196
|
+
type: Array,
|
|
2197
|
+
default: () => []
|
|
2198
|
+
},
|
|
2199
|
+
/** 高级查询模式所需的枚举数据源,按 propertyPath 映射 */
|
|
2200
|
+
advancedOptionSources: {
|
|
2201
|
+
type: Object,
|
|
2202
|
+
required: !1
|
|
2203
|
+
},
|
|
2204
|
+
/** 是否在简单模式下显示快速查询标签,默认 false */
|
|
2205
|
+
showQuickQuery: { type: Boolean, default: !1 },
|
|
2206
|
+
/** 快速查询列表(v-model:quick-queries),与高级面板的 saved-queries 共享 */
|
|
2207
|
+
quickQueries: {
|
|
2208
|
+
type: Array,
|
|
2209
|
+
default: void 0
|
|
2210
|
+
},
|
|
2211
|
+
/**
|
|
2212
|
+
* 异步加载快速查询列表(如从后端拉取已保存的预设)。
|
|
2213
|
+
* 存在时组件 onMounted 自动调用,返回的 SavedQuery[] 填充快速查询列表。
|
|
2214
|
+
* 后端只需存 group + name + description,filterInfo 由组件按 advancedColumns 重算。
|
|
2215
|
+
*/
|
|
2216
|
+
loadQuickQueryFun: {
|
|
2217
|
+
type: Function,
|
|
2218
|
+
required: !1
|
|
2219
|
+
},
|
|
2220
|
+
/**
|
|
2221
|
+
* 异步保存快速查询(如持久化到后端)。
|
|
2222
|
+
* 高级模式点「保存」新增预设时自动调用;返回值若为 SavedQuery 则替换本地(如后端分配了 id)。
|
|
2223
|
+
*/
|
|
2224
|
+
saveQuickQueryFun: {
|
|
2225
|
+
type: Function,
|
|
2226
|
+
required: !1
|
|
2227
|
+
},
|
|
2228
|
+
/**
|
|
2229
|
+
* 单行模式:开启后面板右上角显示展开/折叠按钮,折叠态(默认)放不下的 filter items
|
|
2230
|
+
* 整体隐藏(display:none,不裁切、不可交互),但**不清除已填值**——隐藏的 FilterItem
|
|
2231
|
+
* 仍注册在 panel,条件仍参与聚合查询。展开后恢复多行 wrap 布局。默认 false。
|
|
2232
|
+
* 高级查询模式不受此属性影响(仍是多行)。
|
|
2233
|
+
*/
|
|
2234
|
+
singleLine: { type: Boolean, default: !1 }
|
|
2235
|
+
},
|
|
2236
|
+
emits: ["search", "reset", "update:quickQueries"],
|
|
2237
|
+
setup(e, { expose: f, emit: t }) {
|
|
2238
|
+
const l = e, a = t, { filter: k, register: u, reset: A } = It();
|
|
2239
|
+
ct(ft, u);
|
|
2240
|
+
const y = I("simple"), x = I(!0), S = I(0), B = I(null), U = I([]), R = Q(
|
|
2241
|
+
() => l.quickQueries ?? U.value
|
|
2242
|
+
), b = I(null), _ = Q(() => {
|
|
2243
|
+
var D;
|
|
2244
|
+
return y.value === "advanced" ? ((D = b.value) == null ? void 0 : D.filter) ?? tt() : k.value;
|
|
2245
|
+
});
|
|
2246
|
+
function q() {
|
|
2247
|
+
a("search", _.value);
|
|
2248
|
+
}
|
|
2249
|
+
function T() {
|
|
2250
|
+
var D;
|
|
2251
|
+
y.value === "advanced" ? (D = b.value) == null || D.reset() : A(), a("reset");
|
|
2252
|
+
}
|
|
2253
|
+
function X(D) {
|
|
2254
|
+
a("search", D);
|
|
2255
|
+
}
|
|
2256
|
+
function j() {
|
|
2257
|
+
a("reset");
|
|
2258
|
+
}
|
|
2259
|
+
async function r(D) {
|
|
2260
|
+
const z = new Set(R.value.map((L) => L.id)), H = D.filter((L) => !z.has(L.id));
|
|
2261
|
+
if (l.saveQuickQueryFun && H.length > 0) {
|
|
2262
|
+
const L = [];
|
|
2263
|
+
for (const K of H)
|
|
2264
|
+
try {
|
|
2265
|
+
const ne = await l.saveQuickQueryFun(K);
|
|
2266
|
+
L.push(ne ?? K);
|
|
2267
|
+
} catch {
|
|
2268
|
+
fe.error(`保存快速查询「${K.name}」失败`), L.push(K);
|
|
2269
|
+
}
|
|
2270
|
+
let se = D;
|
|
2271
|
+
if (L.some((K, ne) => K !== H[ne])) {
|
|
2272
|
+
const K = new Map(H.map((ne, ge) => [ne.id, L[ge] ?? ne]));
|
|
2273
|
+
se = D.map((ne) => K.get(ne.id) ?? ne);
|
|
2274
|
+
}
|
|
2275
|
+
U.value = se, a("update:quickQueries", se);
|
|
2276
|
+
} else
|
|
2277
|
+
U.value = D, a("update:quickQueries", D);
|
|
2278
|
+
}
|
|
2279
|
+
let m = null;
|
|
2280
|
+
function F() {
|
|
2281
|
+
return !m && l.advancedColumns.length && (m = mt({
|
|
2282
|
+
columns: l.advancedColumns,
|
|
2283
|
+
optionSources: l.advancedOptionSources
|
|
2284
|
+
})), m;
|
|
2285
|
+
}
|
|
2286
|
+
function Y(D) {
|
|
2287
|
+
const z = F();
|
|
2288
|
+
return z ? (z.rootGroup.value = JSON.parse(JSON.stringify(D)), z.filter.value) : { toString: () => "", isEmpty: () => !0 };
|
|
2289
|
+
}
|
|
2290
|
+
Fe(async () => {
|
|
2291
|
+
if (l.loadQuickQueryFun)
|
|
2292
|
+
try {
|
|
2293
|
+
const z = (await l.loadQuickQueryFun()).map((H) => ({
|
|
2294
|
+
...H,
|
|
2295
|
+
filterInfo: H.filterInfo ?? Y(H.group)
|
|
2296
|
+
}));
|
|
2297
|
+
U.value = z, a("update:quickQueries", z);
|
|
2298
|
+
} catch {
|
|
2299
|
+
fe.error("加载快速查询失败");
|
|
2300
|
+
}
|
|
2301
|
+
});
|
|
2302
|
+
function E() {
|
|
2303
|
+
y.value !== "advanced" && q();
|
|
2304
|
+
}
|
|
2305
|
+
function ue() {
|
|
2306
|
+
y.value = "advanced";
|
|
2307
|
+
}
|
|
2308
|
+
function ce() {
|
|
2309
|
+
y.value = "simple";
|
|
2310
|
+
}
|
|
2311
|
+
function oe() {
|
|
2312
|
+
x.value = !x.value;
|
|
2313
|
+
}
|
|
2314
|
+
function $() {
|
|
2315
|
+
const D = B.value;
|
|
2316
|
+
if (!D) return;
|
|
2317
|
+
for (const ge of Array.from(D.children))
|
|
2318
|
+
ge.style.display = "";
|
|
2319
|
+
if (!l.singleLine || !x.value) {
|
|
2320
|
+
S.value = 0, D.style.maxWidth = "";
|
|
2321
|
+
return;
|
|
2322
|
+
}
|
|
2323
|
+
const z = D.nextElementSibling, H = z ? z.offsetWidth : 0, L = 16;
|
|
2324
|
+
D.style.maxWidth = `calc(100% - ${H + L}px)`;
|
|
2325
|
+
const se = D.clientWidth;
|
|
2326
|
+
let K = 0, ne = 0;
|
|
2327
|
+
for (const ge of Array.from(D.children)) {
|
|
2328
|
+
const xe = ge, pe = xe.offsetWidth;
|
|
2329
|
+
K > 0 && K + pe + L > se ? (xe.style.display = "none", ne++) : K += pe + L;
|
|
2330
|
+
}
|
|
2331
|
+
S.value = ne;
|
|
2332
|
+
}
|
|
2333
|
+
let g = null;
|
|
2334
|
+
function G(D) {
|
|
2335
|
+
var z;
|
|
2336
|
+
y.value === "advanced" ? (z = b.value) == null || z.applySavedQuery(D) : a("search", D.filterInfo);
|
|
2337
|
+
}
|
|
2338
|
+
async function de(D) {
|
|
2339
|
+
const z = R.value.find((L) => L.id === D), H = (z == null ? void 0 : z.name) ?? "该查询";
|
|
2340
|
+
try {
|
|
2341
|
+
await vt.confirm(
|
|
2342
|
+
`确定要删除快速查询「${H}」吗?`,
|
|
2343
|
+
"删除确认",
|
|
2344
|
+
{ type: "warning", confirmButtonText: "删除", cancelButtonText: "取消" }
|
|
2345
|
+
);
|
|
2346
|
+
} catch {
|
|
2347
|
+
return;
|
|
2348
|
+
}
|
|
2349
|
+
await r(R.value.filter((L) => L.id !== D));
|
|
2350
|
+
}
|
|
2351
|
+
return Fe(() => {
|
|
2352
|
+
l.singleLine && ($(), g = new ResizeObserver(() => $()), B.value && g.observe(B.value));
|
|
2353
|
+
}), je(() => {
|
|
2354
|
+
g == null || g.disconnect(), g = null;
|
|
2355
|
+
}), me([x, () => l.singleLine], () => {
|
|
2356
|
+
He($);
|
|
2357
|
+
}), f({
|
|
2358
|
+
filter: _,
|
|
2359
|
+
reset: T,
|
|
2360
|
+
mode: y
|
|
2361
|
+
}), (D, z) => {
|
|
2362
|
+
const H = w("el-button"), L = w("el-tooltip"), se = w("el-tag");
|
|
2363
|
+
return n(), v("div", {
|
|
2364
|
+
class: Se(["yk-filter-panel", { "is-single-line": e.singleLine, "is-collapsed": e.singleLine && x.value }]),
|
|
2365
|
+
onKeydown: Ke(E, ["enter"])
|
|
2366
|
+
}, [
|
|
2367
|
+
y.value === "simple" ? (n(), v(N, { key: 0 }, [
|
|
2368
|
+
e.singleLine ? (n(), h(H, {
|
|
2369
|
+
key: 0,
|
|
2370
|
+
link: "",
|
|
2371
|
+
class: "yk-filter-panel__toggle",
|
|
2372
|
+
"aria-label": x.value ? "展开更多条件" : "折叠",
|
|
2373
|
+
title: x.value ? S.value ? `展开(${S.value} 个条件被隐藏)` : "展开" : "折叠",
|
|
2374
|
+
onClick: oe
|
|
2375
|
+
}, {
|
|
2376
|
+
default: o(() => [
|
|
2377
|
+
x.value ? (n(), v("svg", rn, [...z[0] || (z[0] = [
|
|
2378
|
+
p("polyline", { points: "6 9 12 15 18 9" }, null, -1),
|
|
2379
|
+
p("polyline", { points: "6 14 12 20 18 14" }, null, -1)
|
|
2380
|
+
])])) : (n(), v("svg", un, [...z[1] || (z[1] = [
|
|
2381
|
+
p("polyline", { points: "18 15 12 9 6 15" }, null, -1),
|
|
2382
|
+
p("polyline", { points: "18 10 12 4 6 10" }, null, -1)
|
|
2383
|
+
])]))
|
|
2384
|
+
]),
|
|
2385
|
+
_: 1
|
|
2386
|
+
}, 8, ["aria-label", "title"])) : M("", !0),
|
|
2387
|
+
p("div", {
|
|
2388
|
+
class: "yk-filter-panel__items",
|
|
2389
|
+
ref_key: "itemsEl",
|
|
2390
|
+
ref: B
|
|
2391
|
+
}, [
|
|
2392
|
+
le(D.$slots, "default", {}, void 0, !0)
|
|
2393
|
+
], 512),
|
|
2394
|
+
e.showSearch || e.showReset || e.enableAdvancedFilter ? (n(), v("div", dn, [
|
|
2395
|
+
e.showSearch ? (n(), h(H, {
|
|
2396
|
+
key: 0,
|
|
2397
|
+
type: "primary",
|
|
2398
|
+
onClick: q
|
|
2399
|
+
}, {
|
|
2400
|
+
default: o(() => [
|
|
2401
|
+
C(P(e.searchButtonText), 1)
|
|
2402
|
+
]),
|
|
2403
|
+
_: 1
|
|
2404
|
+
})) : M("", !0),
|
|
2405
|
+
e.showReset ? (n(), h(H, {
|
|
2406
|
+
key: 1,
|
|
2407
|
+
onClick: T
|
|
2408
|
+
}, {
|
|
2409
|
+
default: o(() => [
|
|
2410
|
+
C(P(e.resetButtonText), 1)
|
|
2411
|
+
]),
|
|
2412
|
+
_: 1
|
|
2413
|
+
})) : M("", !0),
|
|
2414
|
+
e.enableAdvancedFilter && !(e.singleLine && x.value) ? (n(), h(H, {
|
|
2415
|
+
key: 2,
|
|
2416
|
+
link: "",
|
|
2417
|
+
type: "primary",
|
|
2418
|
+
onClick: ue
|
|
2419
|
+
}, {
|
|
2420
|
+
default: o(() => [...z[2] || (z[2] = [
|
|
2421
|
+
C(" 高级查询 ", -1)
|
|
2422
|
+
])]),
|
|
2423
|
+
_: 1
|
|
2424
|
+
})) : M("", !0)
|
|
2425
|
+
])) : M("", !0),
|
|
2426
|
+
e.showQuickQuery && R.value.length ? (n(), v("div", cn, [
|
|
2427
|
+
z[3] || (z[3] = p("span", { class: "yk-filter-panel__saved-label" }, "快速查询:", -1)),
|
|
2428
|
+
(n(!0), v(N, null, Z(R.value, (K) => (n(), h(L, {
|
|
2429
|
+
key: K.id,
|
|
2430
|
+
content: K.description,
|
|
2431
|
+
disabled: !K.description,
|
|
2432
|
+
placement: "top"
|
|
2433
|
+
}, {
|
|
2434
|
+
default: o(() => [
|
|
2435
|
+
c(H, {
|
|
2436
|
+
size: "small",
|
|
2437
|
+
onClick: (ne) => G(K)
|
|
2438
|
+
}, {
|
|
2439
|
+
default: o(() => [
|
|
2440
|
+
C(P(K.name), 1)
|
|
2441
|
+
]),
|
|
2442
|
+
_: 2
|
|
2443
|
+
}, 1032, ["onClick"])
|
|
2444
|
+
]),
|
|
2445
|
+
_: 2
|
|
2446
|
+
}, 1032, ["content", "disabled"]))), 128))
|
|
2447
|
+
])) : M("", !0)
|
|
2448
|
+
], 64)) : (n(), v(N, { key: 1 }, [
|
|
2449
|
+
p("div", pn, [
|
|
2450
|
+
c(H, {
|
|
2451
|
+
link: "",
|
|
2452
|
+
type: "primary",
|
|
2453
|
+
onClick: ce
|
|
2454
|
+
}, {
|
|
2455
|
+
default: o(() => [...z[4] || (z[4] = [
|
|
2456
|
+
C("← 简单查询", -1)
|
|
2457
|
+
])]),
|
|
2458
|
+
_: 1
|
|
2459
|
+
})
|
|
2460
|
+
]),
|
|
2461
|
+
c(wt, {
|
|
2462
|
+
ref_key: "advancedPanelRef",
|
|
2463
|
+
ref: b,
|
|
2464
|
+
columns: e.advancedColumns,
|
|
2465
|
+
"option-sources": e.advancedOptionSources,
|
|
2466
|
+
"saved-queries": R.value,
|
|
2467
|
+
onSearch: X,
|
|
2468
|
+
onReset: j,
|
|
2469
|
+
"onUpdate:savedQueries": r
|
|
2470
|
+
}, null, 8, ["columns", "option-sources", "saved-queries"]),
|
|
2471
|
+
R.value.length ? (n(), v("div", mn, [
|
|
2472
|
+
z[5] || (z[5] = p("span", { class: "yk-filter-panel__saved-label" }, "已存查询:", -1)),
|
|
2473
|
+
(n(!0), v(N, null, Z(R.value, (K) => (n(), h(L, {
|
|
2474
|
+
key: K.id,
|
|
2475
|
+
content: K.description,
|
|
2476
|
+
disabled: !K.description,
|
|
2477
|
+
placement: "top"
|
|
2478
|
+
}, {
|
|
2479
|
+
default: o(() => [
|
|
2480
|
+
c(se, {
|
|
2481
|
+
class: "yk-filter-panel__saved-tag",
|
|
2482
|
+
effect: "plain",
|
|
2483
|
+
closable: "",
|
|
2484
|
+
onClick: (ne) => G(K),
|
|
2485
|
+
onClose: (ne) => de(K.id)
|
|
2486
|
+
}, {
|
|
2487
|
+
default: o(() => [
|
|
2488
|
+
C(P(K.name), 1)
|
|
2489
|
+
]),
|
|
2490
|
+
_: 2
|
|
2491
|
+
}, 1032, ["onClick", "onClose"])
|
|
2492
|
+
]),
|
|
2493
|
+
_: 2
|
|
2494
|
+
}, 1032, ["content", "disabled"]))), 128))
|
|
2495
|
+
])) : M("", !0)
|
|
2496
|
+
], 64))
|
|
2497
|
+
], 34);
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
}), xt = /* @__PURE__ */ ae(fn, [["__scopeId", "data-v-5ec097a2"]]), vn = { class: "yk-filter-item__label" }, yn = { class: "yk-filter-item__control" }, gn = /* @__PURE__ */ ee({
|
|
2501
|
+
name: "YsFilterItemLayout",
|
|
2502
|
+
__name: "filterItemLayout",
|
|
2503
|
+
props: {
|
|
2504
|
+
/** 显示标签(渲染在控件上方,小字号次级颜色) */
|
|
2505
|
+
label: { type: String, required: !0 },
|
|
2506
|
+
/** 最小宽度(px),默认 200;daterange 等较宽控件可传 240 */
|
|
2507
|
+
minWidth: { type: Number, default: 200 },
|
|
2508
|
+
/**
|
|
2509
|
+
* FilterItem 的 API 对象;layout 在 onMounted 时将其注册到 panel(若处于 panel 内),
|
|
2510
|
+
* onBeforeUnmount 调反注册。这样各 FilterItem 不用重复写 inject + onMounted + onBeforeUnmount 样板。
|
|
2511
|
+
*/
|
|
2512
|
+
api: { type: Object, required: !0 }
|
|
2513
|
+
},
|
|
2514
|
+
setup(e) {
|
|
2515
|
+
const f = e, t = dt(ft, null);
|
|
2516
|
+
let l = null;
|
|
2517
|
+
return Fe(() => {
|
|
2518
|
+
t && (l = t(f.api));
|
|
2519
|
+
}), je(() => {
|
|
2520
|
+
l == null || l();
|
|
2521
|
+
}), (a, k) => (n(), v("div", {
|
|
2522
|
+
class: "yk-filter-item",
|
|
2523
|
+
style: it({ minWidth: e.minWidth + "px" })
|
|
2524
|
+
}, [
|
|
2525
|
+
p("label", vn, P(e.label), 1),
|
|
2526
|
+
p("div", yn, [
|
|
2527
|
+
le(a.$slots, "default", {}, void 0, !0)
|
|
2528
|
+
])
|
|
2529
|
+
], 4));
|
|
2530
|
+
}
|
|
2531
|
+
}), Ie = /* @__PURE__ */ ae(gn, [["__scopeId", "data-v-2f9ea4d2"]]), kn = /* @__PURE__ */ ee({
|
|
2532
|
+
name: "YsTextFilterItem",
|
|
2533
|
+
__name: "textFilterItem",
|
|
2534
|
+
props: {
|
|
2535
|
+
/** 显示标签(渲染在控件左侧) */
|
|
2536
|
+
label: { type: String, required: !0 },
|
|
2537
|
+
/**
|
|
2538
|
+
* 运算符;字符串 enum 跨包用 String as PropType<Operator>(运行时为 string),
|
|
2539
|
+
* 避免 defineProps<泛型> 跨包类型解析丢字段(同 table.vue 的 viewMode 范式)。
|
|
2540
|
+
* 常传 Operator.Contains,但声明方可传任意 string 类型适用的 Operator
|
|
2541
|
+
* (Equals/StartsWith/EndsWith/Contains 等)。
|
|
2542
|
+
*/
|
|
2543
|
+
op: { type: String, required: !0 },
|
|
2544
|
+
/** 实体属性路径(FilterInfo.left),如 "name" / "user.name" */
|
|
2545
|
+
propertyPath: { type: String, required: !0 },
|
|
2546
|
+
/** 初始值;缺省为空字符串 */
|
|
2547
|
+
defaultValue: {
|
|
2548
|
+
type: String,
|
|
2549
|
+
required: !1
|
|
2550
|
+
},
|
|
2551
|
+
/** 占位文本 */
|
|
2552
|
+
placeholder: { type: String, required: !1 }
|
|
2553
|
+
},
|
|
2554
|
+
setup(e, { expose: f }) {
|
|
2555
|
+
const t = e, { value: l, filter: a, reset: k } = Yt(t), u = {
|
|
2556
|
+
get filter() {
|
|
2557
|
+
return a.value;
|
|
2558
|
+
},
|
|
2559
|
+
reset: k
|
|
2560
|
+
};
|
|
2561
|
+
return f(u), (A, y) => {
|
|
2562
|
+
const x = w("el-input");
|
|
2563
|
+
return n(), h(Ie, {
|
|
2564
|
+
label: e.label,
|
|
2565
|
+
api: u
|
|
2566
|
+
}, {
|
|
2567
|
+
default: o(() => [
|
|
2568
|
+
c(x, {
|
|
2569
|
+
modelValue: i(l),
|
|
2570
|
+
"onUpdate:modelValue": y[0] || (y[0] = (S) => Ce(l) ? l.value = S : null),
|
|
2571
|
+
placeholder: e.placeholder,
|
|
2572
|
+
clearable: ""
|
|
2573
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
2574
|
+
]),
|
|
2575
|
+
_: 1
|
|
2576
|
+
}, 8, ["label"]);
|
|
2577
|
+
};
|
|
2578
|
+
}
|
|
2579
|
+
}), _n = /* @__PURE__ */ ee({
|
|
2580
|
+
name: "YsDateFilterItem",
|
|
2581
|
+
__name: "dateFilterItem",
|
|
2582
|
+
props: {
|
|
2583
|
+
/** 显示标签(渲染在控件左侧) */
|
|
2584
|
+
label: { type: String, required: !0 },
|
|
2585
|
+
/**
|
|
2586
|
+
* 运算符;字符串 enum 跨包用 String as PropType<Operator>(运行时为 string)。
|
|
2587
|
+
* 常传 Operator.Equals,也可传 GreaterThan / LessThan / GreaterThanOrEqual /
|
|
2588
|
+
* LessThanOrEqual 等对日期有意义的 op
|
|
2589
|
+
*/
|
|
2590
|
+
op: { type: String, required: !0 },
|
|
2591
|
+
/** 实体属性路径(FilterInfo.left),如 "birthDate" / "user.createdAt" */
|
|
2592
|
+
propertyPath: { type: String, required: !0 },
|
|
2593
|
+
/** 初始值;YYYY-MM-DD 格式字符串,缺省为空 */
|
|
2594
|
+
defaultValue: {
|
|
2595
|
+
type: String,
|
|
2596
|
+
required: !1
|
|
2597
|
+
},
|
|
2598
|
+
/** 占位文本 */
|
|
2599
|
+
placeholder: { type: String, required: !1 },
|
|
2600
|
+
/** el-date-picker value-format,默认 'YYYY-MM-DD'(v-model 绑字符串) */
|
|
2601
|
+
valueFormat: { type: String, default: "YYYY-MM-DD" }
|
|
2602
|
+
},
|
|
2603
|
+
setup(e, { expose: f }) {
|
|
2604
|
+
const t = e, { value: l, filter: a, reset: k } = Nt(t), u = {
|
|
2605
|
+
get filter() {
|
|
2606
|
+
return a.value;
|
|
2607
|
+
},
|
|
2608
|
+
reset: k
|
|
2609
|
+
};
|
|
2610
|
+
return f(u), (A, y) => {
|
|
2611
|
+
const x = w("el-date-picker");
|
|
2612
|
+
return n(), h(Ie, {
|
|
2613
|
+
label: e.label,
|
|
2614
|
+
api: u
|
|
2615
|
+
}, {
|
|
2616
|
+
default: o(() => [
|
|
2617
|
+
c(x, {
|
|
2618
|
+
modelValue: i(l),
|
|
2619
|
+
"onUpdate:modelValue": y[0] || (y[0] = (S) => Ce(l) ? l.value = S : null),
|
|
2620
|
+
type: "date",
|
|
2621
|
+
placeholder: e.placeholder,
|
|
2622
|
+
"value-format": e.valueFormat,
|
|
2623
|
+
clearable: ""
|
|
2624
|
+
}, null, 8, ["modelValue", "placeholder", "value-format"])
|
|
2625
|
+
]),
|
|
2626
|
+
_: 1
|
|
2627
|
+
}, 8, ["label"]);
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
}), bn = /* @__PURE__ */ ee({
|
|
2631
|
+
name: "YsDateRangeFilterItem",
|
|
2632
|
+
__name: "dateRangeFilterItem",
|
|
2633
|
+
props: {
|
|
2634
|
+
/** 显示标签(渲染在控件左侧) */
|
|
2635
|
+
label: { type: String, required: !0 },
|
|
2636
|
+
/** 实体属性路径(FilterInfo.left),如 "createdAt" / "user.registeredAt" */
|
|
2637
|
+
propertyPath: { type: String, required: !0 },
|
|
2638
|
+
/** 初始值;[start, end] 字符串数组,缺省为 null */
|
|
2639
|
+
defaultValue: {
|
|
2640
|
+
type: Array,
|
|
2641
|
+
required: !1
|
|
2642
|
+
},
|
|
2643
|
+
/** 起始日期占位文本 */
|
|
2644
|
+
startPlaceholder: { type: String, default: "开始日期" },
|
|
2645
|
+
/** 结束日期占位文本 */
|
|
2646
|
+
endPlaceholder: { type: String, default: "结束日期" },
|
|
2647
|
+
/** el-date-picker value-format,默认 'YYYY-MM-DD'(v-model 绑字符串数组) */
|
|
2648
|
+
valueFormat: { type: String, default: "YYYY-MM-DD" },
|
|
2649
|
+
/**
|
|
2650
|
+
* 禁用日期函数(el-date-picker disabled-date),用于限制可选范围。
|
|
2651
|
+
* 接收 Date 返回 boolean,true 表示禁用。
|
|
2652
|
+
* 例如只能选最近 30 天内:(d) => d < new Date(Date.now() - 30*86400*1000) || d > new Date()
|
|
2653
|
+
*/
|
|
2654
|
+
disabledDate: {
|
|
2655
|
+
type: Function,
|
|
2656
|
+
required: !1
|
|
2657
|
+
}
|
|
2658
|
+
},
|
|
2659
|
+
setup(e, { expose: f }) {
|
|
2660
|
+
const t = e, { value: l, filter: a, reset: k } = qt(t), u = {
|
|
2661
|
+
get filter() {
|
|
2662
|
+
return a.value;
|
|
2663
|
+
},
|
|
2664
|
+
reset: k
|
|
2665
|
+
};
|
|
2666
|
+
return f(u), (A, y) => {
|
|
2667
|
+
const x = w("el-date-picker");
|
|
2668
|
+
return n(), h(Ie, {
|
|
2669
|
+
label: e.label,
|
|
2670
|
+
api: u,
|
|
2671
|
+
"min-width": 240
|
|
2672
|
+
}, {
|
|
2673
|
+
default: o(() => [
|
|
2674
|
+
c(x, {
|
|
2675
|
+
modelValue: i(l),
|
|
2676
|
+
"onUpdate:modelValue": y[0] || (y[0] = (S) => Ce(l) ? l.value = S : null),
|
|
2677
|
+
type: "daterange",
|
|
2678
|
+
"start-placeholder": e.startPlaceholder,
|
|
2679
|
+
"end-placeholder": e.endPlaceholder,
|
|
2680
|
+
"value-format": e.valueFormat,
|
|
2681
|
+
"disabled-date": e.disabledDate,
|
|
2682
|
+
clearable: ""
|
|
2683
|
+
}, null, 8, ["modelValue", "start-placeholder", "end-placeholder", "value-format", "disabled-date"])
|
|
2684
|
+
]),
|
|
2685
|
+
_: 1
|
|
2686
|
+
}, 8, ["label"]);
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2689
|
+
}), hn = /* @__PURE__ */ ee({
|
|
2690
|
+
name: "YsEnumFilterItem",
|
|
2691
|
+
__name: "enumFilterItem",
|
|
2692
|
+
props: {
|
|
2693
|
+
/** 显示标签(渲染在控件左侧) */
|
|
2694
|
+
label: { type: String, required: !0 },
|
|
2695
|
+
/**
|
|
2696
|
+
* 运算符;字符串 enum 跨包用 String as PropType<Operator>(运行时为 string)。
|
|
2697
|
+
* 仅单选模式(multiple=false)下使用;多选模式下被 composable 忽略,
|
|
2698
|
+
* 按「1 项→Equals,2+ 项→In」自动派生。
|
|
2699
|
+
*/
|
|
2700
|
+
op: { type: String, required: !0 },
|
|
2701
|
+
/** 实体属性路径(FilterInfo.left),如 "status" / "user.roleId" */
|
|
2702
|
+
propertyPath: { type: String, required: !0 },
|
|
2703
|
+
/**
|
|
2704
|
+
* 初始值;单选模式为 string | number | null(null=未选),
|
|
2705
|
+
* 多选模式为 (string | number)[](空数组=未选)。
|
|
2706
|
+
*/
|
|
2707
|
+
defaultValue: {
|
|
2708
|
+
type: [String, Number, Array],
|
|
2709
|
+
required: !1
|
|
2710
|
+
},
|
|
2711
|
+
/** 占位文本 */
|
|
2712
|
+
placeholder: { type: String, required: !1 },
|
|
2713
|
+
/**
|
|
2714
|
+
* 选项数据源:函数类型,返回 Promise<EnumOption[]>。
|
|
2715
|
+
* 使用方在 dataFunc 里把字段提取成 {label, value} 结构,
|
|
2716
|
+
* 组件端直接用 opt.value 作选中值、opt.label 作显示文本,
|
|
2717
|
+
* 不用再传 keyProperty/valueProperty。
|
|
2718
|
+
* 详见 enumOptionsSource.ts 的 EnumOptionsSource / EnumOption 注释。
|
|
2719
|
+
*/
|
|
2720
|
+
optionsSource: { type: Function, required: !0 },
|
|
2721
|
+
/** 是否可清空,默认 true */
|
|
2722
|
+
clearable: { type: Boolean, default: !0 },
|
|
2723
|
+
/** 是否多选;默认 false。多选时 2+ 项用 In,1 项用 Equals,0 项返回 null */
|
|
2724
|
+
multiple: { type: Boolean, default: !1 }
|
|
2725
|
+
},
|
|
2726
|
+
setup(e, { expose: f }) {
|
|
2727
|
+
const t = e, { value: l, filter: a, reset: k } = Ot(t), u = Q({
|
|
2728
|
+
get: () => l.value,
|
|
2729
|
+
set: (S) => {
|
|
2730
|
+
l.value = S;
|
|
2731
|
+
}
|
|
2732
|
+
}), A = I([]), y = I(!1);
|
|
2733
|
+
Fe(async () => {
|
|
2734
|
+
y.value = !0;
|
|
2735
|
+
try {
|
|
2736
|
+
A.value = await t.optionsSource();
|
|
2737
|
+
} finally {
|
|
2738
|
+
y.value = !1;
|
|
2739
|
+
}
|
|
2740
|
+
});
|
|
2741
|
+
const x = {
|
|
2742
|
+
get filter() {
|
|
2743
|
+
return a.value;
|
|
2744
|
+
},
|
|
2745
|
+
reset: k
|
|
2746
|
+
};
|
|
2747
|
+
return f(x), (S, B) => {
|
|
2748
|
+
const U = w("el-option"), R = w("el-select");
|
|
2749
|
+
return n(), h(Ie, {
|
|
2750
|
+
label: e.label,
|
|
2751
|
+
api: x
|
|
2752
|
+
}, {
|
|
2753
|
+
default: o(() => [
|
|
2754
|
+
c(R, {
|
|
2755
|
+
modelValue: u.value,
|
|
2756
|
+
"onUpdate:modelValue": B[0] || (B[0] = (b) => u.value = b),
|
|
2757
|
+
multiple: e.multiple,
|
|
2758
|
+
placeholder: e.placeholder,
|
|
2759
|
+
clearable: e.clearable,
|
|
2760
|
+
loading: y.value
|
|
2761
|
+
}, {
|
|
2762
|
+
default: o(() => [
|
|
2763
|
+
(n(!0), v(N, null, Z(A.value, (b) => (n(), h(U, {
|
|
2764
|
+
key: String(b.value),
|
|
2765
|
+
value: b.value,
|
|
2766
|
+
label: b.label
|
|
2767
|
+
}, null, 8, ["value", "label"]))), 128))
|
|
2768
|
+
]),
|
|
2769
|
+
_: 1
|
|
2770
|
+
}, 8, ["modelValue", "multiple", "placeholder", "clearable", "loading"])
|
|
2771
|
+
]),
|
|
2772
|
+
_: 1
|
|
2773
|
+
}, 8, ["label"]);
|
|
2774
|
+
};
|
|
2775
|
+
}
|
|
2776
|
+
}), wn = { class: "yk-table-page" }, xn = /* @__PURE__ */ ee({
|
|
2777
|
+
name: "YsTablePage",
|
|
2778
|
+
__name: "tablePage",
|
|
2779
|
+
props: {
|
|
2780
|
+
metaFun: { type: Function, required: !0 },
|
|
2781
|
+
dataFun: { type: Function, required: !0 },
|
|
2782
|
+
rowActionsFunc: { type: Function, required: !1 },
|
|
2783
|
+
pageSize: { type: Number, default: 20 },
|
|
2784
|
+
pageSizes: { type: Array, default: () => [10, 20, 50, 100] },
|
|
2785
|
+
showCheckbox: { type: Boolean, default: !1 },
|
|
2786
|
+
columnResizable: { type: Boolean, default: !0 },
|
|
2787
|
+
stickyHeader: { type: Boolean, default: !1 },
|
|
2788
|
+
loadCustomConfigFun: { type: Function, required: !1 },
|
|
2789
|
+
saveCustomConfigFun: { type: Function, required: !1 },
|
|
2790
|
+
exportPageSize: { type: Number, default: 1e3 },
|
|
2791
|
+
exportorFunc: { type: Function, required: !1 },
|
|
2792
|
+
rowKey: { type: String, default: "id" },
|
|
2793
|
+
viewMode: { type: String, default: "table" },
|
|
2794
|
+
actions: { type: Array, default: () => [] },
|
|
2795
|
+
showActionMenuButton: { type: Boolean, default: !0 },
|
|
2796
|
+
showSearch: { type: Boolean, default: !0 },
|
|
2797
|
+
showReset: { type: Boolean, default: !0 },
|
|
2798
|
+
searchButtonText: { type: String, default: "查询" },
|
|
2799
|
+
resetButtonText: { type: String, default: "重置" },
|
|
2800
|
+
enableAdvancedFilter: { type: Boolean, default: !1 },
|
|
2801
|
+
advancedColumns: { type: Array, default: () => [] },
|
|
2802
|
+
advancedOptionSources: { type: Object, required: !1 },
|
|
2803
|
+
showQuickQuery: { type: Boolean, default: !1 },
|
|
2804
|
+
quickQueries: { type: Array, default: void 0 },
|
|
2805
|
+
loadQuickQueryFun: { type: Function, required: !1 },
|
|
2806
|
+
saveQuickQueryFun: { type: Function, required: !1 },
|
|
2807
|
+
singleLine: { type: Boolean, default: !1 }
|
|
2808
|
+
},
|
|
2809
|
+
emits: ["search", "reset", "update:quickQueries", "data-loaded", "update:viewMode", "update:showCheckbox", "update:columnResizable", "update:stickyHeader"],
|
|
2810
|
+
setup(e, { expose: f, emit: t }) {
|
|
2811
|
+
const l = e, a = t, k = Rt(tt()), u = I(null), A = I(null), y = Q(() => async (R, b) => l.dataFun(R, k.value, b)), x = Q(() => ({
|
|
2812
|
+
metaFun: l.metaFun,
|
|
2813
|
+
dataFun: y.value,
|
|
2814
|
+
rowActionsFunc: l.rowActionsFunc,
|
|
2815
|
+
pageSize: l.pageSize,
|
|
2816
|
+
pageSizes: l.pageSizes,
|
|
2817
|
+
showCheckbox: l.showCheckbox,
|
|
2818
|
+
columnResizable: l.columnResizable,
|
|
2819
|
+
stickyHeader: l.stickyHeader,
|
|
2820
|
+
loadCustomConfigFun: l.loadCustomConfigFun,
|
|
2821
|
+
saveCustomConfigFun: l.saveCustomConfigFun,
|
|
2822
|
+
exportPageSize: l.exportPageSize,
|
|
2823
|
+
exportorFunc: l.exportorFunc,
|
|
2824
|
+
rowKey: l.rowKey,
|
|
2825
|
+
viewMode: l.viewMode
|
|
2826
|
+
})), S = Q(() => ({
|
|
2827
|
+
showSearch: l.showSearch,
|
|
2828
|
+
showReset: l.showReset,
|
|
2829
|
+
searchButtonText: l.searchButtonText,
|
|
2830
|
+
resetButtonText: l.resetButtonText,
|
|
2831
|
+
enableAdvancedFilter: l.enableAdvancedFilter,
|
|
2832
|
+
advancedColumns: l.advancedColumns,
|
|
2833
|
+
advancedOptionSources: l.advancedOptionSources,
|
|
2834
|
+
showQuickQuery: l.showQuickQuery,
|
|
2835
|
+
quickQueries: l.quickQueries,
|
|
2836
|
+
loadQuickQueryFun: l.loadQuickQueryFun,
|
|
2837
|
+
saveQuickQueryFun: l.saveQuickQueryFun,
|
|
2838
|
+
singleLine: l.singleLine
|
|
2839
|
+
}));
|
|
2840
|
+
function B(R) {
|
|
2841
|
+
var b;
|
|
2842
|
+
k.value = R, a("search", R), (b = u.value) == null || b.reload();
|
|
2843
|
+
}
|
|
2844
|
+
function U() {
|
|
2845
|
+
var R;
|
|
2846
|
+
k.value = tt(), a("reset"), (R = u.value) == null || R.reload();
|
|
2847
|
+
}
|
|
2848
|
+
return f({
|
|
2849
|
+
table: u,
|
|
2850
|
+
filterPanel: A
|
|
2851
|
+
}), (R, b) => (n(), v("div", wn, [
|
|
2852
|
+
c(xt, Xe({
|
|
2853
|
+
ref_key: "filterPanelRef",
|
|
2854
|
+
ref: A,
|
|
2855
|
+
class: "yk-table-page__filter"
|
|
2856
|
+
}, S.value, {
|
|
2857
|
+
onSearch: B,
|
|
2858
|
+
onReset: U,
|
|
2859
|
+
"onUpdate:quickQueries": b[0] || (b[0] = (_) => a("update:quickQueries", _))
|
|
2860
|
+
}), {
|
|
2861
|
+
default: o(() => [
|
|
2862
|
+
le(R.$slots, "default", {}, void 0, !0)
|
|
2863
|
+
]),
|
|
2864
|
+
_: 3
|
|
2865
|
+
}, 16),
|
|
2866
|
+
c(kt, {
|
|
2867
|
+
class: "yk-table-page__command",
|
|
2868
|
+
actions: l.actions,
|
|
2869
|
+
table: u.value,
|
|
2870
|
+
"show-action-menu-button": l.showActionMenuButton
|
|
2871
|
+
}, Be({ _: 2 }, [
|
|
2872
|
+
R.$slots["command-bar"] ? {
|
|
2873
|
+
name: "default",
|
|
2874
|
+
fn: o(() => [
|
|
2875
|
+
le(R.$slots, "command-bar", {}, void 0, !0)
|
|
2876
|
+
]),
|
|
2877
|
+
key: "0"
|
|
2878
|
+
} : void 0
|
|
2879
|
+
]), 1032, ["actions", "table", "show-action-menu-button"]),
|
|
2880
|
+
c(yt, Xe({
|
|
2881
|
+
ref_key: "tableRef",
|
|
2882
|
+
ref: u,
|
|
2883
|
+
class: "yk-table-page__table"
|
|
2884
|
+
}, x.value, {
|
|
2885
|
+
onDataLoaded: b[1] || (b[1] = (_) => a("data-loaded", _)),
|
|
2886
|
+
"onUpdate:viewMode": b[2] || (b[2] = (_) => a("update:viewMode", _)),
|
|
2887
|
+
"onUpdate:showCheckbox": b[3] || (b[3] = (_) => a("update:showCheckbox", _)),
|
|
2888
|
+
"onUpdate:columnResizable": b[4] || (b[4] = (_) => a("update:columnResizable", _)),
|
|
2889
|
+
"onUpdate:stickyHeader": b[5] || (b[5] = (_) => a("update:stickyHeader", _))
|
|
2890
|
+
}), Be({ _: 2 }, [
|
|
2891
|
+
R.$slots.card ? {
|
|
2892
|
+
name: "card",
|
|
2893
|
+
fn: o((_) => [
|
|
2894
|
+
le(R.$slots, "card", Qe(Ee(_)), void 0, !0)
|
|
2895
|
+
]),
|
|
2896
|
+
key: "0"
|
|
2897
|
+
} : void 0,
|
|
2898
|
+
R.$slots.list ? {
|
|
2899
|
+
name: "list",
|
|
2900
|
+
fn: o((_) => [
|
|
2901
|
+
le(R.$slots, "list", Qe(Ee(_)), void 0, !0)
|
|
2902
|
+
]),
|
|
2903
|
+
key: "1"
|
|
2904
|
+
} : void 0,
|
|
2905
|
+
R.$slots.empty ? {
|
|
2906
|
+
name: "empty",
|
|
2907
|
+
fn: o((_) => [
|
|
2908
|
+
le(R.$slots, "empty", Qe(Ee(_)), void 0, !0)
|
|
2909
|
+
]),
|
|
2910
|
+
key: "2"
|
|
2911
|
+
} : void 0,
|
|
2912
|
+
R.$slots.loading ? {
|
|
2913
|
+
name: "loading",
|
|
2914
|
+
fn: o((_) => [
|
|
2915
|
+
le(R.$slots, "loading", Qe(Ee(_)), void 0, !0)
|
|
2916
|
+
]),
|
|
2917
|
+
key: "3"
|
|
2918
|
+
} : void 0,
|
|
2919
|
+
R.$slots.footer ? {
|
|
2920
|
+
name: "footer",
|
|
2921
|
+
fn: o((_) => [
|
|
2922
|
+
le(R.$slots, "footer", Qe(Ee(_)), void 0, !0)
|
|
2923
|
+
]),
|
|
2924
|
+
key: "4"
|
|
2925
|
+
} : void 0
|
|
2926
|
+
]), 1040)
|
|
2927
|
+
]));
|
|
2928
|
+
}
|
|
2929
|
+
}), Cn = /* @__PURE__ */ ae(xn, [["__scopeId", "data-v-0ae6f764"]]);
|
|
2930
|
+
function Ct(e) {
|
|
2931
|
+
if (e == null) return "";
|
|
2932
|
+
if (typeof e == "object")
|
|
2933
|
+
try {
|
|
2934
|
+
return JSON.stringify(e);
|
|
2935
|
+
} catch {
|
|
2936
|
+
return String(e);
|
|
2937
|
+
}
|
|
2938
|
+
return String(e);
|
|
2939
|
+
}
|
|
2940
|
+
const Sn = /* @__PURE__ */ ee({
|
|
2941
|
+
__name: "importRowEditDialog",
|
|
2942
|
+
props: {
|
|
2943
|
+
visible: { type: Boolean },
|
|
2944
|
+
row: {},
|
|
2945
|
+
columns: {},
|
|
2946
|
+
saver: { type: Function }
|
|
2947
|
+
},
|
|
2948
|
+
emits: ["update:visible", "saved"],
|
|
2949
|
+
setup(e, { emit: f }) {
|
|
2950
|
+
const t = e, l = f, a = I({}), k = I([]);
|
|
2951
|
+
me(
|
|
2952
|
+
() => t.visible,
|
|
2953
|
+
(y) => {
|
|
2954
|
+
if (!y || !t.row) return;
|
|
2955
|
+
const x = {};
|
|
2956
|
+
for (const S of t.columns)
|
|
2957
|
+
x[S.name] = Ct(t.row.data[S.name]);
|
|
2958
|
+
a.value = x, k.value = [];
|
|
2959
|
+
}
|
|
2960
|
+
);
|
|
2961
|
+
function u() {
|
|
2962
|
+
l("update:visible", !1);
|
|
2963
|
+
}
|
|
2964
|
+
function A() {
|
|
2965
|
+
if (!t.row) return;
|
|
2966
|
+
const y = {};
|
|
2967
|
+
for (const B of t.columns)
|
|
2968
|
+
y[B.name] = a.value[B.name] ?? "";
|
|
2969
|
+
const { row: x, errors: S } = t.saver(t.row, y);
|
|
2970
|
+
k.value = S, !(S.length > 0) && (l("saved", x), l("update:visible", !1));
|
|
2971
|
+
}
|
|
2972
|
+
return (y, x) => {
|
|
2973
|
+
const S = w("el-alert"), B = w("el-input"), U = w("el-form-item"), R = w("el-form"), b = w("el-button"), _ = w("el-dialog");
|
|
2974
|
+
return n(), h(_, {
|
|
2975
|
+
"model-value": e.visible,
|
|
2976
|
+
title: e.row ? `编辑第 ${e.row.rowNumber} 行` : "编辑数据行",
|
|
2977
|
+
width: "480px",
|
|
2978
|
+
"append-to-body": "",
|
|
2979
|
+
"close-on-click-modal": !1,
|
|
2980
|
+
"onUpdate:modelValue": x[1] || (x[1] = (q) => l("update:visible", q))
|
|
2981
|
+
}, {
|
|
2982
|
+
footer: o(() => [
|
|
2983
|
+
c(b, { onClick: u }, {
|
|
2984
|
+
default: o(() => [...x[2] || (x[2] = [
|
|
2985
|
+
C("取消", -1)
|
|
2986
|
+
])]),
|
|
2987
|
+
_: 1
|
|
2988
|
+
}),
|
|
2989
|
+
c(b, {
|
|
2990
|
+
type: "primary",
|
|
2991
|
+
onClick: A
|
|
2992
|
+
}, {
|
|
2993
|
+
default: o(() => [...x[3] || (x[3] = [
|
|
2994
|
+
C("保存并重新校验", -1)
|
|
2995
|
+
])]),
|
|
2996
|
+
_: 1
|
|
2997
|
+
})
|
|
2998
|
+
]),
|
|
2999
|
+
default: o(() => [
|
|
3000
|
+
k.value.length > 0 ? (n(), h(S, {
|
|
3001
|
+
key: 0,
|
|
3002
|
+
class: "yk-import-row-edit-dialog__alert",
|
|
3003
|
+
type: "error",
|
|
3004
|
+
closable: !1,
|
|
3005
|
+
"show-icon": ""
|
|
3006
|
+
}, {
|
|
3007
|
+
default: o(() => [
|
|
3008
|
+
(n(!0), v(N, null, Z(k.value, (q, T) => (n(), v("div", { key: T }, P(q), 1))), 128))
|
|
3009
|
+
]),
|
|
3010
|
+
_: 1
|
|
3011
|
+
})) : M("", !0),
|
|
3012
|
+
c(R, {
|
|
3013
|
+
"label-width": "92px",
|
|
3014
|
+
onSubmit: x[0] || (x[0] = rt(() => {
|
|
3015
|
+
}, ["prevent"]))
|
|
3016
|
+
}, {
|
|
3017
|
+
default: o(() => [
|
|
3018
|
+
(n(!0), v(N, null, Z(e.columns, (q) => (n(), h(U, {
|
|
3019
|
+
key: q.name,
|
|
3020
|
+
label: q.name,
|
|
3021
|
+
required: !q.optional
|
|
3022
|
+
}, {
|
|
3023
|
+
default: o(() => [
|
|
3024
|
+
c(B, {
|
|
3025
|
+
modelValue: a.value[q.name],
|
|
3026
|
+
"onUpdate:modelValue": (T) => a.value[q.name] = T,
|
|
3027
|
+
placeholder: q.optional ? "可留空" : `请输入${q.name}`,
|
|
3028
|
+
onKeyup: Ke(A, ["enter"])
|
|
3029
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
|
|
3030
|
+
]),
|
|
3031
|
+
_: 2
|
|
3032
|
+
}, 1032, ["label", "required"]))), 128))
|
|
3033
|
+
]),
|
|
3034
|
+
_: 1
|
|
3035
|
+
})
|
|
3036
|
+
]),
|
|
3037
|
+
_: 1
|
|
3038
|
+
}, 8, ["model-value", "title"]);
|
|
3039
|
+
};
|
|
3040
|
+
}
|
|
3041
|
+
}), $n = /* @__PURE__ */ ae(Sn, [["__scopeId", "data-v-4f9c19a4"]]), Vn = ["accept"], Fn = { class: "yk-import-excel__toolbar" }, Rn = ["title"], An = {
|
|
3042
|
+
key: 2,
|
|
3043
|
+
class: "yk-import-excel__stats"
|
|
3044
|
+
}, Mn = { class: "yk-import-excel__stat" }, Pn = { class: "yk-import-excel__stat" }, Bn = { class: "yk-import-excel__stat yk-import-excel__stat--danger" }, Dn = {
|
|
3045
|
+
key: 0,
|
|
3046
|
+
class: "yk-import-excel__progress"
|
|
3047
|
+
}, zn = { class: "yk-import-excel__progress-meta" }, Qn = { class: "yk-import-excel__danger-text" }, En = { class: "yk-import-excel__progress-eta" }, Tn = { class: "yk-import-excel__body" }, In = ["title"], Yn = {
|
|
3048
|
+
key: 0,
|
|
3049
|
+
class: "yk-import-excel__spin"
|
|
3050
|
+
}, Nn = {
|
|
3051
|
+
key: 0,
|
|
3052
|
+
class: "yk-import-excel__msg yk-import-excel__msg--danger"
|
|
3053
|
+
}, qn = {
|
|
3054
|
+
key: 1,
|
|
3055
|
+
class: "yk-import-excel__msg yk-import-excel__msg--danger"
|
|
3056
|
+
}, On = {
|
|
3057
|
+
key: 1,
|
|
3058
|
+
class: "yk-import-excel__action-placeholder"
|
|
3059
|
+
}, Un = { class: "yk-import-excel__empty-hint" }, Ln = {
|
|
3060
|
+
key: 1,
|
|
3061
|
+
class: "yk-import-excel__drop-mask"
|
|
3062
|
+
}, Hn = /* @__PURE__ */ ee({
|
|
3063
|
+
__name: "importExcel",
|
|
3064
|
+
props: {
|
|
3065
|
+
columns: {},
|
|
3066
|
+
processor: {},
|
|
3067
|
+
parser: {},
|
|
3068
|
+
accept: { default: ".xlsx" },
|
|
3069
|
+
autoScroll: { type: Boolean, default: !0 }
|
|
3070
|
+
},
|
|
3071
|
+
emits: ["loaded", "selection-change", "processed", "row-update", "row-remove"],
|
|
3072
|
+
setup(e, { expose: f, emit: t }) {
|
|
3073
|
+
const l = e, a = t, {
|
|
3074
|
+
rows: k,
|
|
3075
|
+
fileName: u,
|
|
3076
|
+
sheetName: A,
|
|
3077
|
+
loading: y,
|
|
3078
|
+
processing: x,
|
|
3079
|
+
stopping: S,
|
|
3080
|
+
processingTotal: B,
|
|
3081
|
+
progressDone: U,
|
|
3082
|
+
progressSuccess: R,
|
|
3083
|
+
progressFailed: b,
|
|
3084
|
+
hasData: _,
|
|
3085
|
+
invalidCount: q,
|
|
3086
|
+
successCount: T,
|
|
3087
|
+
failedCount: X,
|
|
3088
|
+
selectedCount: j,
|
|
3089
|
+
pendingCount: r,
|
|
3090
|
+
loadFile: m,
|
|
3091
|
+
syncSelection: F,
|
|
3092
|
+
saveRowEdit: Y,
|
|
3093
|
+
removeRow: E,
|
|
3094
|
+
startProcessing: ue,
|
|
3095
|
+
stopProcessing: ce,
|
|
3096
|
+
clear: oe
|
|
3097
|
+
} = Ut({
|
|
3098
|
+
columns: ve(l, "columns"),
|
|
3099
|
+
processor: ve(l, "processor"),
|
|
3100
|
+
parser: ve(l, "parser")
|
|
3101
|
+
}), $ = I(), g = I(), G = {
|
|
3102
|
+
valid: { label: "待处理", type: "info" },
|
|
3103
|
+
invalid: { label: "校验失败", type: "danger" },
|
|
3104
|
+
processing: { label: "处理中", type: "warning" },
|
|
3105
|
+
success: { label: "成功", type: "success" },
|
|
3106
|
+
failed: { label: "失败", type: "danger" }
|
|
3107
|
+
}, de = Q(
|
|
3108
|
+
() => Object.keys(G).map((d) => ({
|
|
3109
|
+
text: `${G[d].label}(${k.value.filter((V) => V.status === d).length})`,
|
|
3110
|
+
value: d
|
|
3111
|
+
}))
|
|
3112
|
+
);
|
|
3113
|
+
function D(d, V) {
|
|
3114
|
+
return V.status === d;
|
|
3115
|
+
}
|
|
3116
|
+
function z(d) {
|
|
3117
|
+
var ie, we;
|
|
3118
|
+
if (!l.autoScroll) return;
|
|
3119
|
+
const V = (ie = $.value) == null ? void 0 : ie.$el, O = V == null ? void 0 : V.querySelector(".el-table__body-wrapper .el-scrollbar__wrap"), te = V == null ? void 0 : V.querySelector(".el-table__body-wrapper tbody");
|
|
3120
|
+
if (!V || !O || !te) return;
|
|
3121
|
+
const s = k.value.findIndex((St) => St.rowNumber === d), W = te.querySelectorAll("tr")[s];
|
|
3122
|
+
if (!W) return;
|
|
3123
|
+
const re = O.getBoundingClientRect(), ke = W.getBoundingClientRect(), J = Math.max(0, O.scrollHeight - O.clientHeight), _e = O.scrollTop + (ke.top - re.top) - (O.clientHeight - ke.height) / 2;
|
|
3124
|
+
(we = $.value) == null || we.setScrollTop(Math.min(J, Math.max(0, Math.round(_e))));
|
|
3125
|
+
}
|
|
3126
|
+
me(
|
|
3127
|
+
() => {
|
|
3128
|
+
var d;
|
|
3129
|
+
return ((d = k.value.find((V) => V.status === "processing")) == null ? void 0 : d.rowNumber) ?? null;
|
|
3130
|
+
},
|
|
3131
|
+
(d) => {
|
|
3132
|
+
d !== null && He(() => z(d));
|
|
3133
|
+
}
|
|
3134
|
+
);
|
|
3135
|
+
const H = I(0), L = I(0);
|
|
3136
|
+
let se;
|
|
3137
|
+
const K = Q(() => {
|
|
3138
|
+
const d = B.value;
|
|
3139
|
+
return d <= 0 ? 0 : Math.min(100, U.value / d * 100);
|
|
3140
|
+
});
|
|
3141
|
+
function ne() {
|
|
3142
|
+
return `${U.value}/${B.value}`;
|
|
3143
|
+
}
|
|
3144
|
+
const ge = Q(() => {
|
|
3145
|
+
if (!x.value || U.value === 0) return "预计剩余 计算中…";
|
|
3146
|
+
const V = (L.value - H.value) / U.value, O = B.value - U.value;
|
|
3147
|
+
return `预计剩余 ${xe(V * O)}`;
|
|
3148
|
+
});
|
|
3149
|
+
function xe(d) {
|
|
3150
|
+
const V = Math.max(0, Math.ceil(d / 1e3));
|
|
3151
|
+
if (V < 60) return `${V} 秒`;
|
|
3152
|
+
const O = Math.floor(V / 60), te = V % 60;
|
|
3153
|
+
return te > 0 ? `${O} 分 ${te} 秒` : `${O} 分`;
|
|
3154
|
+
}
|
|
3155
|
+
me(x, (d) => {
|
|
3156
|
+
d ? (H.value = Date.now(), L.value = H.value, se = setInterval(() => {
|
|
3157
|
+
L.value = Date.now();
|
|
3158
|
+
}, 500)) : se && (clearInterval(se), se = void 0);
|
|
3159
|
+
}), je(() => {
|
|
3160
|
+
se && clearInterval(se);
|
|
3161
|
+
});
|
|
3162
|
+
function pe() {
|
|
3163
|
+
var d;
|
|
3164
|
+
(d = g.value) == null || d.click();
|
|
3165
|
+
}
|
|
3166
|
+
const be = I(0), he = Q(() => be.value > 0);
|
|
3167
|
+
function $e(d) {
|
|
3168
|
+
var V;
|
|
3169
|
+
return Array.from(((V = d.dataTransfer) == null ? void 0 : V.types) ?? []).includes("Files");
|
|
3170
|
+
}
|
|
3171
|
+
function Ye(d) {
|
|
3172
|
+
const V = l.accept.split(",").map((te) => te.trim().toLowerCase()).filter(Boolean);
|
|
3173
|
+
if (V.length === 0) return !0;
|
|
3174
|
+
const O = d.name.toLowerCase();
|
|
3175
|
+
return V.some((te) => O.endsWith(te));
|
|
3176
|
+
}
|
|
3177
|
+
async function Re(d) {
|
|
3178
|
+
var V;
|
|
3179
|
+
if (!y.value) {
|
|
3180
|
+
if (!Ye(d)) {
|
|
3181
|
+
fe.error(`仅支持 ${l.accept} 格式的文件`);
|
|
3182
|
+
return;
|
|
3183
|
+
}
|
|
3184
|
+
try {
|
|
3185
|
+
const O = await m(d);
|
|
3186
|
+
a("loaded", O), await He();
|
|
3187
|
+
for (const te of k.value)
|
|
3188
|
+
te.status !== "invalid" && ((V = $.value) == null || V.toggleRowSelection(te, !0));
|
|
3189
|
+
fe.success(`已加载 ${O.length} 行(工作表「${A.value}」)`);
|
|
3190
|
+
} catch (O) {
|
|
3191
|
+
fe.error(O instanceof Error ? O.message : String(O));
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
async function Ve(d) {
|
|
3196
|
+
var te;
|
|
3197
|
+
const V = d.target, O = (te = V.files) == null ? void 0 : te[0];
|
|
3198
|
+
V.value = "", O && await Re(O);
|
|
3199
|
+
}
|
|
3200
|
+
function Ne(d) {
|
|
3201
|
+
$e(d) && (be.value += 1);
|
|
3202
|
+
}
|
|
3203
|
+
function De(d) {
|
|
3204
|
+
$e(d) && (d.preventDefault(), d.dataTransfer && (d.dataTransfer.dropEffect = "copy"));
|
|
3205
|
+
}
|
|
3206
|
+
function Ae(d) {
|
|
3207
|
+
$e(d) && (be.value = Math.max(0, be.value - 1));
|
|
3208
|
+
}
|
|
3209
|
+
function qe(d) {
|
|
3210
|
+
var O, te;
|
|
3211
|
+
if (!$e(d)) return;
|
|
3212
|
+
d.preventDefault(), be.value = 0;
|
|
3213
|
+
const V = (te = (O = d.dataTransfer) == null ? void 0 : O.files) == null ? void 0 : te[0];
|
|
3214
|
+
V && Re(V);
|
|
3215
|
+
}
|
|
3216
|
+
function Oe(d) {
|
|
3217
|
+
F(d), a("selection-change", d);
|
|
3218
|
+
}
|
|
3219
|
+
function Ue(d) {
|
|
3220
|
+
return d.status !== "invalid";
|
|
3221
|
+
}
|
|
3222
|
+
async function ze() {
|
|
3223
|
+
try {
|
|
3224
|
+
const d = await ue();
|
|
3225
|
+
if (!d) return;
|
|
3226
|
+
if (a("processed", d), d.stopped) {
|
|
3227
|
+
const V = d.total - d.success - d.failed;
|
|
3228
|
+
fe.warning(
|
|
3229
|
+
`已停止:成功 ${d.success} 行,失败 ${d.failed} 行,剩余 ${V} 行未处理(可再次「开始处理」续跑)`
|
|
3230
|
+
);
|
|
3231
|
+
} else d.failed === 0 ? fe.success(`全部处理完成,共 ${d.success} 行`) : fe.warning(`处理完成:成功 ${d.success} 行,失败 ${d.failed} 行`);
|
|
3232
|
+
} catch (d) {
|
|
3233
|
+
fe.error(d instanceof Error ? d.message : String(d));
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
function Me(d) {
|
|
3237
|
+
return !x.value && (d.status === "invalid" || d.status === "failed");
|
|
3238
|
+
}
|
|
3239
|
+
const Pe = I(!1), ye = I(null);
|
|
3240
|
+
function Ge(d) {
|
|
3241
|
+
Me(d) && (ye.value = d, Pe.value = !0);
|
|
3242
|
+
}
|
|
3243
|
+
async function Le(d) {
|
|
3244
|
+
var V;
|
|
3245
|
+
a("row-update", d), await He(), (V = $.value) == null || V.toggleRowSelection(d, !0), fe.success(`第 ${d.rowNumber} 行已修正,可重新处理`);
|
|
3246
|
+
}
|
|
3247
|
+
async function We(d) {
|
|
3248
|
+
if (Me(d)) {
|
|
3249
|
+
try {
|
|
3250
|
+
await vt.confirm(
|
|
3251
|
+
`确定删除第 ${d.rowNumber} 行吗?删除后不可恢复。`,
|
|
3252
|
+
"删除数据行",
|
|
3253
|
+
{ type: "warning", confirmButtonText: "删除", cancelButtonText: "取消" }
|
|
3254
|
+
);
|
|
3255
|
+
} catch {
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3258
|
+
E(d), a("row-remove", d), fe.success(`已删除第 ${d.rowNumber} 行`);
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
return f({ openFilePicker: pe, startProcessing: ze, stopProcessing: ce, clear: oe }), (d, V) => {
|
|
3262
|
+
const O = w("el-button"), te = w("el-progress"), s = w("el-table-column"), W = w("el-tag"), re = w("el-table"), ke = ut("loading");
|
|
3263
|
+
return n(), v("div", {
|
|
3264
|
+
class: "yk-import-excel",
|
|
3265
|
+
onDragenter: Ne,
|
|
3266
|
+
onDragover: De,
|
|
3267
|
+
onDragleave: Ae,
|
|
3268
|
+
onDrop: qe
|
|
3269
|
+
}, [
|
|
3270
|
+
p("input", {
|
|
3271
|
+
ref_key: "fileInputRef",
|
|
3272
|
+
ref: g,
|
|
3273
|
+
class: "yk-import-excel__file",
|
|
3274
|
+
type: "file",
|
|
3275
|
+
accept: l.accept,
|
|
3276
|
+
onChange: Ve
|
|
3277
|
+
}, null, 40, Vn),
|
|
3278
|
+
p("div", Fn, [
|
|
3279
|
+
c(O, {
|
|
3280
|
+
type: "primary",
|
|
3281
|
+
loading: i(y),
|
|
3282
|
+
onClick: pe
|
|
3283
|
+
}, {
|
|
3284
|
+
default: o(() => [...V[1] || (V[1] = [
|
|
3285
|
+
C(" 选择 Excel 文件 ", -1)
|
|
3286
|
+
])]),
|
|
3287
|
+
_: 1
|
|
3288
|
+
}, 8, ["loading"]),
|
|
3289
|
+
c(O, {
|
|
3290
|
+
type: "success",
|
|
3291
|
+
loading: i(x),
|
|
3292
|
+
disabled: i(r) === 0,
|
|
3293
|
+
onClick: ze
|
|
3294
|
+
}, {
|
|
3295
|
+
default: o(() => [
|
|
3296
|
+
C(" 开始处理" + P(i(r) > 0 ? `(${i(r)} 行)` : ""), 1)
|
|
3297
|
+
]),
|
|
3298
|
+
_: 1
|
|
3299
|
+
}, 8, ["loading", "disabled"]),
|
|
3300
|
+
i(x) ? (n(), h(O, {
|
|
3301
|
+
key: 0,
|
|
3302
|
+
type: "danger",
|
|
3303
|
+
disabled: i(S),
|
|
3304
|
+
onClick: i(ce)
|
|
3305
|
+
}, {
|
|
3306
|
+
default: o(() => [
|
|
3307
|
+
C(P(i(S) ? "正在停止…" : "停止"), 1)
|
|
3308
|
+
]),
|
|
3309
|
+
_: 1
|
|
3310
|
+
}, 8, ["disabled", "onClick"])) : M("", !0),
|
|
3311
|
+
c(O, {
|
|
3312
|
+
disabled: !i(_) || i(x),
|
|
3313
|
+
onClick: i(oe)
|
|
3314
|
+
}, {
|
|
3315
|
+
default: o(() => [...V[2] || (V[2] = [
|
|
3316
|
+
C("清空", -1)
|
|
3317
|
+
])]),
|
|
3318
|
+
_: 1
|
|
3319
|
+
}, 8, ["disabled", "onClick"]),
|
|
3320
|
+
i(u) ? (n(), v("span", {
|
|
3321
|
+
key: 1,
|
|
3322
|
+
class: "yk-import-excel__file-name",
|
|
3323
|
+
title: i(u)
|
|
3324
|
+
}, [
|
|
3325
|
+
C(" 📄 " + P(i(u)), 1),
|
|
3326
|
+
i(A) ? (n(), v(N, { key: 0 }, [
|
|
3327
|
+
C("(工作表:" + P(i(A)) + ")", 1)
|
|
3328
|
+
], 64)) : M("", !0)
|
|
3329
|
+
], 8, Rn)) : M("", !0),
|
|
3330
|
+
i(_) ? (n(), v("div", An, [
|
|
3331
|
+
p("span", Mn, "共 " + P(i(k).length) + " 行", 1),
|
|
3332
|
+
p("span", Pn, "已选 " + P(i(j)), 1),
|
|
3333
|
+
p("span", Bn, "校验失败 " + P(i(q)), 1)
|
|
3334
|
+
])) : M("", !0)
|
|
3335
|
+
]),
|
|
3336
|
+
i(x) ? (n(), v("div", Dn, [
|
|
3337
|
+
c(te, {
|
|
3338
|
+
percentage: K.value,
|
|
3339
|
+
"stroke-width": 14,
|
|
3340
|
+
"text-inside": "",
|
|
3341
|
+
format: ne,
|
|
3342
|
+
class: "yk-import-excel__progress-bar"
|
|
3343
|
+
}, null, 8, ["percentage"]),
|
|
3344
|
+
p("span", zn, [
|
|
3345
|
+
C(" 成功 " + P(i(R)), 1),
|
|
3346
|
+
p("span", Qn, " / 失败 " + P(i(b)), 1)
|
|
3347
|
+
]),
|
|
3348
|
+
p("span", En, P(ge.value), 1)
|
|
3349
|
+
])) : M("", !0),
|
|
3350
|
+
Je((n(), v("div", Tn, [
|
|
3351
|
+
i(_) ? (n(), h(re, {
|
|
3352
|
+
key: 0,
|
|
3353
|
+
ref_key: "tableRef",
|
|
3354
|
+
ref: $,
|
|
3355
|
+
data: i(k),
|
|
3356
|
+
height: "100%",
|
|
3357
|
+
"row-key": "rowNumber",
|
|
3358
|
+
border: "",
|
|
3359
|
+
stripe: "",
|
|
3360
|
+
onSelectionChange: Oe
|
|
3361
|
+
}, {
|
|
3362
|
+
default: o(() => [
|
|
3363
|
+
c(s, {
|
|
3364
|
+
type: "selection",
|
|
3365
|
+
width: "44",
|
|
3366
|
+
fixed: "left",
|
|
3367
|
+
selectable: Ue
|
|
3368
|
+
}),
|
|
3369
|
+
c(s, {
|
|
3370
|
+
label: "行号",
|
|
3371
|
+
width: "70",
|
|
3372
|
+
align: "center",
|
|
3373
|
+
fixed: "left"
|
|
3374
|
+
}, {
|
|
3375
|
+
default: o(({ row: J, $index: _e }) => [
|
|
3376
|
+
p("span", {
|
|
3377
|
+
title: `Excel 第 ${J.rowNumber} 行`
|
|
3378
|
+
}, P(_e + 1), 9, In)
|
|
3379
|
+
]),
|
|
3380
|
+
_: 1
|
|
3381
|
+
}),
|
|
3382
|
+
(n(!0), v(N, null, Z(l.columns, (J) => (n(), h(s, {
|
|
3383
|
+
key: J.name,
|
|
3384
|
+
label: J.name,
|
|
3385
|
+
"min-width": "120",
|
|
3386
|
+
"show-overflow-tooltip": ""
|
|
3387
|
+
}, {
|
|
3388
|
+
default: o(({ row: _e }) => [
|
|
3389
|
+
C(P(i(Ct)(_e.data[J.name])), 1)
|
|
3390
|
+
]),
|
|
3391
|
+
_: 2
|
|
3392
|
+
}, 1032, ["label"]))), 128)),
|
|
3393
|
+
c(s, {
|
|
3394
|
+
label: "状态",
|
|
3395
|
+
width: "200",
|
|
3396
|
+
fixed: "right",
|
|
3397
|
+
"class-name": "yk-import-excel__status-cell",
|
|
3398
|
+
filters: de.value,
|
|
3399
|
+
"filter-method": D,
|
|
3400
|
+
"filter-multiple": !1,
|
|
3401
|
+
"filter-placement": "bottom-end"
|
|
3402
|
+
}, {
|
|
3403
|
+
default: o(({ row: J }) => [
|
|
3404
|
+
c(W, {
|
|
3405
|
+
type: G[J.status].type,
|
|
3406
|
+
size: "small",
|
|
3407
|
+
"disable-transitions": ""
|
|
3408
|
+
}, {
|
|
3409
|
+
default: o(() => [
|
|
3410
|
+
J.status === "processing" ? (n(), v("span", Yn)) : M("", !0),
|
|
3411
|
+
C(" " + P(G[J.status].label), 1)
|
|
3412
|
+
]),
|
|
3413
|
+
_: 2
|
|
3414
|
+
}, 1032, ["type"]),
|
|
3415
|
+
J.status === "invalid" ? (n(), v("div", Nn, P(J.errors.join(";")), 1)) : J.message ? (n(), v("div", qn, P(J.message), 1)) : M("", !0)
|
|
3416
|
+
]),
|
|
3417
|
+
_: 1
|
|
3418
|
+
}, 8, ["filters"]),
|
|
3419
|
+
c(s, {
|
|
3420
|
+
label: "操作",
|
|
3421
|
+
width: "110",
|
|
3422
|
+
fixed: "right",
|
|
3423
|
+
align: "center"
|
|
3424
|
+
}, {
|
|
3425
|
+
default: o(({ row: J }) => [
|
|
3426
|
+
Me(J) ? (n(), v(N, { key: 0 }, [
|
|
3427
|
+
c(O, {
|
|
3428
|
+
link: "",
|
|
3429
|
+
type: "primary",
|
|
3430
|
+
size: "small",
|
|
3431
|
+
onClick: (_e) => Ge(J)
|
|
3432
|
+
}, {
|
|
3433
|
+
default: o(() => [...V[3] || (V[3] = [
|
|
3434
|
+
p("svg", {
|
|
3435
|
+
class: "yk-import-excel__action-icon",
|
|
3436
|
+
viewBox: "0 0 24 24",
|
|
3437
|
+
fill: "none",
|
|
3438
|
+
stroke: "currentColor",
|
|
3439
|
+
"stroke-width": "2",
|
|
3440
|
+
"stroke-linecap": "round",
|
|
3441
|
+
"stroke-linejoin": "round",
|
|
3442
|
+
"aria-hidden": "true"
|
|
3443
|
+
}, [
|
|
3444
|
+
p("path", { d: "M12 20h9" }),
|
|
3445
|
+
p("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
3446
|
+
], -1),
|
|
3447
|
+
C(" 编辑 ", -1)
|
|
3448
|
+
])]),
|
|
3449
|
+
_: 1
|
|
3450
|
+
}, 8, ["onClick"]),
|
|
3451
|
+
c(O, {
|
|
3452
|
+
link: "",
|
|
3453
|
+
type: "danger",
|
|
3454
|
+
size: "small",
|
|
3455
|
+
onClick: (_e) => We(J)
|
|
3456
|
+
}, {
|
|
3457
|
+
default: o(() => [...V[4] || (V[4] = [
|
|
3458
|
+
p("svg", {
|
|
3459
|
+
class: "yk-import-excel__action-icon",
|
|
3460
|
+
viewBox: "0 0 24 24",
|
|
3461
|
+
fill: "none",
|
|
3462
|
+
stroke: "currentColor",
|
|
3463
|
+
"stroke-width": "2",
|
|
3464
|
+
"stroke-linecap": "round",
|
|
3465
|
+
"stroke-linejoin": "round",
|
|
3466
|
+
"aria-hidden": "true"
|
|
3467
|
+
}, [
|
|
3468
|
+
p("polyline", { points: "3 6 5 6 21 6" }),
|
|
3469
|
+
p("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
|
|
3470
|
+
p("line", {
|
|
3471
|
+
x1: "10",
|
|
3472
|
+
y1: "11",
|
|
3473
|
+
x2: "10",
|
|
3474
|
+
y2: "17"
|
|
3475
|
+
}),
|
|
3476
|
+
p("line", {
|
|
3477
|
+
x1: "14",
|
|
3478
|
+
y1: "11",
|
|
3479
|
+
x2: "14",
|
|
3480
|
+
y2: "17"
|
|
3481
|
+
})
|
|
3482
|
+
], -1),
|
|
3483
|
+
C(" 删除 ", -1)
|
|
3484
|
+
])]),
|
|
3485
|
+
_: 1
|
|
3486
|
+
}, 8, ["onClick"])
|
|
3487
|
+
], 64)) : (n(), v("span", On, "—"))
|
|
3488
|
+
]),
|
|
3489
|
+
_: 1
|
|
3490
|
+
})
|
|
3491
|
+
]),
|
|
3492
|
+
_: 1
|
|
3493
|
+
}, 8, ["data"])) : (n(), v("div", {
|
|
3494
|
+
key: 1,
|
|
3495
|
+
class: "yk-import-excel__empty",
|
|
3496
|
+
onClick: pe
|
|
3497
|
+
}, [
|
|
3498
|
+
V[5] || (V[5] = lt('<svg class="yk-import-excel__empty-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-b5999744><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" data-v-b5999744></path><polyline points="14 2 14 8 20 8" data-v-b5999744></polyline><path d="M12 18v-6" data-v-b5999744></path><polyline points="9.5 14.5 12 12l2.5 2.5" data-v-b5999744></polyline></svg><p class="yk-import-excel__empty-title" data-v-b5999744>点击选择 Excel 文件,或将文件拖拽到此处</p>', 2)),
|
|
3499
|
+
p("p", Un, "支持 " + P(l.accept) + " 格式,首行需为表头", 1)
|
|
3500
|
+
]))
|
|
3501
|
+
])), [
|
|
3502
|
+
[ke, i(y)]
|
|
3503
|
+
]),
|
|
3504
|
+
he.value ? (n(), v("div", Ln, [...V[6] || (V[6] = [
|
|
3505
|
+
lt('<div class="yk-import-excel__drop-tip" data-v-b5999744><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-b5999744><path d="M12 15V3" data-v-b5999744></path><polyline points="7 8 12 3 17 8" data-v-b5999744></polyline><path d="M3 15v4a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-4" data-v-b5999744></path></svg><span data-v-b5999744>松开鼠标,加载 Excel 文件</span></div>', 1)
|
|
3506
|
+
])])) : M("", !0),
|
|
3507
|
+
c($n, {
|
|
3508
|
+
visible: Pe.value,
|
|
3509
|
+
"onUpdate:visible": V[0] || (V[0] = (J) => Pe.value = J),
|
|
3510
|
+
row: ye.value,
|
|
3511
|
+
columns: l.columns,
|
|
3512
|
+
saver: i(Y),
|
|
3513
|
+
onSaved: Le
|
|
3514
|
+
}, null, 8, ["visible", "row", "columns", "saver"])
|
|
3515
|
+
], 32);
|
|
3516
|
+
};
|
|
3517
|
+
}
|
|
3518
|
+
}), Kn = /* @__PURE__ */ ae(Hn, [["__scopeId", "data-v-b5999744"]]), Zn = {
|
|
3519
|
+
install(e) {
|
|
3520
|
+
e.component("YsTable", yt), e.component("YsTableActionMenuButton", gt), e.component("YsCommandBar", kt), e.component("YsMainPanel", Kl), e.component("YsFilterPanel", xt), e.component("YsTextFilterItem", kn), e.component("YsDateFilterItem", _n), e.component("YsDateRangeFilterItem", bn), e.component("YsEnumFilterItem", hn), e.component("YsFilterItemLayout", Ie), e.component("YsAdvancedFilterPanel", wt), e.component("YsAdvancedValueEditor", _t), e.component("YsAdvancedConditionGroup", ht), e.component("YsTablePage", Cn), e.component("YsImportExcel", Kn);
|
|
3521
|
+
}
|
|
3522
|
+
};
|
|
3523
|
+
export {
|
|
3524
|
+
ht as YsAdvancedConditionGroup,
|
|
3525
|
+
wt as YsAdvancedFilterPanel,
|
|
3526
|
+
_t as YsAdvancedValueEditor,
|
|
3527
|
+
kt as YsCommandBar,
|
|
3528
|
+
_n as YsDateFilterItem,
|
|
3529
|
+
bn as YsDateRangeFilterItem,
|
|
3530
|
+
hn as YsEnumFilterItem,
|
|
3531
|
+
Ie as YsFilterItemLayout,
|
|
3532
|
+
xt as YsFilterPanel,
|
|
3533
|
+
Kn as YsImportExcel,
|
|
3534
|
+
Kl as YsMainPanel,
|
|
3535
|
+
yt as YsTable,
|
|
3536
|
+
gt as YsTableActionMenuButton,
|
|
3537
|
+
Cn as YsTablePage,
|
|
3538
|
+
kn as YsTextFilterItem,
|
|
3539
|
+
Zn as default,
|
|
3540
|
+
lo as fromArray,
|
|
3541
|
+
no as fromBool,
|
|
3542
|
+
oo as fromObjectItems,
|
|
3543
|
+
ao as fromOptions
|
|
3544
|
+
};
|
|
3545
|
+
//# sourceMappingURL=index.js.map
|