easy-ep-ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/easy-ep-ui.js +1 -1
  2. package/dist/style.css +1 -1
  3. package/es/components/ee-dict-select/src/index.vue.d.ts +2 -0
  4. package/es/components/ee-form-dialog/src/index.vue.d.ts +2 -0
  5. package/es/components/ee-form-table/src/components/FormDrawer.vue.d.ts +38 -0
  6. package/es/components/ee-form-table/src/components/SearchArea.vue.d.ts +39 -0
  7. package/es/components/ee-form-table/src/components/TableToolbar.vue.d.ts +42 -0
  8. package/es/components/ee-form-table/src/constants.d.ts +31 -0
  9. package/es/components/ee-form-table/src/hooks/useAuth.d.ts +14 -0
  10. package/es/components/ee-form-table/src/hooks/useCrud.d.ts +39 -0
  11. package/es/components/ee-form-table/src/hooks/useDict.d.ts +12 -0
  12. package/es/components/ee-form-table/src/hooks/useExport.d.ts +32 -0
  13. package/es/components/ee-form-table/src/hooks/useForm.d.ts +31 -0
  14. package/es/components/ee-form-table/src/hooks/usePagination.d.ts +22 -0
  15. package/es/components/ee-form-table/src/hooks/useSearch.d.ts +39 -0
  16. package/es/components/ee-form-table/src/hooks/useTable.d.ts +49 -0
  17. package/es/components/ee-form-table/src/index.vue.d.ts +1079 -534
  18. package/es/components/ee-form-table/types.d.ts +197 -0
  19. package/es/components/ee-search-bar/src/index.vue.d.ts +2 -0
  20. package/es/index.d.ts +2 -0
  21. package/es/index.mjs +1483 -332
  22. package/es/style.css +1 -1
  23. package/lib/components/ee-dict-select/src/index.vue.d.ts +2 -0
  24. package/lib/components/ee-form-dialog/src/index.vue.d.ts +2 -0
  25. package/lib/components/ee-form-table/src/components/FormDrawer.vue.d.ts +38 -0
  26. package/lib/components/ee-form-table/src/components/SearchArea.vue.d.ts +39 -0
  27. package/lib/components/ee-form-table/src/components/TableToolbar.vue.d.ts +42 -0
  28. package/lib/components/ee-form-table/src/constants.d.ts +31 -0
  29. package/lib/components/ee-form-table/src/hooks/useAuth.d.ts +14 -0
  30. package/lib/components/ee-form-table/src/hooks/useCrud.d.ts +39 -0
  31. package/lib/components/ee-form-table/src/hooks/useDict.d.ts +12 -0
  32. package/lib/components/ee-form-table/src/hooks/useExport.d.ts +32 -0
  33. package/lib/components/ee-form-table/src/hooks/useForm.d.ts +31 -0
  34. package/lib/components/ee-form-table/src/hooks/usePagination.d.ts +22 -0
  35. package/lib/components/ee-form-table/src/hooks/useSearch.d.ts +39 -0
  36. package/lib/components/ee-form-table/src/hooks/useTable.d.ts +49 -0
  37. package/lib/components/ee-form-table/src/index.vue.d.ts +1079 -534
  38. package/lib/components/ee-form-table/types.d.ts +197 -0
  39. package/lib/components/ee-search-bar/src/index.vue.d.ts +2 -0
  40. package/lib/index.cjs +1 -1
  41. package/lib/index.d.ts +2 -0
  42. package/lib/style.css +1 -1
  43. package/package.json +5 -4
package/es/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { defineComponent as F, ref as U, computed as $, onMounted as K, watch as Q, openBlock as t, createBlock as s, unref as o, mergeProps as S, withCtx as i, createElementBlock as h, Fragment as k, renderList as E, createTextVNode as w, toDisplayString as x, createVNode as g, resolveDynamicComponent as G, createCommentVNode as v, createElementVNode as A, renderSlot as I } from "vue";
2
- import { ElSelect as N, ElOption as M, ElTag as X, ElForm as H, ElRow as J, ElCol as P, ElFormItem as W, ElInput as L, ElDatePicker as q, ElButton as D, ElDialog as Y, ElRadioGroup as Z, ElRadio as _, ElCheckboxGroup as ee, ElCheckbox as le, ElSwitch as ae, ElTable as te, ElTableColumn as O, ElPagination as oe } from "element-plus";
3
- const B = /* @__PURE__ */ F({
1
+ import { defineComponent as K, ref as T, computed as C, onMounted as Q, watch as ve, openBlock as i, createBlock as f, unref as t, mergeProps as R, withCtx as d, createElementBlock as D, Fragment as B, renderList as A, createTextVNode as S, toDisplayString as F, createVNode as w, resolveDynamicComponent as Re, createCommentVNode as P, createElementVNode as ue, reactive as Oe, renderSlot as I, normalizeClass as va, normalizeStyle as ba, createSlots as pa, normalizeProps as ya, guardReactiveProps as wa, isRef as Ca } from "vue";
2
+ import { ElSelect as se, ElOption as de, ElTag as za, ElForm as be, ElRow as pe, ElCol as X, ElFormItem as Y, ElInput as Z, ElDatePicker as J, ElButton as E, ElDialog as ye, ElRadioGroup as Ie, ElRadio as we, ElCheckboxGroup as Ce, ElCheckbox as ze, ElSwitch as Va, ElMessageBox as Pe, ElMessage as L, ElInputNumber as ka, ElTooltip as xe, ElDrawer as Sa, ElTable as Da, ElTableColumn as te, ElEmpty as Ea, ElPagination as $a } from "element-plus";
3
+ const le = /* @__PURE__ */ K({
4
4
  name: "EeDictSelect",
5
5
  __name: "index",
6
6
  props: {
@@ -8,50 +8,52 @@ const B = /* @__PURE__ */ F({
8
8
  options: {},
9
9
  request: {},
10
10
  valueField: { default: "value" },
11
- labelField: { default: "label" }
11
+ labelField: { default: "label" },
12
+ size: { default: "default" }
12
13
  },
13
14
  emits: ["update:modelValue", "change", "clear", "focus", "blur"],
14
- setup(e, { emit: y }) {
15
- const r = e, p = y, b = U(!1), c = U([]), d = $(() => (r.options ?? c.value).map((m) => ({
16
- value: String(m[r.valueField] ?? ""),
17
- label: String(m[r.labelField] ?? ""),
18
- disabled: m.disabled ?? !1
15
+ setup(e, { emit: n }) {
16
+ const l = e, a = n, r = T(!1), m = T([]), p = C(() => (l.options ?? m.value).map((g) => ({
17
+ value: String(g[l.valueField] ?? ""),
18
+ label: String(g[l.labelField] ?? ""),
19
+ disabled: g.disabled ?? !1
19
20
  })));
20
- async function a() {
21
- if (!r.options && r.request) {
22
- b.value = !0;
21
+ async function V() {
22
+ if (!l.options && l.request) {
23
+ r.value = !0;
23
24
  try {
24
- c.value = await r.request();
25
+ m.value = await l.request();
25
26
  } finally {
26
- b.value = !1;
27
+ r.value = !1;
27
28
  }
28
29
  }
29
30
  }
30
- return K(a), Q(() => r.request, a), (f, m) => (t(), s(o(N), S(f.$attrs, {
31
+ return Q(V), ve(() => l.request, V), (k, g) => (i(), f(t(se), R(k.$attrs, {
31
32
  "model-value": e.modelValue,
32
- loading: b.value,
33
- "onUpdate:modelValue": m[0] || (m[0] = (l) => p("update:modelValue", l)),
34
- onChange: m[1] || (m[1] = (l) => p("change", l)),
35
- onClear: m[2] || (m[2] = (l) => p("clear")),
36
- onFocus: m[3] || (m[3] = (l) => p("focus", l)),
37
- onBlur: m[4] || (m[4] = (l) => p("blur", l))
33
+ loading: r.value,
34
+ size: e.size,
35
+ "onUpdate:modelValue": g[0] || (g[0] = (o) => a("update:modelValue", o)),
36
+ onChange: g[1] || (g[1] = (o) => a("change", o)),
37
+ onClear: g[2] || (g[2] = (o) => a("clear")),
38
+ onFocus: g[3] || (g[3] = (o) => a("focus", o)),
39
+ onBlur: g[4] || (g[4] = (o) => a("blur", o))
38
40
  }), {
39
- default: i(() => [
40
- (t(!0), h(k, null, E(d.value, (l) => (t(), s(o(M), {
41
- key: l.value,
42
- label: l.label,
43
- value: l.value,
44
- disabled: l.disabled
41
+ default: d(() => [
42
+ (i(!0), D(B, null, A(p.value, (o) => (i(), f(t(de), {
43
+ key: o.value,
44
+ label: o.label,
45
+ value: o.value,
46
+ disabled: o.disabled
45
47
  }, null, 8, ["label", "value", "disabled"]))), 128))
46
48
  ]),
47
49
  _: 1
48
- }, 16, ["model-value", "loading"]));
50
+ }, 16, ["model-value", "loading", "size"]));
49
51
  }
50
52
  });
51
- B.install = (e) => {
52
- e.component(B.name ?? "EeDictSelect", B);
53
+ le.install = (e) => {
54
+ e.component(le.name ?? "EeDictSelect", le);
53
55
  };
54
- const z = /* @__PURE__ */ F({
56
+ const oe = /* @__PURE__ */ K({
55
57
  name: "EeStatusTag",
56
58
  __name: "index",
57
59
  props: {
@@ -62,17 +64,17 @@ const z = /* @__PURE__ */ F({
62
64
  defaultEffect: { default: "light" }
63
65
  },
64
66
  setup(e) {
65
- const y = e, r = $(() => y.mapping.find((p) => p.value === y.value));
66
- return (p, b) => {
67
- var c, d;
68
- return t(), s(o(X), S(p.$attrs, {
69
- type: ((c = r.value) == null ? void 0 : c.type) ?? e.defaultType,
70
- effect: ((d = r.value) == null ? void 0 : d.effect) ?? e.defaultEffect
67
+ const n = e, l = C(() => n.mapping.find((a) => a.value === n.value));
68
+ return (a, r) => {
69
+ var m, p;
70
+ return i(), f(t(za), R(a.$attrs, {
71
+ type: ((m = l.value) == null ? void 0 : m.type) ?? e.defaultType,
72
+ effect: ((p = l.value) == null ? void 0 : p.effect) ?? e.defaultEffect
71
73
  }), {
72
- default: i(() => {
73
- var a;
74
+ default: d(() => {
75
+ var V;
74
76
  return [
75
- w(x(((a = r.value) == null ? void 0 : a.label) ?? e.fallbackLabel ?? e.value), 1)
77
+ S(F(((V = l.value) == null ? void 0 : V.label) ?? e.fallbackLabel ?? e.value), 1)
76
78
  ];
77
79
  }),
78
80
  _: 1
@@ -80,10 +82,10 @@ const z = /* @__PURE__ */ F({
80
82
  };
81
83
  }
82
84
  });
83
- z.install = (e) => {
84
- e.component(z.name ?? "EeStatusTag", z);
85
+ oe.install = (e) => {
86
+ e.component(oe.name ?? "EeStatusTag", oe);
85
87
  };
86
- const ne = { class: "ee-search-bar" }, ue = /* @__PURE__ */ F({
88
+ const Pa = { class: "ee-search-bar" }, xa = /* @__PURE__ */ K({
87
89
  name: "EeSearchBar",
88
90
  __name: "index",
89
91
  props: {
@@ -92,120 +94,129 @@ const ne = { class: "ee-search-bar" }, ue = /* @__PURE__ */ F({
92
94
  inline: { type: Boolean, default: !0 },
93
95
  labelWidth: { default: "auto" },
94
96
  collapsible: { type: Boolean, default: !1 },
95
- collapsedCount: { default: 3 }
97
+ collapsedCount: { default: 3 },
98
+ size: { default: "default" }
96
99
  },
97
100
  emits: ["update:modelValue", "search", "reset"],
98
- setup(e, { emit: y }) {
99
- const r = e, p = y, b = U(), c = U(!1), d = $(() => {
100
- const n = 24 - a.value.reduce((u, V) => u + (V.span ?? 6), 0) % 24;
101
- return n === 24 ? 6 : n;
102
- }), a = $(() => !r.collapsible || c.value ? r.fields : r.fields.slice(0, r.collapsedCount));
103
- function f() {
104
- p("search", { ...r.modelValue });
101
+ setup(e, { emit: n }) {
102
+ const l = e, a = n, r = T(), m = T(!1), p = C(() => {
103
+ const u = 24 - V.value.reduce((c, b) => c + (b.span ?? 6), 0) % 24;
104
+ return u === 24 ? 6 : u;
105
+ }), V = C(() => !l.collapsible || m.value ? l.fields : l.fields.slice(0, l.collapsedCount));
106
+ function k() {
107
+ a("search", { ...l.modelValue });
105
108
  }
106
- function m() {
107
- const l = {};
108
- r.fields.forEach((n) => {
109
- l[n.prop] = "";
110
- }), p("update:modelValue", l), p("reset");
109
+ function g() {
110
+ const o = {};
111
+ l.fields.forEach((u) => {
112
+ o[u.prop] = "";
113
+ }), a("update:modelValue", o), a("reset");
111
114
  }
112
- return (l, n) => (t(), h("div", ne, [
113
- g(o(H), S({
115
+ return (o, u) => (i(), D("div", Pa, [
116
+ w(t(be), R({
114
117
  ref_key: "formRef",
115
- ref: b,
118
+ ref: r,
116
119
  model: e.modelValue,
117
120
  inline: e.inline,
118
- "label-width": e.labelWidth
119
- }, l.$attrs), {
120
- default: i(() => [
121
- g(o(J), null, {
122
- default: i(() => [
123
- (t(!0), h(k, null, E(a.value, (u) => (t(), s(o(P), {
124
- key: u.prop,
125
- span: u.span ?? 6
121
+ "label-width": e.labelWidth,
122
+ size: e.size
123
+ }, o.$attrs), {
124
+ default: d(() => [
125
+ w(t(pe), null, {
126
+ default: d(() => [
127
+ (i(!0), D(B, null, A(V.value, (c) => (i(), f(t(X), {
128
+ key: c.prop,
129
+ span: c.span ?? 6
126
130
  }, {
127
- default: i(() => [
128
- g(o(W), {
129
- label: u.label,
130
- prop: u.prop
131
+ default: d(() => [
132
+ w(t(Y), {
133
+ label: c.label,
134
+ prop: c.prop
131
135
  }, {
132
- default: i(() => [
133
- (u.type ?? "input") === "input" ? (t(), s(o(L), {
136
+ default: d(() => [
137
+ (c.type ?? "input") === "input" ? (i(), f(t(Z), {
134
138
  key: 0,
135
- modelValue: e.modelValue[u.prop],
136
- "onUpdate:modelValue": (V) => e.modelValue[u.prop] = V,
137
- placeholder: u.placeholder ?? `请输入${u.label}`,
139
+ modelValue: e.modelValue[c.prop],
140
+ "onUpdate:modelValue": (b) => e.modelValue[c.prop] = b,
141
+ placeholder: c.placeholder ?? `请输入${c.label}`,
138
142
  clearable: ""
139
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : u.type === "select" ? (t(), s(o(N), {
143
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : c.type === "select" ? (i(), f(t(se), {
140
144
  key: 1,
141
- modelValue: e.modelValue[u.prop],
142
- "onUpdate:modelValue": (V) => e.modelValue[u.prop] = V,
143
- placeholder: u.placeholder ?? `请选择${u.label}`,
145
+ modelValue: e.modelValue[c.prop],
146
+ "onUpdate:modelValue": (b) => e.modelValue[c.prop] = b,
147
+ placeholder: c.placeholder ?? `请选择${c.label}`,
144
148
  clearable: ""
145
149
  }, {
146
- default: i(() => [
147
- (t(!0), h(k, null, E(u.options ?? [], (V) => (t(), s(o(M), {
148
- key: V.value,
149
- label: V.label,
150
- value: V.value
150
+ default: d(() => [
151
+ (i(!0), D(B, null, A(c.options ?? [], (b) => (i(), f(t(de), {
152
+ key: b.value,
153
+ label: b.label,
154
+ value: b.value
151
155
  }, null, 8, ["label", "value"]))), 128))
152
156
  ]),
153
157
  _: 2
154
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : u.type === "date" ? (t(), s(o(q), {
158
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : c.type === "date" ? (i(), f(t(J), {
155
159
  key: 2,
156
- modelValue: e.modelValue[u.prop],
157
- "onUpdate:modelValue": (V) => e.modelValue[u.prop] = V,
158
- placeholder: u.placeholder ?? `请选择${u.label}`,
160
+ modelValue: e.modelValue[c.prop],
161
+ "onUpdate:modelValue": (b) => e.modelValue[c.prop] = b,
162
+ placeholder: c.placeholder ?? `请选择${c.label}`,
159
163
  style: { width: "100%" }
160
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : u.type === "date-range" ? (t(), s(o(q), {
164
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : c.type === "date-range" ? (i(), f(t(J), {
161
165
  key: 3,
162
- modelValue: e.modelValue[u.prop],
163
- "onUpdate:modelValue": (V) => e.modelValue[u.prop] = V,
166
+ modelValue: e.modelValue[c.prop],
167
+ "onUpdate:modelValue": (b) => e.modelValue[c.prop] = b,
164
168
  type: "daterange",
165
- "range-separator": u.placeholder ?? "至",
166
- "start-placeholder": u.placeholder ?? "开始日期",
167
- "end-placeholder": u.placeholder ?? "结束日期",
169
+ "range-separator": c.placeholder ?? "至",
170
+ "start-placeholder": c.placeholder ?? "开始日期",
171
+ "end-placeholder": c.placeholder ?? "结束日期",
168
172
  style: { width: "100%" }
169
- }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : u.component ? (t(), s(G(u.component), {
173
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : c.component ? (i(), f(Re(c.component), {
170
174
  key: 4,
171
- modelValue: e.modelValue[u.prop],
172
- "onUpdate:modelValue": (V) => e.modelValue[u.prop] = V
173
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : v("", !0)
175
+ modelValue: e.modelValue[c.prop],
176
+ "onUpdate:modelValue": (b) => e.modelValue[c.prop] = b
177
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : P("", !0)
174
178
  ]),
175
179
  _: 2
176
180
  }, 1032, ["label", "prop"])
177
181
  ]),
178
182
  _: 2
179
183
  }, 1032, ["span"]))), 128)),
180
- g(o(P), { span: d.value }, {
181
- default: i(() => [
182
- g(o(W), null, {
183
- default: i(() => [
184
- g(o(D), {
184
+ w(t(X), { span: p.value }, {
185
+ default: d(() => [
186
+ w(t(Y), null, {
187
+ default: d(() => [
188
+ w(t(E), {
185
189
  type: "primary",
186
- onClick: f
190
+ size: e.size,
191
+ round: "",
192
+ onClick: k
187
193
  }, {
188
- default: i(() => [...n[1] || (n[1] = [
189
- w(" 搜索 ", -1)
194
+ default: d(() => [...u[1] || (u[1] = [
195
+ S(" 搜索 ", -1)
190
196
  ])]),
191
197
  _: 1
192
- }),
193
- g(o(D), { onClick: m }, {
194
- default: i(() => [...n[2] || (n[2] = [
195
- w(" 重置 ", -1)
198
+ }, 8, ["size"]),
199
+ w(t(E), {
200
+ size: e.size,
201
+ round: "",
202
+ onClick: g
203
+ }, {
204
+ default: d(() => [...u[2] || (u[2] = [
205
+ S(" 重置 ", -1)
196
206
  ])]),
197
207
  _: 1
198
- }),
199
- e.collapsible && e.fields.length > e.collapsedCount ? (t(), s(o(D), {
208
+ }, 8, ["size"]),
209
+ e.collapsible && e.fields.length > e.collapsedCount ? (i(), f(t(E), {
200
210
  key: 0,
201
211
  text: "",
202
- onClick: n[0] || (n[0] = (u) => c.value = !c.value)
212
+ size: e.size,
213
+ onClick: u[0] || (u[0] = (c) => m.value = !m.value)
203
214
  }, {
204
- default: i(() => [
205
- w(x(c.value ? "收起" : "展开"), 1)
215
+ default: d(() => [
216
+ S(F(m.value ? "收起" : "展开"), 1)
206
217
  ]),
207
218
  _: 1
208
- })) : v("", !0)
219
+ }, 8, ["size"])) : P("", !0)
209
220
  ]),
210
221
  _: 1
211
222
  })
@@ -217,19 +228,19 @@ const ne = { class: "ee-search-bar" }, ue = /* @__PURE__ */ F({
217
228
  })
218
229
  ]),
219
230
  _: 1
220
- }, 16, ["model", "inline", "label-width"])
231
+ }, 16, ["model", "inline", "label-width", "size"])
221
232
  ]));
222
233
  }
223
- }), j = (e, y) => {
224
- const r = e.__vccOpts || e;
225
- for (const [p, b] of y)
226
- r[p] = b;
227
- return r;
228
- }, C = /* @__PURE__ */ j(ue, [["__scopeId", "data-v-64bb08e9"]]);
229
- C.install = (e) => {
230
- e.component(C.name ?? "EeSearchBar", C);
234
+ }), Ne = (e, n) => {
235
+ const l = e.__vccOpts || e;
236
+ for (const [a, r] of n)
237
+ l[a] = r;
238
+ return l;
239
+ }, ne = /* @__PURE__ */ Ne(xa, [["__scopeId", "data-v-b65c74a4"]]);
240
+ ne.install = (e) => {
241
+ e.component(ne.name ?? "EeSearchBar", ne);
231
242
  };
232
- const re = { class: "ee-form-dialog-footer" }, de = /* @__PURE__ */ F({
243
+ const Ta = { class: "ee-form-dialog-footer" }, Ua = /* @__PURE__ */ K({
233
244
  name: "EeFormDialog",
234
245
  __name: "index",
235
246
  props: {
@@ -240,13 +251,14 @@ const re = { class: "ee-form-dialog-footer" }, de = /* @__PURE__ */ F({
240
251
  rules: {},
241
252
  width: { default: "600px" },
242
253
  labelWidth: { default: "auto" },
243
- loading: { type: Boolean, default: !1 }
254
+ loading: { type: Boolean, default: !1 },
255
+ size: { default: "default" }
244
256
  },
245
257
  emits: ["update:modelValue", "submit", "cancel"],
246
- setup(e, { emit: y }) {
247
- const r = e, p = y, b = U(), c = $(() => {
248
- const f = {};
249
- for (const m of Object.keys(r))
258
+ setup(e, { emit: n }) {
259
+ const l = e, a = n, r = T(), m = C(() => {
260
+ const k = {};
261
+ for (const g of Object.keys(l))
250
262
  [
251
263
  "modelValue",
252
264
  "title",
@@ -256,143 +268,150 @@ const re = { class: "ee-form-dialog-footer" }, de = /* @__PURE__ */ F({
256
268
  "width",
257
269
  "labelWidth",
258
270
  "loading"
259
- ].includes(m) || (f[m] = r[m]);
260
- return f;
271
+ ].includes(g) || (k[g] = l[g]);
272
+ return k;
261
273
  });
262
- function d() {
263
- p("update:modelValue", !1), p("cancel");
274
+ function p() {
275
+ a("update:modelValue", !1), a("cancel");
264
276
  }
265
- async function a() {
266
- if (b.value)
277
+ async function V() {
278
+ if (r.value)
267
279
  try {
268
- await b.value.validate(), p("submit", { ...r.formData });
280
+ await r.value.validate(), a("submit", { ...l.formData });
269
281
  } catch {
270
282
  }
271
283
  }
272
- return (f, m) => (t(), s(o(Y), S(f.$attrs, {
284
+ return (k, g) => (i(), f(t(ye), R(k.$attrs, {
273
285
  "model-value": e.modelValue,
274
286
  title: e.title,
275
287
  width: e.width,
276
- "onUpdate:modelValue": m[0] || (m[0] = (l) => p("update:modelValue", l)),
277
- onClose: d
288
+ "onUpdate:modelValue": g[0] || (g[0] = (o) => a("update:modelValue", o)),
289
+ onClose: p
278
290
  }), {
279
- footer: i(() => [
280
- A("span", re, [
281
- g(o(D), { onClick: d }, {
282
- default: i(() => [...m[1] || (m[1] = [
283
- w("取消", -1)
291
+ footer: d(() => [
292
+ ue("span", Ta, [
293
+ w(t(E), {
294
+ size: e.size,
295
+ round: "",
296
+ onClick: p
297
+ }, {
298
+ default: d(() => [...g[1] || (g[1] = [
299
+ S("取消", -1)
284
300
  ])]),
285
301
  _: 1
286
- }),
287
- g(o(D), {
302
+ }, 8, ["size"]),
303
+ w(t(E), {
288
304
  type: "primary",
305
+ size: e.size,
306
+ round: "",
289
307
  loading: e.loading,
290
- onClick: a
308
+ onClick: V
291
309
  }, {
292
- default: i(() => [...m[2] || (m[2] = [
293
- w(" 确定 ", -1)
310
+ default: d(() => [...g[2] || (g[2] = [
311
+ S(" 确定 ", -1)
294
312
  ])]),
295
313
  _: 1
296
- }, 8, ["loading"])
314
+ }, 8, ["size", "loading"])
297
315
  ])
298
316
  ]),
299
- default: i(() => [
300
- g(o(H), S({
317
+ default: d(() => [
318
+ w(t(be), R({
301
319
  ref_key: "formRef",
302
- ref: b,
320
+ ref: r,
303
321
  model: e.formData,
304
322
  rules: e.rules,
305
- "label-width": e.labelWidth
306
- }, c.value), {
307
- default: i(() => [
308
- g(o(J), { gutter: 20 }, {
309
- default: i(() => [
310
- (t(!0), h(k, null, E(e.fields, (l) => (t(), s(o(P), {
311
- key: l.prop,
312
- span: l.span ?? 24
323
+ "label-width": e.labelWidth,
324
+ size: e.size
325
+ }, m.value), {
326
+ default: d(() => [
327
+ w(t(pe), { gutter: 20 }, {
328
+ default: d(() => [
329
+ (i(!0), D(B, null, A(e.fields, (o) => (i(), f(t(X), {
330
+ key: o.prop,
331
+ span: o.span ?? 24
313
332
  }, {
314
- default: i(() => [
315
- g(o(W), {
316
- label: l.label,
317
- prop: l.prop
333
+ default: d(() => [
334
+ w(t(Y), {
335
+ label: o.label,
336
+ prop: o.prop
318
337
  }, {
319
- default: i(() => [
320
- (l.type ?? "input") === "input" ? (t(), s(o(L), {
338
+ default: d(() => [
339
+ (o.type ?? "input") === "input" ? (i(), f(t(Z), {
321
340
  key: 0,
322
- modelValue: e.formData[l.prop],
323
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n,
324
- placeholder: l.placeholder ?? `请输入${l.label}`
325
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : l.type === "textarea" ? (t(), s(o(L), {
341
+ modelValue: e.formData[o.prop],
342
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u,
343
+ placeholder: o.placeholder ?? `请输入${o.label}`
344
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : o.type === "textarea" ? (i(), f(t(Z), {
326
345
  key: 1,
327
- modelValue: e.formData[l.prop],
328
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n,
346
+ modelValue: e.formData[o.prop],
347
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u,
329
348
  type: "textarea",
330
- placeholder: l.placeholder ?? `请输入${l.label}`,
349
+ placeholder: o.placeholder ?? `请输入${o.label}`,
331
350
  rows: 3
332
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : l.type === "select" ? (t(), s(o(N), {
351
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : o.type === "select" ? (i(), f(t(se), {
333
352
  key: 2,
334
- modelValue: e.formData[l.prop],
335
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n,
336
- placeholder: l.placeholder ?? `请选择${l.label}`,
353
+ modelValue: e.formData[o.prop],
354
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u,
355
+ placeholder: o.placeholder ?? `请选择${o.label}`,
337
356
  style: { width: "100%" }
338
357
  }, {
339
- default: i(() => [
340
- (t(!0), h(k, null, E(l.options ?? [], (n) => (t(), s(o(M), {
341
- key: n.value,
342
- label: n.label,
343
- value: n.value
358
+ default: d(() => [
359
+ (i(!0), D(B, null, A(o.options ?? [], (u) => (i(), f(t(de), {
360
+ key: u.value,
361
+ label: u.label,
362
+ value: u.value
344
363
  }, null, 8, ["label", "value"]))), 128))
345
364
  ]),
346
365
  _: 2
347
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : l.type === "radio" ? (t(), s(o(Z), {
366
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : o.type === "radio" ? (i(), f(t(Ie), {
348
367
  key: 3,
349
- modelValue: e.formData[l.prop],
350
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n
368
+ modelValue: e.formData[o.prop],
369
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u
351
370
  }, {
352
- default: i(() => [
353
- (t(!0), h(k, null, E(l.options ?? [], (n) => (t(), s(o(_), {
354
- key: n.value,
355
- label: n.value
371
+ default: d(() => [
372
+ (i(!0), D(B, null, A(o.options ?? [], (u) => (i(), f(t(we), {
373
+ key: u.value,
374
+ label: u.value
356
375
  }, {
357
- default: i(() => [
358
- w(x(n.label), 1)
376
+ default: d(() => [
377
+ S(F(u.label), 1)
359
378
  ]),
360
379
  _: 2
361
380
  }, 1032, ["label"]))), 128))
362
381
  ]),
363
382
  _: 2
364
- }, 1032, ["modelValue", "onUpdate:modelValue"])) : l.type === "checkbox" ? (t(), s(o(ee), {
383
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : o.type === "checkbox" ? (i(), f(t(Ce), {
365
384
  key: 4,
366
- modelValue: e.formData[l.prop],
367
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n
385
+ modelValue: e.formData[o.prop],
386
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u
368
387
  }, {
369
- default: i(() => [
370
- (t(!0), h(k, null, E(l.options ?? [], (n) => (t(), s(o(le), {
371
- key: n.value,
372
- label: n.value
388
+ default: d(() => [
389
+ (i(!0), D(B, null, A(o.options ?? [], (u) => (i(), f(t(ze), {
390
+ key: u.value,
391
+ label: u.value
373
392
  }, {
374
- default: i(() => [
375
- w(x(n.label), 1)
393
+ default: d(() => [
394
+ S(F(u.label), 1)
376
395
  ]),
377
396
  _: 2
378
397
  }, 1032, ["label"]))), 128))
379
398
  ]),
380
399
  _: 2
381
- }, 1032, ["modelValue", "onUpdate:modelValue"])) : l.type === "switch" ? (t(), s(o(ae), {
400
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : o.type === "switch" ? (i(), f(t(Va), {
382
401
  key: 5,
383
- modelValue: e.formData[l.prop],
384
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n
385
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : l.type === "date" ? (t(), s(o(q), {
402
+ modelValue: e.formData[o.prop],
403
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u
404
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : o.type === "date" ? (i(), f(t(J), {
386
405
  key: 6,
387
- modelValue: e.formData[l.prop],
388
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n,
389
- placeholder: l.placeholder ?? `请选择${l.label}`,
406
+ modelValue: e.formData[o.prop],
407
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u,
408
+ placeholder: o.placeholder ?? `请选择${o.label}`,
390
409
  style: { width: "100%" }
391
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : l.component ? (t(), s(G(l.component), {
410
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : o.component ? (i(), f(Re(o.component), {
392
411
  key: 7,
393
- modelValue: e.formData[l.prop],
394
- "onUpdate:modelValue": (n) => e.formData[l.prop] = n
395
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : v("", !0)
412
+ modelValue: e.formData[o.prop],
413
+ "onUpdate:modelValue": (u) => e.formData[o.prop] = u
414
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : P("", !0)
396
415
  ]),
397
416
  _: 2
398
417
  }, 1032, ["label", "prop"])
@@ -404,141 +423,1273 @@ const re = { class: "ee-form-dialog-footer" }, de = /* @__PURE__ */ F({
404
423
  })
405
424
  ]),
406
425
  _: 1
407
- }, 16, ["model", "rules", "label-width"])
426
+ }, 16, ["model", "rules", "label-width", "size"])
408
427
  ]),
409
428
  _: 1
410
429
  }, 16, ["model-value", "title", "width"]));
411
430
  }
412
- }), T = /* @__PURE__ */ j(de, [["__scopeId", "data-v-0307e8cf"]]);
413
- T.install = (e) => {
414
- e.component(T.name ?? "EeFormDialog", T);
431
+ }), ie = /* @__PURE__ */ Ne(Ua, [["__scopeId", "data-v-560e642c"]]);
432
+ ie.install = (e) => {
433
+ e.component(ie.name ?? "EeFormDialog", ie);
415
434
  };
416
- const se = { class: "ee-form-table" }, me = {
417
- key: 1,
418
- class: "ee-form-table-toolbar"
419
- }, ie = {
420
- key: 2,
421
- class: "ee-form-table-pagination"
422
- }, pe = /* @__PURE__ */ F({
435
+ const Le = [10, 20, 50, 100], Fa = "total, sizes, prev, pager, next, jumper", Te = {
436
+ show: !0,
437
+ cols: 3,
438
+ maxRow: 2,
439
+ foldable: !0,
440
+ foldDefault: !0
441
+ }, Ue = { show: !1 }, he = {
442
+ show: !0,
443
+ pageSize: 20,
444
+ pageSizes: Le,
445
+ background: !0
446
+ }, Ba = { show: !1 }, Fe = {
447
+ show: !0,
448
+ showView: !1,
449
+ showEdit: !0,
450
+ showDelete: !0,
451
+ confirmDelete: !0,
452
+ deleteConfirmTitle: "确认删除",
453
+ deleteConfirmMessage: "确定要删除该条数据吗?"
454
+ }, Be = { show: !1 }, Aa = {
455
+ show: !0,
456
+ showAdd: !1,
457
+ showImport: !1,
458
+ showExport: !1,
459
+ showBatchDelete: !1
460
+ }, Ae = { show: !1 }, Ra = {
461
+ mode: "drawer",
462
+ width: "40%",
463
+ closeOnReset: !0,
464
+ addTitle: "新增",
465
+ editTitle: "编辑"
466
+ }, Oa = [
467
+ "data",
468
+ "loading",
469
+ "size",
470
+ "stripe",
471
+ "border",
472
+ "height",
473
+ "max-height",
474
+ "highlight-current-row",
475
+ "row-key"
476
+ ], Ia = [
477
+ "prop",
478
+ "label",
479
+ "width",
480
+ "minWidth",
481
+ "align",
482
+ "fixed",
483
+ "sortable",
484
+ "show",
485
+ "formatter",
486
+ "dictKey",
487
+ "slotName",
488
+ "search",
489
+ "auth",
490
+ "children",
491
+ "className"
492
+ ];
493
+ function Na(e) {
494
+ const n = C(() => !!e.authChecker);
495
+ function l(a) {
496
+ return !a || !e.authChecker ? !0 : e.authChecker(a);
497
+ }
498
+ return { authPass: l, authEnabled: n };
499
+ }
500
+ function La(e) {
501
+ function n(a, r) {
502
+ var m;
503
+ return a || (r && ((m = e.dictMap) != null && m[r]) ? e.dictMap[r] : []);
504
+ }
505
+ function l(a, r) {
506
+ var p;
507
+ if (!a || !((p = e.dictMap) != null && p[a])) return String(r ?? "");
508
+ const m = e.dictMap[a].find((V) => V.value === r);
509
+ return (m == null ? void 0 : m.label) ?? String(r ?? "");
510
+ }
511
+ return { resolvedDict: n, dictLabel: l };
512
+ }
513
+ function Ma(e) {
514
+ const n = T(!0), l = Oe({}), a = C(() => e.searchConfig === !1 ? Ue : e.searchConfig === !0 ? { ...Te } : e.searchConfig ? { ...Te, ...e.searchConfig } : Ue), r = C(() => a.value.show), m = C(() => a.value.cols || 3), p = C(() => e.columns.filter((h) => {
515
+ var z;
516
+ return (z = h.search) == null ? void 0 : z.enable;
517
+ }).map((h) => {
518
+ const z = h.search;
519
+ return {
520
+ ...z,
521
+ prop: h.prop,
522
+ label: h.label,
523
+ field: z.field || h.prop,
524
+ placeholder: z.placeholder || h.label,
525
+ dictKey: h.dictKey,
526
+ props: z.props || {}
527
+ };
528
+ })), V = C(() => a.value.maxRow || 2), k = C(() => m.value * V.value), g = C(
529
+ () => a.value.foldable !== !1 && p.value.length > k.value
530
+ );
531
+ Q(() => {
532
+ a.value.foldDefault !== !1 && (n.value = !1);
533
+ });
534
+ const o = C(() => !n.value && g.value ? p.value.slice(0, k.value) : p.value), u = C(() => 24 / m.value);
535
+ function c() {
536
+ p.value.forEach((h) => {
537
+ l[h.field] = h.defaultValue ?? "";
538
+ });
539
+ }
540
+ function b() {
541
+ const h = {};
542
+ return p.value.forEach((z) => {
543
+ h[z.field] = z.defaultValue ?? "";
544
+ }), h;
545
+ }
546
+ function O() {
547
+ const h = {};
548
+ for (const [z, N] of Object.entries(l))
549
+ N !== "" && N !== null && N !== void 0 && (h[z] = N);
550
+ return h;
551
+ }
552
+ function M() {
553
+ Object.assign(l, b());
554
+ }
555
+ function H() {
556
+ n.value = !n.value;
557
+ }
558
+ return {
559
+ searchExpanded: n,
560
+ searchParams: l,
561
+ searchCfg: a,
562
+ showSearch: r,
563
+ searchCols: m,
564
+ allSearchFields: p,
565
+ visibleSearchFields: o,
566
+ showFoldBtn: g,
567
+ actionColSpan: u,
568
+ initSearchParams: c,
569
+ getDefaultSearchParams: b,
570
+ getActiveSearchParams: O,
571
+ resetSearchParams: M,
572
+ toggleFold: H
573
+ };
574
+ }
575
+ function Ha(e) {
576
+ const n = Oe({ current: 1, pageSize: 20, total: 0 }), l = C(() => e.pagination === !1 ? Ba : e.pagination === !0 ? { ...he } : e.pagination ? { ...he, ...e.pagination } : { ...he, show: !0 }), a = C(() => l.value.show !== !1), r = C(() => l.value.pageSizes || Le), m = C(
577
+ () => l.value.layout || Fa
578
+ ), p = C(() => l.value.background !== !1);
579
+ Q(() => {
580
+ e.pagination && typeof e.pagination == "object" && (e.pagination.pageSize && (n.pageSize = e.pagination.pageSize), e.pagination.total !== void 0 && (n.total = e.pagination.total));
581
+ }), ve(
582
+ () => e.pagination,
583
+ (o) => {
584
+ typeof o == "object" && o && (o.total !== void 0 && (n.total = o.total), o.pageSize && (n.pageSize = o.pageSize));
585
+ },
586
+ { deep: !0 }
587
+ );
588
+ function V(o) {
589
+ n.current = o;
590
+ }
591
+ function k(o) {
592
+ n.pageSize = o;
593
+ }
594
+ function g() {
595
+ n.current = 1;
596
+ }
597
+ return {
598
+ pageState: n,
599
+ paginationCfg: l,
600
+ showPagination: a,
601
+ pageSizesComputed: r,
602
+ paginationLayoutComputed: m,
603
+ paginationBgComputed: p,
604
+ setPage: V,
605
+ setPageSize: k,
606
+ resetPage: g
607
+ };
608
+ }
609
+ function Ga(e, n) {
610
+ const l = T(), a = T([]), r = T(null), m = T(!1), p = T([]), V = C(() => ({
611
+ show: !1,
612
+ type: "multiple",
613
+ reserveSelection: !1,
614
+ ...e.selectionConfig
615
+ })), k = C(() => ({
616
+ show: !1,
617
+ ...e.columnSetting
618
+ })), g = C(() => k.value.show), o = C(() => e.columns.filter((h) => h.prop));
619
+ Q(() => {
620
+ p.value = o.value.map((h) => h.prop);
621
+ }), ve(
622
+ () => e.columns,
623
+ () => {
624
+ p.value = [
625
+ .../* @__PURE__ */ new Set([
626
+ ...p.value.filter((h) => o.value.some((z) => z.prop === h)),
627
+ ...o.value.map((h) => h.prop)
628
+ ])
629
+ ];
630
+ },
631
+ { deep: !0 }
632
+ );
633
+ const u = C(
634
+ () => o.value.filter(
635
+ (h) => h.show !== !1 && p.value.includes(h.prop) && n.authPass(h.auth)
636
+ )
637
+ ), c = C(() => e.tableHeight || void 0), b = C(() => e.tableMaxHeight || void 0), O = C(() => e.autoHeight ? { minHeight: `calc(100vh - ${(typeof e.autoHeight == "object" ? e.autoHeight : {}).offset || 200}px)` } : {});
638
+ function M(h) {
639
+ a.value = h;
640
+ }
641
+ function H(h) {
642
+ const z = e.rowKey || "id";
643
+ r.value = h[z], a.value = [h];
644
+ }
645
+ return {
646
+ tableRef: l,
647
+ selection: a,
648
+ singleSelection: r,
649
+ columnSettingVisible: m,
650
+ checkedColumns: p,
651
+ selectionCfg: V,
652
+ columnSettingCfg: k,
653
+ showColumnSetting: g,
654
+ allColumns: o,
655
+ visibleColumns: u,
656
+ tableComputedHeight: c,
657
+ tableMaxHeightProp: b,
658
+ tableWrapperStyle: O,
659
+ handleSelectionChange: M,
660
+ handleSingleSelect: H
661
+ };
662
+ }
663
+ function ja(e, n) {
664
+ const l = T([]), a = T(!1), r = C(() => {
665
+ var u;
666
+ return !!((u = e.crudConfig) != null && u.api.list);
667
+ });
668
+ async function m() {
669
+ var u;
670
+ if ((u = e.crudConfig) != null && u.api.list) {
671
+ a.value = !0;
672
+ try {
673
+ const c = {
674
+ page: n.pageState.current,
675
+ pageSize: n.pageState.pageSize,
676
+ ...e.crudConfig.baseParams
677
+ }, b = n.getActiveSearchParams();
678
+ Object.assign(c, b);
679
+ const O = await e.crudConfig.api.list(c);
680
+ l.value = O.data || [], n.setTotal(O.total ?? 0);
681
+ } catch (c) {
682
+ n.emit("request-error", c), L.error((c == null ? void 0 : c.message) || "请求失败");
683
+ } finally {
684
+ a.value = !1;
685
+ }
686
+ }
687
+ }
688
+ async function p() {
689
+ n.resetPage(), await m();
690
+ }
691
+ async function V(u) {
692
+ var c;
693
+ if (!((c = e.crudConfig) != null && c.api.delete)) {
694
+ n.emit("delete", u);
695
+ return;
696
+ }
697
+ a.value = !0;
698
+ try {
699
+ const b = u[e.rowKey || "id"];
700
+ await e.crudConfig.api.delete(b), L.success("删除成功"), n.emit("delete-success"), await m();
701
+ } catch (b) {
702
+ n.emit("request-error", b), L.error((b == null ? void 0 : b.message) || "删除失败");
703
+ } finally {
704
+ a.value = !1;
705
+ }
706
+ }
707
+ async function k(u, c, b, O) {
708
+ if (!c) {
709
+ await V(u);
710
+ return;
711
+ }
712
+ try {
713
+ await Pe.confirm(
714
+ O || "确定要删除该条数据吗?",
715
+ b || "确认删除",
716
+ { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }
717
+ ), await V(u);
718
+ } catch {
719
+ }
720
+ }
721
+ async function g(u) {
722
+ var c;
723
+ if (!((c = e.crudConfig) != null && c.api.batchDelete)) {
724
+ n.emit("batch-delete", u);
725
+ return;
726
+ }
727
+ a.value = !0;
728
+ try {
729
+ await e.crudConfig.api.batchDelete(u), L.success("批量删除成功"), n.emit("batch-delete-success"), n.selection.value = [], await m();
730
+ } catch (b) {
731
+ n.emit("request-error", b), L.error((b == null ? void 0 : b.message) || "批量删除失败");
732
+ } finally {
733
+ a.value = !1;
734
+ }
735
+ }
736
+ async function o() {
737
+ const u = n.selection.value;
738
+ if (u.length !== 0)
739
+ try {
740
+ await Pe.confirm(
741
+ `确定要删除选中的 ${u.length} 条数据吗?`,
742
+ "确认批量删除",
743
+ { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }
744
+ );
745
+ const c = u.map((b) => b[e.rowKey || "id"]);
746
+ await g(c);
747
+ } catch {
748
+ }
749
+ }
750
+ return {
751
+ internalData: l,
752
+ loadingState: a,
753
+ hasCrud: r,
754
+ fetchData: m,
755
+ refreshTable: p,
756
+ doDelete: V,
757
+ handleDelete: k,
758
+ doBatchDelete: g,
759
+ handleBatchDelete: o
760
+ };
761
+ }
762
+ function Ka(e) {
763
+ const n = T(!1), l = T(!1), a = T(null), r = T({}), m = T(!1), p = {
764
+ ...Ra,
765
+ ...e.drawerConfig
766
+ }, V = p.mode || "drawer";
767
+ function k() {
768
+ l.value = !1, a.value = null, r.value = {}, n.value = !0;
769
+ }
770
+ function g(u) {
771
+ l.value = !0, a.value = u, r.value = { ...u }, n.value = !0;
772
+ }
773
+ function o() {
774
+ n.value = !1;
775
+ }
776
+ return {
777
+ formVisible: n,
778
+ isEditing: l,
779
+ editingRow: a,
780
+ formData: r,
781
+ saving: m,
782
+ drawerMode: V,
783
+ drawerCfg: p,
784
+ openAdd: k,
785
+ openEdit: g,
786
+ closeForm: o
787
+ };
788
+ }
789
+ function Wa(e, n) {
790
+ const l = T(!1);
791
+ async function a() {
792
+ var r, m, p, V, k;
793
+ l.value = !0, n.setLoading(!0);
794
+ try {
795
+ const g = await import("xlsx").catch(() => null);
796
+ if (!g) {
797
+ L.warning("请安装 xlsx 依赖: npm install xlsx");
798
+ return;
799
+ }
800
+ const o = ((r = e.exportConfig) == null ? void 0 : r.mode) || "current";
801
+ let u;
802
+ if (o === "all" && ((p = (m = e.crudConfig) == null ? void 0 : m.api) != null && p.list)) {
803
+ const h = {
804
+ page: 1,
805
+ pageSize: 99999,
806
+ ...e.crudConfig.baseParams
807
+ }, z = n.getActiveSearchParams();
808
+ Object.assign(h, z), u = (await e.crudConfig.api.list(h)).data || [];
809
+ } else
810
+ u = [...n.getCurrentData()];
811
+ const c = ((V = e.exportConfig) == null ? void 0 : V.ignoreColumn) || [], b = n.visibleColumns.value.filter((h) => !c.includes(h.prop)).map((h) => ({ prop: h.prop, label: h.label })), O = [
812
+ b.map((h) => h.label),
813
+ ...u.map(
814
+ (h) => b.map((z) => {
815
+ var _;
816
+ if (z.prop === "action") return "";
817
+ const N = (_ = e.columns.find((ce) => ce.prop === z.prop)) == null ? void 0 : _.dictKey;
818
+ return N ? n.dictLabel(N, h[z.prop]) : h[z.prop] ?? "";
819
+ })
820
+ )
821
+ ], M = g.utils.aoa_to_sheet(O), H = g.utils.book_new();
822
+ g.utils.book_append_sheet(H, M, "Sheet1"), g.writeFile(H, ((k = e.exportConfig) == null ? void 0 : k.fileName) || "export.xlsx"), L.success("导出成功");
823
+ } catch (g) {
824
+ L.error((g == null ? void 0 : g.message) || "导出失败");
825
+ } finally {
826
+ n.setLoading(!1), l.value = !1;
827
+ }
828
+ }
829
+ return { handleExport: a, exporting: l };
830
+ }
831
+ const qa = {
832
+ key: 0,
833
+ class: "ee-search-area"
834
+ }, Xa = /* @__PURE__ */ K({
835
+ __name: "SearchArea",
836
+ props: {
837
+ showSearch: { type: Boolean },
838
+ searchParams: {},
839
+ visibleSearchFields: {},
840
+ searchCols: {},
841
+ actionColSpan: {},
842
+ showFoldBtn: { type: Boolean },
843
+ searchExpanded: { type: Boolean },
844
+ size: {},
845
+ resolveDict: { type: Function }
846
+ },
847
+ emits: ["search", "reset", "toggle-fold"],
848
+ setup(e) {
849
+ return (n, l) => e.showSearch ? (i(), D("div", qa, [
850
+ w(t(be), {
851
+ model: e.searchParams,
852
+ "label-width": "auto",
853
+ size: e.size
854
+ }, {
855
+ default: d(() => [
856
+ w(t(pe), { gutter: 12 }, {
857
+ default: d(() => [
858
+ (i(!0), D(B, null, A(e.visibleSearchFields, (a) => (i(), f(t(X), {
859
+ key: String(a.prop),
860
+ span: 24 / e.searchCols
861
+ }, {
862
+ default: d(() => [
863
+ w(t(Y), {
864
+ label: String(a.label)
865
+ }, {
866
+ default: d(() => [
867
+ a.type === "input" ? (i(), f(t(Z), R({
868
+ key: 0,
869
+ modelValue: e.searchParams[a.field],
870
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r,
871
+ placeholder: String(a.placeholder || `请输入${a.label}`),
872
+ clearable: ""
873
+ }, { ref_for: !0 }, a.props || {}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : a.type === "number" ? (i(), f(t(ka), R({
874
+ key: 1,
875
+ modelValue: e.searchParams[a.field],
876
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r,
877
+ placeholder: String(a.placeholder || `请输入${a.label}`),
878
+ style: { width: "100%" }
879
+ }, { ref_for: !0 }, a.props || {}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : a.type === "select" ? (i(), f(t(se), R({
880
+ key: 2,
881
+ modelValue: e.searchParams[a.field],
882
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r,
883
+ placeholder: String(a.placeholder || `请选择${a.label}`),
884
+ clearable: "",
885
+ style: { width: "100%" }
886
+ }, { ref_for: !0 }, a.props || {}), {
887
+ default: d(() => {
888
+ var r;
889
+ return [
890
+ (i(!0), D(B, null, A(e.resolveDict(
891
+ (r = a.props) == null ? void 0 : r.options,
892
+ a.dictKey
893
+ ), (m) => (i(), f(t(de), {
894
+ key: m.value,
895
+ label: m.label,
896
+ value: m.value
897
+ }, null, 8, ["label", "value"]))), 128))
898
+ ];
899
+ }),
900
+ _: 2
901
+ }, 1040, ["modelValue", "onUpdate:modelValue", "placeholder"])) : a.type === "radio" ? (i(), f(t(Ie), R({
902
+ key: 3,
903
+ modelValue: e.searchParams[a.field],
904
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r
905
+ }, { ref_for: !0 }, a.props || {}), {
906
+ default: d(() => {
907
+ var r;
908
+ return [
909
+ (i(!0), D(B, null, A(e.resolveDict(
910
+ (r = a.props) == null ? void 0 : r.options,
911
+ a.dictKey
912
+ ), (m) => (i(), f(t(we), {
913
+ key: m.value,
914
+ value: m.value
915
+ }, {
916
+ default: d(() => [
917
+ S(F(m.label), 1)
918
+ ]),
919
+ _: 2
920
+ }, 1032, ["value"]))), 128))
921
+ ];
922
+ }),
923
+ _: 2
924
+ }, 1040, ["modelValue", "onUpdate:modelValue"])) : a.type === "checkbox" ? (i(), f(t(Ce), R({
925
+ key: 4,
926
+ modelValue: e.searchParams[a.field],
927
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r
928
+ }, { ref_for: !0 }, a.props || {}), {
929
+ default: d(() => {
930
+ var r;
931
+ return [
932
+ (i(!0), D(B, null, A(e.resolveDict(
933
+ (r = a.props) == null ? void 0 : r.options,
934
+ a.dictKey
935
+ ), (m) => (i(), f(t(ze), {
936
+ key: m.value,
937
+ value: m.value,
938
+ label: m.label
939
+ }, null, 8, ["value", "label"]))), 128))
940
+ ];
941
+ }),
942
+ _: 2
943
+ }, 1040, ["modelValue", "onUpdate:modelValue"])) : a.type === "date" ? (i(), f(t(J), R({
944
+ key: 5,
945
+ modelValue: e.searchParams[a.field],
946
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r,
947
+ placeholder: String(a.placeholder || `请选择${a.label}`),
948
+ style: { width: "100%" }
949
+ }, { ref_for: !0 }, a.props || {}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : a.type === "date-range" ? (i(), f(t(J), R({
950
+ key: 6,
951
+ modelValue: e.searchParams[a.field],
952
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r,
953
+ type: "daterange",
954
+ "range-separator": "至",
955
+ "start-placeholder": "开始日期",
956
+ "end-placeholder": "结束日期",
957
+ style: { width: "100%" }
958
+ }, { ref_for: !0 }, a.props || {}), null, 16, ["modelValue", "onUpdate:modelValue"])) : a.type === "textarea" ? (i(), f(t(Z), R({
959
+ key: 7,
960
+ modelValue: e.searchParams[a.field],
961
+ "onUpdate:modelValue": (r) => e.searchParams[a.field] = r,
962
+ placeholder: String(a.placeholder || `请输入${a.label}`),
963
+ type: "textarea"
964
+ }, { ref_for: !0 }, a.props || {}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : P("", !0)
965
+ ]),
966
+ _: 2
967
+ }, 1032, ["label"])
968
+ ]),
969
+ _: 2
970
+ }, 1032, ["span"]))), 128)),
971
+ w(t(X), { span: e.actionColSpan }, {
972
+ default: d(() => [
973
+ w(t(Y), null, {
974
+ default: d(() => [
975
+ w(t(E), {
976
+ type: "primary",
977
+ round: "",
978
+ onClick: l[0] || (l[0] = (a) => n.$emit("search"))
979
+ }, {
980
+ default: d(() => [...l[3] || (l[3] = [
981
+ S("查询", -1)
982
+ ])]),
983
+ _: 1
984
+ }),
985
+ w(t(E), {
986
+ round: "",
987
+ onClick: l[1] || (l[1] = (a) => n.$emit("reset"))
988
+ }, {
989
+ default: d(() => [...l[4] || (l[4] = [
990
+ S("重置", -1)
991
+ ])]),
992
+ _: 1
993
+ }),
994
+ e.showFoldBtn ? (i(), f(t(E), {
995
+ key: 0,
996
+ text: "",
997
+ size: e.size,
998
+ onClick: l[2] || (l[2] = (a) => n.$emit("toggle-fold"))
999
+ }, {
1000
+ default: d(() => [
1001
+ S(F(e.searchExpanded ? "收起" : "展开"), 1)
1002
+ ]),
1003
+ _: 1
1004
+ }, 8, ["size"])) : P("", !0),
1005
+ I(n.$slots, "search-action", { params: e.searchParams })
1006
+ ]),
1007
+ _: 3
1008
+ })
1009
+ ]),
1010
+ _: 3
1011
+ }, 8, ["span"])
1012
+ ]),
1013
+ _: 3
1014
+ })
1015
+ ]),
1016
+ _: 3
1017
+ }, 8, ["model", "size"])
1018
+ ])) : P("", !0);
1019
+ }
1020
+ }), Ya = {
1021
+ key: 0,
1022
+ class: "ee-toolbar"
1023
+ }, Za = { class: "ee-toolbar-left" }, Ja = { class: "ee-toolbar-right" }, Qa = /* @__PURE__ */ K({
1024
+ __name: "TableToolbar",
1025
+ props: {
1026
+ show: { type: Boolean },
1027
+ toolbarCfg: {},
1028
+ size: {},
1029
+ deps: {}
1030
+ },
1031
+ emits: ["add", "import", "export", "batch-delete", "refresh", "column-setting"],
1032
+ setup(e) {
1033
+ return (n, l) => e.show ? (i(), D("div", Ya, [
1034
+ ue("div", Za, [
1035
+ e.toolbarCfg.showAdd && e.deps.authPass(e.toolbarCfg.addAuth) ? (i(), f(t(E), {
1036
+ key: 0,
1037
+ type: "primary",
1038
+ size: e.size,
1039
+ round: "",
1040
+ onClick: l[0] || (l[0] = (a) => n.$emit("add"))
1041
+ }, {
1042
+ default: d(() => [
1043
+ S(F(e.toolbarCfg.addText || "新增"), 1)
1044
+ ]),
1045
+ _: 1
1046
+ }, 8, ["size"])) : P("", !0),
1047
+ e.toolbarCfg.showImport && e.deps.authPass(e.toolbarCfg.importAuth) ? (i(), f(t(E), {
1048
+ key: 1,
1049
+ size: e.size,
1050
+ round: "",
1051
+ onClick: l[1] || (l[1] = (a) => n.$emit("import"))
1052
+ }, {
1053
+ default: d(() => [
1054
+ S(F(e.toolbarCfg.importText || "导入"), 1)
1055
+ ]),
1056
+ _: 1
1057
+ }, 8, ["size"])) : P("", !0),
1058
+ e.toolbarCfg.showExport && e.deps.authPass(e.toolbarCfg.exportAuth) ? (i(), f(t(E), {
1059
+ key: 2,
1060
+ size: e.size,
1061
+ round: "",
1062
+ onClick: l[2] || (l[2] = (a) => n.$emit("export"))
1063
+ }, {
1064
+ default: d(() => [
1065
+ S(F(e.toolbarCfg.exportText || "导出"), 1)
1066
+ ]),
1067
+ _: 1
1068
+ }, 8, ["size"])) : P("", !0),
1069
+ e.toolbarCfg.showBatchDelete && e.deps.selectionCount > 0 && e.deps.authPass(e.toolbarCfg.batchDeleteAuth) ? (i(), f(t(E), {
1070
+ key: 3,
1071
+ type: "danger",
1072
+ size: e.size,
1073
+ round: "",
1074
+ onClick: l[3] || (l[3] = (a) => n.$emit("batch-delete"))
1075
+ }, {
1076
+ default: d(() => [
1077
+ S(F(e.toolbarCfg.batchDeleteText || "批量删除"), 1)
1078
+ ]),
1079
+ _: 1
1080
+ }, 8, ["size"])) : P("", !0),
1081
+ (i(!0), D(B, null, A(e.toolbarCfg.customButtons || [], (a) => (i(), D(B, {
1082
+ key: a.code
1083
+ }, [
1084
+ e.deps.authPass(a.auth) ? (i(), f(t(E), {
1085
+ key: 0,
1086
+ type: a.type,
1087
+ size: e.size,
1088
+ round: "",
1089
+ onClick: a.handler
1090
+ }, {
1091
+ default: d(() => [
1092
+ S(F(a.text), 1)
1093
+ ]),
1094
+ _: 2
1095
+ }, 1032, ["type", "size", "onClick"])) : P("", !0)
1096
+ ], 64))), 128))
1097
+ ]),
1098
+ ue("div", Ja, [
1099
+ w(t(xe), { content: "刷新" }, {
1100
+ default: d(() => [
1101
+ w(t(E), {
1102
+ icon: "Refresh",
1103
+ size: e.size,
1104
+ circle: "",
1105
+ onClick: l[4] || (l[4] = (a) => n.$emit("refresh"))
1106
+ }, null, 8, ["size"])
1107
+ ]),
1108
+ _: 1
1109
+ }),
1110
+ e.deps.showColumnSetting ? (i(), f(t(xe), {
1111
+ key: 0,
1112
+ content: "列设置"
1113
+ }, {
1114
+ default: d(() => [
1115
+ w(t(E), {
1116
+ icon: "Setting",
1117
+ size: e.size,
1118
+ circle: "",
1119
+ onClick: l[5] || (l[5] = (a) => n.$emit("column-setting"))
1120
+ }, null, 8, ["size"])
1121
+ ]),
1122
+ _: 1
1123
+ })) : P("", !0),
1124
+ I(n.$slots, "toolbar-right")
1125
+ ])
1126
+ ])) : P("", !0);
1127
+ }
1128
+ }), _a = /* @__PURE__ */ K({
1129
+ __name: "FormDrawer",
1130
+ props: {
1131
+ visible: { type: Boolean },
1132
+ drawerMode: {},
1133
+ isEditing: { type: Boolean },
1134
+ editingRow: {},
1135
+ formData: {},
1136
+ drawerCfg: {},
1137
+ size: {},
1138
+ saving: { type: Boolean }
1139
+ },
1140
+ emits: ["update:visible", "save"],
1141
+ setup(e) {
1142
+ return (n, l) => e.drawerMode === "drawer" ? (i(), f(t(Sa), {
1143
+ key: 0,
1144
+ "model-value": e.visible,
1145
+ "onUpdate:modelValue": l[2] || (l[2] = (a) => n.$emit("update:visible", a)),
1146
+ title: e.isEditing ? e.drawerCfg.editTitle || "编辑" : e.drawerCfg.addTitle || "新增",
1147
+ size: e.drawerCfg.width || "40%",
1148
+ "destroy-on-close": e.drawerCfg.closeOnReset !== !1
1149
+ }, {
1150
+ footer: d(() => [
1151
+ w(t(E), {
1152
+ size: e.size,
1153
+ round: "",
1154
+ onClick: l[0] || (l[0] = (a) => n.$emit("update:visible", !1))
1155
+ }, {
1156
+ default: d(() => [...l[6] || (l[6] = [
1157
+ S("取消", -1)
1158
+ ])]),
1159
+ _: 1
1160
+ }, 8, ["size"]),
1161
+ w(t(E), {
1162
+ type: "primary",
1163
+ size: e.size,
1164
+ round: "",
1165
+ loading: e.saving,
1166
+ onClick: l[1] || (l[1] = (a) => n.$emit("save"))
1167
+ }, {
1168
+ default: d(() => [...l[7] || (l[7] = [
1169
+ S(" 确定 ", -1)
1170
+ ])]),
1171
+ _: 1
1172
+ }, 8, ["size", "loading"])
1173
+ ]),
1174
+ default: d(() => [
1175
+ I(n.$slots, e.isEditing ? "edit-form" : "add-form", {
1176
+ row: e.editingRow,
1177
+ formData: e.formData
1178
+ })
1179
+ ]),
1180
+ _: 3
1181
+ }, 8, ["model-value", "title", "size", "destroy-on-close"])) : (i(), f(t(ye), {
1182
+ key: 1,
1183
+ "model-value": e.visible,
1184
+ "onUpdate:modelValue": l[5] || (l[5] = (a) => n.$emit("update:visible", a)),
1185
+ title: e.isEditing ? e.drawerCfg.editTitle || "编辑" : e.drawerCfg.addTitle || "新增",
1186
+ width: e.drawerCfg.width || "600px",
1187
+ "destroy-on-close": e.drawerCfg.closeOnReset !== !1
1188
+ }, {
1189
+ footer: d(() => [
1190
+ w(t(E), {
1191
+ size: e.size,
1192
+ round: "",
1193
+ onClick: l[3] || (l[3] = (a) => n.$emit("update:visible", !1))
1194
+ }, {
1195
+ default: d(() => [...l[8] || (l[8] = [
1196
+ S("取消", -1)
1197
+ ])]),
1198
+ _: 1
1199
+ }, 8, ["size"]),
1200
+ w(t(E), {
1201
+ type: "primary",
1202
+ size: e.size,
1203
+ round: "",
1204
+ loading: e.saving,
1205
+ onClick: l[4] || (l[4] = (a) => n.$emit("save"))
1206
+ }, {
1207
+ default: d(() => [...l[9] || (l[9] = [
1208
+ S(" 确定 ", -1)
1209
+ ])]),
1210
+ _: 1
1211
+ }, 8, ["size", "loading"])
1212
+ ]),
1213
+ default: d(() => [
1214
+ I(n.$slots, e.isEditing ? "edit-form" : "add-form", {
1215
+ row: e.editingRow,
1216
+ formData: e.formData
1217
+ })
1218
+ ]),
1219
+ _: 3
1220
+ }, 8, ["model-value", "title", "width", "destroy-on-close"]));
1221
+ }
1222
+ }), et = { key: 0 }, at = { key: 1 }, tt = { key: 2 }, lt = {
1223
+ key: 0,
1224
+ class: "ee-pagination"
1225
+ }, re = /* @__PURE__ */ K({
423
1226
  name: "EeFormTable",
424
1227
  __name: "index",
425
1228
  props: {
426
- data: {},
427
1229
  columns: {},
428
- searchFields: {},
429
- pagination: {},
1230
+ data: {},
430
1231
  loading: { type: Boolean, default: !1 },
431
- showSelection: { type: Boolean, default: !1 },
432
- showIndex: { type: Boolean, default: !1 },
433
- showPagination: { type: Boolean, default: !0 },
434
- pageSizes: { default: () => [10, 20, 50, 100] },
435
- paginationLayout: { default: "total, sizes, prev, pager, next, jumper" },
436
- collapsible: { type: Boolean, default: !1 },
437
- collapsedCount: { default: 3 }
1232
+ searchConfig: {},
1233
+ pagination: {},
1234
+ actionConfig: { type: [Object, Boolean] },
1235
+ toolbarConfig: { type: [Object, Boolean] },
1236
+ crudConfig: {},
1237
+ selectionConfig: {},
1238
+ exportConfig: {},
1239
+ drawerConfig: {},
1240
+ columnSetting: {},
1241
+ autoHeight: {},
1242
+ dictMap: {},
1243
+ authChecker: {},
1244
+ authMode: { default: "hide" },
1245
+ emptyText: { default: "暂无数据" },
1246
+ tableHeight: {},
1247
+ tableMaxHeight: {},
1248
+ size: { default: "default" },
1249
+ stripe: { type: Boolean, default: !1 },
1250
+ border: { type: Boolean, default: !0 },
1251
+ highlightCurrentRow: { type: Boolean, default: !1 },
1252
+ rowKey: { default: "id" }
438
1253
  },
439
- emits: ["search", "reset", "selection-change", "sort-change", "current-change", "size-change"],
440
- setup(e, { emit: y }) {
441
- const r = y, p = U(), b = U({});
442
- return (c, d) => (t(), h("div", se, [
443
- e.searchFields && e.searchFields.length ? (t(), s(o(C), {
444
- key: 0,
445
- modelValue: b.value,
446
- "onUpdate:modelValue": d[0] || (d[0] = (a) => b.value = a),
447
- fields: e.searchFields,
448
- collapsible: e.collapsible,
449
- "collapsed-count": e.collapsedCount,
450
- onSearch: d[1] || (d[1] = (a) => r("search", a)),
451
- onReset: d[2] || (d[2] = (a) => r("reset"))
452
- }, null, 8, ["modelValue", "fields", "collapsible", "collapsed-count"])) : v("", !0),
453
- c.$slots.toolbar ? (t(), h("div", me, [
454
- I(c.$slots, "toolbar", {}, void 0, !0)
455
- ])) : v("", !0),
456
- g(o(te), S({
457
- ref_key: "tableRef",
458
- ref: p
459
- }, c.$attrs, {
460
- data: e.data,
461
- loading: e.loading,
462
- onSelectionChange: d[3] || (d[3] = (a) => r("selection-change", a)),
463
- onSortChange: d[4] || (d[4] = (a) => r("sort-change", a))
464
- }), {
465
- default: i(() => [
466
- e.showSelection ? (t(), s(o(O), {
467
- key: 0,
468
- type: "selection",
469
- width: "50",
470
- fixed: "left"
471
- })) : v("", !0),
472
- e.showIndex ? (t(), s(o(O), {
473
- key: 1,
474
- type: "index",
475
- label: "序号",
476
- width: "60",
477
- fixed: "left"
478
- })) : v("", !0),
479
- (t(!0), h(k, null, E(e.columns, (a) => (t(), s(o(O), {
480
- key: a.prop,
481
- prop: a.prop,
482
- label: a.label,
483
- width: a.width,
484
- "min-width": a.minWidth,
485
- fixed: a.fixed,
486
- sortable: a.sortable,
487
- align: a.align ?? "center"
1254
+ emits: ["search", "search-reset", "page-change", "selection-change", "current-change", "size-change", "sort-change", "row-click", "row-dblclick", "view", "add", "edit", "delete", "batch-delete", "import", "export", "add-success", "edit-success", "delete-success", "batch-delete-success", "request-error", "column-visible-change", "form-save"],
1255
+ setup(e, { expose: n, emit: l }) {
1256
+ const a = e, r = l, m = Na(a), p = La(a), {
1257
+ searchExpanded: V,
1258
+ searchParams: k,
1259
+ showSearch: g,
1260
+ searchCols: o,
1261
+ visibleSearchFields: u,
1262
+ showFoldBtn: c,
1263
+ actionColSpan: b,
1264
+ initSearchParams: O,
1265
+ getActiveSearchParams: M,
1266
+ resetSearchParams: H,
1267
+ toggleFold: h
1268
+ } = Ma(a), {
1269
+ pageState: z,
1270
+ showPagination: N,
1271
+ pageSizesComputed: _,
1272
+ paginationLayoutComputed: ce,
1273
+ paginationBgComputed: Me,
1274
+ setPage: He,
1275
+ setPageSize: Ge,
1276
+ resetPage: me
1277
+ } = Ha(a), {
1278
+ tableRef: Ve,
1279
+ selection: ee,
1280
+ singleSelection: je,
1281
+ columnSettingVisible: ke,
1282
+ checkedColumns: fe,
1283
+ showColumnSetting: Ke,
1284
+ allColumns: We,
1285
+ visibleColumns: Se,
1286
+ tableComputedHeight: qe,
1287
+ tableMaxHeightProp: Xe,
1288
+ tableWrapperStyle: Ye,
1289
+ selectionCfg: W,
1290
+ handleSelectionChange: Ze,
1291
+ handleSingleSelect: Je
1292
+ } = Ga(a, { authPass: m.authPass }), Qe = ja(a, {
1293
+ searchParams: k,
1294
+ getActiveSearchParams: M,
1295
+ pageState: z,
1296
+ resetPage: me,
1297
+ setTotal: (v) => {
1298
+ z.total = v;
1299
+ },
1300
+ selection: ee,
1301
+ emit: (v, ...y) => r(v, ...y)
1302
+ }), {
1303
+ internalData: ge,
1304
+ loadingState: De,
1305
+ hasCrud: q,
1306
+ fetchData: G,
1307
+ refreshTable: Ee,
1308
+ handleDelete: _e,
1309
+ handleBatchDelete: ea
1310
+ } = Qe, x = Ka(a), { handleExport: aa } = Wa(a, {
1311
+ visibleColumns: Se,
1312
+ getActiveSearchParams: M,
1313
+ dictLabel: p.dictLabel,
1314
+ internalData: ge,
1315
+ fetchData: G,
1316
+ setLoading: (v) => {
1317
+ De.value = v;
1318
+ },
1319
+ getCurrentData: () => a.data || ge.value
1320
+ }), j = C(() => ({
1321
+ visible: !!x.formVisible.value,
1322
+ drawerMode: x.drawerMode,
1323
+ isEditing: x.isEditing.value ?? !1,
1324
+ editingRow: x.editingRow.value ?? null,
1325
+ formData: x.formData.value ?? {},
1326
+ drawerCfg: x.drawerCfg,
1327
+ saving: x.saving.value ?? !1,
1328
+ onVisibleChange: (v) => {
1329
+ x.formVisible.value = v;
1330
+ }
1331
+ })), ae = C({
1332
+ get: () => ke.value,
1333
+ set: (v) => {
1334
+ ke.value = v;
1335
+ }
1336
+ }), U = C(() => a.actionConfig === !1 ? Be : a.actionConfig === !0 ? { ...Fe } : a.actionConfig ? { ...Fe, ...a.actionConfig } : Be), $e = C(() => {
1337
+ if (a.toolbarConfig === !1) return Ae;
1338
+ const v = { ...Aa };
1339
+ return a.toolbarConfig === !0 ? { ...v, show: !0 } : a.toolbarConfig ? { ...v, ...a.toolbarConfig } : Ae;
1340
+ }), ta = C(() => q.value ? ge.value : a.data || []), la = C(() => De.value || a.loading);
1341
+ function oa() {
1342
+ me();
1343
+ const v = M();
1344
+ r("search", v), q.value && G();
1345
+ }
1346
+ function na() {
1347
+ H(), r("search-reset"), q.value ? G() : r("search", {});
1348
+ }
1349
+ function ia(v) {
1350
+ He(v), r("current-change", v), r("page-change", { currentPage: v, pageSize: z.pageSize }), q.value && G();
1351
+ }
1352
+ function ra(v) {
1353
+ Ge(v), me(), r("size-change", v), r("page-change", { currentPage: 1, pageSize: v }), q.value && G();
1354
+ }
1355
+ function ua() {
1356
+ x.openAdd(), r("add");
1357
+ }
1358
+ function sa(v) {
1359
+ x.openEdit(v), r("edit", v);
1360
+ }
1361
+ function da(v) {
1362
+ _e(
1363
+ v,
1364
+ U.value.confirmDelete !== !1,
1365
+ U.value.deleteConfirmTitle,
1366
+ U.value.deleteConfirmMessage
1367
+ );
1368
+ }
1369
+ function ca() {
1370
+ ea();
1371
+ }
1372
+ function ma() {
1373
+ r("export"), aa();
1374
+ }
1375
+ async function fa() {
1376
+ var v, y;
1377
+ x.saving.value = !0;
1378
+ try {
1379
+ r("form-save", { ...x.formData.value }, x.isEditing.value ?? !1), x.isEditing.value && ((v = a.crudConfig) != null && v.api.edit) ? (await a.crudConfig.api.edit(x.formData.value), L.success("编辑成功"), r("edit-success")) : !x.isEditing.value && ((y = a.crudConfig) != null && y.api.add) && (await a.crudConfig.api.add(x.formData.value), L.success("新增成功"), r("add-success")), x.closeForm(), await G();
1380
+ } catch (s) {
1381
+ r("request-error", s);
1382
+ } finally {
1383
+ x.saving.value = !1;
1384
+ }
1385
+ }
1386
+ const ga = C(() => {
1387
+ const v = {};
1388
+ for (const y of Object.keys(a))
1389
+ !Oa.includes(y) && !y.startsWith("on") && (v[y] = a[y]);
1390
+ return v;
1391
+ });
1392
+ function ha(v) {
1393
+ const y = {};
1394
+ for (const [s, $] of Object.entries(v))
1395
+ Ia.includes(s) || (y[s] = $);
1396
+ return y;
1397
+ }
1398
+ return Q(() => {
1399
+ O(), q.value && G();
1400
+ }), n({
1401
+ refresh: Ee,
1402
+ /* 刷新表格 */
1403
+ fetchData: G,
1404
+ /* 手动请求数据 */
1405
+ getSelection: () => ee.value,
1406
+ /* 获取选中行 */
1407
+ tableRef: Ve
1408
+ /* el-table 引用 */
1409
+ }), (v, y) => (i(), D("div", {
1410
+ class: va(["ee-form-table", [`ee-size--${e.size}`, { "ee-stripe": e.stripe, "ee-border": e.border }]])
1411
+ }, [
1412
+ w(Xa, {
1413
+ "show-search": !!t(g),
1414
+ "search-params": t(k),
1415
+ "visible-search-fields": t(u),
1416
+ "search-cols": t(o),
1417
+ "action-col-span": t(b),
1418
+ "show-fold-btn": !!t(c),
1419
+ "search-expanded": !!t(V),
1420
+ size: e.size,
1421
+ "resolve-dict": t(p).resolvedDict,
1422
+ onSearch: oa,
1423
+ onReset: na,
1424
+ onToggleFold: t(h)
1425
+ }, {
1426
+ "search-action": d(({ params: s }) => [
1427
+ I(v.$slots, "search-action", { params: s })
1428
+ ]),
1429
+ _: 3
1430
+ }, 8, ["show-search", "search-params", "visible-search-fields", "search-cols", "action-col-span", "show-fold-btn", "search-expanded", "size", "resolve-dict", "onToggleFold"]),
1431
+ w(Qa, {
1432
+ show: !!$e.value.show,
1433
+ "toolbar-cfg": $e.value,
1434
+ size: e.size,
1435
+ deps: {
1436
+ authPass: t(m).authPass,
1437
+ selectionCount: t(ee).length,
1438
+ showColumnSetting: !!t(Ke)
1439
+ },
1440
+ onAdd: ua,
1441
+ onImport: y[0] || (y[0] = (s) => v.$emit("import")),
1442
+ onExport: ma,
1443
+ onBatchDelete: ca,
1444
+ onRefresh: y[1] || (y[1] = (s) => t(Ee)()),
1445
+ onColumnSetting: y[2] || (y[2] = (s) => ae.value = !0)
1446
+ }, {
1447
+ "toolbar-right": d(() => [
1448
+ I(v.$slots, "toolbar-right")
1449
+ ]),
1450
+ _: 3
1451
+ }, 8, ["show", "toolbar-cfg", "size", "deps"]),
1452
+ ue("div", {
1453
+ class: "ee-table-wrapper",
1454
+ style: ba(t(Ye))
1455
+ }, [
1456
+ w(t(Da), R({
1457
+ ref_key: "tableRef",
1458
+ ref: Ve,
1459
+ data: ta.value,
1460
+ loading: la.value,
1461
+ size: e.size,
1462
+ stripe: e.stripe,
1463
+ border: e.border,
1464
+ height: t(qe),
1465
+ "max-height": t(Xe),
1466
+ "highlight-current-row": e.highlightCurrentRow,
1467
+ "row-key": e.rowKey,
1468
+ onSelectionChange: y[3] || (y[3] = (s) => {
1469
+ t(Ze)(s), v.$emit("selection-change", s);
1470
+ }),
1471
+ onRowClick: y[4] || (y[4] = (s) => v.$emit("row-click", s)),
1472
+ onRowDblclick: y[5] || (y[5] = (s) => v.$emit("row-dblclick", s)),
1473
+ onSortChange: y[6] || (y[6] = (s) => v.$emit("sort-change", s))
1474
+ }, ga.value), {
1475
+ empty: d(() => [
1476
+ I(v.$slots, "empty", {}, () => [
1477
+ w(t(Ea), {
1478
+ description: e.emptyText || "暂无数据"
1479
+ }, null, 8, ["description"])
1480
+ ])
1481
+ ]),
1482
+ default: d(() => [
1483
+ t(W).show && t(W).type === "multiple" ? (i(), f(t(te), {
1484
+ key: 0,
1485
+ type: "selection",
1486
+ width: "50",
1487
+ fixed: "left",
1488
+ selectable: t(W).disabledRow ? (s) => !t(W).disabledRow(s) : void 0,
1489
+ "reserve-selection": t(W).reserveSelection
1490
+ }, null, 8, ["selectable", "reserve-selection"])) : P("", !0),
1491
+ t(W).show && t(W).type === "single" ? (i(), f(t(te), {
1492
+ key: 1,
1493
+ width: "50",
1494
+ fixed: "left"
1495
+ }, {
1496
+ default: d(({ row: s }) => [
1497
+ w(t(we), {
1498
+ "model-value": t(je) === s[e.rowKey || "id"],
1499
+ value: s[e.rowKey || "id"],
1500
+ onChange: () => {
1501
+ t(Je)(s), v.$emit("selection-change", t(ee));
1502
+ }
1503
+ }, null, 8, ["model-value", "value", "onChange"])
1504
+ ]),
1505
+ _: 1
1506
+ })) : P("", !0),
1507
+ (i(!0), D(B, null, A(t(Se), (s) => (i(), f(t(te), R({
1508
+ key: s.prop,
1509
+ prop: s.prop,
1510
+ label: s.label,
1511
+ width: s.width,
1512
+ "min-width": s.minWidth,
1513
+ fixed: s.fixed,
1514
+ sortable: s.sortable,
1515
+ align: s.align || "center",
1516
+ "class-name": s.className
1517
+ }, { ref_for: !0 }, ha(s)), {
1518
+ default: d(($) => [
1519
+ I(v.$slots, s.slotName || s.prop, {
1520
+ row: $.row,
1521
+ index: $.$index,
1522
+ column: s
1523
+ }, () => [
1524
+ s.formatter ? (i(), D("span", et, F(s.formatter($.row, s, $.row[s.prop], $.$index)), 1)) : s.dictKey ? (i(), D("span", at, F(t(p).dictLabel(s.dictKey, $.row[s.prop])), 1)) : (i(), D("span", tt, F($.row[s.prop] ?? "-"), 1))
1525
+ ])
1526
+ ]),
1527
+ _: 2
1528
+ }, 1040, ["prop", "label", "width", "min-width", "fixed", "sortable", "align", "class-name"]))), 128)),
1529
+ U.value.show ? (i(), f(t(te), {
1530
+ key: 2,
1531
+ label: U.value.label || "操作",
1532
+ width: U.value.width,
1533
+ fixed: U.value.fixed ?? "right",
1534
+ align: U.value.align || "center"
1535
+ }, {
1536
+ default: d(({ row: s }) => [
1537
+ I(v.$slots, "action-before", { row: s }),
1538
+ U.value.showView && t(m).authPass(U.value.viewAuth) ? (i(), f(t(E), {
1539
+ key: 0,
1540
+ type: "primary",
1541
+ link: "",
1542
+ size: e.size,
1543
+ onClick: ($) => v.$emit("view", s)
1544
+ }, {
1545
+ default: d(() => [
1546
+ S(F(U.value.viewText || "查看"), 1)
1547
+ ]),
1548
+ _: 1
1549
+ }, 8, ["size", "onClick"])) : P("", !0),
1550
+ U.value.showEdit && t(m).authPass(U.value.editAuth) ? (i(), f(t(E), {
1551
+ key: 1,
1552
+ type: "primary",
1553
+ link: "",
1554
+ size: e.size,
1555
+ onClick: ($) => sa(s)
1556
+ }, {
1557
+ default: d(() => [
1558
+ S(F(U.value.editText || "编辑"), 1)
1559
+ ]),
1560
+ _: 1
1561
+ }, 8, ["size", "onClick"])) : P("", !0),
1562
+ U.value.showDelete && t(m).authPass(U.value.deleteAuth) ? (i(), f(t(E), {
1563
+ key: 2,
1564
+ type: "danger",
1565
+ link: "",
1566
+ size: e.size,
1567
+ onClick: ($) => da(s)
1568
+ }, {
1569
+ default: d(() => [
1570
+ S(F(U.value.deleteText || "删除"), 1)
1571
+ ]),
1572
+ _: 1
1573
+ }, 8, ["size", "onClick"])) : P("", !0),
1574
+ (i(!0), D(B, null, A(U.value.customButtons || [], ($) => (i(), D(B, {
1575
+ key: $.code
1576
+ }, [
1577
+ (!$.show || $.show(s)) && t(m).authPass($.auth) ? (i(), f(t(E), {
1578
+ key: 0,
1579
+ type: $.type || "default",
1580
+ link: "",
1581
+ size: e.size,
1582
+ onClick: (it) => $.handler(s)
1583
+ }, {
1584
+ default: d(() => [
1585
+ S(F($.text), 1)
1586
+ ]),
1587
+ _: 2
1588
+ }, 1032, ["type", "size", "onClick"])) : P("", !0)
1589
+ ], 64))), 128)),
1590
+ I(v.$slots, "action", { row: s })
1591
+ ]),
1592
+ _: 3
1593
+ }, 8, ["label", "width", "fixed", "align"])) : P("", !0)
1594
+ ]),
1595
+ _: 3
1596
+ }, 16, ["data", "loading", "size", "stripe", "border", "height", "max-height", "highlight-current-row", "row-key"])
1597
+ ], 4),
1598
+ t(N) ? (i(), D("div", lt, [
1599
+ w(t($a), {
1600
+ "current-page": t(z).current,
1601
+ "onUpdate:currentPage": y[7] || (y[7] = (s) => t(z).current = s),
1602
+ "page-size": t(z).pageSize,
1603
+ "onUpdate:pageSize": y[8] || (y[8] = (s) => t(z).pageSize = s),
1604
+ "page-sizes": t(_),
1605
+ total: t(z).total,
1606
+ layout: t(ce),
1607
+ background: t(Me),
1608
+ size: e.size,
1609
+ onCurrentChange: ia,
1610
+ onSizeChange: ra
1611
+ }, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout", "background", "size"])
1612
+ ])) : P("", !0),
1613
+ w(_a, {
1614
+ visible: j.value.visible,
1615
+ "drawer-mode": j.value.drawerMode,
1616
+ "is-editing": j.value.isEditing,
1617
+ "editing-row": j.value.editingRow,
1618
+ "form-data": j.value.formData,
1619
+ "drawer-cfg": j.value.drawerCfg,
1620
+ size: e.size,
1621
+ saving: j.value.saving,
1622
+ "onUpdate:visible": j.value.onVisibleChange,
1623
+ onSave: fa
1624
+ }, pa({ _: 2 }, [
1625
+ A(["add-form", "edit-form"], (s) => ({
1626
+ name: s,
1627
+ fn: d(($) => [
1628
+ I(v.$slots, s, ya(wa($)))
1629
+ ])
1630
+ }))
1631
+ ]), 1032, ["visible", "drawer-mode", "is-editing", "editing-row", "form-data", "drawer-cfg", "size", "saving", "onUpdate:visible"]),
1632
+ w(t(ye), {
1633
+ modelValue: ae.value,
1634
+ "onUpdate:modelValue": y[11] || (y[11] = (s) => ae.value = s),
1635
+ title: "列设置",
1636
+ width: "400px",
1637
+ "close-on-click-modal": !1
1638
+ }, {
1639
+ footer: d(() => [
1640
+ w(t(E), {
1641
+ size: e.size,
1642
+ round: "",
1643
+ onClick: y[10] || (y[10] = (s) => ae.value = !1)
1644
+ }, {
1645
+ default: d(() => [...y[12] || (y[12] = [
1646
+ S("关闭", -1)
1647
+ ])]),
1648
+ _: 1
1649
+ }, 8, ["size"])
1650
+ ]),
1651
+ default: d(() => [
1652
+ w(t(Ce), {
1653
+ modelValue: t(fe),
1654
+ "onUpdate:modelValue": y[9] || (y[9] = (s) => Ca(fe) ? fe.value = s : null)
488
1655
  }, {
489
- default: i((f) => [
490
- I(c.$slots, a.prop, {
491
- row: f.row,
492
- index: f.$index
493
- }, () => [
494
- A("span", null, x(a.formatter ? a.formatter(f.row, a, f.row[a.prop], f.$index) : f.row[a.prop]), 1)
495
- ], !0)
1656
+ default: d(() => [
1657
+ (i(!0), D(B, null, A(t(We), (s) => (i(), f(t(ze), {
1658
+ key: s.prop,
1659
+ value: s.prop,
1660
+ label: s.label
1661
+ }, null, 8, ["value", "label"]))), 128))
496
1662
  ]),
497
- _: 2
498
- }, 1032, ["prop", "label", "width", "min-width", "fixed", "sortable", "align"]))), 128)),
499
- I(c.$slots, "default", {}, void 0, !0)
1663
+ _: 1
1664
+ }, 8, ["modelValue"])
500
1665
  ]),
501
- _: 3
502
- }, 16, ["data", "loading"]),
503
- e.showPagination ? (t(), h("div", ie, [
504
- g(o(oe), {
505
- "current-page": e.pagination.current,
506
- "onUpdate:currentPage": d[5] || (d[5] = (a) => e.pagination.current = a),
507
- "page-size": e.pagination.pageSize,
508
- "onUpdate:pageSize": d[6] || (d[6] = (a) => e.pagination.pageSize = a),
509
- total: e.pagination.total,
510
- "page-sizes": e.pageSizes,
511
- layout: e.paginationLayout,
512
- background: "",
513
- onCurrentChange: d[7] || (d[7] = (a) => r("current-change", a)),
514
- onSizeChange: d[8] || (d[8] = (a) => r("size-change", a))
515
- }, null, 8, ["current-page", "page-size", "total", "page-sizes", "layout"])
516
- ])) : v("", !0)
517
- ]));
1666
+ _: 1
1667
+ }, 8, ["modelValue"])
1668
+ ], 2));
518
1669
  }
519
- }), R = /* @__PURE__ */ j(pe, [["__scopeId", "data-v-70d01eeb"]]);
520
- R.install = (e) => {
521
- e.component(R.name ?? "EeFormTable", R);
1670
+ });
1671
+ re.install = (e) => {
1672
+ e.component(re.name ?? "EeFormTable", re);
522
1673
  };
523
- const ce = [
524
- B,
525
- z,
526
- C,
527
- T,
528
- R
1674
+ const ot = [
1675
+ le,
1676
+ oe,
1677
+ ne,
1678
+ ie,
1679
+ re
529
1680
  ];
530
- function fe(e) {
531
- ce.forEach((y) => {
532
- e.use(y);
1681
+ function nt(e) {
1682
+ ot.forEach((n) => {
1683
+ e.use(n);
533
1684
  });
534
1685
  }
535
- const ye = { install: fe };
1686
+ const st = { install: nt };
536
1687
  export {
537
- B as EeDictSelect,
538
- T as EeFormDialog,
539
- R as EeFormTable,
540
- C as EeSearchBar,
541
- z as EeStatusTag,
542
- ye as default,
543
- fe as install
1688
+ le as EeDictSelect,
1689
+ ie as EeFormDialog,
1690
+ re as EeFormTable,
1691
+ ne as EeSearchBar,
1692
+ oe as EeStatusTag,
1693
+ st as default,
1694
+ nt as install
544
1695
  };