@es-plus/vue2 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -0
- package/dist/components/es-crud-page/es-crud-page.vue.d.ts +57 -0
- package/dist/components/es-crud-page/es-crud-page.vue.d.ts.map +1 -0
- package/dist/components/es-crud-page/index.d.ts +6 -0
- package/dist/components/es-crud-page/index.d.ts.map +1 -0
- package/dist/components/es-crud-page/types.d.ts +100 -0
- package/dist/components/es-crud-page/types.d.ts.map +1 -0
- package/dist/components/es-dialog/component.vue.d.ts +236 -0
- package/dist/components/es-dialog/component.vue.d.ts.map +1 -0
- package/dist/components/es-dialog/index.d.ts +6 -0
- package/dist/components/es-dialog/index.d.ts.map +1 -0
- package/dist/components/es-dialog/render-jsx.vue.d.ts +60 -0
- package/dist/components/es-dialog/render-jsx.vue.d.ts.map +1 -0
- package/dist/components/es-dialog/use-dialog.d.ts +17 -0
- package/dist/components/es-dialog/use-dialog.d.ts.map +1 -0
- package/dist/components/es-form/es-form.vue.d.ts +174 -0
- package/dist/components/es-form/es-form.vue.d.ts.map +1 -0
- package/dist/components/es-form/index.d.ts +5 -0
- package/dist/components/es-form/index.d.ts.map +1 -0
- package/dist/components/es-table/column-item.vue.d.ts +17 -0
- package/dist/components/es-table/column-item.vue.d.ts.map +1 -0
- package/dist/components/es-table/component.vue.d.ts +228 -0
- package/dist/components/es-table/component.vue.d.ts.map +1 -0
- package/dist/components/es-table/index.d.ts +5 -0
- package/dist/components/es-table/index.d.ts.map +1 -0
- package/dist/components/es-table/table-btns.vue.d.ts +72 -0
- package/dist/components/es-table/table-btns.vue.d.ts.map +1 -0
- package/dist/composables/use-form-inputs.d.ts +27 -0
- package/dist/composables/use-form-inputs.d.ts.map +1 -0
- package/dist/composables/use-form-layout.d.ts +61 -0
- package/dist/composables/use-form-layout.d.ts.map +1 -0
- package/dist/composables/use-form-request.d.ts +10 -0
- package/dist/composables/use-form-request.d.ts.map +1 -0
- package/dist/composables/use-table-resize.d.ts +30 -0
- package/dist/composables/use-table-resize.d.ts.map +1 -0
- package/dist/composables/use-table-selection.d.ts +11 -0
- package/dist/composables/use-table-selection.d.ts.map +1 -0
- package/dist/es-plus-vue2.js +2105 -0
- package/dist/es-plus-vue2.js.map +1 -0
- package/dist/es-plus-vue2.umd.cjs +2 -0
- package/dist/es-plus-vue2.umd.cjs.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/icon.d.ts +13 -0
- package/dist/utils/icon.d.ts.map +1 -0
- package/dist/utils/size.d.ts +29 -0
- package/dist/utils/size.d.ts.map +1 -0
- package/dist/vue-compat.d.ts +18 -0
- package/dist/vue-compat.d.ts.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,2105 @@
|
|
|
1
|
+
import { getNestedValue as G, setNestedValue as Q, getRowColsAlgorithm as rt, configFormField as at, formatConfigOut as lt, getEveryFormQueryField as it, queryTableListMethod as ct, getGlobalConfig as pe, createSelectionState as ut, restoreSelectionForPage as dt, clearAllSelection as ft, applySelectionChange as pt, isObject as fe, findValueByKey as mt, configureEsPlus as gt } from "@es-plus/core";
|
|
2
|
+
import { configureEsPlus as Sn } from "@es-plus/core";
|
|
3
|
+
import yt, { ref as z, computed as B, watch as ce, defineComponent as se, getCurrentInstance as Ee, inject as ae, nextTick as Be, h as le, onMounted as De, onBeforeUnmount as ht, provide as et, reactive as Le, onUpdated as vt } from "vue";
|
|
4
|
+
import { MessageBox as Ze } from "element-ui";
|
|
5
|
+
function _e(n) {
|
|
6
|
+
if (Array.isArray(n)) return n;
|
|
7
|
+
if (typeof n == "function") {
|
|
8
|
+
const e = n();
|
|
9
|
+
return Array.isArray(e) ? e : [];
|
|
10
|
+
}
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
function Y(n) {
|
|
14
|
+
const e = { ...n.attrs || {} };
|
|
15
|
+
return typeof e.disabled == "function" && (e.disabled = e.disabled()), e;
|
|
16
|
+
}
|
|
17
|
+
function te(n, e) {
|
|
18
|
+
const o = n.on || {}, t = {};
|
|
19
|
+
for (const [a, l] of Object.entries(o))
|
|
20
|
+
typeof l == "function" && (t[a] = l);
|
|
21
|
+
return typeof t.input != "function" && (t.input = e), t;
|
|
22
|
+
}
|
|
23
|
+
function bt() {
|
|
24
|
+
return { formInputComponents: (e) => {
|
|
25
|
+
var F;
|
|
26
|
+
const o = /* @__PURE__ */ new Map([
|
|
27
|
+
// ─────────────────────────────────────────────────────────────────
|
|
28
|
+
// Input - 文本输入
|
|
29
|
+
// ─────────────────────────────────────────────────────────────────
|
|
30
|
+
[
|
|
31
|
+
"Input",
|
|
32
|
+
(d, g, { row: r }) => {
|
|
33
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
34
|
+
return d("el-input", {
|
|
35
|
+
attrs: f,
|
|
36
|
+
props: { value: p, ...r.props },
|
|
37
|
+
on: _
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
// ─────────────────────────────────────────────────────────────────
|
|
42
|
+
// InputNumber - 数字输入(保留兼容 es-eui 的扩展类型)
|
|
43
|
+
// ─────────────────────────────────────────────────────────────────
|
|
44
|
+
[
|
|
45
|
+
"InputNumber",
|
|
46
|
+
(d, g, { row: r }) => {
|
|
47
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
48
|
+
return d("el-input-number", {
|
|
49
|
+
attrs: f,
|
|
50
|
+
props: { value: p, ...r.props },
|
|
51
|
+
on: _
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
// ─────────────────────────────────────────────────────────────────
|
|
56
|
+
// Select - 下拉选择
|
|
57
|
+
// ─────────────────────────────────────────────────────────────────
|
|
58
|
+
[
|
|
59
|
+
"Select",
|
|
60
|
+
(d, g, { row: r }) => {
|
|
61
|
+
const f = Y(r), p = G(g, r.prop), _ = _e(r.dataOptions), h = te(r, (v) => Q(g, r.prop, v));
|
|
62
|
+
return d(
|
|
63
|
+
"el-select",
|
|
64
|
+
{
|
|
65
|
+
attrs: f,
|
|
66
|
+
props: { value: p, ...r.props },
|
|
67
|
+
on: h
|
|
68
|
+
},
|
|
69
|
+
_.map(
|
|
70
|
+
(v, T) => d("el-option", {
|
|
71
|
+
key: T,
|
|
72
|
+
props: { value: v.value, label: v.label, disabled: v.disabled }
|
|
73
|
+
})
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
// ─────────────────────────────────────────────────────────────────
|
|
79
|
+
// datePicker - 日期选择(注意 Vue 3 用大写 DatePicker,Vue 2 用 datePicker;
|
|
80
|
+
// 这里 Map key 跟 Vue 3 版本对齐,使用 'datePicker')
|
|
81
|
+
// ─────────────────────────────────────────────────────────────────
|
|
82
|
+
[
|
|
83
|
+
"datePicker",
|
|
84
|
+
(d, g, { row: r }) => {
|
|
85
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
86
|
+
return d("el-date-picker", {
|
|
87
|
+
attrs: f,
|
|
88
|
+
props: { value: p, ...r.props },
|
|
89
|
+
on: _
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
// ─────────────────────────────────────────────────────────────────
|
|
94
|
+
// timePicker - 时间选择
|
|
95
|
+
// ─────────────────────────────────────────────────────────────────
|
|
96
|
+
[
|
|
97
|
+
"timePicker",
|
|
98
|
+
(d, g, { row: r }) => {
|
|
99
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
100
|
+
return d("el-time-picker", {
|
|
101
|
+
attrs: f,
|
|
102
|
+
props: { value: p, ...r.props },
|
|
103
|
+
on: _
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
// ─────────────────────────────────────────────────────────────────
|
|
108
|
+
// Slider - 滑块
|
|
109
|
+
// ─────────────────────────────────────────────────────────────────
|
|
110
|
+
[
|
|
111
|
+
"Slider",
|
|
112
|
+
(d, g, { row: r }) => {
|
|
113
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
114
|
+
return d("el-slider", {
|
|
115
|
+
attrs: f,
|
|
116
|
+
props: { value: p, ...r.props },
|
|
117
|
+
on: _
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
// ─────────────────────────────────────────────────────────────────
|
|
122
|
+
// ColorPicker - 颜色选择
|
|
123
|
+
// Element UI 的 el-color-picker 使用 v-model 默认 prop 为 'value',事件 'change'/'active-change'
|
|
124
|
+
// 但同时支持 input 事件透传,这里保持 input 用作默认写回
|
|
125
|
+
// ─────────────────────────────────────────────────────────────────
|
|
126
|
+
[
|
|
127
|
+
"ColorPicker",
|
|
128
|
+
(d, g, { row: r }) => {
|
|
129
|
+
const f = Y(r), p = G(g, r.prop), _ = r.on || {}, h = {};
|
|
130
|
+
for (const [v, T] of Object.entries(_))
|
|
131
|
+
typeof T == "function" && (h[v] = T);
|
|
132
|
+
return typeof h.change != "function" && (h.change = (v) => Q(g, r.prop, v)), d("el-color-picker", {
|
|
133
|
+
attrs: f,
|
|
134
|
+
props: { value: p, ...r.props },
|
|
135
|
+
on: h
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
// ─────────────────────────────────────────────────────────────────
|
|
140
|
+
// Transfer - 穿梭框
|
|
141
|
+
// Element UI 中 el-transfer 默认 v-model 为 :value + @input,data 通过 props 传入
|
|
142
|
+
// ─────────────────────────────────────────────────────────────────
|
|
143
|
+
[
|
|
144
|
+
"Transfer",
|
|
145
|
+
(d, g, { row: r }) => {
|
|
146
|
+
const f = Y(r), p = G(g, r.prop), _ = _e(r.dataOptions), h = te(r, (v) => Q(g, r.prop, v));
|
|
147
|
+
return d("el-transfer", {
|
|
148
|
+
attrs: f,
|
|
149
|
+
props: {
|
|
150
|
+
value: p,
|
|
151
|
+
data: _.map((v) => ({ key: v.value, label: v.label, disabled: v.disabled })),
|
|
152
|
+
...r.props
|
|
153
|
+
},
|
|
154
|
+
on: h
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
// ─────────────────────────────────────────────────────────────────
|
|
159
|
+
// Cascader - 级联选择
|
|
160
|
+
// ─────────────────────────────────────────────────────────────────
|
|
161
|
+
[
|
|
162
|
+
"Cascader",
|
|
163
|
+
(d, g, { row: r }) => {
|
|
164
|
+
const f = Y(r), p = G(g, r.prop), _ = _e(r.dataOptions), h = te(r, (v) => Q(g, r.prop, v));
|
|
165
|
+
return d("el-cascader", {
|
|
166
|
+
// key 强制 dataOptions 变化时重渲染,Element UI 内部 cache 否则不刷新
|
|
167
|
+
key: JSON.stringify(_),
|
|
168
|
+
attrs: f,
|
|
169
|
+
props: {
|
|
170
|
+
value: p,
|
|
171
|
+
options: _,
|
|
172
|
+
...r.props
|
|
173
|
+
},
|
|
174
|
+
on: h
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
// ─────────────────────────────────────────────────────────────────
|
|
179
|
+
// Radio - 单选组
|
|
180
|
+
// ─────────────────────────────────────────────────────────────────
|
|
181
|
+
[
|
|
182
|
+
"Radio",
|
|
183
|
+
(d, g, { row: r }) => {
|
|
184
|
+
const f = Y(r), p = G(g, r.prop), _ = _e(r.dataOptions), h = te(r, (v) => Q(g, r.prop, v));
|
|
185
|
+
return d(
|
|
186
|
+
"el-radio-group",
|
|
187
|
+
{
|
|
188
|
+
attrs: f,
|
|
189
|
+
props: { value: p, ...r.props },
|
|
190
|
+
on: h
|
|
191
|
+
},
|
|
192
|
+
_.map(
|
|
193
|
+
(v, T) => d(
|
|
194
|
+
"el-radio",
|
|
195
|
+
{
|
|
196
|
+
key: T,
|
|
197
|
+
// Element UI 中 el-radio 使用 :label 作为值
|
|
198
|
+
props: { label: v.value, disabled: v.disabled || f.disabled }
|
|
199
|
+
},
|
|
200
|
+
[v.label]
|
|
201
|
+
)
|
|
202
|
+
)
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
// ─────────────────────────────────────────────────────────────────
|
|
207
|
+
// Checkbox - 复选组
|
|
208
|
+
// ─────────────────────────────────────────────────────────────────
|
|
209
|
+
[
|
|
210
|
+
"Checkbox",
|
|
211
|
+
(d, g, { row: r }) => {
|
|
212
|
+
const f = Y(r), p = G(g, r.prop), _ = _e(r.dataOptions), h = te(r, (v) => Q(g, r.prop, v));
|
|
213
|
+
return d(
|
|
214
|
+
"el-checkbox-group",
|
|
215
|
+
{
|
|
216
|
+
attrs: f,
|
|
217
|
+
props: { value: p, ...r.props },
|
|
218
|
+
on: h
|
|
219
|
+
},
|
|
220
|
+
_.map(
|
|
221
|
+
(v, T) => d(
|
|
222
|
+
"el-checkbox",
|
|
223
|
+
{
|
|
224
|
+
key: T,
|
|
225
|
+
props: { label: v.value, disabled: v.disabled || f.disabled }
|
|
226
|
+
},
|
|
227
|
+
[v.label]
|
|
228
|
+
)
|
|
229
|
+
)
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
// ─────────────────────────────────────────────────────────────────
|
|
234
|
+
// Switch - 开关
|
|
235
|
+
// ─────────────────────────────────────────────────────────────────
|
|
236
|
+
[
|
|
237
|
+
"Switch",
|
|
238
|
+
(d, g, { row: r }) => {
|
|
239
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
240
|
+
return d("el-switch", {
|
|
241
|
+
attrs: f,
|
|
242
|
+
props: { value: p, ...r.props },
|
|
243
|
+
on: _
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
// ─────────────────────────────────────────────────────────────────
|
|
248
|
+
// Rate - 评分
|
|
249
|
+
// ─────────────────────────────────────────────────────────────────
|
|
250
|
+
[
|
|
251
|
+
"Rate",
|
|
252
|
+
(d, g, { row: r }) => {
|
|
253
|
+
const f = Y(r), p = G(g, r.prop), _ = te(r, (h) => Q(g, r.prop, h));
|
|
254
|
+
return d("el-rate", {
|
|
255
|
+
attrs: f,
|
|
256
|
+
props: { value: p, ...r.props },
|
|
257
|
+
on: _
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
// ─────────────────────────────────────────────────────────────────
|
|
262
|
+
// Upload - 上传(最复杂的一个,需处理 fileList、httpRequest、自定义 trigger 等)
|
|
263
|
+
// ─────────────────────────────────────────────────────────────────
|
|
264
|
+
[
|
|
265
|
+
"Upload",
|
|
266
|
+
(d, g, { row: r }) => {
|
|
267
|
+
const f = r.prop, p = Y(r), _ = r.props || {}, h = r.on || {}, v = G(g, f) || [], T = typeof r.httpRequest == "function", D = r.triggerRender, q = r.fileRender, W = D ? D(d) : d("el-button", { props: { size: "mini", type: "primary" } }, ["选择文件"]), J = (s, u, y) => {
|
|
268
|
+
var O, x;
|
|
269
|
+
const R = (s == null ? void 0 : s.link) || (s == null ? void 0 : s.url) || ((O = s == null ? void 0 : s.data) == null ? void 0 : O.link) || ((x = s == null ? void 0 : s.data) == null ? void 0 : x.url);
|
|
270
|
+
R && (u.url = R), u.status = "success", u.response = s, typeof h.success == "function" && h.success(s, u, y), Q(g, f, [...y]);
|
|
271
|
+
}, N = (s, u, y) => {
|
|
272
|
+
u.status = "fail", u.error = s, typeof h.error == "function" && h.error(s, u, y), Q(g, f, [...y]);
|
|
273
|
+
}, U = T ? (s) => {
|
|
274
|
+
const u = r.httpRequest;
|
|
275
|
+
u({
|
|
276
|
+
file: s.file,
|
|
277
|
+
filename: s.file.name,
|
|
278
|
+
onProgress: s.onProgress
|
|
279
|
+
}).then((y) => {
|
|
280
|
+
const R = (y == null ? void 0 : y.data) || y;
|
|
281
|
+
s.onSuccess(R);
|
|
282
|
+
}).catch((y) => s.onError(y));
|
|
283
|
+
} : void 0, L = {
|
|
284
|
+
preview: "onPreview",
|
|
285
|
+
change: "onChange",
|
|
286
|
+
success: "onSuccess",
|
|
287
|
+
error: "onError",
|
|
288
|
+
progress: "onProgress",
|
|
289
|
+
remove: "onRemove",
|
|
290
|
+
exceed: "onExceed"
|
|
291
|
+
}, K = {};
|
|
292
|
+
for (const [s, u] of Object.entries(h)) {
|
|
293
|
+
if (typeof u != "function" || s === "success" || s === "error" || s === "remove") continue;
|
|
294
|
+
const y = L[s];
|
|
295
|
+
y && (K[y] = u);
|
|
296
|
+
}
|
|
297
|
+
return K.onSuccess = J, K.onError = N, K.onRemove = (s, u) => {
|
|
298
|
+
typeof h.remove == "function" && h.remove(s, u), Q(g, f, [...u]);
|
|
299
|
+
}, d(
|
|
300
|
+
"el-upload",
|
|
301
|
+
{
|
|
302
|
+
attrs: {
|
|
303
|
+
...p,
|
|
304
|
+
action: _.action || p.action || "#",
|
|
305
|
+
"file-list": v
|
|
306
|
+
},
|
|
307
|
+
props: {
|
|
308
|
+
..._,
|
|
309
|
+
fileList: v,
|
|
310
|
+
// 自定义上传时禁用 auto-upload,由 httpRequest 接管
|
|
311
|
+
autoUpload: T ? !1 : _.autoUpload !== !1,
|
|
312
|
+
httpRequest: U,
|
|
313
|
+
// 把 row.on.* 转换为 onXxx prop(覆盖在 userProps 之上:
|
|
314
|
+
// 若用户已直接在 props 里给了 onPreview,这里仍以 row.on 为优先权来源)
|
|
315
|
+
...K
|
|
316
|
+
},
|
|
317
|
+
// Vue 2 的 scopedSlots 用于自定义文件项渲染
|
|
318
|
+
scopedSlots: q ? {
|
|
319
|
+
file: ({ file: s }) => q(d, s, () => {
|
|
320
|
+
const u = v.filter((y) => y !== s);
|
|
321
|
+
Q(g, f, u);
|
|
322
|
+
})
|
|
323
|
+
} : void 0
|
|
324
|
+
},
|
|
325
|
+
[W]
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
]), t = (F = e.formtype) != null ? F : "";
|
|
330
|
+
if (!t) return () => null;
|
|
331
|
+
const a = o.get(t);
|
|
332
|
+
if (a) return a;
|
|
333
|
+
const l = t[0] ? t[0] === t[0].toLowerCase() ? t[0].toUpperCase() + t.slice(1) : t[0].toLowerCase() + t.slice(1) : t, c = o.get(l);
|
|
334
|
+
if (c) return c;
|
|
335
|
+
const S = t.toLowerCase();
|
|
336
|
+
for (const [d, g] of o)
|
|
337
|
+
if (d.toLowerCase() === S) return g;
|
|
338
|
+
return () => null;
|
|
339
|
+
} };
|
|
340
|
+
}
|
|
341
|
+
function _t(n) {
|
|
342
|
+
const e = z(!1), o = B(() => {
|
|
343
|
+
var h, v;
|
|
344
|
+
const f = (h = n.layoutFormProps) == null ? void 0 : h.fromLayProps;
|
|
345
|
+
if (!f) return !1;
|
|
346
|
+
const p = f.isBtnHiden, _ = f.isBtnHidden;
|
|
347
|
+
return !!((v = p != null ? p : _) != null && v);
|
|
348
|
+
}), t = B(() => {
|
|
349
|
+
var p;
|
|
350
|
+
return {
|
|
351
|
+
type: "flex",
|
|
352
|
+
gutter: 20,
|
|
353
|
+
...((p = n.layoutFormProps) == null ? void 0 : p.rowLayProps) || {}
|
|
354
|
+
};
|
|
355
|
+
}), a = B(() => {
|
|
356
|
+
var f;
|
|
357
|
+
return ((f = n.layoutFormProps) == null ? void 0 : f.fromLayProps) || {};
|
|
358
|
+
}), l = B(() => {
|
|
359
|
+
var f;
|
|
360
|
+
return (f = n.layoutFormProps) == null ? void 0 : f.setOptions;
|
|
361
|
+
}), c = B(
|
|
362
|
+
() => rt(n.formItemList || [])
|
|
363
|
+
), S = () => {
|
|
364
|
+
var h, v;
|
|
365
|
+
const f = (h = n.layoutFormProps) == null ? void 0 : h.fromLayProps;
|
|
366
|
+
if (!f) return 0;
|
|
367
|
+
const p = f.minfoldRows, _ = f.minFoldRows;
|
|
368
|
+
return Number((v = p != null ? p : _) != null ? v : 0) || 0;
|
|
369
|
+
}, F = B(() => {
|
|
370
|
+
const f = S();
|
|
371
|
+
return f > 0 && f < c.value.rowNum;
|
|
372
|
+
}), d = B(() => {
|
|
373
|
+
var D, q;
|
|
374
|
+
const { rowNum: f, columnRow: p } = c.value, _ = p[f - 1] || [], h = ((q = (D = n.layoutFormProps) == null ? void 0 : D.fromLayProps) == null ? void 0 : q.btnColSpan) || 0, T = 24 - _.reduce(
|
|
375
|
+
(W, J) => {
|
|
376
|
+
var N;
|
|
377
|
+
return W + (((N = n.formItemList[J]) == null ? void 0 : N.span) || 24);
|
|
378
|
+
},
|
|
379
|
+
0
|
|
380
|
+
);
|
|
381
|
+
return !e.value && h <= T ? T : 24;
|
|
382
|
+
}), g = B(() => {
|
|
383
|
+
var _, h;
|
|
384
|
+
const f = S(), { columnNodeIndex: p } = c.value;
|
|
385
|
+
if (e.value) {
|
|
386
|
+
const v = (h = (_ = p[f - 1]) != null ? _ : p[p.length - 1]) != null ? h : 9999;
|
|
387
|
+
return (n.formItemList || []).map((T, D) => ({
|
|
388
|
+
...T,
|
|
389
|
+
isFold: D > v
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
return (n.formItemList || []).map((v) => ({ ...v, isFold: !1 }));
|
|
393
|
+
});
|
|
394
|
+
return ce(
|
|
395
|
+
F,
|
|
396
|
+
(f) => {
|
|
397
|
+
e.value = f;
|
|
398
|
+
},
|
|
399
|
+
{ immediate: !0 }
|
|
400
|
+
), {
|
|
401
|
+
folded: e,
|
|
402
|
+
isBtnHidden: o,
|
|
403
|
+
rowLayout: t,
|
|
404
|
+
formLayout: a,
|
|
405
|
+
getSetOptionsStatus: l,
|
|
406
|
+
getRowColsAlgorithm: c,
|
|
407
|
+
isFold: F,
|
|
408
|
+
getBtnColSpan: d,
|
|
409
|
+
formItem: g,
|
|
410
|
+
changeFolded: () => {
|
|
411
|
+
e.value = !e.value;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function Ct(n) {
|
|
416
|
+
return {
|
|
417
|
+
queryTableListMethod: (l, c = {}) => ct(l, c, n),
|
|
418
|
+
getEveryFormQueryField: (l, c) => it(l, n, c),
|
|
419
|
+
formatConfigOut: (l, c, S = {}, F) => lt(l, c, S, F),
|
|
420
|
+
configFormField: (l = {}, c) => at(l, c)
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
const St = {
|
|
424
|
+
large: "medium",
|
|
425
|
+
default: "small",
|
|
426
|
+
small: "mini",
|
|
427
|
+
// EUI 原生值透传
|
|
428
|
+
medium: "medium",
|
|
429
|
+
mini: "mini"
|
|
430
|
+
};
|
|
431
|
+
function $e(n) {
|
|
432
|
+
if (n == null || n === "") return;
|
|
433
|
+
const e = String(n).trim();
|
|
434
|
+
if (e)
|
|
435
|
+
return St[e];
|
|
436
|
+
}
|
|
437
|
+
const Bt = se({
|
|
438
|
+
name: "RenderDomForm",
|
|
439
|
+
functional: !0,
|
|
440
|
+
props: {
|
|
441
|
+
row: { type: Object, default: () => ({}) },
|
|
442
|
+
index: { type: Number, default: 0 },
|
|
443
|
+
render: { type: Function, default: void 0 },
|
|
444
|
+
model: { type: Object, default: () => ({}) }
|
|
445
|
+
},
|
|
446
|
+
render(n, e) {
|
|
447
|
+
const { row: o, index: t, model: a, render: l } = e.props;
|
|
448
|
+
if (typeof l != "function") return null;
|
|
449
|
+
const S = l(n, a || {}, { row: o || {}, index: t });
|
|
450
|
+
return typeof S == "string" ? n("span", S) : S;
|
|
451
|
+
}
|
|
452
|
+
}), Ft = se({
|
|
453
|
+
name: "RenderBtn",
|
|
454
|
+
functional: !0,
|
|
455
|
+
props: {
|
|
456
|
+
row: { type: Object, default: () => ({}) },
|
|
457
|
+
formItemList: { type: Array, default: () => [] },
|
|
458
|
+
formModel: { type: Object, default: () => ({}) },
|
|
459
|
+
render: { type: Function, default: void 0 }
|
|
460
|
+
},
|
|
461
|
+
render(n, e) {
|
|
462
|
+
const { formItemList: o, formModel: t, row: a, render: l } = e.props;
|
|
463
|
+
if (typeof l != "function") return null;
|
|
464
|
+
const c = l(a, t, o, n) || "";
|
|
465
|
+
return typeof c == "string" ? n("span", c) : c;
|
|
466
|
+
}
|
|
467
|
+
}), kt = se({
|
|
468
|
+
name: "EsForm",
|
|
469
|
+
components: { RenderDomForm: Bt, RenderBtn: Ft },
|
|
470
|
+
props: {
|
|
471
|
+
/** 表单 model 数据 */
|
|
472
|
+
model: { type: Object, default: () => ({}) },
|
|
473
|
+
/** 表单字段配置 */
|
|
474
|
+
formItemList: { type: Array, default: () => [] },
|
|
475
|
+
/** 布局配置 */
|
|
476
|
+
layoutFormProps: { type: Object, default: () => ({}) },
|
|
477
|
+
/** 工具栏按钮 */
|
|
478
|
+
configBtn: { type: Array, default: () => [] },
|
|
479
|
+
/** 自定义按钮区渲染函数 */
|
|
480
|
+
renderBtn: { type: [Function, Boolean], default: !1 },
|
|
481
|
+
/** 是否一行内左右分布按钮 */
|
|
482
|
+
btnColSpanRow: { type: Boolean, default: !0 },
|
|
483
|
+
/** 校验规则 */
|
|
484
|
+
rules: { type: Object, default: () => ({}) },
|
|
485
|
+
/** 字段映射注入函数 */
|
|
486
|
+
fieldFieldOutput: { type: Function, default: void 0 }
|
|
487
|
+
},
|
|
488
|
+
setup(n, e) {
|
|
489
|
+
var Re, Oe, we, be, Pe;
|
|
490
|
+
const o = Ee(), t = () => {
|
|
491
|
+
const m = o == null ? void 0 : o.proxy;
|
|
492
|
+
return (m == null ? void 0 : m.$refs) || {};
|
|
493
|
+
}, a = B(() => {
|
|
494
|
+
var $, w;
|
|
495
|
+
const m = o == null ? void 0 : o.proxy, b = (w = ($ = m == null ? void 0 : m.$vnode) == null ? void 0 : $.data) == null ? void 0 : w.model;
|
|
496
|
+
return b && typeof b == "object" && typeof b.callback != "function" ? b : n.model;
|
|
497
|
+
}), l = (Oe = (Re = ae("$esPlusForm", null)) != null ? Re : pe().EsForm) != null ? Oe : {}, c = (be = (we = ae("$EsPlus", null)) != null ? we : pe()) != null ? be : {}, S = (m) => {
|
|
498
|
+
if (!m) return !0;
|
|
499
|
+
const b = c.permission;
|
|
500
|
+
return typeof b == "function" ? b(m) : !0;
|
|
501
|
+
}, F = (m) => m.labelKey && typeof c.t == "function" ? c.t(m.labelKey) : m.label, d = ae("getTableInstantce", null), g = B(() => {
|
|
502
|
+
if (d)
|
|
503
|
+
return typeof d == "function" ? d() : d;
|
|
504
|
+
const m = o == null ? void 0 : o.proxy, b = m == null ? void 0 : m.getTableInstantce;
|
|
505
|
+
return typeof b == "function" ? b() : b;
|
|
506
|
+
}), r = B(() => {
|
|
507
|
+
const m = g.value;
|
|
508
|
+
return !!(m && Object.keys(m).length);
|
|
509
|
+
}), f = (m) => m ? m.startsWith("el-icon-") ? m : `el-icon-${m.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase()}` : void 0, p = (m) => {
|
|
510
|
+
const { icon: b, ...$ } = m;
|
|
511
|
+
if ($.size !== void 0) {
|
|
512
|
+
const w = $e($.size);
|
|
513
|
+
w !== void 0 && ($.size = w);
|
|
514
|
+
} else
|
|
515
|
+
$.size = "mini";
|
|
516
|
+
return $;
|
|
517
|
+
}, _ = (m) => {
|
|
518
|
+
const b = m.disabled;
|
|
519
|
+
return typeof b == "function" ? !!b() : !!b;
|
|
520
|
+
}, h = z({}), v = z(n.formItemList || []), { formInputComponents: T } = bt(), D = (l == null ? void 0 : l.$httpRequest) || void 0, q = n.fieldFieldOutput || (l == null ? void 0 : l.fieldFieldOutput), { getEveryFormQueryField: W } = Ct(D), J = z(((Pe = n.layoutFormProps) == null ? void 0 : Pe.fromLayProps) || {}), N = B(() => {
|
|
521
|
+
const b = {
|
|
522
|
+
size: "mini",
|
|
523
|
+
...J.value || {},
|
|
524
|
+
model: a.value,
|
|
525
|
+
rules: n.rules,
|
|
526
|
+
validateOnRuleChange: !1
|
|
527
|
+
}, $ = $e(b.size);
|
|
528
|
+
return $ !== void 0 && (b.size = $), (b.labelWidth === void 0 || b.labelWidth === "" || b.labelWidth === null) && (b.labelWidth = "auto"), b;
|
|
529
|
+
}), U = z(/* @__PURE__ */ new Set());
|
|
530
|
+
ce(
|
|
531
|
+
() => n.formItemList,
|
|
532
|
+
async (m) => {
|
|
533
|
+
const b = Array.isArray(m) ? m : [], $ = b.filter(
|
|
534
|
+
(k) => k && k.isInitRun !== !1 && !U.value.has(k.prop)
|
|
535
|
+
);
|
|
536
|
+
if (!$.length) {
|
|
537
|
+
v.value = b.map((k) => {
|
|
538
|
+
var M;
|
|
539
|
+
if (!k) return null;
|
|
540
|
+
const A = v.value.find((X) => X && X.prop === k.prop);
|
|
541
|
+
return (M = A == null ? void 0 : A.dataOptions) != null && M.length ? { ...k, dataOptions: A.dataOptions } : k;
|
|
542
|
+
}).filter((k) => !!k);
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const w = await W($, q);
|
|
546
|
+
$.forEach((k) => U.value.add(k.prop)), v.value = b.map((k) => {
|
|
547
|
+
var X;
|
|
548
|
+
if (!k) return null;
|
|
549
|
+
const A = w.find((ee) => ee && ee.prop === k.prop), M = v.value.find((ee) => ee && ee.prop === k.prop);
|
|
550
|
+
return A ? {
|
|
551
|
+
...k,
|
|
552
|
+
dataOptions: A.listData
|
|
553
|
+
} : (X = M == null ? void 0 : M.dataOptions) != null && X.length ? { ...k, dataOptions: M.dataOptions } : k;
|
|
554
|
+
}).filter((k) => !!k);
|
|
555
|
+
},
|
|
556
|
+
{ immediate: !0, deep: !0 }
|
|
557
|
+
);
|
|
558
|
+
const L = B(() => {
|
|
559
|
+
const b = (v.value || []).map((A) => A ? { ...A, dataOptions: A.dataOptions || [] } : null).filter((A) => {
|
|
560
|
+
if (!A) return !1;
|
|
561
|
+
const M = A.isHiden, X = A.isHidden, ee = typeof M == "function" ? M : typeof X == "function" ? X : null;
|
|
562
|
+
return ee ? !ee(a.value, A, N.value) : !0;
|
|
563
|
+
}), w = b.filter((A) => !A.span).length;
|
|
564
|
+
let k = 6;
|
|
565
|
+
if (w > 0) {
|
|
566
|
+
const A = b.reduce((X, ee) => X + (ee.span || 0), 0), M = 24 - (A % 24 || (A ? 24 : 0));
|
|
567
|
+
A === 0 ? w === 1 ? k = 24 : w === 2 ? k = 12 : w === 3 ? k = 8 : k = 6 : (k = M >= w ? Math.floor(M / w) : 6, k > 12 && (k = 12), k < 4 && (k = 6));
|
|
568
|
+
}
|
|
569
|
+
return b.map((A) => ({ ...A, span: A.span || k }));
|
|
570
|
+
}), K = _t({
|
|
571
|
+
layoutFormProps: n.layoutFormProps,
|
|
572
|
+
get formItemList() {
|
|
573
|
+
return L.value;
|
|
574
|
+
}
|
|
575
|
+
}), {
|
|
576
|
+
folded: s,
|
|
577
|
+
isBtnHidden: u,
|
|
578
|
+
rowLayout: y,
|
|
579
|
+
formLayout: R,
|
|
580
|
+
getRowColsAlgorithm: O,
|
|
581
|
+
isFold: x,
|
|
582
|
+
getBtnColSpan: j,
|
|
583
|
+
formItem: Z,
|
|
584
|
+
changeFolded: E
|
|
585
|
+
} = K;
|
|
586
|
+
ce(
|
|
587
|
+
R,
|
|
588
|
+
(m) => {
|
|
589
|
+
J.value = m;
|
|
590
|
+
},
|
|
591
|
+
{ immediate: !0 }
|
|
592
|
+
);
|
|
593
|
+
const ne = B(() => ({
|
|
594
|
+
colRightBtn: n.configBtn.filter((m) => m.direction === "right" || !m.direction),
|
|
595
|
+
colLeftBtn: n.configBtn.filter((m) => m.direction === "left")
|
|
596
|
+
})), oe = B(() => typeof n.renderBtn == "function"), de = (m) => {
|
|
597
|
+
var w, k;
|
|
598
|
+
const b = t().formRef, $ = (w = g.value) == null ? void 0 : w.httpRequestInstance;
|
|
599
|
+
(k = m.click) == null || k.call(m, a.value, b, $);
|
|
600
|
+
}, he = (m, b, $) => {
|
|
601
|
+
var k, A, M;
|
|
602
|
+
const w = g.value;
|
|
603
|
+
$ === "query" ? r.value && ((k = w == null ? void 0 : w.httpRequestInstance) == null || k.call(w, m)) : $ === "rest" && b && (r.value && ((A = w == null ? void 0 : w.httpRequestInstance) == null || A.call(w, m)), (M = b.resetFields) == null || M.call(b));
|
|
604
|
+
}, Te = (m) => {
|
|
605
|
+
var $, w, k;
|
|
606
|
+
const b = t().formRef;
|
|
607
|
+
if (m.triggerEvent && ["query", "rest"].includes(m.key || ""))
|
|
608
|
+
he(a.value, b, m.key);
|
|
609
|
+
else {
|
|
610
|
+
m.key === "rest" && b && (($ = b.resetFields) == null || $.call(b));
|
|
611
|
+
const A = (w = g.value) == null ? void 0 : w.httpRequestInstance;
|
|
612
|
+
(k = m.click) == null || k.call(m, a.value, b, A);
|
|
613
|
+
}
|
|
614
|
+
}, ze = (m) => {
|
|
615
|
+
if (r.value) {
|
|
616
|
+
const { style: b, ...$ } = m;
|
|
617
|
+
return { style: { marginBottom: "10px", ...b || {} }, ...$ };
|
|
618
|
+
}
|
|
619
|
+
return m;
|
|
620
|
+
}, re = () => t().formRef, Fe = () => {
|
|
621
|
+
const m = re();
|
|
622
|
+
return m ? new Promise((b) => {
|
|
623
|
+
try {
|
|
624
|
+
const $ = m.validate((w) => {
|
|
625
|
+
b(!!w);
|
|
626
|
+
});
|
|
627
|
+
$ && typeof $.then == "function" && $.then(b).catch(() => b(!1));
|
|
628
|
+
} catch ($) {
|
|
629
|
+
b(!1);
|
|
630
|
+
}
|
|
631
|
+
}) : Promise.resolve(!1);
|
|
632
|
+
}, ke = () => {
|
|
633
|
+
var m;
|
|
634
|
+
return (m = re()) == null ? void 0 : m.resetFields();
|
|
635
|
+
}, ve = (m) => {
|
|
636
|
+
var b;
|
|
637
|
+
return (b = re()) == null ? void 0 : b.clearValidate(m);
|
|
638
|
+
}, xe = (m) => {
|
|
639
|
+
var b;
|
|
640
|
+
return (b = re()) == null ? void 0 : b.validateField(m);
|
|
641
|
+
}, Ie = async (m) => {
|
|
642
|
+
const $ = L.value.filter((k) => k && m.includes(k.prop));
|
|
643
|
+
if (!$.length) return;
|
|
644
|
+
(await W($, q)).forEach((k) => {
|
|
645
|
+
if (!k) return;
|
|
646
|
+
const A = v.value.findIndex((M) => M && M.prop === k.prop);
|
|
647
|
+
A !== -1 && (v.value[A] = {
|
|
648
|
+
...v.value[A],
|
|
649
|
+
dataOptions: k.listData
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
};
|
|
653
|
+
return Be(() => {
|
|
654
|
+
h.value = t().formRef;
|
|
655
|
+
const m = o == null ? void 0 : o.proxy, b = m == null ? void 0 : m.bodyFormInstance;
|
|
656
|
+
b == null || b(h.value);
|
|
657
|
+
}), typeof e.expose == "function" && e.expose({
|
|
658
|
+
formItmeRequestInstance: Ie,
|
|
659
|
+
getFormRef: re,
|
|
660
|
+
validate: Fe,
|
|
661
|
+
resetFields: ke,
|
|
662
|
+
clearValidate: ve,
|
|
663
|
+
validateField: xe
|
|
664
|
+
}), {
|
|
665
|
+
// 模板使用
|
|
666
|
+
formProps: N,
|
|
667
|
+
rowLayout: y,
|
|
668
|
+
formItem: Z,
|
|
669
|
+
isBtnHidden: u,
|
|
670
|
+
isFold: x,
|
|
671
|
+
folded: s,
|
|
672
|
+
getBtnColSpan: j,
|
|
673
|
+
isRenderBtn: oe,
|
|
674
|
+
colRightLeftList: ne,
|
|
675
|
+
configBtn: B(() => n.configBtn),
|
|
676
|
+
formInputComponents: T,
|
|
677
|
+
formInstance: h,
|
|
678
|
+
model: a,
|
|
679
|
+
btnColSpanRow: B(() => n.btnColSpanRow),
|
|
680
|
+
renderBtn: B(() => n.renderBtn),
|
|
681
|
+
getRowColsAlgorithm: O,
|
|
682
|
+
changeFolded: E,
|
|
683
|
+
// 方法
|
|
684
|
+
checkPermission: S,
|
|
685
|
+
translateLabel: F,
|
|
686
|
+
getCompIcon: f,
|
|
687
|
+
filterOptions: p,
|
|
688
|
+
resolveDisabled: _,
|
|
689
|
+
handleBtnClick: de,
|
|
690
|
+
clickBtn: Te,
|
|
691
|
+
initFormItemOptions: ze,
|
|
692
|
+
noop: () => {
|
|
693
|
+
},
|
|
694
|
+
// expose 公开方法(供 $refs.<esForm>.validate() 直接调用,不经过 ctx.expose)
|
|
695
|
+
formItmeRequestInstance: Ie,
|
|
696
|
+
getFormRef: re,
|
|
697
|
+
validate: Fe,
|
|
698
|
+
resetFields: ke,
|
|
699
|
+
clearValidate: ve,
|
|
700
|
+
validateField: xe
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
function me(n, e, o, t, a, l, c, S) {
|
|
705
|
+
var F = typeof n == "function" ? n.options : n;
|
|
706
|
+
return e && (F.render = e, F.staticRenderFns = o, F._compiled = !0), l && (F._scopeId = "data-v-" + l), {
|
|
707
|
+
exports: n,
|
|
708
|
+
options: F
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
var xt = function() {
|
|
712
|
+
var e = this, o = e._self._c;
|
|
713
|
+
return e._self._setupProxy, o("el-form", e._b({ ref: "formRef", staticClass: "es-form" }, "el-form", e.formProps, !1), [o("div", { staticClass: "flex-center" }, [o("el-row", e._b({}, "el-row", e.rowLayout, !1), [e._l(e.formItem, function(t, a) {
|
|
714
|
+
return [o("el-col", { directives: [{ name: "show", rawName: "v-show", value: !t.isFold, expression: "!item.isFold" }], key: t.prop || a, attrs: { span: t.span } }, [o("el-form-item", e._b({ attrs: { label: e.translateLabel(t), prop: t.prop }, nativeOn: { click: function(l) {
|
|
715
|
+
return l.stopPropagation(), e.noop.apply(null, arguments);
|
|
716
|
+
} } }, "el-form-item", e.initFormItemOptions(t.formItemOptions || {}), !1), [t.formtype ? [o("render-dom-form", { attrs: { row: t, render: e.formInputComponents(t), index: a, model: e.model } })] : t.render ? [o("render-dom-form", { attrs: { row: t, render: t.render, index: a, model: e.model } })] : e._e()], 2)], 1)];
|
|
717
|
+
}), e.isBtnHidden ? e._e() : [e.isRenderBtn ? o("render-btn", { attrs: { row: { isFold: e.isFold, folded: e.folded, getBtnColSpan: e.getBtnColSpan, getRowColsAlgorithm: e.getRowColsAlgorithm, changeFolded: e.changeFolded, refsForm: e.formInstance }, "form-model": e.model, "form-item-list": e.formItem, render: e.renderBtn } }) : o("el-col", { attrs: { span: e.btnColSpanRow ? 24 : e.getBtnColSpan } }, [e.btnColSpanRow && e.configBtn.length ? o("div", { staticClass: "buttonOperate leftRightBtn" }, [o("div", { staticClass: "btn-left" }, [o("el-form-item", { staticClass: "btn-formItem", attrs: { "label-width": "0px" } }, [e._l(e.colRightLeftList.colLeftBtn, function(t, a) {
|
|
718
|
+
return [e.checkPermission(t.permissionValue) ? o("el-button", e._b({ key: t.key || a, attrs: { icon: e.getCompIcon(t.icon), disabled: e.resolveDisabled(t) }, on: { click: function(l) {
|
|
719
|
+
return e.handleBtnClick(t);
|
|
720
|
+
} } }, "el-button", e.filterOptions(t), !1), [e._v(" " + e._s(t.name) + " ")]) : e._e()];
|
|
721
|
+
})], 2)], 1), o("div", { staticClass: "btn-right" }, [o("el-form-item", { staticClass: "btn-formItem", attrs: { "label-width": "0px" } }, [e._l(e.colRightLeftList.colRightBtn, function(t, a) {
|
|
722
|
+
return [e.checkPermission(t.permissionValue) ? o("el-button", e._b({ key: t.key || a, attrs: { icon: e.getCompIcon(t.icon), disabled: e.resolveDisabled(t) }, on: { click: function(l) {
|
|
723
|
+
return e.clickBtn(t);
|
|
724
|
+
} } }, "el-button", e.filterOptions(t), !1), [e._v(" " + e._s(t.name) + " ")]) : e._e()];
|
|
725
|
+
}), e.isFold ? o("el-button", { staticStyle: { "padding-left": "0", border: "none" }, attrs: { type: "text", icon: e.folded ? "el-icon-arrow-down" : "el-icon-arrow-up" }, on: { click: e.changeFolded } }, [e._v(" " + e._s(e.folded ? "展开" : "收起") + " ")]) : e._e()], 2)], 1)]) : e._e(), !e.btnColSpanRow && e.configBtn.length ? o("el-form-item", { staticClass: "btn-formItem", class: { formItemCols: e.btnColSpanRow ? !0 : e.getBtnColSpan === 24 }, attrs: { label: " ", "label-width": e.formProps.labelBtnWidth ? e.formProps.labelBtnWidth : e.formProps.labelWidth } }, [o("div", { staticClass: "buttonOperate", style: { "text-align": e.getBtnColSpan === 24 ? "right" : "left" } }, [e._l(e.configBtn, function(t, a) {
|
|
726
|
+
return [e.checkPermission(t.permissionValue) ? o("el-button", e._b({ key: t.key || a, attrs: { icon: e.getCompIcon(t.icon), disabled: e.resolveDisabled(t) }, on: { click: function(l) {
|
|
727
|
+
return e.handleBtnClick(t);
|
|
728
|
+
} } }, "el-button", e.filterOptions(t), !1), [e._v(" " + e._s(t.name) + " ")]) : e._e()];
|
|
729
|
+
}), e.isFold ? o("el-button", { staticStyle: { "padding-left": "0", border: "none" }, attrs: { type: "text", icon: e.folded ? "el-icon-arrow-down" : "el-icon-arrow-up" }, on: { click: e.changeFolded } }, [e._v(" " + e._s(e.folded ? "展开" : "收起") + " ")]) : e._e()], 2)]) : e._e()], 1)]], 2)], 1)]);
|
|
730
|
+
}, It = [], Rt = /* @__PURE__ */ me(
|
|
731
|
+
kt,
|
|
732
|
+
xt,
|
|
733
|
+
It,
|
|
734
|
+
!1,
|
|
735
|
+
null,
|
|
736
|
+
"c43f2284"
|
|
737
|
+
);
|
|
738
|
+
const ye = Rt.exports;
|
|
739
|
+
ye.install = function(n) {
|
|
740
|
+
n.component(ye.name || "EsForm", ye);
|
|
741
|
+
};
|
|
742
|
+
const Ot = se({
|
|
743
|
+
name: "RenderDomTb",
|
|
744
|
+
props: {
|
|
745
|
+
row: { type: Object, default: () => ({}) },
|
|
746
|
+
index: { type: Number, default: 0 },
|
|
747
|
+
dataKey: String,
|
|
748
|
+
render: { type: Function, required: !0 }
|
|
749
|
+
},
|
|
750
|
+
setup(n) {
|
|
751
|
+
return () => {
|
|
752
|
+
const { row: e, index: o, dataKey: t, render: a } = n;
|
|
753
|
+
if (!e) return le("span", "-");
|
|
754
|
+
const l = t ? e[t] : null;
|
|
755
|
+
try {
|
|
756
|
+
const c = a(le, { value: l, row: e, index: o });
|
|
757
|
+
return typeof c == "string" ? le("span", c) : c;
|
|
758
|
+
} catch (c) {
|
|
759
|
+
return le("span", "-");
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
}), wt = (n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase(), Pt = se({
|
|
764
|
+
name: "EsTableColumnItem",
|
|
765
|
+
components: { RenderDomTb: Ot },
|
|
766
|
+
props: {
|
|
767
|
+
cols: {
|
|
768
|
+
type: Object,
|
|
769
|
+
required: !0
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
setup() {
|
|
773
|
+
var o, t;
|
|
774
|
+
const n = (t = (o = ae("$EsPlus", null)) != null ? o : pe()) != null ? t : {};
|
|
775
|
+
return {
|
|
776
|
+
columnBindAttr: (a) => {
|
|
777
|
+
const l = {};
|
|
778
|
+
for (const c in a)
|
|
779
|
+
if (!(c === "groups" || c === "scopedSlots" || c === "render"))
|
|
780
|
+
if (c.includes("-")) {
|
|
781
|
+
const S = c.split("-");
|
|
782
|
+
let F = S[0];
|
|
783
|
+
for (let d = 1; d < S.length; d++)
|
|
784
|
+
F += wt(S[d]);
|
|
785
|
+
l[F] = a[c];
|
|
786
|
+
} else c === "key" ? (l.prop = a[c], l[c] = a[c]) : c === "label" && a.labelKey && typeof n.t == "function" ? l.label = n.t(a.labelKey) : l[c] = a[c];
|
|
787
|
+
return l.align || (l.align = "center"), l;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
var Ht = function() {
|
|
793
|
+
var e = this, o = e._self._c;
|
|
794
|
+
return e._self._setupProxy, e.cols.groups && Array.isArray(e.cols.groups) ? o("el-table-column", e._b({}, "el-table-column", e.columnBindAttr(e.cols), !1), e._l(e.cols.groups, function(t, a) {
|
|
795
|
+
return o("el-table-column", e._b({ key: t.prop || t.key || a, scopedSlots: e._u([t.render && typeof t.render == "function" ? { key: "default", fn: function(l) {
|
|
796
|
+
return [l && l.row ? o("render-dom-tb", { attrs: { row: l.row, index: l.$index, "data-key": t.key, render: t.render } }) : o("span", [e._v("-")])];
|
|
797
|
+
} } : t.scopedSlots && t.scopedSlots.customRender ? { key: "default", fn: function(l) {
|
|
798
|
+
return [l && l.row ? e._t(t.scopedSlots.customRender, null, null, Object.assign({}, t, { row: l.row, column: l.column, scope: l })) : o("span", [e._v("-")])];
|
|
799
|
+
} } : null], null, !0) }, "el-table-column", e.columnBindAttr(Object.assign({}, t, { columnIndex: a })), !1));
|
|
800
|
+
}), 1) : e.cols.render && typeof e.cols.render == "function" ? o("el-table-column", e._b({ scopedSlots: e._u([{ key: "default", fn: function(t) {
|
|
801
|
+
return [t && t.row ? o("render-dom-tb", { attrs: { row: t.row, index: t.$index, "data-key": e.cols.key, render: e.cols.render } }) : o("span", [e._v("-")])];
|
|
802
|
+
} }]) }, "el-table-column", e.columnBindAttr(e.cols), !1)) : e.cols.scopedSlots && e.cols.scopedSlots.customRender ? o("el-table-column", e._b({ scopedSlots: e._u([{ key: "default", fn: function(t) {
|
|
803
|
+
return [t && t.row ? e._t(e.cols.scopedSlots.customRender, null, null, Object.assign({}, e.cols, { row: t.row, column: t.column, scope: t })) : o("span", [e._v("-")])];
|
|
804
|
+
} }], null, !0) }, "el-table-column", e.columnBindAttr(e.cols), !1)) : e.cols.ellipsis && typeof e.cols.ellipsis == "boolean" ? o("el-table-column", e._b({ attrs: { "show-overflow-tooltip": "" } }, "el-table-column", e.columnBindAttr(e.cols), !1)) : o("el-table-column", e._b({}, "el-table-column", e.columnBindAttr(e.cols), !1));
|
|
805
|
+
}, Lt = [], $t = /* @__PURE__ */ me(
|
|
806
|
+
Pt,
|
|
807
|
+
Ht,
|
|
808
|
+
Lt,
|
|
809
|
+
!1,
|
|
810
|
+
null,
|
|
811
|
+
null
|
|
812
|
+
);
|
|
813
|
+
const At = $t.exports, tt = (n) => n ? n.startsWith("el-icon-") ? n : `el-icon-${n.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase()}` : void 0, Tt = se({
|
|
814
|
+
name: "RenderDomTbBtn",
|
|
815
|
+
props: {
|
|
816
|
+
render: { type: Function, required: !0 }
|
|
817
|
+
},
|
|
818
|
+
setup(n) {
|
|
819
|
+
return () => {
|
|
820
|
+
if (!n.render || typeof n.render != "function") return null;
|
|
821
|
+
try {
|
|
822
|
+
return n.render();
|
|
823
|
+
} catch (e) {
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
}), zt = se({
|
|
829
|
+
name: "EsTableBtns",
|
|
830
|
+
components: { RenderDom: Tt },
|
|
831
|
+
props: {
|
|
832
|
+
leftText: { type: String, default: "" },
|
|
833
|
+
btnConfig: {
|
|
834
|
+
type: Array,
|
|
835
|
+
default: () => []
|
|
836
|
+
},
|
|
837
|
+
instance: {
|
|
838
|
+
type: Object,
|
|
839
|
+
default: () => ({})
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
setup(n) {
|
|
843
|
+
var r, f;
|
|
844
|
+
const e = (f = (r = ae("$EsPlus", null)) != null ? r : pe()) != null ? f : {}, o = (p, _) => {
|
|
845
|
+
if (!_) return !0;
|
|
846
|
+
const h = e.permission;
|
|
847
|
+
return typeof h == "function" ? h(_) : !0;
|
|
848
|
+
}, t = (p) => p.map((_) => {
|
|
849
|
+
const h = { ..._ };
|
|
850
|
+
return o([], _.permissionValue) ? typeof _.isHide == "function" ? h.isHide = _.isHide() : h.isHide = _.isHide || !1 : h.isHide = !0, h;
|
|
851
|
+
}), a = B(() => t(
|
|
852
|
+
(n.btnConfig || []).filter((p) => p.code === 1)
|
|
853
|
+
).filter((p) => !p.isHide)), l = B(() => t(
|
|
854
|
+
(n.btnConfig || []).filter((p) => p.code === 2)
|
|
855
|
+
).filter((p) => !p.isHide)), c = B(() => !!n.leftText || a.value.length > 0 || l.value.length > 0);
|
|
856
|
+
return {
|
|
857
|
+
processedBtnLeft: a,
|
|
858
|
+
processedBtnRight: l,
|
|
859
|
+
showContainer: c,
|
|
860
|
+
getDisabledState: (p) => typeof p.disabled == "function" ? p.disabled() : p.disabled || !1,
|
|
861
|
+
buttonContainerStyle: (p) => ({
|
|
862
|
+
display: "inline-block",
|
|
863
|
+
marginLeft: p !== 0 ? "8px" : "0px"
|
|
864
|
+
}),
|
|
865
|
+
getCompIcon: tt,
|
|
866
|
+
filterOptions: (p) => {
|
|
867
|
+
const {
|
|
868
|
+
render: _,
|
|
869
|
+
click: h,
|
|
870
|
+
icon: v,
|
|
871
|
+
permissionValue: T,
|
|
872
|
+
code: D,
|
|
873
|
+
isHide: q,
|
|
874
|
+
name: W,
|
|
875
|
+
size: J,
|
|
876
|
+
...N
|
|
877
|
+
} = p;
|
|
878
|
+
return N;
|
|
879
|
+
},
|
|
880
|
+
resolveBtnSize: (p) => $e(p.size) || "mini"
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
var Et = function() {
|
|
885
|
+
var e = this, o = e._self._c;
|
|
886
|
+
return e._self._setupProxy, e.showContainer ? o("div", { staticClass: "flex-float btns" }, [o("div", { staticClass: "left-text" }, [e._v(" " + e._s(e.leftText) + " ")]), o("div", { staticClass: "btn-container_block" }, [o("div", { staticClass: "btn-left" }, [e._l(e.processedBtnLeft, function(t, a) {
|
|
887
|
+
return [t.isHide ? e._e() : o("div", { key: t.name || a, style: e.buttonContainerStyle(a) }, [t.render && typeof t.render == "function" ? o("render-dom", { attrs: { render: t.render } }) : o("el-button", e._b({ attrs: { type: t.type || "", size: e.resolveBtnSize(t), icon: e.getCompIcon(t.icon), loading: t.loading || !1, disabled: e.getDisabledState(t) }, on: { click: () => t.click && t.click(e.instance) } }, "el-button", e.filterOptions(t), !1), [e._v(" " + e._s(t.name) + " ")])], 1)];
|
|
888
|
+
})], 2), o("div", { staticClass: "btn-right" }, [e._l(e.processedBtnRight, function(t, a) {
|
|
889
|
+
return [t.isHide ? e._e() : o("div", { key: t.name || a, style: e.buttonContainerStyle(a) }, [t.render && typeof t.render == "function" ? o("render-dom", { attrs: { render: t.render } }) : o("el-button", e._b({ attrs: { type: t.type || "", size: e.resolveBtnSize(t), icon: e.getCompIcon(t.icon), loading: t.loading || !1, disabled: e.getDisabledState(t) }, on: { click: () => t.click && t.click(e.instance) } }, "el-button", e.filterOptions(t), !1), [e._v(" " + e._s(t.name) + " ")])], 1)];
|
|
890
|
+
})], 2)])]) : e._e();
|
|
891
|
+
}, Dt = [], jt = /* @__PURE__ */ me(
|
|
892
|
+
zt,
|
|
893
|
+
Et,
|
|
894
|
+
Dt,
|
|
895
|
+
!1,
|
|
896
|
+
null,
|
|
897
|
+
"4ad68a37"
|
|
898
|
+
);
|
|
899
|
+
const qt = jt.exports;
|
|
900
|
+
function Nt(n, e, o, t, a) {
|
|
901
|
+
const l = z(400), c = z(null), S = (f) => Math.sign(f) === -1, F = () => {
|
|
902
|
+
var h, v, T, D;
|
|
903
|
+
const f = ((h = e.value) == null ? void 0 : h.offsetHeight) || 0, p = ((T = (v = o.value) == null ? void 0 : v.$el) == null ? void 0 : T.offsetHeight) || 0, _ = ((D = t.value) == null ? void 0 : D.offsetHeight) || 0;
|
|
904
|
+
return Math.round(_ + f + p);
|
|
905
|
+
}, d = () => {
|
|
906
|
+
var J, N, U, L, K;
|
|
907
|
+
const f = n.value;
|
|
908
|
+
if (!f) return;
|
|
909
|
+
const p = typeof a.tabHeight == "number" ? a.tabHeight : a.heightType === "height" ? ((J = f.parentElement) == null ? void 0 : J.offsetHeight) || f.offsetHeight : parseInt(a.tabHeight, 10) || 450, _ = isNaN(p) ? 450 : p, h = _ - F(), v = S(h) ? F() + 300 : _, T = ((N = t.value) == null ? void 0 : N.offsetHeight) || 0, D = ((U = e.value) == null ? void 0 : U.offsetHeight) || 0, q = ((K = (L = o.value) == null ? void 0 : L.$el) == null ? void 0 : K.offsetHeight) || 0, W = Math.floor(v) - Math.round(T + D + q);
|
|
910
|
+
l.value !== W && (l.value = W);
|
|
911
|
+
}, g = () => {
|
|
912
|
+
Be(() => {
|
|
913
|
+
if (!n.value || typeof ResizeObserver == "undefined") return;
|
|
914
|
+
c.value = new ResizeObserver(() => {
|
|
915
|
+
requestAnimationFrame(() => {
|
|
916
|
+
n.value && d();
|
|
917
|
+
});
|
|
918
|
+
});
|
|
919
|
+
const f = a.heightType === "height" && n.value.parentElement || n.value;
|
|
920
|
+
c.value.observe(f), e.value && c.value.observe(e.value);
|
|
921
|
+
});
|
|
922
|
+
}, r = () => {
|
|
923
|
+
c.value && (c.value.disconnect(), c.value = null);
|
|
924
|
+
};
|
|
925
|
+
return De(() => g()), ht(() => r()), { tableHeight: l, resizeObservers: d, startObserver: g, stopObserver: r };
|
|
926
|
+
}
|
|
927
|
+
function Mt(n) {
|
|
928
|
+
const e = ut(), o = z([]), t = z({}), a = z(!1), l = () => {
|
|
929
|
+
o.value = [...e.multipleSelection], t.value = { ...e.selectionsByPage }, a.value = e.isInitChange;
|
|
930
|
+
};
|
|
931
|
+
return {
|
|
932
|
+
multipleSelection: o,
|
|
933
|
+
selectionsByPage: t,
|
|
934
|
+
isInitChange: a,
|
|
935
|
+
handleSelectionChange: (d, g) => {
|
|
936
|
+
e.isInitChange && n || (pt(e, d, g, n), l());
|
|
937
|
+
},
|
|
938
|
+
clearAllSelection: (d) => {
|
|
939
|
+
d ? ft(e, d) : (e.multipleSelection = [], e.selectionsByPage = {}), l();
|
|
940
|
+
},
|
|
941
|
+
initSelection: (d, g) => {
|
|
942
|
+
if (e.isInitChange = !0, l(), !g) {
|
|
943
|
+
e.isInitChange = !1, l();
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
n ? Be(() => {
|
|
947
|
+
dt(e, d, g, n), e.isInitChange = !1, l();
|
|
948
|
+
}) : Be(() => {
|
|
949
|
+
var r;
|
|
950
|
+
(r = g.clearSelection) == null || r.call(g), e.isInitChange = !1, l();
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
const Ge = {
|
|
956
|
+
multiSelect: !1,
|
|
957
|
+
expand: !1,
|
|
958
|
+
snIndex: !1,
|
|
959
|
+
loading: !1,
|
|
960
|
+
border: !1,
|
|
961
|
+
size: "small",
|
|
962
|
+
headerCellStyle: { background: "#f5f7fa" },
|
|
963
|
+
highlightCurrentRow: !0,
|
|
964
|
+
cachePageSelection: !0
|
|
965
|
+
}, Vt = /* @__PURE__ */ new Set([
|
|
966
|
+
"multiSelect",
|
|
967
|
+
"expand",
|
|
968
|
+
"snIndex",
|
|
969
|
+
"loading",
|
|
970
|
+
"cachePageSelection",
|
|
971
|
+
"httpRequest",
|
|
972
|
+
"configTableOut",
|
|
973
|
+
"listenToCallBack",
|
|
974
|
+
"apiParams",
|
|
975
|
+
"actionUrl",
|
|
976
|
+
"heightType",
|
|
977
|
+
"tabHeight",
|
|
978
|
+
"isInitRun",
|
|
979
|
+
"entryQuery",
|
|
980
|
+
"configBtn",
|
|
981
|
+
"leftText",
|
|
982
|
+
"rowkey",
|
|
983
|
+
"virtual",
|
|
984
|
+
"engine",
|
|
985
|
+
"rowHeight",
|
|
986
|
+
"estimatedRowHeight",
|
|
987
|
+
"overscanCount",
|
|
988
|
+
"rowClassName"
|
|
989
|
+
]), Kt = (n) => n.toLowerCase().replace(/(\s|^)[a-z]/g, (e) => e.toUpperCase()), Wt = (n) => {
|
|
990
|
+
const e = {};
|
|
991
|
+
for (const o in n)
|
|
992
|
+
if (!(o === "groups" || o === "scopedSlots" || o === "render"))
|
|
993
|
+
if (o.includes("-")) {
|
|
994
|
+
const t = o.split("-");
|
|
995
|
+
let a = t[0];
|
|
996
|
+
for (let l = 1; l < t.length; l++)
|
|
997
|
+
a += Kt(t[l]);
|
|
998
|
+
e[a] = n[o];
|
|
999
|
+
} else o === "key" && (e.prop = n[o]), e[o] = n[o];
|
|
1000
|
+
return e.align || (e.align = "center"), e;
|
|
1001
|
+
}, Ye = (n) => {
|
|
1002
|
+
const e = ["total", "pageSize", "current", "tableData"];
|
|
1003
|
+
return fe(n) ? Object.keys(n).every((o) => e.find((t) => t === o) && n[o] && typeof n[o] == "string") : !1;
|
|
1004
|
+
}, Ut = se({
|
|
1005
|
+
name: "EsTable",
|
|
1006
|
+
components: { ColumnItem: At, TableBtns: qt },
|
|
1007
|
+
// 关闭自动 attrs 继承,避免 fallthrough 重复绑定
|
|
1008
|
+
inheritAttrs: !1,
|
|
1009
|
+
props: {
|
|
1010
|
+
initTabHeight: { type: Number, default: 400 },
|
|
1011
|
+
headBarClass: {
|
|
1012
|
+
type: [String, Object],
|
|
1013
|
+
default: ""
|
|
1014
|
+
},
|
|
1015
|
+
showHeaderBar: { type: Boolean, default: !0 },
|
|
1016
|
+
dataSource: {
|
|
1017
|
+
type: Array,
|
|
1018
|
+
default: () => []
|
|
1019
|
+
},
|
|
1020
|
+
columns: {
|
|
1021
|
+
type: Array,
|
|
1022
|
+
default: () => []
|
|
1023
|
+
},
|
|
1024
|
+
options: {
|
|
1025
|
+
type: Object,
|
|
1026
|
+
default: () => ({ ...Ge })
|
|
1027
|
+
},
|
|
1028
|
+
pagination: {
|
|
1029
|
+
type: Object,
|
|
1030
|
+
default: () => ({})
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
emits: [
|
|
1034
|
+
"update:dataSource",
|
|
1035
|
+
"update:pagination",
|
|
1036
|
+
"pagination-current-change",
|
|
1037
|
+
"size-change",
|
|
1038
|
+
"change-table-sort"
|
|
1039
|
+
],
|
|
1040
|
+
setup(n, { emit: e, slots: o, attrs: t, expose: a }) {
|
|
1041
|
+
var qe, Ne, Me, Ve;
|
|
1042
|
+
const l = Ee(), c = (Ne = (qe = ae(
|
|
1043
|
+
"$esPlusTable",
|
|
1044
|
+
null
|
|
1045
|
+
)) != null ? qe : pe().EsTable) != null ? Ne : {}, S = (Ve = (Me = ae("$EsPlus", null)) != null ? Me : pe()) != null ? Ve : {}, F = (i) => {
|
|
1046
|
+
if (!i) return !0;
|
|
1047
|
+
const P = S.permission;
|
|
1048
|
+
return typeof P == "function" ? P(i) : !0;
|
|
1049
|
+
};
|
|
1050
|
+
(n.options.virtual === !0 || n.options.engine === "virtual") && console.warn(
|
|
1051
|
+
"[@es-plus/vue2] 虚拟滚动 (virtual: true) 在 Vue 2 + Element UI 下不可用,已降级为普通 el-table 渲染。如需虚拟滚动请使用 Vue 3 + Element Plus 版本(@es-plus/vue3)。"
|
|
1052
|
+
);
|
|
1053
|
+
const d = z(null), g = z(null), r = z(null), f = z(null), p = z(null), _ = z(`table_${Math.random().toString(36).substring(2, 12)}`), h = z([]), v = z([...n.columns]);
|
|
1054
|
+
ce(
|
|
1055
|
+
() => n.columns,
|
|
1056
|
+
(i) => {
|
|
1057
|
+
v.value = [...i];
|
|
1058
|
+
},
|
|
1059
|
+
{ deep: !0 }
|
|
1060
|
+
);
|
|
1061
|
+
const T = z(!1), D = z(!1), q = z(!1), W = (i) => {
|
|
1062
|
+
i && (p.value = i);
|
|
1063
|
+
}, J = ae("bodyFormInstance", () => {
|
|
1064
|
+
}), N = ae("getVisibleShow", !1), U = B(
|
|
1065
|
+
() => typeof N == "function" ? N() : N
|
|
1066
|
+
), L = z({
|
|
1067
|
+
pageSize: 10,
|
|
1068
|
+
current: 1,
|
|
1069
|
+
total: 0,
|
|
1070
|
+
pageSizes: [],
|
|
1071
|
+
size: "small",
|
|
1072
|
+
isSmall: !0,
|
|
1073
|
+
...n.pagination
|
|
1074
|
+
}), K = z(null), s = B(() => {
|
|
1075
|
+
const i = n.options.entryQuery;
|
|
1076
|
+
return i && fe(i) && Object.keys(i).length ? i : {};
|
|
1077
|
+
}), u = B(() => {
|
|
1078
|
+
if (n.options.configTableOut && fe(n.options.configTableOut) && Object.keys(n.options.configTableOut).length && Ye(n.options.configTableOut))
|
|
1079
|
+
return n.options.configTableOut;
|
|
1080
|
+
if (c != null && c.configQueryFieldOutput && typeof c.configQueryFieldOutput == "function") {
|
|
1081
|
+
const i = c.configQueryFieldOutput({
|
|
1082
|
+
total: "records",
|
|
1083
|
+
pageSize: "pageSize",
|
|
1084
|
+
current: "pageNo",
|
|
1085
|
+
tableData: "rows"
|
|
1086
|
+
});
|
|
1087
|
+
if (Ye(i)) return i;
|
|
1088
|
+
}
|
|
1089
|
+
return {
|
|
1090
|
+
total: "records",
|
|
1091
|
+
pageSize: "pageSize",
|
|
1092
|
+
current: "pageNo",
|
|
1093
|
+
tableData: "rows"
|
|
1094
|
+
};
|
|
1095
|
+
}), y = B(() => {
|
|
1096
|
+
const i = l == null ? void 0 : l.proxy;
|
|
1097
|
+
if (!i || !i.$children) return {};
|
|
1098
|
+
const P = i.$children.find((C) => {
|
|
1099
|
+
var I;
|
|
1100
|
+
return ((I = C == null ? void 0 : C.$options) == null ? void 0 : I.name) === "EsForm";
|
|
1101
|
+
});
|
|
1102
|
+
return P ? (K.value = P, J(P), P) : {};
|
|
1103
|
+
}), R = B(() => {
|
|
1104
|
+
const i = o.default;
|
|
1105
|
+
if (typeof i == "function") {
|
|
1106
|
+
const C = i();
|
|
1107
|
+
return Array.isArray(C) ? C.length > 0 : !!C;
|
|
1108
|
+
}
|
|
1109
|
+
const P = o.default;
|
|
1110
|
+
return Array.isArray(P) && P.length > 0;
|
|
1111
|
+
}), O = B(
|
|
1112
|
+
() => n.options.heightType || "auto"
|
|
1113
|
+
), x = B(() => typeof n.options.tabHeight == "number" ? `${n.options.tabHeight}px` : O.value === "height" && typeof n.options.height == "number" ? `${n.options.height}px` : "100%"), j = B(() => ({
|
|
1114
|
+
[O.value]: x.value
|
|
1115
|
+
})), Z = B(() => n.headBarClass ? {
|
|
1116
|
+
type: typeof n.headBarClass == "string" ? "string" : "object",
|
|
1117
|
+
value: n.headBarClass
|
|
1118
|
+
} : { type: "string", value: "" }), E = B(() => {
|
|
1119
|
+
const i = c == null ? void 0 : c.paginationLayout;
|
|
1120
|
+
return i ? typeof i == "function" ? i() : i : null;
|
|
1121
|
+
}), ne = B(
|
|
1122
|
+
() => {
|
|
1123
|
+
var i;
|
|
1124
|
+
return ((i = E.value) == null ? void 0 : i.layout) || "prev, pager, next, jumper, sizes, ->, total";
|
|
1125
|
+
}
|
|
1126
|
+
), oe = B(
|
|
1127
|
+
() => {
|
|
1128
|
+
var i;
|
|
1129
|
+
return ((i = E.value) == null ? void 0 : i.pageSizes) || L.value.pageSizes;
|
|
1130
|
+
}
|
|
1131
|
+
), de = B(
|
|
1132
|
+
() => {
|
|
1133
|
+
var i, P;
|
|
1134
|
+
return (P = (i = E.value) == null ? void 0 : i.isSmall) != null ? P : L.value.isSmall;
|
|
1135
|
+
}
|
|
1136
|
+
), he = B(
|
|
1137
|
+
() => {
|
|
1138
|
+
var i, P;
|
|
1139
|
+
return (P = (i = E.value) == null ? void 0 : i.background) != null ? P : !0;
|
|
1140
|
+
}
|
|
1141
|
+
), Te = B(() => ({
|
|
1142
|
+
position: O.value === "height" ? "absolute" : "static",
|
|
1143
|
+
bottom: "0px",
|
|
1144
|
+
left: "0px",
|
|
1145
|
+
zIndex: 5,
|
|
1146
|
+
background: "#fff"
|
|
1147
|
+
})), ze = B(() => n.options.loading || T.value), re = B(
|
|
1148
|
+
() => !!n.options.actionUrl || n.options.apiParams && fe(n.options.apiParams) && Object.keys(n.options.apiParams).length > 0
|
|
1149
|
+
), Fe = B(() => {
|
|
1150
|
+
const i = v.value.filter((C) => !C.hidCol);
|
|
1151
|
+
if (i.forEach((C) => {
|
|
1152
|
+
C.prop !== "operate" && C.key !== "operate" && (C.prop || C.key) && !C.formatter && (C.formatter = (H) => {
|
|
1153
|
+
const I = H[C.prop] || H[C.key];
|
|
1154
|
+
return I == null || I === "" ? C.emptyPlaceholder || "-" : I;
|
|
1155
|
+
}), (C.prop === "operate" || C.key === "operate") && C.btns && !C.render && (C.render = (H, { row: I }) => {
|
|
1156
|
+
var ie;
|
|
1157
|
+
return le("div", [
|
|
1158
|
+
(ie = C.btns) == null ? void 0 : ie.filter((V) => F(V.permissionValue)).map(
|
|
1159
|
+
(V) => (
|
|
1160
|
+
// Element UI text 按钮:type="text" 而非 text 属性
|
|
1161
|
+
le(
|
|
1162
|
+
"el-button",
|
|
1163
|
+
{
|
|
1164
|
+
props: {
|
|
1165
|
+
type: "text"
|
|
1166
|
+
},
|
|
1167
|
+
attrs: {
|
|
1168
|
+
...V.type ? { "data-btn-type": V.type } : {}
|
|
1169
|
+
},
|
|
1170
|
+
on: {
|
|
1171
|
+
click: () => {
|
|
1172
|
+
var ue;
|
|
1173
|
+
return (ue = V.clickEvent) == null ? void 0 : ue.call(V, I);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
},
|
|
1177
|
+
V.name
|
|
1178
|
+
)
|
|
1179
|
+
)
|
|
1180
|
+
)
|
|
1181
|
+
]);
|
|
1182
|
+
});
|
|
1183
|
+
}), i.length > 0 && i.every((C) => C.width && !C.minWidth)) {
|
|
1184
|
+
let C = -1;
|
|
1185
|
+
for (let H = i.length - 1; H >= 0; H--) {
|
|
1186
|
+
const I = i[H];
|
|
1187
|
+
if (!I.fixed && I.prop !== "operate" && I.key !== "operate") {
|
|
1188
|
+
C = H;
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
if (C === -1 && (C = i.length - 1), C >= 0) {
|
|
1193
|
+
const H = i[C];
|
|
1194
|
+
H.minWidth = H.width, delete H.width;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
return i;
|
|
1198
|
+
}), ke = B(() => {
|
|
1199
|
+
const i = Wt({ ...Ge, ...n.options }), { align: P, ...C } = i, H = {};
|
|
1200
|
+
for (const I in C)
|
|
1201
|
+
Vt.has(I) || (H[I] = C[I]);
|
|
1202
|
+
if (H.size !== void 0) {
|
|
1203
|
+
const I = $e(H.size);
|
|
1204
|
+
I !== void 0 && (H.size = I);
|
|
1205
|
+
}
|
|
1206
|
+
return H;
|
|
1207
|
+
}), { tableHeight: ve, resizeObservers: xe } = Nt(
|
|
1208
|
+
p,
|
|
1209
|
+
r,
|
|
1210
|
+
g,
|
|
1211
|
+
f,
|
|
1212
|
+
{
|
|
1213
|
+
heightType: O.value,
|
|
1214
|
+
tabHeight: n.options.tabHeight
|
|
1215
|
+
}
|
|
1216
|
+
), Ie = B(() => {
|
|
1217
|
+
const i = { ...ke.value, ...t };
|
|
1218
|
+
return n.options.rowkey && (i.rowKey = n.options.rowkey), O.value === "height" ? i.height = ve.value : O.value === "maxHeight" && (i.maxHeight = ve.value), i;
|
|
1219
|
+
}), {
|
|
1220
|
+
multipleSelection: Re,
|
|
1221
|
+
handleSelectionChange: Oe,
|
|
1222
|
+
initSelection: we,
|
|
1223
|
+
clearAllSelection: be
|
|
1224
|
+
} = Mt(n.options.rowkey), Pe = (i) => {
|
|
1225
|
+
Oe(i, L.value.current || 1);
|
|
1226
|
+
};
|
|
1227
|
+
ce(U, async (i, P) => {
|
|
1228
|
+
var C, H;
|
|
1229
|
+
i && i !== P && (n.options.actionUrl && await w(), (H = (C = d.value) == null ? void 0 : C.doLayout) == null || H.call(C));
|
|
1230
|
+
}), ce(
|
|
1231
|
+
() => n.pagination,
|
|
1232
|
+
(i) => {
|
|
1233
|
+
L.value = { ...L.value, ...i }, q.value = i.total !== void 0;
|
|
1234
|
+
},
|
|
1235
|
+
{ deep: !0, immediate: !0 }
|
|
1236
|
+
), ce(
|
|
1237
|
+
() => n.dataSource,
|
|
1238
|
+
(i) => {
|
|
1239
|
+
we(i, d.value);
|
|
1240
|
+
},
|
|
1241
|
+
{ deep: !0 }
|
|
1242
|
+
), ce(
|
|
1243
|
+
h,
|
|
1244
|
+
(i) => {
|
|
1245
|
+
Array.isArray(i) && e("update:dataSource", i);
|
|
1246
|
+
},
|
|
1247
|
+
{ deep: !0 }
|
|
1248
|
+
), De(() => {
|
|
1249
|
+
re.value && n.options.isInitRun !== !1 && w(), Be(() => {
|
|
1250
|
+
y.value;
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
const m = (i, P) => {
|
|
1254
|
+
const C = [
|
|
1255
|
+
{ eventName: "brcb", isReturn: !0 },
|
|
1256
|
+
{ eventName: "qrcb", isReturn: !0 }
|
|
1257
|
+
], H = C.findIndex((I) => I.eventName === i);
|
|
1258
|
+
if (n.options.listenToCallBack && n.options.listenToCallBack[i] && H !== -1 && C[H].isReturn)
|
|
1259
|
+
return n.options.listenToCallBack[i](P);
|
|
1260
|
+
}, b = (i, P) => {
|
|
1261
|
+
const C = u.value;
|
|
1262
|
+
fe(C) && Object.keys(C).length && Object.entries(C).forEach(([H, I]) => {
|
|
1263
|
+
var ue;
|
|
1264
|
+
if (!P.includes(H)) return;
|
|
1265
|
+
const V = (ue = i[I]) != null ? ue : mt(i, I);
|
|
1266
|
+
H === "tableData" ? h.value = Array.isArray(V) ? V : [] : L.value[H] = typeof V == "number" ? V : parseInt(V, 10) || 0;
|
|
1267
|
+
});
|
|
1268
|
+
}, $ = (i, P = {}) => {
|
|
1269
|
+
var Qe, Je;
|
|
1270
|
+
const { success: C, fail: H } = P, I = ((Qe = n.options) == null ? void 0 : Qe.apiParams) || {}, ie = ((Je = n.options) == null ? void 0 : Je.actionUrl) || I.url || "";
|
|
1271
|
+
if (!ie || !Object.keys(I).length) return;
|
|
1272
|
+
const V = y.value, ue = V && V.props && V.props.model ? { ...V.props.model } : s.value || {}, Ke = m("brcb", {
|
|
1273
|
+
...ue,
|
|
1274
|
+
...i,
|
|
1275
|
+
...I.model || {}
|
|
1276
|
+
}), nt = fe(Ke) ? Ke : { ...ue, ...I.model || {}, ...i }, We = { ...I.options || {} };
|
|
1277
|
+
I != null && I.method && (We.method = I == null ? void 0 : I.method);
|
|
1278
|
+
const Ue = async (ot) => {
|
|
1279
|
+
if (!T.value) {
|
|
1280
|
+
T.value = !0;
|
|
1281
|
+
try {
|
|
1282
|
+
const ge = await ot({
|
|
1283
|
+
url: ie,
|
|
1284
|
+
formParams: nt,
|
|
1285
|
+
headers: I.headers || {},
|
|
1286
|
+
...We,
|
|
1287
|
+
...i
|
|
1288
|
+
}), st = m("qrcb", ge) || ge;
|
|
1289
|
+
fe(ge) && Object.keys(ge).length && typeof C == "function" && C(st);
|
|
1290
|
+
} catch (ge) {
|
|
1291
|
+
typeof H == "function" && H(ge);
|
|
1292
|
+
} finally {
|
|
1293
|
+
T.value = !1;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
n.options.httpRequest ? Ue(n.options.httpRequest) : c.$httpRequest && Ue(c.$httpRequest);
|
|
1298
|
+
}, w = (i) => new Promise((P, C) => {
|
|
1299
|
+
L.value.current = 1, $(
|
|
1300
|
+
{
|
|
1301
|
+
...i || {},
|
|
1302
|
+
pageIndex: L.value.current,
|
|
1303
|
+
pageSize: L.value.pageSize
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
success: (H) => {
|
|
1307
|
+
b(H, ["total", "tableData"]), Object.keys(n.pagination).length && e("update:pagination", L.value), P(H);
|
|
1308
|
+
},
|
|
1309
|
+
fail: (H) => {
|
|
1310
|
+
C(H);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
);
|
|
1314
|
+
}), k = () => {
|
|
1315
|
+
$(
|
|
1316
|
+
{
|
|
1317
|
+
pageIndex: L.value.current,
|
|
1318
|
+
pageSize: L.value.pageSize
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
success: (i) => {
|
|
1322
|
+
b(i, ["total", "tableData"]), e("update:pagination", L.value), e("pagination-current-change", L.value);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
);
|
|
1326
|
+
}, A = () => {
|
|
1327
|
+
$(
|
|
1328
|
+
{
|
|
1329
|
+
pageIndex: L.value.current,
|
|
1330
|
+
pageSize: L.value.pageSize
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
success: (i) => {
|
|
1334
|
+
b(i, ["total", "tableData"]), e("update:pagination", L.value);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
}, M = (i) => {
|
|
1339
|
+
L.value.pageSize = i, L.value.current = 1, re.value ? A() : (e("update:pagination", L.value), e("size-change", L.value, i));
|
|
1340
|
+
}, X = (i) => {
|
|
1341
|
+
L.value.current = i, re.value ? k() : (e("update:pagination", L.value), e("pagination-current-change", L.value));
|
|
1342
|
+
}, ee = (i) => {
|
|
1343
|
+
e("change-table-sort", i);
|
|
1344
|
+
};
|
|
1345
|
+
et("getTableInstantce", () => ({
|
|
1346
|
+
tableRef: d,
|
|
1347
|
+
toggleSelection: (i) => {
|
|
1348
|
+
var P, C;
|
|
1349
|
+
i ? i.forEach((H) => {
|
|
1350
|
+
var I, ie;
|
|
1351
|
+
(ie = (I = d.value) == null ? void 0 : I.toggleRowSelection) == null || ie.call(I, H);
|
|
1352
|
+
}) : (C = (P = d.value) == null ? void 0 : P.clearSelection) == null || C.call(P);
|
|
1353
|
+
},
|
|
1354
|
+
clearAllSelection: () => be(d.value),
|
|
1355
|
+
refsInstance: () => d.value,
|
|
1356
|
+
httpRequestInstance: w
|
|
1357
|
+
}));
|
|
1358
|
+
const je = {
|
|
1359
|
+
httpRequestInstance: w,
|
|
1360
|
+
getSelectionRows: () => Re.value,
|
|
1361
|
+
clearSelection: () => {
|
|
1362
|
+
var i, P;
|
|
1363
|
+
return (P = (i = d.value) == null ? void 0 : i.clearSelection) == null ? void 0 : P.call(i);
|
|
1364
|
+
},
|
|
1365
|
+
clearAllSelection: () => be(d.value),
|
|
1366
|
+
refresh: () => {
|
|
1367
|
+
var i, P;
|
|
1368
|
+
return (P = (i = d.value) == null ? void 0 : i.doLayout) == null ? void 0 : P.call(i);
|
|
1369
|
+
},
|
|
1370
|
+
// virtual 滚动占位(保持 API 一致,Vue 2 版本无效)
|
|
1371
|
+
scrollToRow: (i) => {
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
return typeof a == "function" && a(je), {
|
|
1375
|
+
// refs
|
|
1376
|
+
tableRef: d,
|
|
1377
|
+
tbBtnRef: g,
|
|
1378
|
+
headBarRef: r,
|
|
1379
|
+
paginationRef: f,
|
|
1380
|
+
tableId: _,
|
|
1381
|
+
tableData: h,
|
|
1382
|
+
// state
|
|
1383
|
+
loadStatus: ze,
|
|
1384
|
+
paginationConfig: L,
|
|
1385
|
+
formInstance: K,
|
|
1386
|
+
// computeds
|
|
1387
|
+
filteredColumns: Fe,
|
|
1388
|
+
tableBindAttrs: Ie,
|
|
1389
|
+
hasDefaultSlot: R,
|
|
1390
|
+
heightType: O,
|
|
1391
|
+
tabHeight: x,
|
|
1392
|
+
slotStyles: Z,
|
|
1393
|
+
slotState: D,
|
|
1394
|
+
showPagination: q,
|
|
1395
|
+
containerStyle: j,
|
|
1396
|
+
paginationStyle: Te,
|
|
1397
|
+
layout: ne,
|
|
1398
|
+
paginationPageSizes: oe,
|
|
1399
|
+
paginationIsSmall: de,
|
|
1400
|
+
paginationBackground: he,
|
|
1401
|
+
// handlers
|
|
1402
|
+
setTableContainer: W,
|
|
1403
|
+
handleTableSelectionChange: Pe,
|
|
1404
|
+
changeTableSort: ee,
|
|
1405
|
+
handleSizeChange: M,
|
|
1406
|
+
handleIndexChange: X,
|
|
1407
|
+
// exposed methods (also accessible via $refs.tableRef.xxx in Vue 2)
|
|
1408
|
+
...je,
|
|
1409
|
+
instance: l,
|
|
1410
|
+
resizeObservers: xe
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
var Qt = function() {
|
|
1415
|
+
var e = this, o = e._self._c;
|
|
1416
|
+
return e._self._setupProxy, o("div", { ref: e.setTableContainer, staticClass: "table_component", style: e.containerStyle }, [o("div", { staticClass: "table_containers" }, [e.showHeaderBar ? o("div", { ref: "headBarRef", staticClass: "btn-slot", class: e.slotStyles.type === "string" ? e.slotStyles.value : null, style: e.slotStyles.type === "object" ? e.slotStyles.value : null }, [e.hasDefaultSlot ? o("div", { staticClass: "headerBar", style: { paddingBottom: e.hasDefaultSlot ? "10px" : "0px" } }, [e._t("default")], 2) : e._e()]) : e._e(), o("div", { directives: [{ name: "loading", rawName: "v-loading", value: e.loadStatus, expression: "loadStatus" }], staticClass: "page-loading-con tableContainer", attrs: { "element-loading-background": "rgba(0, 0, 0, 0.03)", "element-loading-text": "努力加载中..." } }, [o("div", { staticClass: "table_inner_containers" }, [e.options.configBtn && e.options.configBtn.length || e.options.leftText ? o("table-btns", { ref: "tbBtnRef", attrs: { instance: { tableRef: e.instance, formInstance: e.formInstance }, "btn-config": e.options.configBtn, "left-text": e.options.leftText } }) : e._e(), o("el-table", e._b({ key: e.tableId, ref: "tableRef", staticClass: "el-dp_tables", staticStyle: { width: "100%" }, attrs: { id: e.tableId, data: e.dataSource }, on: { "sort-change": e.changeTableSort, "selection-change": e.handleTableSelectionChange }, scopedSlots: e._u([{ key: "empty", fn: function() {
|
|
1417
|
+
return [o("div", { staticClass: "ant-empty ant-empty-normal" }, [o("div", { staticClass: "ant-empty-image" }, [o("svg", { staticClass: "ant-empty-img-simple", attrs: { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg" } }, [o("g", { attrs: { transform: "translate(0 1)", fill: "none", "fill-rule": "evenodd" } }, [o("ellipse", { staticClass: "ant-empty-img-simple-ellipse", attrs: { cx: "32", cy: "33", rx: "32", ry: "7" } }), o("g", { staticClass: "ant-empty-img-simple-g", attrs: { "fill-rule": "nonzero" } }, [o("path", { attrs: { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" } }), o("path", { staticClass: "ant-empty-img-simple-path", attrs: { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z" } })])])])]), o("div", { staticClass: "ant-empty-description" }, [e._v("暂无数据")])])];
|
|
1418
|
+
}, proxy: !0 }]) }, "el-table", e.tableBindAttrs, !1), e._l(e.filteredColumns, function(t, a) {
|
|
1419
|
+
return o("column-item", { key: t.prop || t.key || a, attrs: { cols: Object.assign({}, t, { columnIndex: a }) }, scopedSlots: e._u([t.scopedSlots && t.scopedSlots.customRender ? { key: t.scopedSlots.customRender, fn: function({ scope: l }) {
|
|
1420
|
+
return [e._t(
|
|
1421
|
+
t.scopedSlots.customRender,
|
|
1422
|
+
null,
|
|
1423
|
+
{ scope: l },
|
|
1424
|
+
Object.assign({}, t, {
|
|
1425
|
+
columnIndex: a,
|
|
1426
|
+
row: l.row,
|
|
1427
|
+
column: l.column
|
|
1428
|
+
})
|
|
1429
|
+
)];
|
|
1430
|
+
} } : null], null, !0) });
|
|
1431
|
+
}), 1)], 1), e.showPagination ? o("div", { ref: "paginationRef", staticClass: "pagination_page", style: e.paginationStyle }, [o("el-pagination", { staticStyle: { padding: "0", margin: "10px 0", "text-align": "center" }, attrs: { background: e.paginationBackground, size: e.paginationIsSmall ? "small" : e.paginationConfig.size, total: e.paginationConfig.total, "page-size": e.paginationConfig.pageSize, "page-sizes": e.paginationPageSizes, "current-page": e.paginationConfig.current, layout: e.layout }, on: { "update:pageSize": function(t) {
|
|
1432
|
+
return e.$set(e.paginationConfig, "pageSize", t);
|
|
1433
|
+
}, "update:page-size": function(t) {
|
|
1434
|
+
return e.$set(e.paginationConfig, "pageSize", t);
|
|
1435
|
+
}, "update:currentPage": function(t) {
|
|
1436
|
+
return e.$set(e.paginationConfig, "current", t);
|
|
1437
|
+
}, "update:current-page": function(t) {
|
|
1438
|
+
return e.$set(e.paginationConfig, "current", t);
|
|
1439
|
+
}, "size-change": e.handleSizeChange, "current-change": e.handleIndexChange } })], 1) : e._e()])])]);
|
|
1440
|
+
}, Jt = [], Zt = /* @__PURE__ */ me(
|
|
1441
|
+
Ut,
|
|
1442
|
+
Qt,
|
|
1443
|
+
Jt,
|
|
1444
|
+
!1,
|
|
1445
|
+
null,
|
|
1446
|
+
"b7e547d7"
|
|
1447
|
+
);
|
|
1448
|
+
const Ce = Zt.exports;
|
|
1449
|
+
Ce.install = function(n) {
|
|
1450
|
+
n.component(Ce.name || "EsTable", Ce);
|
|
1451
|
+
};
|
|
1452
|
+
const Gt = se({
|
|
1453
|
+
name: "RenderJsx",
|
|
1454
|
+
props: {
|
|
1455
|
+
refs: { type: [Function, Object], default: null },
|
|
1456
|
+
row: { type: Object, default: () => ({}) },
|
|
1457
|
+
render: { type: Function, default: () => {
|
|
1458
|
+
} },
|
|
1459
|
+
model: { type: Object, default: () => ({}) },
|
|
1460
|
+
instance: { type: Object, default: () => ({}) },
|
|
1461
|
+
components: { type: Object, default: () => ({}) }
|
|
1462
|
+
},
|
|
1463
|
+
setup(n) {
|
|
1464
|
+
const e = n.refs && typeof n.refs == "object" ? n.refs : Le({});
|
|
1465
|
+
let o = null;
|
|
1466
|
+
function t() {
|
|
1467
|
+
if (!o) return;
|
|
1468
|
+
const a = o.componentInstance;
|
|
1469
|
+
a && (e.currentRef = a);
|
|
1470
|
+
}
|
|
1471
|
+
return De(() => t()), vt(() => t()), () => {
|
|
1472
|
+
const { instance: a } = n, l = {
|
|
1473
|
+
...a,
|
|
1474
|
+
registerRef: (F, d) => {
|
|
1475
|
+
d != null && (e[F] = d);
|
|
1476
|
+
},
|
|
1477
|
+
getRefs: () => e
|
|
1478
|
+
}, c = n.render, S = c && typeof c == "function" ? c(le, l, n.components || {}) : "";
|
|
1479
|
+
return typeof S == "string" || typeof S == "number" ? (o = null, le(
|
|
1480
|
+
"span",
|
|
1481
|
+
{
|
|
1482
|
+
ref: "currentRef"
|
|
1483
|
+
// Vue 2 的函数式 ref 通过 v-bind 不可直接传,用以下方式赋值
|
|
1484
|
+
},
|
|
1485
|
+
[String(S)]
|
|
1486
|
+
)) : S && typeof S == "object" && "tag" in S ? S.componentOptions ? (o = S, S) : (o = null, le("div", [S])) : (o = null, le("div", [String(S || "")]));
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1489
|
+
}), Yt = null, Xt = null;
|
|
1490
|
+
var en = /* @__PURE__ */ me(
|
|
1491
|
+
Gt,
|
|
1492
|
+
Yt,
|
|
1493
|
+
Xt,
|
|
1494
|
+
!1,
|
|
1495
|
+
null,
|
|
1496
|
+
null
|
|
1497
|
+
);
|
|
1498
|
+
const tn = en.exports, nn = se({
|
|
1499
|
+
name: "EsDialog",
|
|
1500
|
+
components: { RenderJsx: tn },
|
|
1501
|
+
inheritAttrs: !1,
|
|
1502
|
+
props: {
|
|
1503
|
+
title: { type: String, default: "" },
|
|
1504
|
+
visible: { type: Boolean, default: !1 },
|
|
1505
|
+
appendTo: { type: [Object, String], default: void 0 },
|
|
1506
|
+
appendToBody: { type: Boolean, default: !1 },
|
|
1507
|
+
modalAppendToBody: { type: Boolean, default: !0 },
|
|
1508
|
+
closeOnClickModal: { type: Boolean, default: !0 },
|
|
1509
|
+
closeOnPressEscape: { type: Boolean, default: !0 },
|
|
1510
|
+
destroyOnClose: { type: Boolean, default: !1 },
|
|
1511
|
+
hiddenFullBtn: { type: Boolean, default: !1 },
|
|
1512
|
+
width: { type: [String, Number], default: "50%" },
|
|
1513
|
+
// Element UI 不支持 draggable,保留 prop 兼容用户配置但实际不生效
|
|
1514
|
+
isDraggable: { type: Boolean, default: !1 },
|
|
1515
|
+
confirmText: { type: String, default: "" },
|
|
1516
|
+
cancelText: { type: String, default: "" },
|
|
1517
|
+
configBtn: { type: Array, default: () => [] },
|
|
1518
|
+
maxHeight: { type: [String, Number], default: void 0 },
|
|
1519
|
+
isHiddenFooter: { type: Boolean, default: !1 },
|
|
1520
|
+
renderHeader: { type: Function, default: void 0 },
|
|
1521
|
+
renderFooter: { type: Function, default: void 0 },
|
|
1522
|
+
render: { type: Function, default: void 0 },
|
|
1523
|
+
fullscreen: { type: Boolean, default: !1 },
|
|
1524
|
+
// 用户透传给 RenderJsx 的额外组件映射(如 EsTable / EsForm 引用)
|
|
1525
|
+
components: { type: Object, default: () => ({}) }
|
|
1526
|
+
},
|
|
1527
|
+
emits: ["update:visible", "closed", "submit"],
|
|
1528
|
+
setup(n, { emit: e, attrs: o, slots: t, expose: a }) {
|
|
1529
|
+
var R, O;
|
|
1530
|
+
const l = Ee(), c = z(null), S = Le({}), F = z(!1), d = l, g = (O = (R = ae("$EsPlus", null)) != null ? R : pe()) != null ? O : {}, r = (x) => {
|
|
1531
|
+
if (!x) return !0;
|
|
1532
|
+
const j = g.permission;
|
|
1533
|
+
return typeof j == "function" ? j(x) : !0;
|
|
1534
|
+
}, f = (x) => {
|
|
1535
|
+
const {
|
|
1536
|
+
icon: j,
|
|
1537
|
+
click: Z,
|
|
1538
|
+
permissionValue: E,
|
|
1539
|
+
name: ne,
|
|
1540
|
+
disabled: oe,
|
|
1541
|
+
key: de,
|
|
1542
|
+
...he
|
|
1543
|
+
} = x;
|
|
1544
|
+
return he;
|
|
1545
|
+
}, p = (x) => {
|
|
1546
|
+
const j = x.disabled;
|
|
1547
|
+
return typeof j == "function" ? j() : !!j;
|
|
1548
|
+
}, _ = () => {
|
|
1549
|
+
setTimeout(() => {
|
|
1550
|
+
F.value && (F.value = !1);
|
|
1551
|
+
}, 500);
|
|
1552
|
+
}, h = () => {
|
|
1553
|
+
o != null && o.fullscreen || (F.value = !F.value);
|
|
1554
|
+
}, v = B({
|
|
1555
|
+
get: () => n.visible || !1,
|
|
1556
|
+
set: (x) => {
|
|
1557
|
+
e("update:visible", x), x || (e("closed", x), _());
|
|
1558
|
+
}
|
|
1559
|
+
}), T = () => {
|
|
1560
|
+
v.value = !1, e("closed", !1), _();
|
|
1561
|
+
}, D = () => {
|
|
1562
|
+
e("closed", !1), _();
|
|
1563
|
+
}, q = () => {
|
|
1564
|
+
}, W = (x) => {
|
|
1565
|
+
x();
|
|
1566
|
+
}, J = B(() => ({ ...o })), N = B(() => F.value ? "dialogFull" : n.maxHeight ? "dialogShadow" : "dialogAuto"), U = () => {
|
|
1567
|
+
const x = typeof window != "undefined" ? window.innerHeight : 800;
|
|
1568
|
+
return Math.max(x - 135, 200);
|
|
1569
|
+
}, L = B(() => {
|
|
1570
|
+
const x = U();
|
|
1571
|
+
return F.value ? { height: x + "px" } : n.maxHeight ? {
|
|
1572
|
+
maxHeight: typeof n.maxHeight == "number" ? `${n.maxHeight}px` : n.maxHeight
|
|
1573
|
+
} : { maxHeight: x + "px" };
|
|
1574
|
+
}), K = B(() => ({
|
|
1575
|
+
renderBodyRefs: S.currentRef,
|
|
1576
|
+
renderBodyRefsObject: S,
|
|
1577
|
+
lyFormInstance: c,
|
|
1578
|
+
dialogInstance: d,
|
|
1579
|
+
getRefs: () => S
|
|
1580
|
+
})), s = (x) => {
|
|
1581
|
+
const j = x.click;
|
|
1582
|
+
typeof j == "function" && j(S.currentRef, {
|
|
1583
|
+
close: T,
|
|
1584
|
+
getRefs: (Z) => Z ? S[Z] || null : S,
|
|
1585
|
+
dialogInstance: d
|
|
1586
|
+
});
|
|
1587
|
+
};
|
|
1588
|
+
et("bodyFormInstance", (x) => {
|
|
1589
|
+
c.value = x;
|
|
1590
|
+
});
|
|
1591
|
+
const u = B(() => ({
|
|
1592
|
+
...n.components
|
|
1593
|
+
})), y = {
|
|
1594
|
+
closed: T
|
|
1595
|
+
};
|
|
1596
|
+
return typeof a == "function" && a(y), {
|
|
1597
|
+
// state
|
|
1598
|
+
dialogVisible: v,
|
|
1599
|
+
isFullscreen: F,
|
|
1600
|
+
lyFormInstance: c,
|
|
1601
|
+
renderBodyRefsObject: S,
|
|
1602
|
+
// computeds
|
|
1603
|
+
filteredAttrs: J,
|
|
1604
|
+
initDialogCls: N,
|
|
1605
|
+
initDialogHeight: L,
|
|
1606
|
+
getCurrentInstanceModel: K,
|
|
1607
|
+
dialogComponents: u,
|
|
1608
|
+
// methods
|
|
1609
|
+
handleClose: T,
|
|
1610
|
+
handleFullscreen: h,
|
|
1611
|
+
handleBtnClick: s,
|
|
1612
|
+
onDialogClose: D,
|
|
1613
|
+
onDialogClosed: q,
|
|
1614
|
+
beforeCloseHandler: W,
|
|
1615
|
+
checkPermission: r,
|
|
1616
|
+
filterOptions: f,
|
|
1617
|
+
getDisabled: p,
|
|
1618
|
+
getCompIcon: tt,
|
|
1619
|
+
// exposed
|
|
1620
|
+
...y
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
var on = function() {
|
|
1625
|
+
var e = this, o = e._self._c;
|
|
1626
|
+
return e._self._setupProxy, o("div", { staticClass: "dp-dialog_wrapper" }, [o("el-dialog", e._b({ class: ["dg-dialog", e.initDialogCls], attrs: { visible: e.dialogVisible, width: typeof e.width == "number" ? e.width + "px" : e.width, "show-close": !1, fullscreen: e.filteredAttrs && e.filteredAttrs.fullscreen != null ? e.filteredAttrs.fullscreen : e.isFullscreen, "append-to-body": e.appendToBody, "modal-append-to-body": e.modalAppendToBody, "close-on-click-modal": e.closeOnClickModal, "close-on-press-escape": e.closeOnPressEscape, "destroy-on-close": e.destroyOnClose, "before-close": e.beforeCloseHandler }, on: { "update:visible": function(t) {
|
|
1627
|
+
e.dialogVisible = t;
|
|
1628
|
+
}, close: e.onDialogClose, closed: e.onDialogClosed }, scopedSlots: e._u([{ key: "title", fn: function() {
|
|
1629
|
+
return [e.renderHeader && typeof e.renderHeader == "function" ? o("render-jsx", { attrs: { render: e.renderHeader, instance: e.getCurrentInstanceModel } }) : [o("div", { staticClass: "dialog-header" }, [o("span", { staticClass: "dialog-title" }, [e._v(e._s(e.title))]), o("div", { staticClass: "btns" }, [o("i", { directives: [{ name: "show", rawName: "v-show", value: !e.hiddenFullBtn, expression: "!hiddenFullBtn" }], class: e.isFullscreen ? "el-icon-copy-document" : "el-icon-full-screen", on: { click: e.handleFullscreen } }), o("i", { staticClass: "el-icon-close", on: { click: e.handleClose } })])])]];
|
|
1630
|
+
}, proxy: !0 }, e.isHiddenFooter ? null : { key: "footer", fn: function() {
|
|
1631
|
+
return [e.$slots.footer ? e._t("footer") : o("span", { staticClass: "dialog-footer" }, [e.renderFooter && typeof e.renderFooter == "function" ? o("render-jsx", { attrs: { render: e.renderFooter, instance: e.getCurrentInstanceModel } }) : e.configBtn && e.configBtn.length ? [e._l(e.configBtn, function(t, a) {
|
|
1632
|
+
return [e.checkPermission(t.permissionValue) ? o("el-button", e._b({ key: t.key || a, attrs: { size: "small", icon: e.getCompIcon(t.icon), disabled: e.getDisabled(t) }, on: { click: () => e.handleBtnClick(t) } }, "el-button", e.filterOptions(t), !1), [e._v(" " + e._s(t.name) + " ")]) : e._e()];
|
|
1633
|
+
})] : e._e()], 2)];
|
|
1634
|
+
}, proxy: !0 }], null, !0) }, "el-dialog", e.filteredAttrs, !1), [o("div", { staticClass: "dialog_body_layouts", style: e.initDialogHeight }, [e.render && typeof e.render == "function" ? o("render-jsx", { attrs: { refs: e.renderBodyRefsObject, instance: e.getCurrentInstanceModel, render: e.render, components: e.dialogComponents } }) : e._e()], 1)])], 1);
|
|
1635
|
+
}, sn = [], rn = /* @__PURE__ */ me(
|
|
1636
|
+
nn,
|
|
1637
|
+
on,
|
|
1638
|
+
sn,
|
|
1639
|
+
!1,
|
|
1640
|
+
null,
|
|
1641
|
+
"de050fb4"
|
|
1642
|
+
);
|
|
1643
|
+
const Se = rn.exports, an = (n) => typeof n == "string" ? document.querySelector(n) || document.body : n instanceof HTMLElement ? n : document.body, ln = (n) => {
|
|
1644
|
+
const e = {}, o = {};
|
|
1645
|
+
return Object.entries(n).forEach(([t, a]) => {
|
|
1646
|
+
if (t.startsWith("on") && typeof a == "function" && t.length > 2) {
|
|
1647
|
+
const l = t.slice(2), c = l.charAt(0).toLowerCase() + l.slice(1);
|
|
1648
|
+
e[c] = a;
|
|
1649
|
+
} else
|
|
1650
|
+
o[t] = a;
|
|
1651
|
+
}), { propsData: o, events: e };
|
|
1652
|
+
}, Xe = (n, e, o) => {
|
|
1653
|
+
const { propsData: t, events: a } = ln(e), l = yt.extend(n), c = new l({ propsData: t });
|
|
1654
|
+
return Object.entries(a).forEach(([F, d]) => {
|
|
1655
|
+
c.$on(F, d);
|
|
1656
|
+
}), c.$mount(), an(o).appendChild(c.$el), c;
|
|
1657
|
+
};
|
|
1658
|
+
function Ae(n, e = {}) {
|
|
1659
|
+
if (n = n || Se, Object.assign({ onlyInstance: !1 }, e).onlyInstance) {
|
|
1660
|
+
let t = null;
|
|
1661
|
+
const a = () => {
|
|
1662
|
+
t && (t.visible = !1, setTimeout(() => {
|
|
1663
|
+
t && (t.$destroy(), t.$el && t.$el.parentNode && t.$el.parentNode.removeChild(t.$el), t = null);
|
|
1664
|
+
}, 300));
|
|
1665
|
+
}, l = (c) => {
|
|
1666
|
+
c.visible === void 0 && (c.visible = !0);
|
|
1667
|
+
const S = c.onClosed, F = c.onSubmit;
|
|
1668
|
+
return c.onClosed = (...d) => {
|
|
1669
|
+
S == null || S(...d), a();
|
|
1670
|
+
}, c.onSubmit = (d = a) => {
|
|
1671
|
+
F == null || F(d);
|
|
1672
|
+
}, t = Xe(n, c, c.appendTo), t;
|
|
1673
|
+
};
|
|
1674
|
+
return l.close = a, l;
|
|
1675
|
+
} else {
|
|
1676
|
+
let t = null;
|
|
1677
|
+
const a = () => {
|
|
1678
|
+
t && (t.visible = !1);
|
|
1679
|
+
}, l = () => {
|
|
1680
|
+
t && (t.$destroy(), t.$el && t.$el.parentNode && t.$el.parentNode.removeChild(t.$el), t = null);
|
|
1681
|
+
}, c = (S) => {
|
|
1682
|
+
if (t)
|
|
1683
|
+
return Object.entries(S).forEach(([r, f]) => {
|
|
1684
|
+
r.startsWith("on") || (t[r] = f);
|
|
1685
|
+
}), t.visible = !0, t;
|
|
1686
|
+
const F = {
|
|
1687
|
+
visible: !0,
|
|
1688
|
+
width: "50%",
|
|
1689
|
+
destroyOnClose: !0,
|
|
1690
|
+
...S
|
|
1691
|
+
}, d = F.onClosed, g = F.onSubmit;
|
|
1692
|
+
return F.onClosed = () => {
|
|
1693
|
+
d == null || d(), a();
|
|
1694
|
+
}, F.onSubmit = (r = a) => {
|
|
1695
|
+
g == null || g(r);
|
|
1696
|
+
}, t = Xe(n, F, F.appendTo), t;
|
|
1697
|
+
};
|
|
1698
|
+
return c.close = a, c.destroy = l, c;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
Se.install = function(n) {
|
|
1702
|
+
n.component(Se.name || "EsDialog", Se), n.prototype.$useDialog = Ae;
|
|
1703
|
+
};
|
|
1704
|
+
const cn = se({
|
|
1705
|
+
name: "EsCrudPage",
|
|
1706
|
+
components: { EsForm: ye, EsTable: Ce },
|
|
1707
|
+
inheritAttrs: !1,
|
|
1708
|
+
props: {
|
|
1709
|
+
schema: { type: Object, required: !0 },
|
|
1710
|
+
httpRequest: {
|
|
1711
|
+
type: Function,
|
|
1712
|
+
default: void 0
|
|
1713
|
+
},
|
|
1714
|
+
autoLoad: { type: Boolean, default: !0 }
|
|
1715
|
+
},
|
|
1716
|
+
emits: [
|
|
1717
|
+
"query",
|
|
1718
|
+
"add",
|
|
1719
|
+
"edit",
|
|
1720
|
+
"delete",
|
|
1721
|
+
"view",
|
|
1722
|
+
"export",
|
|
1723
|
+
"row-click",
|
|
1724
|
+
"btn-click",
|
|
1725
|
+
"dialog-confirm",
|
|
1726
|
+
"dialog-cancel",
|
|
1727
|
+
"dialog-open"
|
|
1728
|
+
],
|
|
1729
|
+
setup(n, { emit: e, expose: o }) {
|
|
1730
|
+
const t = z(null), a = z(null), l = z([]), c = Le({});
|
|
1731
|
+
ce(
|
|
1732
|
+
() => n.schema.formItems,
|
|
1733
|
+
(s) => {
|
|
1734
|
+
s && s.forEach((u) => {
|
|
1735
|
+
u.prop && !(u.prop in c) && (c[u.prop] = "");
|
|
1736
|
+
});
|
|
1737
|
+
},
|
|
1738
|
+
{ immediate: !0 }
|
|
1739
|
+
);
|
|
1740
|
+
const S = z({
|
|
1741
|
+
current: 1,
|
|
1742
|
+
pageSize: 10,
|
|
1743
|
+
total: 0,
|
|
1744
|
+
...n.schema.pagination || {}
|
|
1745
|
+
}), F = B(() => {
|
|
1746
|
+
var R, O;
|
|
1747
|
+
if (n.schema.dialogs) return n.schema.dialogs;
|
|
1748
|
+
if (!((R = n.schema.dialogFormItems) != null && R.length)) return {};
|
|
1749
|
+
const s = {
|
|
1750
|
+
width: ((O = n.schema.dialogOptions) == null ? void 0 : O.width) || "600px",
|
|
1751
|
+
formItems: n.schema.dialogFormItems,
|
|
1752
|
+
...n.schema.dialogOptions || {}
|
|
1753
|
+
}, u = {}, y = n.schema.actions || ["add", "edit", "delete"];
|
|
1754
|
+
return y.includes("add") && (u.add = { ...s, title: "新增" }), y.includes("edit") && (u.edit = { ...s, title: "编辑" }), y.includes("view") && (u.view = { ...s, title: "查看", isHiddenFooter: !0 }), u;
|
|
1755
|
+
}), d = B(() => {
|
|
1756
|
+
if (n.schema.toolbarBtns) return n.schema.toolbarBtns;
|
|
1757
|
+
if (n.schema.dialogs || n.schema.operationColumn !== void 0) return [];
|
|
1758
|
+
const s = n.schema.actions || ["add", "edit", "delete"], u = [];
|
|
1759
|
+
return s.includes("add") && u.push({
|
|
1760
|
+
name: "新增",
|
|
1761
|
+
type: "primary",
|
|
1762
|
+
key: "add",
|
|
1763
|
+
icon: "Plus",
|
|
1764
|
+
dialogKey: "add"
|
|
1765
|
+
}), s.includes("export") && u.push({
|
|
1766
|
+
name: "导出",
|
|
1767
|
+
key: "export",
|
|
1768
|
+
icon: "Download",
|
|
1769
|
+
actionType: "export"
|
|
1770
|
+
}), s.includes("import") && u.push({
|
|
1771
|
+
name: "导入",
|
|
1772
|
+
key: "import",
|
|
1773
|
+
icon: "Upload",
|
|
1774
|
+
actionType: "import"
|
|
1775
|
+
}), u;
|
|
1776
|
+
}), g = B(
|
|
1777
|
+
() => {
|
|
1778
|
+
var O;
|
|
1779
|
+
if (n.schema.operationColumn !== void 0) return n.schema.operationColumn;
|
|
1780
|
+
const s = n.schema.actions || ["add", "edit", "delete"];
|
|
1781
|
+
if ((O = n.schema.columns) == null ? void 0 : O.some(
|
|
1782
|
+
(x) => x.prop === "action" || x.prop === "operate" || x.btns
|
|
1783
|
+
)) return;
|
|
1784
|
+
if (s.filter((x) => ["edit", "delete", "view"].includes(x)).length === 0) return !1;
|
|
1785
|
+
const R = [];
|
|
1786
|
+
return s.includes("view") && R.push({ name: "查看", type: "primary", key: "view", dialogKey: "view" }), s.includes("edit") && R.push({ name: "编辑", type: "primary", key: "edit", dialogKey: "edit" }), s.includes("delete") && R.push({
|
|
1787
|
+
name: "删除",
|
|
1788
|
+
type: "danger",
|
|
1789
|
+
key: "delete",
|
|
1790
|
+
confirm: "确定删除该条数据吗?"
|
|
1791
|
+
}), {
|
|
1792
|
+
label: "操作",
|
|
1793
|
+
width: R.length * 80 + 20,
|
|
1794
|
+
fixed: "right",
|
|
1795
|
+
btns: R
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
), r = B(() => {
|
|
1799
|
+
if (n.schema.queryBtns) return n.schema.queryBtns;
|
|
1800
|
+
const s = [
|
|
1801
|
+
{ name: "查询", type: "primary", key: "query", triggerEvent: !0 },
|
|
1802
|
+
{ name: "重置", key: "rest", triggerEvent: !0 }
|
|
1803
|
+
], u = d.value.map((y) => {
|
|
1804
|
+
const R = { ...y };
|
|
1805
|
+
return R.click || (R.click = () => v(y)), R;
|
|
1806
|
+
});
|
|
1807
|
+
return [...s, ...u];
|
|
1808
|
+
}), f = B(() => {
|
|
1809
|
+
const s = [...n.schema.columns || []], u = g.value;
|
|
1810
|
+
if (u === !1 || u === void 0) return s;
|
|
1811
|
+
const y = u.btns.map((R) => ({
|
|
1812
|
+
name: R.name,
|
|
1813
|
+
type: R.type,
|
|
1814
|
+
permissionValue: R.permissionValue,
|
|
1815
|
+
clickEvent: (O) => T(R, O)
|
|
1816
|
+
}));
|
|
1817
|
+
return s.push({
|
|
1818
|
+
prop: "operate",
|
|
1819
|
+
label: u.label || "操作",
|
|
1820
|
+
width: u.width || y.length * 80 + 20,
|
|
1821
|
+
fixed: u.fixed || "right",
|
|
1822
|
+
btns: y
|
|
1823
|
+
}), s;
|
|
1824
|
+
}), p = B(() => {
|
|
1825
|
+
var s;
|
|
1826
|
+
return (s = n.schema.tableBtns) != null && s.length ? n.schema.tableBtns.map((u) => ({
|
|
1827
|
+
name: u.name,
|
|
1828
|
+
type: u.type,
|
|
1829
|
+
size: u.size || "small",
|
|
1830
|
+
icon: u.icon,
|
|
1831
|
+
code: u.code || 1,
|
|
1832
|
+
permissionValue: u.permissionValue,
|
|
1833
|
+
loading: u.loading,
|
|
1834
|
+
disabled: u.disabled,
|
|
1835
|
+
click: () => v(u)
|
|
1836
|
+
})) : [];
|
|
1837
|
+
}), _ = B(() => {
|
|
1838
|
+
const s = {
|
|
1839
|
+
border: !0,
|
|
1840
|
+
isInitRun: n.autoLoad,
|
|
1841
|
+
...n.schema.tableOptions || {}
|
|
1842
|
+
};
|
|
1843
|
+
n.httpRequest && (s.httpRequest = n.httpRequest);
|
|
1844
|
+
const u = p.value;
|
|
1845
|
+
if (u.length > 0) {
|
|
1846
|
+
const y = s.configBtn || [];
|
|
1847
|
+
s.configBtn = [...y, ...u];
|
|
1848
|
+
}
|
|
1849
|
+
return s;
|
|
1850
|
+
}), h = B(() => {
|
|
1851
|
+
const s = n.schema.formLayout;
|
|
1852
|
+
if (s)
|
|
1853
|
+
return {
|
|
1854
|
+
rowLayProps: { gutter: 16 },
|
|
1855
|
+
fromLayProps: {
|
|
1856
|
+
labelBtnWidth: s.labelWidth,
|
|
1857
|
+
...s.minFoldRows ? { minFoldRows: s.minFoldRows } : {}
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
});
|
|
1861
|
+
async function v(s) {
|
|
1862
|
+
const u = s.key || s.actionType || "";
|
|
1863
|
+
if (s.confirm) {
|
|
1864
|
+
const y = typeof s.confirm == "string" ? s.confirm : "确定执行此操作吗?";
|
|
1865
|
+
try {
|
|
1866
|
+
await Ze.confirm(y, "提示", { type: "warning" });
|
|
1867
|
+
} catch (R) {
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
if (s.dialogKey) {
|
|
1872
|
+
u === "add" && e("add"), q(s.dialogKey);
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
u === "export" || s.actionType === "export" ? e("export", { ...c }) : u === "add" && e("add"), e("btn-click", u, { ...c });
|
|
1876
|
+
}
|
|
1877
|
+
async function T(s, u) {
|
|
1878
|
+
const y = s.key || "";
|
|
1879
|
+
if (s.confirm) {
|
|
1880
|
+
const R = typeof s.confirm == "string" ? s.confirm : "确定执行此操作吗?";
|
|
1881
|
+
try {
|
|
1882
|
+
await Ze.confirm(R, "提示", { type: "warning" });
|
|
1883
|
+
} catch (O) {
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
if (s.click) {
|
|
1888
|
+
s.click(u, { refresh: U, getSelectedRows: L, openDialog: q });
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
if (s.dialogKey) {
|
|
1892
|
+
q(s.dialogKey, u);
|
|
1893
|
+
return;
|
|
1894
|
+
}
|
|
1895
|
+
y === "edit" ? e("edit", u) : y === "delete" ? e("delete", u) : y === "view" && e("view", u), e("btn-click", y, u);
|
|
1896
|
+
}
|
|
1897
|
+
const D = /* @__PURE__ */ new Map();
|
|
1898
|
+
function q(s, u) {
|
|
1899
|
+
var Z;
|
|
1900
|
+
const y = F.value[s];
|
|
1901
|
+
if (!y) return;
|
|
1902
|
+
e("dialog-open", s, u);
|
|
1903
|
+
const R = Ae();
|
|
1904
|
+
D.set(s, R);
|
|
1905
|
+
const O = Le({});
|
|
1906
|
+
y.formItems && y.formItems.forEach((E) => {
|
|
1907
|
+
var ne;
|
|
1908
|
+
E.prop && (O[E.prop] = (ne = u == null ? void 0 : u[E.prop]) != null ? ne : "");
|
|
1909
|
+
});
|
|
1910
|
+
const x = typeof y.title == "function" ? y.title(u) : y.title || "";
|
|
1911
|
+
(Z = y.onOpen) == null || Z.call(y, u);
|
|
1912
|
+
const j = J(s, y, O, u || {});
|
|
1913
|
+
R({
|
|
1914
|
+
title: x,
|
|
1915
|
+
width: y.width || "600px",
|
|
1916
|
+
isDraggable: y.isDraggable,
|
|
1917
|
+
maxHeight: y.maxHeight,
|
|
1918
|
+
fullscreen: y.fullscreen,
|
|
1919
|
+
isHiddenFooter: y.isHiddenFooter,
|
|
1920
|
+
// 用户自定义 render
|
|
1921
|
+
render: y.render ? (E, ne) => y.render(E, {
|
|
1922
|
+
row: u || {},
|
|
1923
|
+
model: O,
|
|
1924
|
+
registerRef: ne.registerRef,
|
|
1925
|
+
close: () => W(s),
|
|
1926
|
+
refresh: U
|
|
1927
|
+
}) : y.formItems ? (E, { registerRef: ne }) => {
|
|
1928
|
+
const oe = E(ye, {
|
|
1929
|
+
props: {
|
|
1930
|
+
model: O,
|
|
1931
|
+
formItemList: y.formItems,
|
|
1932
|
+
layoutFormProps: {
|
|
1933
|
+
rowLayProps: { gutter: 16 },
|
|
1934
|
+
fromLayProps: {
|
|
1935
|
+
isBtnHidden: !0,
|
|
1936
|
+
...y.formLayout || {}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
},
|
|
1940
|
+
// Vue 2 函数式 ref:通过 RenderJsx 暴露的 registerRef 注册
|
|
1941
|
+
ref: "dialogForm"
|
|
1942
|
+
});
|
|
1943
|
+
return oe && oe.data && (oe.data.hook = oe.data.hook || {}, oe.data.hook.insert = (de) => {
|
|
1944
|
+
de.componentInstance && ne("dialogForm", de.componentInstance);
|
|
1945
|
+
}), oe;
|
|
1946
|
+
} : void 0,
|
|
1947
|
+
configBtn: j,
|
|
1948
|
+
// useDialog 的 onClosed 通过 extractEventHandlers 转为 'closed' 事件
|
|
1949
|
+
onClosed: () => {
|
|
1950
|
+
var E;
|
|
1951
|
+
D.delete(s), (E = y.onClose) == null || E.call(y);
|
|
1952
|
+
}
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
function W(s) {
|
|
1956
|
+
const u = D.get(s);
|
|
1957
|
+
u && (u.close(), D.delete(s));
|
|
1958
|
+
}
|
|
1959
|
+
function J(s, u, y, R) {
|
|
1960
|
+
if (!u.isHiddenFooter)
|
|
1961
|
+
return u.configBtn ? u.configBtn.map((O) => O.action === "cancel" ? {
|
|
1962
|
+
...O,
|
|
1963
|
+
click: (x, { close: j }) => {
|
|
1964
|
+
e("dialog-cancel", s), j();
|
|
1965
|
+
}
|
|
1966
|
+
} : O.action === "confirm" ? {
|
|
1967
|
+
...O,
|
|
1968
|
+
click: async (x, { close: j, getRefs: Z }) => {
|
|
1969
|
+
await N(s, u, y, R, j, Z);
|
|
1970
|
+
}
|
|
1971
|
+
} : O) : [
|
|
1972
|
+
{
|
|
1973
|
+
name: "取消",
|
|
1974
|
+
click: (O, { close: x }) => {
|
|
1975
|
+
e("dialog-cancel", s), x();
|
|
1976
|
+
}
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
name: "确定",
|
|
1980
|
+
type: "primary",
|
|
1981
|
+
click: async (O, { close: x, getRefs: j }) => {
|
|
1982
|
+
await N(s, u, y, R, x, j);
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
];
|
|
1986
|
+
}
|
|
1987
|
+
async function N(s, u, y, R, O, x) {
|
|
1988
|
+
var Z;
|
|
1989
|
+
if ((Z = u.formItems) != null && Z.length) {
|
|
1990
|
+
const E = x("dialogForm");
|
|
1991
|
+
E != null && E.validate && await E.validate();
|
|
1992
|
+
}
|
|
1993
|
+
const j = { close: O, refresh: U, getRefs: x, row: R };
|
|
1994
|
+
if (u.onConfirm)
|
|
1995
|
+
await u.onConfirm(y, j);
|
|
1996
|
+
else {
|
|
1997
|
+
const E = s === "add" ? "add-confirm" : s === "edit" ? "edit-confirm" : `${s}-confirm`;
|
|
1998
|
+
e("btn-click", E, y), O(), U();
|
|
1999
|
+
}
|
|
2000
|
+
e("dialog-confirm", s, y);
|
|
2001
|
+
}
|
|
2002
|
+
function U() {
|
|
2003
|
+
var s, u;
|
|
2004
|
+
(u = (s = t.value) == null ? void 0 : s.httpRequestInstance) == null || u.call(s);
|
|
2005
|
+
}
|
|
2006
|
+
function L() {
|
|
2007
|
+
var s, u;
|
|
2008
|
+
return ((u = (s = t.value) == null ? void 0 : s.getSelectionRows) == null ? void 0 : u.call(s)) || [];
|
|
2009
|
+
}
|
|
2010
|
+
const K = {
|
|
2011
|
+
refresh: U,
|
|
2012
|
+
getSelectedRows: L,
|
|
2013
|
+
tableRef: t,
|
|
2014
|
+
formRef: a,
|
|
2015
|
+
queryModel: c,
|
|
2016
|
+
openDialog: q,
|
|
2017
|
+
closeDialog: W
|
|
2018
|
+
};
|
|
2019
|
+
return typeof o == "function" && o(K), {
|
|
2020
|
+
// refs
|
|
2021
|
+
tableRef: t,
|
|
2022
|
+
formRef: a,
|
|
2023
|
+
tableData: l,
|
|
2024
|
+
queryModel: c,
|
|
2025
|
+
paginationState: S,
|
|
2026
|
+
// computeds
|
|
2027
|
+
mergedColumns: f,
|
|
2028
|
+
mergedOptions: _,
|
|
2029
|
+
mergedFormBtns: r,
|
|
2030
|
+
formLayoutProps: h,
|
|
2031
|
+
// exposed
|
|
2032
|
+
...K
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
var un = function() {
|
|
2037
|
+
var e = this, o = e._self._c;
|
|
2038
|
+
return e._self._setupProxy, o("div", { staticClass: "es-crud-page" }, [o("es-table", e._b({ ref: "tableRef", attrs: { columns: e.mergedColumns, options: e.mergedOptions, "data-source": e.tableData, pagination: e.paginationState }, on: { "update:dataSource": function(t) {
|
|
2039
|
+
e.tableData = t;
|
|
2040
|
+
}, "update:data-source": function(t) {
|
|
2041
|
+
e.tableData = t;
|
|
2042
|
+
}, "update:pagination": function(t) {
|
|
2043
|
+
e.paginationState = t;
|
|
2044
|
+
} }, scopedSlots: e._u([e._l(e.$slots, function(t, a) {
|
|
2045
|
+
return { key: a, fn: function(l) {
|
|
2046
|
+
return [e._t(a, null, null, l || {})];
|
|
2047
|
+
} };
|
|
2048
|
+
})], null, !0) }, "es-table", e.$attrs, !1), [e.schema.formItems && e.schema.formItems.length ? o("es-form", { ref: "formRef", attrs: { model: e.queryModel, "form-item-list": e.schema.formItems, "config-btn": e.mergedFormBtns, "layout-form-props": e.formLayoutProps } }) : e._e()], 1)], 1);
|
|
2049
|
+
}, dn = [], fn = /* @__PURE__ */ me(
|
|
2050
|
+
cn,
|
|
2051
|
+
un,
|
|
2052
|
+
dn,
|
|
2053
|
+
!1,
|
|
2054
|
+
null,
|
|
2055
|
+
"ec24c733"
|
|
2056
|
+
);
|
|
2057
|
+
const He = fn.exports;
|
|
2058
|
+
He.install = function(n) {
|
|
2059
|
+
n.component(
|
|
2060
|
+
He.name || "EsCrudPage",
|
|
2061
|
+
He
|
|
2062
|
+
);
|
|
2063
|
+
};
|
|
2064
|
+
const pn = [ye, Ce, Se, He], mn = (n) => {
|
|
2065
|
+
const e = { ...n };
|
|
2066
|
+
for (const o of ["EsTable", "EsForm", "EsDialog"]) {
|
|
2067
|
+
const t = e[o];
|
|
2068
|
+
if (!t || typeof t != "object") continue;
|
|
2069
|
+
const a = t.methods;
|
|
2070
|
+
if (a && typeof a == "object") {
|
|
2071
|
+
const { methods: c, ...S } = t;
|
|
2072
|
+
e[o] = { ...a, ...S };
|
|
2073
|
+
}
|
|
2074
|
+
const l = e[o];
|
|
2075
|
+
typeof l.configQueryfieldOutput == "function" && typeof l.configQueryFieldOutput != "function" && (l.configQueryFieldOutput = l.configQueryfieldOutput);
|
|
2076
|
+
}
|
|
2077
|
+
return e;
|
|
2078
|
+
}, gn = (n, e = {}) => {
|
|
2079
|
+
const o = mn(e);
|
|
2080
|
+
gt(o), o.skipComponentRegistration || pn.forEach((t) => {
|
|
2081
|
+
const a = t.name;
|
|
2082
|
+
a && n.component(a, t);
|
|
2083
|
+
}), o.globalProperties !== !1 && (n.prototype.$useDialog = Ae), n.mixin({
|
|
2084
|
+
provide: {
|
|
2085
|
+
$EsPlus: {
|
|
2086
|
+
useDialog: Ae,
|
|
2087
|
+
...o
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
2091
|
+
}, bn = {
|
|
2092
|
+
version: "0.9.0",
|
|
2093
|
+
install: gn
|
|
2094
|
+
};
|
|
2095
|
+
export {
|
|
2096
|
+
He as EsCrudPage,
|
|
2097
|
+
Se as EsDialog,
|
|
2098
|
+
ye as EsForm,
|
|
2099
|
+
Ce as EsTable,
|
|
2100
|
+
Sn as configureEsPlus,
|
|
2101
|
+
bn as default,
|
|
2102
|
+
gn as install,
|
|
2103
|
+
Ae as useDialog
|
|
2104
|
+
};
|
|
2105
|
+
//# sourceMappingURL=es-plus-vue2.js.map
|