@jt-home/mfe-components 1.0.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.
Files changed (53) hide show
  1. package/dist/index.cjs +2 -0
  2. package/dist/index.mjs +3029 -0
  3. package/dist/style.css +1 -0
  4. package/dist/types/components/JtButton/index.d.ts +1 -0
  5. package/dist/types/components/JtButton/index.vue.d.ts +21 -0
  6. package/dist/types/components/JtPageHeader/index.d.ts +2 -0
  7. package/dist/types/components/JtPageHeader/index.vue.d.ts +25 -0
  8. package/dist/types/components/JtPageHeader/types.d.ts +31 -0
  9. package/dist/types/components/JtPagination/index.d.ts +2 -0
  10. package/dist/types/components/JtPagination/index.vue.d.ts +22 -0
  11. package/dist/types/components/JtPagination/types.d.ts +16 -0
  12. package/dist/types/components/form/JtFormItems.vue.d.ts +16 -0
  13. package/dist/types/components/form/index.d.ts +4 -0
  14. package/dist/types/components/form/item/JtCascader/index.d.ts +1 -0
  15. package/dist/types/components/form/item/JtCascader/index.vue.d.ts +29 -0
  16. package/dist/types/components/form/item/JtDatePicker/index.d.ts +1 -0
  17. package/dist/types/components/form/item/JtDatePicker/index.vue.d.ts +9 -0
  18. package/dist/types/components/form/item/JtInput/index.d.ts +1 -0
  19. package/dist/types/components/form/item/JtInput/index.vue.d.ts +35 -0
  20. package/dist/types/components/form/item/JtSelect/index.d.ts +2 -0
  21. package/dist/types/components/form/item/JtSelect/index.vue.d.ts +34 -0
  22. package/dist/types/components/form/item/JtSelect/types.d.ts +6 -0
  23. package/dist/types/components/form/item/index.d.ts +5 -0
  24. package/dist/types/components/form/types.d.ts +71 -0
  25. package/dist/types/components/globalInfo/components/GlobalInfoGroup.vue.d.ts +105 -0
  26. package/dist/types/components/globalInfo/components/GlobalInfoProvider.vue.d.ts +22 -0
  27. package/dist/types/components/globalInfo/components/GlobalInfoSectionBlock.vue.d.ts +165 -0
  28. package/dist/types/components/globalInfo/components/GlobalInfoSectionOutlet.vue.d.ts +31 -0
  29. package/dist/types/components/globalInfo/components/GlobalInfoSections.vue.d.ts +59 -0
  30. package/dist/types/components/globalInfo/components/GlobalInfoSlotErrorBoundary.vue.d.ts +36 -0
  31. package/dist/types/components/globalInfo/controller/useGlobalInfoController.d.ts +19 -0
  32. package/dist/types/components/globalInfo/index.d.ts +14 -0
  33. package/dist/types/components/globalInfo/model/adapter.d.ts +9 -0
  34. package/dist/types/components/globalInfo/model/fieldUtils.d.ts +11 -0
  35. package/dist/types/components/globalInfo/model/types.d.ts +558 -0
  36. package/dist/types/components/globalInfo/renderers/GlobalInfoAutoRenderer.vue.d.ts +11 -0
  37. package/dist/types/components/globalInfo/renderers/GlobalInfoDeleteConfirm.vue.d.ts +28 -0
  38. package/dist/types/components/globalInfo/renderers/GlobalInfoFieldControl.vue.d.ts +19 -0
  39. package/dist/types/components/globalInfo/renderers/GlobalInfoFieldValue.vue.d.ts +11 -0
  40. package/dist/types/components/globalInfo/renderers/GlobalInfoFormRenderer.vue.d.ts +34 -0
  41. package/dist/types/components/globalInfo/renderers/GlobalInfoTableRenderer.vue.d.ts +39 -0
  42. package/dist/types/components/index.d.ts +11 -0
  43. package/dist/types/components/table/JtCrudTable.vue.d.ts +288 -0
  44. package/dist/types/components/table/JtFilterBar.vue.d.ts +65 -0
  45. package/dist/types/components/table/JtPagination.vue.d.ts +22 -0
  46. package/dist/types/components/table/JtTable.vue.d.ts +27 -0
  47. package/dist/types/components/table/index.d.ts +5 -0
  48. package/dist/types/components/table/types.d.ts +134 -0
  49. package/dist/types/components/table/useSearchDisabled.d.ts +12 -0
  50. package/dist/types/main.d.ts +3 -0
  51. package/dist/types/utils/componentAttrs.d.ts +14 -0
  52. package/package.json +77 -0
  53. package/readme.md +671 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,3029 @@
1
+ import { defineComponent as U, useAttrs as yt, computed as I, openBlock as y, createBlock as F, mergeProps as D, toHandlers as Ce, withCtx as M, renderSlot as j, resolveDynamicComponent as ht, createCommentVNode as Z, withKeys as nn, createElementBlock as L, Fragment as de, renderList as oe, normalizeStyle as bt, ref as ne, useSlots as ve, watch as Re, normalizeClass as Ue, createVNode as re, withModifiers as on, unref as q, createSlots as ke, createElementVNode as J, toDisplayString as ee, normalizeProps as ce, guardReactiveProps as me, useModel as Pe, resolveDirective as an, withDirectives as ln, mergeModels as xe, shallowRef as Se, onMounted as St, createTextVNode as Be, resolveComponent as rn, onErrorCaptured as sn } from "vue";
2
+ import { ElButton as nt, ElIcon as _t, ElCascader as un, ElDatePicker as It, ElInput as wt, ElSelect as kt, ElOption as Ct, ElFormItem as $t, ElForm as Tt, ElTable as Bt, ElTableColumn as Et, ElPagination as Mt, ElInputNumber as cn, ElSwitch as dn, ElRow as pn, ElCol as fn, ElPopconfirm as mn } from "element-plus/es";
3
+ import { cascaderEmits as lt, inputEmits as rt, selectEmits as st, paginationEmits as it } from "element-plus";
4
+ const Xe = 2, vn = 3;
5
+ function gn(t) {
6
+ return t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
7
+ }
8
+ function Ft(t) {
9
+ if (!t.startsWith("on") || t.length <= Xe)
10
+ return !1;
11
+ const e = t.charCodeAt(Xe);
12
+ return e < 97 || e > 122;
13
+ }
14
+ function yn(t) {
15
+ if (t.startsWith("on-"))
16
+ return t.slice(vn);
17
+ const [e, n] = t.slice(Xe).split(":"), o = gn(e);
18
+ return n ? `${o}:${n}` : o;
19
+ }
20
+ function Vt(t, e = /* @__PURE__ */ new Set()) {
21
+ return Object.fromEntries(
22
+ Object.entries(t).filter(([n, o]) => !e.has(n) && Ft(n) && typeof o == "function").map(([n, o]) => [yn(n), o])
23
+ );
24
+ }
25
+ function Pt(t, e = /* @__PURE__ */ new Set()) {
26
+ return Object.fromEntries(
27
+ Object.entries(t).filter(([n]) => !e.has(n) && !Ft(n))
28
+ );
29
+ }
30
+ const hn = /* @__PURE__ */ U({
31
+ name: "JtButton",
32
+ __name: "index",
33
+ props: {
34
+ size: {},
35
+ disabled: { type: Boolean },
36
+ type: {},
37
+ icon: {},
38
+ nativeType: {},
39
+ loading: { type: Boolean },
40
+ loadingIcon: {},
41
+ plain: { type: Boolean },
42
+ text: { type: Boolean },
43
+ link: { type: Boolean },
44
+ bg: { type: Boolean },
45
+ autofocus: { type: Boolean },
46
+ round: { type: Boolean },
47
+ circle: { type: Boolean },
48
+ dashed: { type: Boolean },
49
+ color: {},
50
+ dark: { type: Boolean },
51
+ autoInsertSpace: { type: Boolean },
52
+ tag: {}
53
+ },
54
+ setup(t) {
55
+ const e = t, n = yt(), o = I(() => {
56
+ const { icon: s, ...v } = e;
57
+ return {
58
+ ...Pt(n),
59
+ ...v
60
+ };
61
+ }), a = I(() => Vt(n));
62
+ return (s, v) => {
63
+ const p = _t, c = nt;
64
+ return y(), F(c, D({ class: "jt-button" }, o.value, Ce(a.value)), {
65
+ default: M(() => [
66
+ s.$slots.icon ? (y(), F(p, {
67
+ key: 0,
68
+ class: "jt-button__icon"
69
+ }, {
70
+ default: M(() => [
71
+ j(s.$slots, "icon", {}, void 0, !0)
72
+ ]),
73
+ _: 3
74
+ })) : e.icon ? (y(), F(p, {
75
+ key: 1,
76
+ class: "jt-button__icon"
77
+ }, {
78
+ default: M(() => [
79
+ (y(), F(ht(e.icon)))
80
+ ]),
81
+ _: 1
82
+ })) : Z("", !0),
83
+ j(s.$slots, "default", {}, void 0, !0)
84
+ ]),
85
+ _: 3
86
+ }, 16);
87
+ };
88
+ }
89
+ }), X = (t, e) => {
90
+ const n = t.__vccOpts || t;
91
+ for (const [o, a] of e)
92
+ n[o] = a;
93
+ return n;
94
+ }, Je = /* @__PURE__ */ X(hn, [["__scopeId", "data-v-fbcdce34"]]), bn = /* @__PURE__ */ U({
95
+ name: "JtCascader",
96
+ __name: "index",
97
+ props: {
98
+ size: {},
99
+ placeholder: { default: "请选择" },
100
+ disabled: { type: Boolean },
101
+ clearable: { type: Boolean, default: !0 },
102
+ clearIcon: {},
103
+ filterable: { type: Boolean },
104
+ filterMethod: {},
105
+ separator: {},
106
+ showAllLevels: { type: Boolean },
107
+ collapseTags: { type: Boolean },
108
+ maxCollapseTags: {},
109
+ collapseTagsTooltip: { type: Boolean },
110
+ maxCollapseTagsTooltipHeight: {},
111
+ debounce: {},
112
+ beforeFilter: {},
113
+ placement: {},
114
+ fallbackPlacements: {},
115
+ popperClass: {},
116
+ popperStyle: { type: [Boolean, null, String, Object, Array] },
117
+ teleported: { type: Boolean },
118
+ effect: {},
119
+ tagType: {},
120
+ tagEffect: {},
121
+ validateEvent: { type: Boolean },
122
+ persistent: { type: Boolean },
123
+ showCheckedStrategy: {},
124
+ checkOnClickNode: { type: Boolean },
125
+ showPrefix: { type: Boolean },
126
+ fitInputWidth: { type: [Boolean, Number] },
127
+ modelValue: {},
128
+ props: {},
129
+ virtualScroll: { type: Boolean },
130
+ itemSize: {},
131
+ height: {},
132
+ emptyValues: {},
133
+ valueOnClear: { type: [String, Number, Boolean, Function, null] },
134
+ options: { default: () => [] }
135
+ },
136
+ emits: lt,
137
+ setup(t, { emit: e }) {
138
+ const n = t, o = e, a = I(() => Object.fromEntries(
139
+ Object.keys(lt).map((s) => [
140
+ s,
141
+ (...v) => o(s, ...v)
142
+ ])
143
+ ));
144
+ return (s, v) => {
145
+ const p = un;
146
+ return y(), F(p, D({ class: "jt-cascader" }, n, Ce(a.value)), null, 16);
147
+ };
148
+ }
149
+ }), Sn = /* @__PURE__ */ X(bn, [["__scopeId", "data-v-9164edeb"]]), _n = /* @__PURE__ */ U({
150
+ name: "JtDatePicker",
151
+ __name: "index",
152
+ props: {
153
+ type: { default: "date" },
154
+ showNow: { type: Boolean },
155
+ showConfirm: { type: Boolean },
156
+ showFooter: { type: Boolean },
157
+ showWeekNumber: { type: Boolean },
158
+ ariaLabel: {},
159
+ emptyValues: {},
160
+ valueOnClear: {},
161
+ disabledDate: {},
162
+ cellClassName: {},
163
+ shortcuts: {},
164
+ arrowControl: { type: Boolean },
165
+ tabindex: {},
166
+ validateEvent: { type: Boolean },
167
+ unlinkPanels: { type: Boolean },
168
+ singlePanel: { type: Boolean },
169
+ placement: {},
170
+ fallbackPlacements: {},
171
+ disabledHours: {},
172
+ disabledMinutes: {},
173
+ disabledSeconds: {},
174
+ automaticDropdown: { type: Boolean },
175
+ id: {},
176
+ name: {},
177
+ popperClass: {},
178
+ popperStyle: {},
179
+ format: {},
180
+ valueFormat: { default: "YYYY-MM-DD" },
181
+ dateFormat: {},
182
+ timeFormat: {},
183
+ clearable: { type: Boolean, default: !0 },
184
+ clearIcon: {},
185
+ editable: { type: Boolean },
186
+ saveOnBlur: { type: Boolean },
187
+ prefixIcon: {},
188
+ size: {},
189
+ readonly: { type: Boolean },
190
+ disabled: { type: Boolean },
191
+ placeholder: { default: "请选择日期" },
192
+ popperOptions: {},
193
+ modelValue: {},
194
+ rangeSeparator: {},
195
+ startPlaceholder: {},
196
+ endPlaceholder: {},
197
+ defaultValue: {},
198
+ defaultTime: {},
199
+ isRange: { type: Boolean }
200
+ },
201
+ setup(t) {
202
+ const e = t, n = I(() => ({
203
+ ...e,
204
+ startPlaceholder: e.startPlaceholder ?? (o(e.type) ? "开始日期" : void 0),
205
+ endPlaceholder: e.endPlaceholder ?? (o(e.type) ? "结束日期" : void 0)
206
+ }));
207
+ function o(a) {
208
+ return a?.includes("range") ?? !1;
209
+ }
210
+ return (a, s) => {
211
+ const v = It;
212
+ return y(), F(v, D({ class: "jt-date-picker" }, n.value, {
213
+ "onUpdate:modelValue": s[0] || (s[0] = (p) => a.$emit("update:modelValue", p))
214
+ }), null, 16);
215
+ };
216
+ }
217
+ }), In = /* @__PURE__ */ X(_n, [["__scopeId", "data-v-2aaf2264"]]), wn = /* @__PURE__ */ U({
218
+ name: "JtInput",
219
+ __name: "index",
220
+ props: {
221
+ id: {},
222
+ size: {},
223
+ disabled: { type: Boolean },
224
+ modelValue: {},
225
+ modelModifiers: {},
226
+ maxlength: {},
227
+ minlength: {},
228
+ type: {},
229
+ resize: {},
230
+ autosize: { type: [Object, Boolean] },
231
+ autocomplete: {},
232
+ formatter: {},
233
+ parser: {},
234
+ placeholder: { default: "请输入" },
235
+ form: {},
236
+ readonly: { type: Boolean },
237
+ clearable: { type: Boolean, default: !0 },
238
+ clearIcon: {},
239
+ showPassword: { type: Boolean },
240
+ showWordLimit: { type: Boolean },
241
+ wordLimitPosition: {},
242
+ suffixIcon: {},
243
+ prefixIcon: {},
244
+ containerRole: {},
245
+ tabindex: {},
246
+ validateEvent: { type: Boolean },
247
+ inputStyle: { type: [Boolean, null, String, Object, Array] },
248
+ autofocus: { type: Boolean },
249
+ rows: {},
250
+ ariaLabel: {},
251
+ inputmode: {},
252
+ name: {},
253
+ countGraphemes: {}
254
+ },
255
+ emits: {
256
+ ...rt,
257
+ enter: () => !0
258
+ },
259
+ setup(t, { emit: e }) {
260
+ const n = t, o = e, a = I(() => Object.fromEntries(
261
+ Object.keys(rt).map((s) => [
262
+ s,
263
+ (...v) => o(s, ...v)
264
+ ])
265
+ ));
266
+ return (s, v) => {
267
+ const p = wt;
268
+ return y(), F(p, D({ class: "jt-input" }, n, Ce(a.value), {
269
+ onKeyup: v[0] || (v[0] = nn((c) => o("enter"), ["enter"]))
270
+ }), null, 16);
271
+ };
272
+ }
273
+ }), Ze = /* @__PURE__ */ X(wn, [["__scopeId", "data-v-c4e9cb3f"]]), kn = /* @__PURE__ */ U({
274
+ name: "JtSelect",
275
+ __name: "index",
276
+ props: {
277
+ options: {},
278
+ ariaLabel: {},
279
+ emptyValues: {},
280
+ valueOnClear: {},
281
+ name: {},
282
+ id: {},
283
+ modelValue: {},
284
+ autocomplete: {},
285
+ automaticDropdown: { type: Boolean },
286
+ size: {},
287
+ effect: {},
288
+ disabled: { type: Boolean },
289
+ clearable: { type: Boolean, default: !0 },
290
+ filterable: { type: Boolean, default: !0 },
291
+ allowCreate: { type: Boolean },
292
+ loading: { type: Boolean },
293
+ popperClass: {},
294
+ popperStyle: {},
295
+ popperOptions: {},
296
+ remote: { type: Boolean },
297
+ debounce: {},
298
+ loadingText: {},
299
+ noMatchText: {},
300
+ noDataText: {},
301
+ remoteMethod: {},
302
+ filterMethod: {},
303
+ multiple: { type: Boolean },
304
+ multipleLimit: {},
305
+ placeholder: { default: "请选择" },
306
+ defaultFirstOption: { type: Boolean },
307
+ reserveKeyword: { type: Boolean },
308
+ valueKey: {},
309
+ collapseTags: { type: Boolean },
310
+ collapseTagsTooltip: { type: Boolean },
311
+ tagTooltip: {},
312
+ maxCollapseTags: {},
313
+ teleported: { type: Boolean },
314
+ persistent: { type: Boolean },
315
+ clearIcon: {},
316
+ fitInputWidth: { type: Boolean },
317
+ suffixIcon: {},
318
+ tagType: {},
319
+ tagEffect: {},
320
+ validateEvent: { type: Boolean },
321
+ remoteShowSuffix: { type: Boolean },
322
+ showArrow: { type: Boolean },
323
+ offset: {},
324
+ placement: {},
325
+ fallbackPlacements: {},
326
+ tabindex: {},
327
+ appendTo: {},
328
+ props: {}
329
+ },
330
+ emits: st,
331
+ setup(t, { emit: e }) {
332
+ const n = t, o = I(() => {
333
+ const { options: v, ...p } = n;
334
+ return p;
335
+ }), a = e, s = I(() => Object.fromEntries(
336
+ Object.keys(st).map((v) => [
337
+ v,
338
+ (...p) => a(v, ...p)
339
+ ])
340
+ ));
341
+ return (v, p) => {
342
+ const c = Ct, b = kt;
343
+ return y(), F(b, D({ class: "jt-select" }, o.value, Ce(s.value)), {
344
+ default: M(() => [
345
+ (y(!0), L(de, null, oe(v.options ?? [], (C) => (y(), F(c, D({
346
+ key: C.value,
347
+ ref_for: !0
348
+ }, C), null, 16))), 128))
349
+ ]),
350
+ _: 1
351
+ }, 16);
352
+ };
353
+ }
354
+ }), Cn = /* @__PURE__ */ X(kn, [["__scopeId", "data-v-abce8e44"]]), $n = { class: "jt-form-items" }, Qe = 4, Tn = /* @__PURE__ */ U({
355
+ name: "JTFormItems",
356
+ __name: "JtFormItems",
357
+ props: {
358
+ configs: {},
359
+ formData: {},
360
+ span: {}
361
+ },
362
+ setup(t) {
363
+ const e = t, n = {
364
+ input: Ze,
365
+ select: Cn,
366
+ cascader: Sn,
367
+ "date-picker": In
368
+ }, o = {
369
+ "remote-select": "select",
370
+ date: "date-picker",
371
+ daterange: "date-picker",
372
+ "date-range": "date-picker",
373
+ dateRange: "date-picker"
374
+ }, a = /* @__PURE__ */ new Set(["prop", "label", "itemType", "span", "options", "rules", "formItemProps", "showSlot", "show"]), s = Object.keys(n), v = I(() => e.configs.filter((S) => S.show !== !1)), p = (S) => {
375
+ const { itemType: B } = S;
376
+ if (!B) return Ze;
377
+ if (typeof B != "string") return B;
378
+ const u = o[B] ?? B;
379
+ return s.includes(u) ? n[u] : (console.error(
380
+ `[JtFormItems] 不支持的 itemType: "${B}",支持的类型: ${s.join(", ")}`
381
+ ), Ze);
382
+ }, c = (S) => {
383
+ const B = Pt(S, a);
384
+ return S.itemType === "select" || S.itemType === "remote-select" || S.itemType === "cascader" ? {
385
+ ...B,
386
+ options: S.options
387
+ } : h(S.itemType) ? {
388
+ ...B,
389
+ type: "daterange"
390
+ } : B;
391
+ }, b = (S) => Vt(S, a), C = (S) => ({
392
+ rules: S.rules,
393
+ ...S.formItemProps
394
+ }), i = (S, B) => {
395
+ e.formData[S] = B;
396
+ }, d = (S) => Math.min(Math.max(Math.trunc(S || 1), 1), 4), m = I(() => {
397
+ const B = v.value.reduce(
398
+ (u, _) => u + d(e.span || _.span),
399
+ 0
400
+ ) % Qe;
401
+ return B === 0 ? {
402
+ gridColumn: `1 / span ${Qe}`
403
+ } : {
404
+ gridColumn: `${B + 1} / span ${Qe - B}`
405
+ };
406
+ }), g = (S) => ({
407
+ gridColumn: `span ${d(e.span || S.span)}`
408
+ });
409
+ function h(S) {
410
+ return S === "daterange" || S === "date-range" || S === "dateRange";
411
+ }
412
+ return (S, B) => {
413
+ const u = $t;
414
+ return y(), L("div", $n, [
415
+ (y(!0), L(de, null, oe(v.value, (_) => (y(), F(u, D({
416
+ key: _.prop,
417
+ class: "jt-form-items__item",
418
+ style: g(_),
419
+ label: _.label,
420
+ prop: _.prop,
421
+ ref_for: !0
422
+ }, C(_)), {
423
+ default: M(() => [
424
+ _.showSlot ? j(S.$slots, _.prop, { key: 0 }, void 0, !0) : (y(), F(ht(p(_)), D({
425
+ key: 1,
426
+ "model-value": S.formData[_.prop],
427
+ ref_for: !0
428
+ }, c(_), Ce(b(_)), {
429
+ "onUpdate:modelValue": (V) => i(_.prop, V)
430
+ }), null, 16, ["model-value", "onUpdate:modelValue"]))
431
+ ]),
432
+ _: 2
433
+ }, 1040, ["style", "label", "prop"]))), 128)),
434
+ S.$slots.actions ? (y(), F(u, {
435
+ key: 0,
436
+ class: "jt-form-items__actions",
437
+ style: bt(m.value)
438
+ }, {
439
+ default: M(() => [
440
+ j(S.$slots, "actions", {}, void 0, !0)
441
+ ]),
442
+ _: 3
443
+ }, 8, ["style"])) : Z("", !0)
444
+ ]);
445
+ };
446
+ }
447
+ }), Bn = /* @__PURE__ */ X(Tn, [["__scopeId", "data-v-20df934b"]]);
448
+ function En() {
449
+ const t = ne(!1);
450
+ function e() {
451
+ t.value = !0;
452
+ }
453
+ function n() {
454
+ t.value = !1;
455
+ }
456
+ return {
457
+ searchDisabled: t,
458
+ searchLoading: e,
459
+ searchDone: n
460
+ };
461
+ }
462
+ const Mn = { class: "jt-filter-bar__btns" }, Fn = ["src"], Vn = ["src"], Pn = ["src"], Ln = /* @__PURE__ */ U({
463
+ name: "JtFilterBar",
464
+ __name: "JtFilterBar",
465
+ props: {
466
+ columns: {},
467
+ option: { default: () => ({}) },
468
+ modelValue: {}
469
+ },
470
+ emits: ["update:modelValue", "search", "reset"],
471
+ setup(t, { expose: e, emit: n }) {
472
+ const o = new URL("data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0.5'%20y='-0.5'%20width='11'%20height='11'%20rx='5.5'%20transform='matrix(1%200%200%20-1%201%2012)'%20stroke='%23999999'/%3e%3cpath%20d='M10%208.16064L7%205.16064L4%208.16064'%20stroke='%23999999'/%3e%3c/svg%3e", import.meta.url).href, a = new URL("data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.375%207.00017C2.375%207.27631%202.59886%207.50017%202.875%207.50017C3.15114%207.50017%203.375%207.27631%203.375%207.00017H2.875H2.375ZM2.875%207.00017H3.375C3.375%204.46334%205.41801%202.41406%207.93713%202.41406V1.91406V1.41406C4.86127%201.41406%202.375%203.91551%202.375%207.00017H2.875ZM7.93713%201.91406V2.41406C10.4563%202.41406%2012.4993%204.46334%2012.4993%207.00017H12.9993H13.4993C13.4993%203.91551%2011.013%201.41406%207.93713%201.41406V1.91406ZM12.9993%207.00017H12.4993C12.4993%209.537%2010.4563%2011.5863%207.93713%2011.5863V12.0863V12.5863C11.013%2012.5863%2013.4993%2010.0848%2013.4993%207.00017H12.9993ZM7.93713%2012.0863V11.5863C6.68975%2011.5863%205.55663%2011.0806%204.72892%2010.2635L4.37765%2010.6193L4.02638%2010.9752C5.0317%2011.9676%206.41366%2012.5863%207.93713%2012.5863V12.0863Z'%20fill='%23999999'/%3e%3cpath%20d='M4.75131%206.0102L2.88631%207.88403L1%205.99414'%20stroke='%23999999'%20stroke-miterlimit='10'/%3e%3c/svg%3e", import.meta.url).href, s = new URL("data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.60938%2012.1099C9.64694%2012.1099%2012.1094%209.64743%2012.1094%206.60986C12.1094%203.5723%209.64694%201.10986%206.60938%201.10986C3.57181%201.10986%201.10938%203.5723%201.10938%206.60986C1.10938%209.64743%203.57181%2012.1099%206.60938%2012.1099Z'%20stroke='white'%20stroke-miterlimit='10'/%3e%3cpath%20d='M12.4993%2012.5002L10.2832%2010.3301'%20stroke='white'%20stroke-miterlimit='10'/%3e%3c/svg%3e", import.meta.url).href, v = t, p = n, c = ne(), b = ve(), C = ne({}), {
473
+ searchDisabled: i,
474
+ searchLoading: d,
475
+ searchDone: m
476
+ } = En(), g = I(() => v.option), h = ne(g.value.searchCollapsed ?? !1), S = I(() => v.columns.filter(($) => $.search === !0)), B = I(
477
+ () => Math.max(1, g.value.searchSpan ?? 4)
478
+ ), u = I(() => Math.max(1, g.value.searchCollapsedRows ?? 1)), _ = I(() => Math.max(1, B.value - 1)), V = I(
479
+ () => Math.max(1, _.value * u.value)
480
+ ), G = I(() => Ye(g.value.searchLabelWidth ?? 84)), P = I(() => g.value.searchLabelPosition ?? "top"), w = I(() => Ge(g.value.searchGutter, 14)), R = I(() => Ge(g.value.searchRowGap, 14)), k = I(() => Ae(g.value.searchPadding ?? "18px 4px 0")), z = I(() => g.value.searchCollapse === !1 ? !1 : Me(S.value) > V.value), ae = I(() => {
481
+ if (!z.value || !h.value) return S.value;
482
+ let $ = 0;
483
+ return S.value.filter((x) => {
484
+ const W = Ie(x);
485
+ return $ + W > V.value ? !1 : ($ += W, !0);
486
+ });
487
+ }), pe = I(
488
+ () => ae.value.filter(($) => !!b[`${$.prop}-search`])
489
+ ), ze = I(
490
+ () => ae.value.map(($) => We($))
491
+ );
492
+ Re(
493
+ () => g.value.searchCollapsed,
494
+ ($) => {
495
+ typeof $ == "boolean" && (h.value = $);
496
+ }
497
+ ), Re(
498
+ () => v.modelValue,
499
+ ($) => {
500
+ C.value = { ...$ };
501
+ },
502
+ { deep: !0, immediate: !0 }
503
+ );
504
+ function Oe($, x) {
505
+ if (i.value) return;
506
+ const W = { ...C.value, [$]: x };
507
+ C.value = W, p("update:modelValue", W);
508
+ }
509
+ function We($) {
510
+ const x = $.searchProps ?? {};
511
+ return {
512
+ ...x,
513
+ prop: $.prop,
514
+ label: $.searchLabel ?? $.label,
515
+ span: Ie($),
516
+ itemType: $.searchType ?? "input",
517
+ // 外部提供 `${prop}-search` 时交给插槽渲染,保持旧版 JtFilterBar 的自定义能力。
518
+ showSlot: !!b[`${$.prop}-search`],
519
+ options: x.options ?? $.searchOptions ?? $.dicData,
520
+ placeholder: x.placeholder ?? $.searchPlaceholder,
521
+ valueFormat: x.valueFormat ?? $.searchValueFormat,
522
+ disabled: i.value || x.disabled === !0,
523
+ formItemProps: {
524
+ required: $.searchRequired,
525
+ class: ["jt-filter-bar__item", { "is-required": $.searchRequired }]
526
+ },
527
+ // 保留原来输入框回车触发查询的行为,同时不吞掉使用方在 searchProps 中传入的 onEnter。
528
+ onEnter: (...W) => {
529
+ le(x.onEnter, ...W), ye();
530
+ },
531
+ // JtFormItems 内部会修改 filterModel,这里继续按旧接口向外 emit update:modelValue。
532
+ "onUpdate:modelValue": (W) => {
533
+ le(x["onUpdate:modelValue"], W), Oe($.prop, W);
534
+ }
535
+ };
536
+ }
537
+ function le($, ...x) {
538
+ if (Array.isArray($)) {
539
+ $.forEach((W) => le(W, ...x));
540
+ return;
541
+ }
542
+ typeof $ == "function" && $(...x);
543
+ }
544
+ function ye() {
545
+ i.value || p("search");
546
+ }
547
+ function Ee() {
548
+ i.value || p("reset");
549
+ }
550
+ function he() {
551
+ h.value = !h.value;
552
+ }
553
+ function Ie($) {
554
+ return Math.min(B.value, Math.max(1, $.searchSpan ?? 1));
555
+ }
556
+ function Me($) {
557
+ return $.reduce((x, W) => x + Ie(W), 0);
558
+ }
559
+ function Ye($) {
560
+ return typeof $ == "number" ? `${$}px` : $;
561
+ }
562
+ function Ge($, x) {
563
+ return typeof $ == "number" ? $ : x;
564
+ }
565
+ function Ae($) {
566
+ return typeof $ == "number" ? `${$}px` : $;
567
+ }
568
+ return e({
569
+ /** 内部 Element Plus Form 实例,保留给业务侧做校验、重置等原生表单操作。 */
570
+ formRef: c,
571
+ /** 当前筛选表单禁用态。 */
572
+ searchDisabled: i,
573
+ /** 开启筛选表单禁用。 */
574
+ searchLoading: d,
575
+ /** 关闭筛选表单禁用。 */
576
+ searchDone: m
577
+ }), ($, x) => {
578
+ const W = Tt;
579
+ return y(), L("div", {
580
+ class: Ue(["jt-filter-bar", `is-label-${P.value}`]),
581
+ style: bt({
582
+ "--jt-filter-columns": B.value,
583
+ "--jt-filter-label-width": G.value,
584
+ "--jt-filter-column-gap": `${w.value}px`,
585
+ "--jt-filter-row-gap": `${R.value}px`,
586
+ "--jt-filter-padding": k.value
587
+ })
588
+ }, [
589
+ re(W, {
590
+ ref_key: "formRef",
591
+ ref: c,
592
+ class: "jt-filter-bar__form",
593
+ model: C.value,
594
+ "label-position": P.value,
595
+ "label-width": G.value,
596
+ disabled: q(i),
597
+ onSubmit: x[0] || (x[0] = on(() => {
598
+ }, ["prevent"]))
599
+ }, {
600
+ default: M(() => [
601
+ re(q(Bn), {
602
+ configs: ze.value,
603
+ "form-data": C.value
604
+ }, ke({
605
+ actions: M(() => [
606
+ J("div", Mn, [
607
+ j($.$slots, "search-menu", {
608
+ search: ye,
609
+ reset: Ee,
610
+ disabled: q(i),
611
+ collapsed: h.value,
612
+ toggleCollapse: he
613
+ }, () => [
614
+ z.value ? (y(), F(q(Je), {
615
+ key: 0,
616
+ class: "jt-filter-bar__btn-collapse",
617
+ onClick: he
618
+ }, {
619
+ icon: M(() => [
620
+ J("img", {
621
+ class: Ue(["jt-filter-bar__icon-arrow", { "is-collapsed": h.value }]),
622
+ src: q(o),
623
+ alt: ""
624
+ }, null, 10, Fn)
625
+ ]),
626
+ default: M(() => [
627
+ J("span", null, ee(h.value ? "展 开" : "收 起"), 1)
628
+ ]),
629
+ _: 1
630
+ })) : Z("", !0),
631
+ re(q(Je), {
632
+ class: "jt-filter-bar__btn-reset",
633
+ disabled: q(i),
634
+ onClick: Ee
635
+ }, {
636
+ icon: M(() => [
637
+ J("img", {
638
+ src: q(a),
639
+ alt: ""
640
+ }, null, 8, Vn)
641
+ ]),
642
+ default: M(() => [
643
+ J("span", null, ee(g.value.resetBtnText ?? "重 置"), 1)
644
+ ]),
645
+ _: 1
646
+ }, 8, ["disabled"]),
647
+ re(q(Je), {
648
+ class: "jt-filter-bar__btn-query",
649
+ type: "primary",
650
+ disabled: q(i),
651
+ onClick: ye
652
+ }, {
653
+ icon: M(() => [
654
+ J("img", {
655
+ src: q(s),
656
+ alt: ""
657
+ }, null, 8, Pn)
658
+ ]),
659
+ default: M(() => [
660
+ J("span", null, ee(g.value.searchBtnText ?? "查 询"), 1)
661
+ ]),
662
+ _: 1
663
+ }, 8, ["disabled"])
664
+ ], !0)
665
+ ])
666
+ ]),
667
+ _: 2
668
+ }, [
669
+ oe(pe.value, (we) => ({
670
+ name: we.prop,
671
+ fn: M(() => [
672
+ j($.$slots, `${we.prop}-search`, {
673
+ value: C.value[we.prop],
674
+ column: we,
675
+ setValue: (De) => Oe(we.prop, De),
676
+ search: ye,
677
+ reset: Ee,
678
+ disabled: q(i)
679
+ }, void 0, !0)
680
+ ])
681
+ }))
682
+ ]), 1032, ["configs", "form-data"])
683
+ ]),
684
+ _: 3
685
+ }, 8, ["model", "label-position", "label-width", "disabled"])
686
+ ], 6);
687
+ };
688
+ }
689
+ }), Rn = /* @__PURE__ */ X(Ln, [["__scopeId", "data-v-ea82d792"]]), Nn = { key: 1 }, jn = { key: 2 }, zn = { key: 3 }, On = /* @__PURE__ */ U({
690
+ name: "JtTable",
691
+ __name: "JtTable",
692
+ props: {
693
+ data: {},
694
+ columns: {},
695
+ option: {},
696
+ tableEvents: {}
697
+ },
698
+ setup(t, { expose: e }) {
699
+ const n = t, o = ve(), a = ne(), s = I(() => n.option ?? {}), v = I(() => n.columns.filter((i) => !i.hide));
700
+ function p(i) {
701
+ return !!o[`${i}-header`];
702
+ }
703
+ function c(i) {
704
+ return !!o[`${i}-data`];
705
+ }
706
+ function b(i) {
707
+ return {
708
+ width: i.width,
709
+ minWidth: i.minWidth,
710
+ align: i.align,
711
+ fixed: i.fixed,
712
+ sortable: i.sortable,
713
+ showOverflowTooltip: i.showOverflowTooltip,
714
+ ...i.columnOptions
715
+ };
716
+ }
717
+ function C(i, d) {
718
+ return i.find((m) => m.value === d)?.label ?? String(d ?? "");
719
+ }
720
+ return e({ tableRef: a }), (i, d) => {
721
+ const m = Et, g = Bt;
722
+ return y(), F(g, D({
723
+ ref_key: "tableRef",
724
+ ref: a,
725
+ data: i.data,
726
+ "row-key": s.value.rowKey ?? "id",
727
+ height: s.value.height,
728
+ "max-height": s.value.maxHeight,
729
+ "empty-text": s.value.emptyText,
730
+ class: "jt-table"
731
+ }, s.value.tableProps, Ce(i.tableEvents)), {
732
+ default: M(() => [
733
+ s.value.selection ? (y(), F(m, {
734
+ key: 0,
735
+ type: "selection",
736
+ width: "55",
737
+ align: "center"
738
+ })) : Z("", !0),
739
+ s.value.index ? (y(), F(m, {
740
+ key: 1,
741
+ type: "index",
742
+ label: s.value.indexLabel ?? "序号",
743
+ width: "60",
744
+ align: "center"
745
+ }, null, 8, ["label"])) : Z("", !0),
746
+ (y(!0), L(de, null, oe(v.value, (h) => (y(), F(m, D({
747
+ key: h.prop,
748
+ prop: h.prop,
749
+ label: h.label,
750
+ formatter: !c(h.prop) && !h.dicData ? h.formatter : void 0,
751
+ ref_for: !0
752
+ }, b(h)), ke({
753
+ default: M((S) => [
754
+ c(h.prop) ? j(i.$slots, `${h.prop}-data`, D({
755
+ key: 0,
756
+ ref_for: !0
757
+ }, S), void 0, !0) : h.dicData ? (y(), L("span", Nn, ee(C(h.dicData, S.row[h.prop])), 1)) : h.formatter ? (y(), L("span", jn, ee(h.formatter(S.row, S.column, S.row[h.prop], S.$index)), 1)) : (y(), L("span", zn, ee(S.row[h.prop]), 1))
758
+ ]),
759
+ _: 2
760
+ }, [
761
+ p(h.prop) ? {
762
+ name: "header",
763
+ fn: M((S) => [
764
+ j(i.$slots, `${h.prop}-header`, D({ ref_for: !0 }, S), void 0, !0)
765
+ ]),
766
+ key: "0"
767
+ } : void 0
768
+ ]), 1040, ["prop", "label", "formatter"]))), 128)),
769
+ s.value.menu ? (y(), F(m, {
770
+ key: 2,
771
+ label: s.value.menuLabel ?? "操作",
772
+ width: s.value.menuWidth,
773
+ "min-width": s.value.menuMinWidth,
774
+ align: s.value.menuAlign ?? "center",
775
+ fixed: s.value.menuFixed
776
+ }, {
777
+ default: M((h) => [
778
+ j(i.$slots, "menu", ce(me(h)), void 0, !0)
779
+ ]),
780
+ _: 3
781
+ }, 8, ["label", "width", "min-width", "align", "fixed"])) : Z("", !0)
782
+ ]),
783
+ _: 3
784
+ }, 16, ["data", "row-key", "height", "max-height", "empty-text"]);
785
+ };
786
+ }
787
+ }), Gn = /* @__PURE__ */ X(On, [["__scopeId", "data-v-4804a967"]]), An = { class: "jt-pagination" }, Dn = { class: "jt-pagination__count" }, Kn = /* @__PURE__ */ U({
788
+ name: "JtPagination",
789
+ __name: "JtPagination",
790
+ props: {
791
+ currentPage: {},
792
+ pageSize: {},
793
+ total: {},
794
+ option: {}
795
+ },
796
+ emits: ["update:currentPage", "update:pageSize", "current-change", "page-change", "size-change"],
797
+ setup(t, { emit: e }) {
798
+ const n = t, o = I(() => n.option ?? {}), a = e;
799
+ function s(v) {
800
+ a("current-change", v), a("page-change", v);
801
+ }
802
+ return (v, p) => {
803
+ const c = Mt;
804
+ return y(), L("div", An, [
805
+ re(c, {
806
+ "current-page": v.currentPage,
807
+ "page-size": v.pageSize,
808
+ "page-sizes": o.value.pageSizes ?? [10, 20, 50, 100],
809
+ total: v.total,
810
+ layout: o.value.paginationLayout ?? "sizes, prev, pager, next, jumper",
811
+ "onUpdate:currentPage": p[0] || (p[0] = (b) => v.$emit("update:currentPage", b)),
812
+ "onUpdate:pageSize": p[1] || (p[1] = (b) => v.$emit("update:pageSize", b)),
813
+ onCurrentChange: s,
814
+ onSizeChange: p[2] || (p[2] = (b) => v.$emit("size-change", b))
815
+ }, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"]),
816
+ J("span", Dn, "共" + ee(v.total) + "条记录", 1)
817
+ ]);
818
+ };
819
+ }
820
+ }), qn = /* @__PURE__ */ X(Kn, [["__scopeId", "data-v-19ef6db6"]]), Jn = { class: "jt-crud-table" }, Un = {
821
+ key: 1,
822
+ class: "jt-crud-table__toolbar"
823
+ }, xn = /* @__PURE__ */ U({
824
+ name: "JtCrudTable",
825
+ __name: "JtCrudTable",
826
+ props: /* @__PURE__ */ xe({
827
+ columns: {},
828
+ option: { default: () => ({}) },
829
+ data: {},
830
+ total: { default: 0 },
831
+ tableEvents: {}
832
+ }, {
833
+ currentPage: { default: 1 },
834
+ currentPageModifiers: {},
835
+ pageSize: { default: 20 },
836
+ pageSizeModifiers: {},
837
+ searchModel: { default: () => ({}) },
838
+ searchModelModifiers: {}
839
+ }),
840
+ emits: /* @__PURE__ */ xe(["search", "reset", "page-change", "size-change"], ["update:currentPage", "update:pageSize", "update:searchModel"]),
841
+ setup(t, { expose: e, emit: n }) {
842
+ const o = t, a = n, s = Pe(t, "currentPage"), v = Pe(t, "pageSize"), p = Pe(t, "searchModel"), c = ve(), b = ne(), C = ne(), i = I(() => o.option), d = I(() => i.value.searchShow !== !1), m = I(() => i.value.paginationShow !== !1), g = I(
843
+ () => o.columns.filter((P) => P.search && !!c[`${P.prop}-search`])
844
+ ), h = I(
845
+ () => o.columns.filter((P) => !P.hide && !!c[`${P.prop}-header`])
846
+ ), S = I(
847
+ () => o.columns.filter((P) => !P.hide && !!c[`${P.prop}-data`])
848
+ );
849
+ function B() {
850
+ const P = {};
851
+ return o.columns.forEach((w) => {
852
+ w.search && (P[w.prop] = void 0);
853
+ }), P;
854
+ }
855
+ function u() {
856
+ a("search", { ...p.value });
857
+ }
858
+ function _() {
859
+ p.value = B(), a("reset");
860
+ }
861
+ function V() {
862
+ C.value?.searchLoading();
863
+ }
864
+ function G() {
865
+ C.value?.searchDone();
866
+ }
867
+ return e({
868
+ /** 获取内部 el-table 实例 */
869
+ tableRef: I(() => b.value?.tableRef),
870
+ /** 获取内部筛选条实例 */
871
+ filterBarRef: C,
872
+ /** 开启筛选表单禁用。 */
873
+ searchLoading: V,
874
+ /** 关闭筛选表单禁用。 */
875
+ searchDone: G
876
+ }), (P, w) => {
877
+ const R = an("loading");
878
+ return y(), L("div", Jn, [
879
+ j(P.$slots, "header", {}, void 0, !0),
880
+ d.value ? (y(), F(Rn, {
881
+ key: 0,
882
+ ref_key: "filterBarRef",
883
+ ref: C,
884
+ modelValue: p.value,
885
+ "onUpdate:modelValue": w[0] || (w[0] = (k) => p.value = k),
886
+ columns: P.columns,
887
+ option: i.value,
888
+ onSearch: u,
889
+ onReset: _
890
+ }, ke({ _: 2 }, [
891
+ oe(g.value, (k) => ({
892
+ name: `${k.prop}-search`,
893
+ fn: M((z) => [
894
+ j(P.$slots, `${k.prop}-search`, ce(me(z)), void 0, !0)
895
+ ])
896
+ }))
897
+ ]), 1032, ["modelValue", "columns", "option"])) : Z("", !0),
898
+ q(c).toolbar ? (y(), L("div", Un, [
899
+ j(P.$slots, "toolbar", {}, void 0, !0)
900
+ ])) : Z("", !0),
901
+ ln((y(), F(Gn, {
902
+ ref_key: "jtTableRef",
903
+ ref: b,
904
+ data: P.data,
905
+ columns: P.columns,
906
+ option: i.value,
907
+ "table-events": P.tableEvents
908
+ }, ke({ _: 2 }, [
909
+ oe(h.value, (k) => ({
910
+ name: `${k.prop}-header`,
911
+ fn: M((z) => [
912
+ j(P.$slots, `${k.prop}-header`, ce(me(z)), void 0, !0)
913
+ ])
914
+ })),
915
+ oe(S.value, (k) => ({
916
+ name: `${k.prop}-data`,
917
+ fn: M((z) => [
918
+ j(P.$slots, `${k.prop}-data`, ce(me(z)), void 0, !0)
919
+ ])
920
+ })),
921
+ i.value.menu ? {
922
+ name: "menu",
923
+ fn: M((k) => [
924
+ j(P.$slots, "menu", ce(me(k)), void 0, !0)
925
+ ]),
926
+ key: "0"
927
+ } : void 0
928
+ ]), 1032, ["data", "columns", "option", "table-events"])), [
929
+ [R, i.value.loading]
930
+ ]),
931
+ m.value ? (y(), F(qn, {
932
+ key: 2,
933
+ "current-page": s.value,
934
+ "onUpdate:currentPage": w[1] || (w[1] = (k) => s.value = k),
935
+ "page-size": v.value,
936
+ "onUpdate:pageSize": w[2] || (w[2] = (k) => v.value = k),
937
+ total: P.total,
938
+ option: i.value,
939
+ onPageChange: w[3] || (w[3] = (k) => P.$emit("page-change", k)),
940
+ onSizeChange: w[4] || (w[4] = (k) => P.$emit("size-change", k))
941
+ }, null, 8, ["current-page", "page-size", "total", "option"])) : Z("", !0)
942
+ ]);
943
+ };
944
+ }
945
+ }), va = /* @__PURE__ */ X(xn, [["__scopeId", "data-v-6df082c6"]]), Hn = { class: "jt-pagination" }, Wn = {
946
+ key: 0,
947
+ class: "jt-pagination__count"
948
+ }, Yn = /* @__PURE__ */ U({
949
+ name: "JtPagination",
950
+ inheritAttrs: !1,
951
+ __name: "index",
952
+ props: /* @__PURE__ */ xe({
953
+ defaultPageSize: {},
954
+ total: { default: 0 },
955
+ pageCount: {},
956
+ pagerCount: {},
957
+ defaultCurrentPage: {},
958
+ layout: { default: "prev, pager, next, jumper" },
959
+ pageSizes: { default: () => [10, 20, 50, 100] },
960
+ popperClass: {},
961
+ popperStyle: {},
962
+ prevText: {},
963
+ prevIcon: {},
964
+ nextText: {},
965
+ nextIcon: {},
966
+ teleported: { type: Boolean },
967
+ small: { type: Boolean },
968
+ size: {},
969
+ background: { type: Boolean },
970
+ disabled: { type: Boolean },
971
+ hideOnSinglePage: { type: Boolean, default: !1 },
972
+ appendSizeTo: {}
973
+ }, {
974
+ currentPage: { default: 1 },
975
+ currentPageModifiers: {},
976
+ pageSize: { default: 20 },
977
+ pageSizeModifiers: {}
978
+ }),
979
+ emits: /* @__PURE__ */ xe(it, ["update:currentPage", "update:pageSize"]),
980
+ setup(t, { emit: e }) {
981
+ const n = Pe(t, "currentPage"), o = Pe(t, "pageSize"), a = t, s = yt(), v = e, p = I(() => ({
982
+ ...s,
983
+ ...a
984
+ })), c = I(() => Object.fromEntries(
985
+ Object.keys(it).filter((C) => !C.startsWith("update:")).map((C) => [
986
+ C,
987
+ (...i) => v(C, ...i)
988
+ ])
989
+ )), b = I(() => !(a.hideOnSinglePage && a.total <= o.value));
990
+ return (C, i) => {
991
+ const d = Mt;
992
+ return y(), L("div", Hn, [
993
+ re(d, D({
994
+ "current-page": n.value,
995
+ "onUpdate:currentPage": i[0] || (i[0] = (m) => n.value = m),
996
+ "page-size": o.value,
997
+ "onUpdate:pageSize": i[1] || (i[1] = (m) => o.value = m)
998
+ }, p.value, Ce(c.value)), null, 16, ["current-page", "page-size"]),
999
+ b.value ? (y(), L("span", Wn, "共" + ee(C.total) + "条记录", 1)) : Z("", !0)
1000
+ ]);
1001
+ };
1002
+ }
1003
+ }), ga = /* @__PURE__ */ X(Yn, [["__scopeId", "data-v-72da666d"]]), Zn = { class: "jt-page-header__title" }, Qn = { key: 0 }, Xn = {
1004
+ key: 0,
1005
+ class: "jt-page-header__operates"
1006
+ }, eo = /* @__PURE__ */ U({
1007
+ name: "JtPageHeader",
1008
+ __name: "index",
1009
+ props: {
1010
+ type: { default: "section" },
1011
+ title: {},
1012
+ operates: { default: () => [] }
1013
+ },
1014
+ emits: ["operate-click"],
1015
+ setup(t, { emit: e }) {
1016
+ const n = t, o = e, a = ve(), s = I(() => n.operates.length > 0 || !!a.operates);
1017
+ function v(p, c) {
1018
+ p.onClick?.(p, c), o("operate-click", p, c);
1019
+ }
1020
+ return (p, c) => (y(), L("div", D({
1021
+ class: ["jt-page-header", `jt-page-header--${p.type}`]
1022
+ }, p.$attrs), [
1023
+ J("div", Zn, [
1024
+ j(p.$slots, "title", {}, () => [
1025
+ p.title ? (y(), L("span", Qn, ee(p.title), 1)) : Z("", !0)
1026
+ ], !0)
1027
+ ]),
1028
+ s.value ? (y(), L("div", Xn, [
1029
+ j(p.$slots, "operates", { operates: p.operates }, () => [
1030
+ (y(!0), L(de, null, oe(p.operates, (b) => (y(), F(q(Je), D({
1031
+ key: b.key ?? b.label,
1032
+ ref_for: !0
1033
+ }, b.buttonProps, {
1034
+ type: b.type,
1035
+ disabled: b.disabled,
1036
+ loading: b.loading,
1037
+ plain: b.plain,
1038
+ text: b.text,
1039
+ link: b.link,
1040
+ icon: b.icon,
1041
+ onClick: (C) => v(b, C)
1042
+ }), {
1043
+ default: M(() => [
1044
+ J("span", null, ee(b.label), 1)
1045
+ ]),
1046
+ _: 2
1047
+ }, 1040, ["type", "disabled", "loading", "plain", "text", "link", "icon", "onClick"]))), 128))
1048
+ ], !0)
1049
+ ])) : Z("", !0)
1050
+ ], 16));
1051
+ }
1052
+ }), ya = /* @__PURE__ */ X(eo, [["__scopeId", "data-v-2f59fb4a"]]);
1053
+ function to(t = null) {
1054
+ return {
1055
+ scheme: null,
1056
+ node: null,
1057
+ topNodes: [],
1058
+ treeNodes: [],
1059
+ activeNode: null,
1060
+ activeSection: null,
1061
+ sections: [],
1062
+ sectionMap: {},
1063
+ raw: t
1064
+ };
1065
+ }
1066
+ function ut(t) {
1067
+ const e = Ot(t), n = zt(e), o = fo(e).flatMap((a) => jt(a, n));
1068
+ return {
1069
+ ...to(t),
1070
+ scheme: n,
1071
+ topNodes: o,
1072
+ treeNodes: o
1073
+ };
1074
+ }
1075
+ function Lt(t, e, n) {
1076
+ return t.map((o) => o.key === e || o.tagId === e || o.id === e ? { ...o, children: n, loaded: !0 } : {
1077
+ ...o,
1078
+ children: Lt(o.children, e, n)
1079
+ });
1080
+ }
1081
+ function no(t, e = {}, n = null) {
1082
+ const o = Ot(t), a = zt(o, e), s = lo(o, e, n), v = Object.fromEntries(s.map((p) => [p.key, p]));
1083
+ return {
1084
+ scheme: a,
1085
+ node: n,
1086
+ topNodes: [],
1087
+ treeNodes: [],
1088
+ activeNode: n,
1089
+ activeSection: s[0] ?? null,
1090
+ sections: s,
1091
+ sectionMap: v,
1092
+ raw: t
1093
+ };
1094
+ }
1095
+ function oo(t) {
1096
+ return t.multRow || t.htmlDisplay === "T" ? "table" : "form";
1097
+ }
1098
+ function ao(t, e = {}) {
1099
+ return {
1100
+ ...e,
1101
+ infSchmId: e.infSchmId ?? H(t.raw.infSchmId),
1102
+ emplid: e.emplid ?? H(t.raw.emplid),
1103
+ tagId: e.tagId ?? t.requestTagId ?? t.tagId,
1104
+ infSetId: e.infSetId ?? t.infSetId,
1105
+ setId: e.setId ?? t.setId,
1106
+ infSetFields: t.renderType === "table" ? t.rows.map(et) : [et(t.model)],
1107
+ section: t
1108
+ };
1109
+ }
1110
+ function ha(t) {
1111
+ const e = t;
1112
+ return !!(e && typeof e == "object" && typeof e.key == "string" && typeof e.tagId == "string");
1113
+ }
1114
+ function Rt(t) {
1115
+ const e = Gt(t);
1116
+ return (Array.isArray(e) ? e : Ne(Q(e), ["options", "list", "records", "data"])).map((o) => {
1117
+ const a = Q(o);
1118
+ return {
1119
+ id: a.id,
1120
+ code: a.code,
1121
+ label: N(a.label ?? a.name ?? a.descr ?? a.text ?? a.value ?? a.code),
1122
+ name: H(a.name),
1123
+ value: a.value ?? a.code ?? a.id ?? a.label ?? a.name,
1124
+ raw: o
1125
+ };
1126
+ });
1127
+ }
1128
+ function lo(t, e, n) {
1129
+ const o = Ne(t, ["sections", "sets", "list"]);
1130
+ return o.length > 0 ? o.map((a) => ct(a, e, n, o.length === 1)) : t.infSetMark || t.infSetFields || t.fields ? [ct(t, e, n, !0)] : [];
1131
+ }
1132
+ function ct(t, e, n, o) {
1133
+ const a = Q(t), s = ro(a.infSetMark ?? a), v = so(a.infSetFields ?? a.fields ?? []), p = uo(a.infSetValues ?? a.rows ?? a.data, v), c = p[0] ? et(p[0]) : Nt(v), b = Q(a.tag), C = N(a.tagId ?? a.infTagId ?? b.tagId), i = N(e.tagId ?? n?.tagId), d = N(n?.key), m = o ? e.infSetId ?? n?.infSetId : void 0, g = o ? e.setId : void 0, h = o ? n?.code : void 0, S = s.setId || N(a.setId), B = N(a.infSetId) || S || N(m), u = S || N(g ?? B), _ = s.code || N(a.code ?? h ?? u), V = u || _ || B || C, G = {
1134
+ key: V,
1135
+ id: V,
1136
+ setId: u,
1137
+ code: _,
1138
+ tagId: C,
1139
+ requestTagId: i || void 0,
1140
+ ownerNodeKey: d || void 0,
1141
+ infSetId: B,
1142
+ title: s.name || N(a.name ?? n?.tagName ?? V),
1143
+ renderType: oo(s),
1144
+ mark: s,
1145
+ fields: v,
1146
+ model: c,
1147
+ rows: p,
1148
+ operationInfo: He(e.operationInfo ?? a.operationInfo),
1149
+ raw: a
1150
+ };
1151
+ return G.renderType === "form" && p.length === 0 && (G.rows = [{ ...c, __rowKey: `${V}-0` }]), G;
1152
+ }
1153
+ function ro(t) {
1154
+ const e = Q(t), n = N(e.htmlDisplay || "F");
1155
+ return {
1156
+ name: N(e.name ?? e.title),
1157
+ parentName: H(e.parentName),
1158
+ value: H(e.value),
1159
+ type: H(e.type),
1160
+ code: N(e.code),
1161
+ setId: N(e.setId ?? e.id ?? e.key),
1162
+ htmlDisplay: n,
1163
+ multRow: ue(e.multRow),
1164
+ isRequired: ue(e.isRequired),
1165
+ raw: e
1166
+ };
1167
+ }
1168
+ function so(t) {
1169
+ return (Array.isArray(t) ? t : []).map((n, o) => io(n, o));
1170
+ }
1171
+ function io(t, e) {
1172
+ const n = Q(t), o = N(n.code ?? n.fieldCode ?? n.prop ?? n.key ?? `field_${e}`), a = N(n.label ?? n.name ?? n.tagName ?? o);
1173
+ return {
1174
+ id: N(n.id ?? n.key ?? n.prop ?? o),
1175
+ key: N(n.key ?? n.prop ?? o),
1176
+ code: o,
1177
+ label: a,
1178
+ value: n.value ?? n.defaultValue ?? "",
1179
+ type: go(n),
1180
+ fieldType: H(n.fieldType),
1181
+ renderType: vo(n),
1182
+ required: ue(n.required ?? n.isRequired),
1183
+ readonly: ue(n.readonly ?? n.disabled),
1184
+ visible: n.visible === void 0 ? ue(n.visibled ?? !0) : ue(n.visible),
1185
+ htmlDisplay: ue(n.htmlDisplay),
1186
+ multRow: ue(n.multRow),
1187
+ isRequired: ue(n.isRequired),
1188
+ disabled: n.disabled === void 0 ? void 0 : ue(n.disabled),
1189
+ span: Kt(n.span ?? n.colSpan),
1190
+ width: pt(n.width),
1191
+ minWidth: pt(n.minWidth),
1192
+ placeholder: H(n.placeholder),
1193
+ options: Rt(n.options),
1194
+ interface: At(n.interface),
1195
+ cascadeClearFields: dt(n.cascadeClearFields),
1196
+ cascadeDependFields: dt(n.cascadeDependFields),
1197
+ props: tt(n.props),
1198
+ formItemProps: tt(n.formItemProps),
1199
+ raw: n
1200
+ };
1201
+ }
1202
+ function uo(t, e) {
1203
+ if (Array.isArray(t) && t.some((a) => {
1204
+ const s = Q(a);
1205
+ return e.some((v) => s[v.code] !== void 0 || s[v.key] !== void 0);
1206
+ }))
1207
+ return t.map((a, s) => ({ ...Q(a), __rowKey: N(Q(a).__rowKey ?? Q(a).key ?? s) }));
1208
+ const n = Nt(e);
1209
+ return Object.keys(n).length ? [{ ...n, __rowKey: "0" }] : [];
1210
+ }
1211
+ function Nt(t) {
1212
+ return t.reduce((e, n) => (e[n.code || n.key] = n.value, e), {});
1213
+ }
1214
+ function jt(t, e, n = "") {
1215
+ const o = Q(t), a = Ne(o, ["children", "list", "tags"]).flatMap((v) => jt(v, e, N(o.tagId ?? o.id ?? o.key))), s = mo(o.infSetList);
1216
+ return a.length === 0 && s.length > 0 ? s.map((v, p) => po(o, v, e, n, p)) : [co(o, e, n, a)];
1217
+ }
1218
+ function co(t, e, n, o) {
1219
+ const a = N(t.tagId ?? t.id ?? t.key), s = N(t.tagName ?? t.name ?? t.label ?? a);
1220
+ return {
1221
+ key: N(t.key ?? a),
1222
+ id: a,
1223
+ tagId: a,
1224
+ tagName: s,
1225
+ label: s,
1226
+ tagLevel: H(t.tagLevel ?? t.level) ?? null,
1227
+ level: Dt(t.tagLevel ?? t.level),
1228
+ parentTagId: H(t.parentTagId ?? t.parentId ?? n),
1229
+ parentId: H(t.parentTagId ?? t.parentId ?? n) ?? null,
1230
+ infSchmId: H(t.infSchmId ?? e?.infSchmId),
1231
+ schemeId: N(t.infSchmId ?? e?.infSchmId),
1232
+ infSetId: H(t.infSetId ?? t.setId),
1233
+ setId: H(t.setId),
1234
+ code: H(t.code),
1235
+ children: o,
1236
+ infSetList: [],
1237
+ operationInfo: He(t.operationInfo),
1238
+ loaded: o.length > 0,
1239
+ raw: t
1240
+ };
1241
+ }
1242
+ function po(t, e, n, o, a) {
1243
+ const s = N(t.tagId ?? t.id ?? t.key), v = N(t.tagName ?? t.name ?? t.label ?? s), p = e.infSetId || N(e.setId), c = e.setId || p, b = p || `${s}-${a}`;
1244
+ return {
1245
+ key: b,
1246
+ id: b,
1247
+ tagId: s,
1248
+ tagName: v,
1249
+ label: v,
1250
+ tagLevel: H(t.tagLevel ?? t.level) ?? null,
1251
+ level: Dt(t.tagLevel ?? t.level),
1252
+ parentTagId: H(t.parentTagId ?? t.parentId ?? o),
1253
+ parentId: H(t.parentTagId ?? t.parentId ?? o) ?? null,
1254
+ infSchmId: H(t.infSchmId ?? n?.infSchmId),
1255
+ schemeId: N(t.infSchmId ?? n?.infSchmId),
1256
+ infSetId: p,
1257
+ setId: c,
1258
+ code: H(t.code ?? p),
1259
+ children: [],
1260
+ infSetList: [e],
1261
+ operationInfo: He(t.operationInfo),
1262
+ loaded: !0,
1263
+ raw: {
1264
+ ...t,
1265
+ infSetId: p,
1266
+ setId: c,
1267
+ infSetList: [e.raw]
1268
+ }
1269
+ };
1270
+ }
1271
+ function zt(t, e = {}) {
1272
+ const n = Q(t.globalInfoSchmMark ?? t.scheme ?? t), o = N(n.infSchmId ?? e.infSchmId), a = N(n.emplid ?? e.emplid);
1273
+ return !o && !a && Object.keys(n).length === 0 ? null : {
1274
+ infSchmId: o,
1275
+ emplid: a,
1276
+ id: o,
1277
+ mark: N(n.globalInfoSchmMark ?? t.globalInfoSchmMark),
1278
+ config: Array.isArray(t.globalInfoSchmConfig) ? "" : N(n.globalInfoSchmConfig ?? t.globalInfoSchmConfig),
1279
+ raw: n
1280
+ };
1281
+ }
1282
+ function fo(t) {
1283
+ if (Array.isArray(t.globalInfoSchmConfig))
1284
+ return t.globalInfoSchmConfig;
1285
+ const e = Q(t.globalInfoSchmConfig), n = Ne(e, ["children", "tree", "list", "tags"]);
1286
+ return n.length ? n : Ne(t, ["children", "tree", "list", "tags", "records"]);
1287
+ }
1288
+ function mo(t) {
1289
+ return Array.isArray(t) ? t.map((e) => {
1290
+ const n = Q(e);
1291
+ return {
1292
+ infSetId: N(n.infSetId ?? n.setId ?? n.id),
1293
+ setId: H(n.setId),
1294
+ operationInfo: He(n.operationInfo),
1295
+ raw: n
1296
+ };
1297
+ }) : [];
1298
+ }
1299
+ function Ot(t) {
1300
+ return Q(Gt(t));
1301
+ }
1302
+ function Gt(t) {
1303
+ const e = Q(t);
1304
+ return e.data ?? e.result ?? t;
1305
+ }
1306
+ function Ne(t, e) {
1307
+ for (const n of e) {
1308
+ const o = t[n];
1309
+ if (Array.isArray(o))
1310
+ return o;
1311
+ }
1312
+ return [];
1313
+ }
1314
+ function et(t) {
1315
+ const e = { ...t };
1316
+ return delete e.__rowKey, delete e.fields, e;
1317
+ }
1318
+ function At(t) {
1319
+ const e = Q(t);
1320
+ if (!(!e.method && !e.url && !e.params))
1321
+ return {
1322
+ ...e,
1323
+ method: H(e.method),
1324
+ url: H(e.url),
1325
+ params: tt(e.params)
1326
+ };
1327
+ }
1328
+ function He(t) {
1329
+ const e = Q(t);
1330
+ if (Object.keys(e).length !== 0)
1331
+ return Object.fromEntries(
1332
+ Object.entries(e).map(([n, o]) => [n, At(o) ?? o])
1333
+ );
1334
+ }
1335
+ function dt(t) {
1336
+ if (!Array.isArray(t))
1337
+ return;
1338
+ const e = t.map((n) => N(n)).filter(Boolean);
1339
+ return e.length ? e : void 0;
1340
+ }
1341
+ function vo(t) {
1342
+ if (ue(t.htmlDisplay)) return "html";
1343
+ if (ue(t.multRow)) return "multi-row";
1344
+ const e = N(t.renderType).toLowerCase();
1345
+ return e === "code" || e === "empty" ? e : "text";
1346
+ }
1347
+ function go(t) {
1348
+ const e = N(t.fieldType ?? t.type ?? t.renderType).toLowerCase();
1349
+ return e.includes("date") ? "date" : e.includes("select") || e.includes("enum") ? "select" : e.includes("number") || e.includes("int") ? "number" : e.includes("bool") || e.includes("switch") ? "switch" : e.includes("file") || e.includes("upload") || e.includes("attachment") ? "file" : e.includes("textarea") || e.includes("text_area") ? "textarea" : "text";
1350
+ }
1351
+ function tt(t) {
1352
+ const e = Q(t);
1353
+ return Object.keys(e).length ? e : void 0;
1354
+ }
1355
+ function pt(t) {
1356
+ return typeof t == "string" || typeof t == "number" ? t : void 0;
1357
+ }
1358
+ function Q(t) {
1359
+ return t && typeof t == "object" && !Array.isArray(t) ? t : {};
1360
+ }
1361
+ function N(t) {
1362
+ return t == null ? "" : String(t).trim();
1363
+ }
1364
+ function H(t) {
1365
+ return N(t) || void 0;
1366
+ }
1367
+ function Dt(t) {
1368
+ const e = Kt(t);
1369
+ return e === void 0 ? null : e;
1370
+ }
1371
+ function Kt(t) {
1372
+ if (t == null || t === "") return;
1373
+ const e = Number(t);
1374
+ return Number.isFinite(e) ? e : void 0;
1375
+ }
1376
+ function ue(t) {
1377
+ return typeof t == "string" ? ["true", "1", "y", "yes", "t", "是"].includes(t.toLowerCase()) : !!t;
1378
+ }
1379
+ const _e = (t) => t.key || t.code, ie = (t) => t.key || t.setId, $e = (t) => new Error(`[GlobalInfo] ${t}`), Te = (t) => t && typeof t == "object" && !Array.isArray(t) ? t : {}, qe = (t) => {
1380
+ const e = Te(t);
1381
+ return !!(e.url || e.method || e.params);
1382
+ }, yo = (t) => String(t ?? "").trim(), je = (t) => Array.from(new Set(t.map(yo).filter(Boolean))), Le = (t) => je([
1383
+ t?.key,
1384
+ t?.id,
1385
+ t?.setId,
1386
+ t?.infSetId,
1387
+ t?.tagId,
1388
+ t?.code,
1389
+ ...(t?.infSetList ?? []).map((e) => e.infSetId),
1390
+ ...(t?.infSetList ?? []).map((e) => e.setId)
1391
+ ]), ho = (t) => je([
1392
+ t.key,
1393
+ t.id,
1394
+ t.setId,
1395
+ t.infSetId,
1396
+ t.tagId,
1397
+ t.code
1398
+ ]), Fe = (t = {}) => ({
1399
+ // loading:当前 section 是否正在拉详情。
1400
+ loading: !1,
1401
+ // saving:当前 section 是否正在保存。
1402
+ saving: !1,
1403
+ // error:当前 section 最近一次加载/保存错误。
1404
+ error: null,
1405
+ // loaded:当前 section 是否已经成功完成过详情加载。
1406
+ loaded: !1,
1407
+ // editing:当前 section 是否处于编辑态。
1408
+ editing: !1,
1409
+ // status 覆盖默认值,用于局部状态补丁。
1410
+ ...t
1411
+ }), Ve = (t) => !!(t && typeof t == "object" && "children" in t), qt = (t, e, n) => {
1412
+ const o = ho(t), a = je([n, ...Le(e)]);
1413
+ return a.length === 0 ? !1 : a.some((s) => o.includes(s));
1414
+ }, bo = (t, e, n) => je([n, ...Le(e)]).length === 0 ? t : t.filter((a) => qt(a, e, n)), So = (t) => {
1415
+ const e = ne(!1), n = ne(!1), o = ne(!1), a = Se(null), s = Se([]), v = Se(null), p = Se(null), c = Se(null), b = Se({}), C = Se({}), i = ne([]), d = Se({}), m = ne([]), g = I(
1416
+ () => {
1417
+ const r = i.value.map((f) => b.value[f]).filter((f) => !!f), l = Object.entries(b.value).filter(([f]) => !i.value.includes(f)).map(([, f]) => f);
1418
+ return [...r, ...l];
1419
+ }
1420
+ ), h = I(() => ({
1421
+ // 整棵树是否正在加载。
1422
+ loading: e.value,
1423
+ // 当前详情是否正在加载。
1424
+ detailLoading: n.value,
1425
+ // 当前是否正在保存。
1426
+ saving: o.value,
1427
+ // 当前所有编辑中的 section key。
1428
+ editingSectionKeys: m.value,
1429
+ // 已加载 section 映射。
1430
+ sectionMap: b.value,
1431
+ // section 状态映射;这里把 alias 后的编辑态也同步进去。
1432
+ sectionStatusMap: Object.fromEntries(
1433
+ Object.entries(d.value).map(([r, l]) => [
1434
+ r,
1435
+ {
1436
+ // 保留原状态字段。
1437
+ ...l,
1438
+ // 编辑态以 editingSectionKeys 为准,避免状态对象里 editing 值残留。
1439
+ editing: m.value.includes(
1440
+ C.value[r] ?? r
1441
+ )
1442
+ }
1443
+ ])
1444
+ ),
1445
+ // 最近一次全局错误。
1446
+ error: a.value
1447
+ })), S = () => ({
1448
+ // adaptScene 透传给新接口形态。
1449
+ adaptScene: t.adaptScene,
1450
+ // emplid 是当前人员标识,树和详情接口都需要它。
1451
+ emplid: t.emplid
1452
+ }), B = (r) => ({
1453
+ // 复用基础参数,保证人员和场景一致。
1454
+ ...S(),
1455
+ // infSchmId 指定当前模板方案。
1456
+ infSchmId: r.infSchmId,
1457
+ // tagId 指定要展开的树节点。
1458
+ tagId: r.tagId,
1459
+ // tagLevel 告诉后端当前节点层级。
1460
+ tagLevel: r.tagLevel,
1461
+ // parentTagId 保留父子关系上下文。
1462
+ parentTagId: r.parentTagId
1463
+ }), u = (r = p.value, l = c.value) => ({
1464
+ // 详情接口同样需要基础人员和场景参数。
1465
+ ...S(),
1466
+ // 当前节点所属模板方案。
1467
+ infSchmId: r?.infSchmId,
1468
+ // 当前点击或加载的树节点 id。
1469
+ tagId: r?.tagId,
1470
+ // 保存或刷新指定 section 时优先使用 section 自己的信息集 id。
1471
+ infSetId: l?.infSetId ?? r?.infSetId,
1472
+ // setId 同样优先取 section,避免保存时拿错节点 setId。
1473
+ setId: l?.setId ?? r?.setId
1474
+ }), _ = async (r, l) => {
1475
+ if (!t.service.requestOperation)
1476
+ throw $e("service.requestOperation is required for operationInfo");
1477
+ return t.service.requestOperation(r, l);
1478
+ }, V = (r, l = {}, f) => {
1479
+ const T = Te(r.params), E = f?.cascadeDependFields ?? [];
1480
+ let A = 0;
1481
+ return Object.fromEntries(
1482
+ Object.entries(T).map(([O, K]) => {
1483
+ if (K !== "")
1484
+ return [O, K];
1485
+ if (l[O] !== void 0)
1486
+ return [O, l[O]];
1487
+ const Y = E[A];
1488
+ return A += 1, [O, Y ? l[Y] ?? "" : K];
1489
+ })
1490
+ );
1491
+ }, G = (r) => {
1492
+ const f = Te(r.operationInfo).openTag;
1493
+ return qe(f) ? f : void 0;
1494
+ }, P = (r, l, f) => {
1495
+ const T = Te(r?.operationInfo).queryInfoSet;
1496
+ if (qe(T))
1497
+ return T;
1498
+ const E = l?.infSetList.find((O) => O.infSetId === f), A = Te(E?.operationInfo).queryInfoSet;
1499
+ return qe(A) ? A : void 0;
1500
+ }, w = (r) => {
1501
+ const l = Te(r.operationInfo).editInfoSet;
1502
+ return qe(l) ? l : void 0;
1503
+ }, R = (r, l) => {
1504
+ if (!l)
1505
+ return r[0] ?? null;
1506
+ for (const f of r) {
1507
+ if (Le(f).includes(l))
1508
+ return f;
1509
+ const T = R(f.children, l);
1510
+ if (T)
1511
+ return T;
1512
+ }
1513
+ return null;
1514
+ }, k = (r = c.value) => {
1515
+ if (r)
1516
+ return typeof r == "string" ? r : Ve(r) ? pe(r) : ie(r);
1517
+ }, z = (r = c.value) => {
1518
+ const l = k(r);
1519
+ if (!l)
1520
+ return null;
1521
+ const f = C.value[l] ?? l;
1522
+ return b.value[f] ?? null;
1523
+ }, ae = (r = c.value) => {
1524
+ const l = k(r);
1525
+ if (l)
1526
+ return C.value[l] ?? l;
1527
+ }, pe = (r = c.value) => {
1528
+ if (r)
1529
+ return typeof r == "string" ? r : Ve(r) ? r.setId ?? r.infSetId ?? r.key : ie(r);
1530
+ }, ze = (r = c.value) => {
1531
+ if (Ve(r))
1532
+ return r;
1533
+ if (typeof r == "string") {
1534
+ const l = R(s.value, r);
1535
+ if (l)
1536
+ return l;
1537
+ const f = z(r);
1538
+ return f?.ownerNodeKey ? R(s.value, f.ownerNodeKey) ?? p.value : f || p.value && Le(p.value).includes(r) ? p.value : null;
1539
+ }
1540
+ return r?.ownerNodeKey ? R(s.value, r.ownerNodeKey) ?? p.value : p.value;
1541
+ }, Oe = (r = c.value) => !r || Ve(r) ? null : z(r), We = (r = c.value) => {
1542
+ const l = pe(r);
1543
+ if (!l)
1544
+ return Fe();
1545
+ const f = C.value[l] ?? l;
1546
+ return Fe({
1547
+ ...d.value[l],
1548
+ ...d.value[f],
1549
+ // 编辑态始终从 editingSectionKeys 计算,避免状态对象过期。
1550
+ editing: m.value.includes(
1551
+ f
1552
+ )
1553
+ });
1554
+ }, le = (r, l) => {
1555
+ const f = pe(r);
1556
+ f && (d.value = {
1557
+ ...d.value,
1558
+ [f]: Fe({
1559
+ // 保留已有状态。
1560
+ ...d.value[f],
1561
+ // 合并本次状态补丁。
1562
+ ...l,
1563
+ // 编辑态仍以 editingSectionKeys 为准。
1564
+ editing: m.value.includes(f)
1565
+ })
1566
+ });
1567
+ }, ye = (r = v.value?.raw ?? null, l = p.value) => {
1568
+ const f = g.value, T = c.value && f.find(
1569
+ (E) => ie(E) === ie(c.value)
1570
+ ) ? c.value : null;
1571
+ v.value = {
1572
+ // 保留原 scheme。
1573
+ scheme: v.value?.scheme ?? null,
1574
+ // 当前节点。
1575
+ node: l,
1576
+ // 顶层节点和树节点都来自 nodes。
1577
+ topNodes: s.value,
1578
+ treeNodes: s.value,
1579
+ // 当前激活节点。
1580
+ activeNode: l,
1581
+ // 当前激活 section。
1582
+ activeSection: T,
1583
+ // 当前所有已加载 section。
1584
+ sections: f,
1585
+ // 当前 section 缓存。
1586
+ sectionMap: b.value,
1587
+ // 保留原始接口数据。
1588
+ raw: r
1589
+ }, c.value = T;
1590
+ }, Ee = (r, l = p.value, f) => {
1591
+ const T = { ...b.value }, E = { ...C.value }, A = [...i.value], O = { ...d.value }, K = bo(r.sections, l, f), Y = je([f, ...Le(l)]).length > 0, te = K.find((be) => qt(be, l, f)) ?? (Y ? null : r.activeSection ?? K[0] ?? c.value ?? null);
1592
+ return K.forEach((be) => {
1593
+ const ge = ie(be);
1594
+ T[ge] = be, A.includes(ge) || A.push(ge), O[ge] = Fe({
1595
+ ...O[ge],
1596
+ loaded: !0,
1597
+ loading: !1,
1598
+ error: null,
1599
+ editing: m.value.includes(ge)
1600
+ });
1601
+ }), f && te ? E[f] = ie(te) : f && (E[f] = ""), f && (O[f] = Fe({
1602
+ ...O[f],
1603
+ loaded: !0,
1604
+ loading: !1,
1605
+ error: null,
1606
+ editing: !!(te && m.value.includes(ie(te)))
1607
+ })), b.value = T, C.value = E, i.value = A, d.value = O, v.value = {
1608
+ ...r,
1609
+ scheme: r.scheme ?? v.value?.scheme ?? null,
1610
+ topNodes: s.value,
1611
+ treeNodes: s.value,
1612
+ activeNode: l,
1613
+ activeSection: te,
1614
+ sections: K,
1615
+ sectionMap: b.value
1616
+ }, c.value = te, te;
1617
+ }, he = (r, l) => {
1618
+ const f = ae(r), T = f ? b.value[f] : null;
1619
+ if (!f || !T)
1620
+ return;
1621
+ const E = l(T);
1622
+ b.value = {
1623
+ ...b.value,
1624
+ [f]: E
1625
+ }, c.value = ie(c.value ?? E) === f ? E : c.value, ye();
1626
+ }, Ie = async (r = c.value ?? p.value) => {
1627
+ const l = Oe(r), f = ze(r) ?? p.value, T = pe(r);
1628
+ if (!f)
1629
+ return null;
1630
+ if (!t.service.requestOperation)
1631
+ throw $e("service.requestOperation is required");
1632
+ n.value = !0, a.value = null, le(T ?? f, { loading: !0, error: null });
1633
+ try {
1634
+ const E = l ? [{ infSetId: l.infSetId, setId: l.setId, operationInfo: l.operationInfo, raw: l.raw }] : f.infSetList;
1635
+ if (E.length === 0)
1636
+ throw $e("node.infSetList is required");
1637
+ const A = await Promise.all(E.map(async (K) => {
1638
+ const Y = P(l, f, K.infSetId), te = {
1639
+ ...u(f, l),
1640
+ infSetId: K.infSetId,
1641
+ setId: K.setId,
1642
+ operationInfo: K.operationInfo
1643
+ };
1644
+ if (Y) {
1645
+ const be = await _(Y, {
1646
+ type: "queryInfoSet",
1647
+ node: f,
1648
+ section: l,
1649
+ params: te
1650
+ });
1651
+ return no(be, te, f);
1652
+ }
1653
+ throw $e("infoSet.operationInfo.queryInfoSet is required");
1654
+ })), O = {
1655
+ ...A[0],
1656
+ sections: A.flatMap((K) => K.sections),
1657
+ sectionMap: Object.fromEntries(A.flatMap((K) => K.sections).map((K) => [K.key, K]))
1658
+ };
1659
+ return Ee(O, f, T);
1660
+ } catch (E) {
1661
+ throw a.value = E, le(T ?? f, { loading: !1, error: E }), E;
1662
+ } finally {
1663
+ n.value = !1, le(T ?? f, { loading: !1 });
1664
+ }
1665
+ }, Me = (r = c.value) => Ie(r), Ye = (r = c.value) => {
1666
+ if (!r)
1667
+ return null;
1668
+ if (!Ve(r) && typeof r != "string")
1669
+ return z(r);
1670
+ const l = pe(r);
1671
+ return l ? b.value[C.value[l] ?? l] ?? null : null;
1672
+ }, Ge = async (r = p.value) => r ? (await Ie(r), v.value) : (v.value = null, c.value = null, b.value = {}, C.value = {}, i.value = [], d.value = {}, null), Ae = async (r) => {
1673
+ const l = G(r);
1674
+ if (!l)
1675
+ return r.children;
1676
+ const f = B(r), T = await _(l, { type: "openTag", node: r, params: f });
1677
+ return ut(T).treeNodes;
1678
+ }, $ = async (r) => {
1679
+ if (r.loaded)
1680
+ return r.children;
1681
+ const l = await Ae(r);
1682
+ return l.length > 0 && (s.value = Lt(s.value, r.key, l)), l;
1683
+ }, x = async (r) => {
1684
+ const l = typeof r == "string" ? R(s.value, r) : r;
1685
+ return l ? (p.value = l, c.value = null, m.value = [], await $(l), ye(v.value?.raw, l), l) : null;
1686
+ }, W = async () => {
1687
+ const r = t.service.templateTree;
1688
+ if (!r)
1689
+ throw $e("service.templateTree is required");
1690
+ e.value = !0, a.value = null;
1691
+ try {
1692
+ const l = await r(S()), f = ut(l), T = await Promise.all(
1693
+ f.treeNodes.map(async (A) => {
1694
+ const O = await Ae(A);
1695
+ return {
1696
+ ...A,
1697
+ children: O,
1698
+ loaded: O.length > 0 || A.loaded
1699
+ };
1700
+ })
1701
+ );
1702
+ s.value = T, c.value = null, b.value = {}, C.value = {}, i.value = [], d.value = {}, m.value = [];
1703
+ const E = R(T, t.initialActiveNodeKey) ?? R(T);
1704
+ return p.value = E, v.value = {
1705
+ ...f,
1706
+ treeNodes: T,
1707
+ activeNode: E,
1708
+ sectionMap: b.value,
1709
+ sections: g.value
1710
+ }, s.value;
1711
+ } catch (l) {
1712
+ throw a.value = l, l;
1713
+ } finally {
1714
+ e.value = !1;
1715
+ }
1716
+ }, we = async () => {
1717
+ const r = k();
1718
+ await Me(c.value ?? p.value);
1719
+ const l = g.value.find(
1720
+ (f) => ie(f) === r
1721
+ );
1722
+ return l && (c.value = l), ye(), v.value;
1723
+ }, De = (r = c.value) => {
1724
+ const l = ae(r);
1725
+ return !!(l && m.value.includes(l));
1726
+ }, Zt = (r = c.value) => {
1727
+ const l = ae(r);
1728
+ !l || De(l) || (m.value = [...m.value, l], le(l, { editing: !0 }));
1729
+ }, at = (r = c.value) => {
1730
+ const l = ae(r);
1731
+ l && (m.value = m.value.filter(
1732
+ (f) => f !== l
1733
+ ), le(l, { editing: !1 }));
1734
+ }, Qt = (r, l, f) => {
1735
+ const T = typeof l == "string" ? l : _e(l);
1736
+ he(r, (E) => {
1737
+ const O = (typeof l == "string" ? E.fields.find((Y) => _e(Y) === T || Y.code === T) : l)?.cascadeClearFields ?? [], K = {
1738
+ ...E.model,
1739
+ [T]: f
1740
+ };
1741
+ return O.forEach((Y) => {
1742
+ K[Y] = "";
1743
+ }), {
1744
+ // 保留 section 其它元数据。
1745
+ ...E,
1746
+ // 更新表单 model。
1747
+ model: K,
1748
+ // 表单类型同步更新第一行 rows,方便保存时统一从 rows 构造 payload。
1749
+ rows: E.renderType === "form" ? [{ ...E.rows[0], ...K }] : E.rows,
1750
+ // 同步 fields.value,保证只读 renderer 立即显示新值。
1751
+ fields: E.fields.map((Y) => {
1752
+ const te = _e(Y);
1753
+ return te === T || Y.code === T ? { ...Y, value: f } : O.includes(te) || O.includes(Y.code) ? { ...Y, value: "" } : Y;
1754
+ })
1755
+ };
1756
+ });
1757
+ }, Xt = async (r, l, f = {}) => {
1758
+ const T = z(r);
1759
+ if (!T)
1760
+ return [];
1761
+ const E = Object.keys(f).length > 0 ? f : T.model, A = typeof l == "string" ? l : _e(l), O = typeof l == "string" ? T.fields.find((fe) => _e(fe) === A || fe.code === A) : l, K = O?.interface;
1762
+ if (!O || !K)
1763
+ return O?.options ?? [];
1764
+ if ((O.cascadeDependFields ?? []).some((fe) => {
1765
+ const se = E[fe];
1766
+ return se == null || se === "";
1767
+ }))
1768
+ return he(T, (fe) => ({
1769
+ ...fe,
1770
+ fields: fe.fields.map(
1771
+ (se) => _e(se) === A || se.code === A ? { ...se, options: [] } : se
1772
+ )
1773
+ })), [];
1774
+ const te = V(K, E, O), be = await _(
1775
+ {
1776
+ ...K,
1777
+ params: te
1778
+ },
1779
+ {
1780
+ type: "fieldOptions",
1781
+ node: ze(T),
1782
+ section: T,
1783
+ field: O,
1784
+ params: te
1785
+ }
1786
+ ), ge = Rt(be);
1787
+ return he(T, (fe) => ({
1788
+ ...fe,
1789
+ fields: fe.fields.map(
1790
+ (se) => _e(se) === A || se.code === A ? { ...se, options: ge } : se
1791
+ )
1792
+ })), ge;
1793
+ }, en = (r, l) => {
1794
+ if (Array.isArray(l)) {
1795
+ Ke(r, l);
1796
+ return;
1797
+ }
1798
+ he(r, (f) => ({
1799
+ ...f,
1800
+ // 替换当前 model。
1801
+ model: l,
1802
+ // 表单类型同步合并到第一行 rows。
1803
+ rows: f.renderType === "form" ? [{ ...f.rows[0], ...l }] : f.rows,
1804
+ // fields.value 也同步成 model 中的值。
1805
+ fields: f.fields.map((T) => ({
1806
+ ...T,
1807
+ value: l[_e(T)]
1808
+ }))
1809
+ }));
1810
+ }, Ke = (r, l) => {
1811
+ he(r, (f) => ({
1812
+ ...f,
1813
+ rows: l,
1814
+ data: l
1815
+ }));
1816
+ }, tn = {
1817
+ // 加载模板树。
1818
+ loadTree: W,
1819
+ // 选中树节点。
1820
+ selectNode: x,
1821
+ // 加载当前节点详情。
1822
+ loadDetail: Ge,
1823
+ // 刷新当前详情。
1824
+ reloadActiveSection: we,
1825
+ // 加载指定节点或 section。
1826
+ loadSection: Ie,
1827
+ // 重新加载指定节点或 section。
1828
+ reloadSection: Me,
1829
+ // 获取指定节点或 section 的缓存数据。
1830
+ getSection: Ye,
1831
+ // 获取指定节点或 section 的状态。
1832
+ getSectionStatus: We,
1833
+ // 开启编辑。
1834
+ startEdit: Zt,
1835
+ // 取消编辑。
1836
+ cancelEdit: at,
1837
+ // 更新单字段。
1838
+ updateField: Qt,
1839
+ // 加载字段动态选项。
1840
+ loadFieldOptions: Xt,
1841
+ // 批量更新 model。
1842
+ updateModel: en,
1843
+ // 更新表格行。
1844
+ updateTableRows: Ke,
1845
+ // 保存单行到本地缓存。
1846
+ saveRow: (r, l = {}, f = -1) => {
1847
+ const E = [...z(r)?.rows ?? []];
1848
+ E.splice(f >= 0 ? f : E.length, f >= 0 ? 1 : 0, l), Ke(r, E);
1849
+ },
1850
+ // 删除单行本地缓存。
1851
+ deleteRow: (r, l) => {
1852
+ const f = z(r), T = typeof l == "string" ? Number(l) : l, E = (f?.rows ?? []).filter(
1853
+ (A, O) => O !== T
1854
+ );
1855
+ Ke(r, E);
1856
+ },
1857
+ // 调用接口保存 section。
1858
+ saveSection: async (r = c.value) => {
1859
+ const l = k(r), f = z(r);
1860
+ if (!f)
1861
+ return null;
1862
+ const T = w(f);
1863
+ if (!T)
1864
+ throw $e("section.operationInfo.editInfoSet is required");
1865
+ o.value = !0, a.value = null, l && l !== ie(f) && le(l, { saving: !0, error: null }), le(f, { saving: !0, error: null });
1866
+ try {
1867
+ const E = u(p.value, f), A = ao(f, E), O = await _(
1868
+ {
1869
+ ...T,
1870
+ params: {
1871
+ ...V(T, f.model),
1872
+ ...A
1873
+ }
1874
+ },
1875
+ {
1876
+ type: "editInfoSet",
1877
+ node: p.value,
1878
+ section: f,
1879
+ params: A
1880
+ }
1881
+ );
1882
+ return at(f), await Me(f), O;
1883
+ } catch (E) {
1884
+ throw a.value = E, l && l !== ie(f) && le(l, { saving: !1, error: E }), le(f, { saving: !1, error: E }), E;
1885
+ } finally {
1886
+ o.value = !1, l && l !== ie(f) && le(l, { saving: !1 }), le(f, { saving: !1 });
1887
+ }
1888
+ },
1889
+ // 判断编辑态。
1890
+ isEditing: De
1891
+ };
1892
+ return Re(
1893
+ // 监听当前人员 id。
1894
+ () => t.emplid,
1895
+ () => {
1896
+ (t.autoLoad ?? !0) && W();
1897
+ }
1898
+ ), St(() => {
1899
+ (t.autoLoad ?? !0) && W();
1900
+ }), {
1901
+ // 当前 viewModel。
1902
+ viewModel: v,
1903
+ // 当前模板树节点。
1904
+ nodes: s,
1905
+ // 当前已加载 section 列表。
1906
+ sections: g,
1907
+ // 当前 section 缓存。
1908
+ sectionMap: b,
1909
+ // 当前 section 状态缓存。
1910
+ sectionStatusMap: d,
1911
+ // 当前激活节点。
1912
+ activeNode: p,
1913
+ // 当前激活 section。
1914
+ activeSection: c,
1915
+ // 给页面消费的状态快照。
1916
+ state: h,
1917
+ // 给页面消费的操作集合。
1918
+ actions: tn
1919
+ };
1920
+ }, ba = /* @__PURE__ */ U({
1921
+ name: "GlobalInfoProvider",
1922
+ __name: "GlobalInfoProvider",
1923
+ props: {
1924
+ service: {},
1925
+ adaptScene: {},
1926
+ emplid: {},
1927
+ autoLoad: { type: Boolean, default: !0 },
1928
+ initialActiveNodeKey: {}
1929
+ },
1930
+ setup(t) {
1931
+ const n = So(t), { viewModel: o, nodes: a, sections: s, activeNode: v, activeSection: p, state: c, actions: b } = n;
1932
+ return (C, i) => j(C.$slots, "default", ce(me({
1933
+ viewModel: q(o),
1934
+ nodes: q(a),
1935
+ sections: q(s),
1936
+ activeNode: q(v),
1937
+ activeSection: q(p),
1938
+ state: q(c),
1939
+ actions: q(b)
1940
+ })));
1941
+ }
1942
+ });
1943
+ function _o(t) {
1944
+ return ft(t.type || t.fieldType) || ft(t.renderType) || "text";
1945
+ }
1946
+ function Jt(t) {
1947
+ return mt(t.type || t.fieldType) || mt(t.renderType) || "text";
1948
+ }
1949
+ function ot(t) {
1950
+ return t == null || t === "" || Array.isArray(t) && t.length === 0;
1951
+ }
1952
+ function Ut(t) {
1953
+ if (t instanceof Error) return !0;
1954
+ if (!t || typeof t != "object") return !1;
1955
+ const e = t;
1956
+ return typeof e.message == "string" && (typeof e.stack == "string" || e.name === "Error");
1957
+ }
1958
+ function xt(t, e, n = "-") {
1959
+ const o = Jt(t);
1960
+ return o === "empty" || ot(e) ? n : Ut(e) ? (console.error("[globalInfo] field value render failed", e), n) : o === "select" ? Io(t, e, n) : o === "switch" ? Ht(e) ? "是" : "否" : o === "file" ? wo(e, n) : o === "multi-row" ? ko(e) : String(e);
1961
+ }
1962
+ function Ht(t) {
1963
+ if (typeof t == "boolean") return t;
1964
+ if (typeof t == "number") return t !== 0;
1965
+ const e = String(t ?? "").trim().toLowerCase();
1966
+ return ["true", "1", "y", "yes", "t", "是"].includes(e);
1967
+ }
1968
+ function ft(t) {
1969
+ const e = String(t ?? "").toLowerCase();
1970
+ return e === "upload" || e === "attachment" ? "file" : e === "text" || e === "textarea" || e === "select" || e === "date" || e === "number" || e === "switch" || e === "file" || e === "html" || e === "code" || e === "multi-row" || e === "empty" ? e : "";
1971
+ }
1972
+ function mt(t) {
1973
+ const e = String(t ?? "").toLowerCase();
1974
+ return e === "upload" || e === "attachment" ? "file" : e === "select" || e === "switch" || e === "file" || e === "html" || e === "code" || e === "multi-row" || e === "empty" ? e : e === "textarea" || e === "date" || e === "number" || e === "text" ? "text" : "";
1975
+ }
1976
+ function Io(t, e, n) {
1977
+ if (Array.isArray(e)) {
1978
+ const o = e.map((a) => vt(t, a) || String(a ?? "").trim()).filter(Boolean);
1979
+ return o.length > 0 ? o.join("、") : n;
1980
+ }
1981
+ return vt(t, e) || String(e);
1982
+ }
1983
+ function vt(t, e) {
1984
+ return t.options?.find((o) => o.value === e || String(o.value) === String(e))?.label ?? "";
1985
+ }
1986
+ function wo(t, e) {
1987
+ if (Array.isArray(t)) {
1988
+ const n = t.map((o) => gt(o)).filter(Boolean);
1989
+ return n.length > 0 ? n.join("、") : e;
1990
+ }
1991
+ return gt(t) || e;
1992
+ }
1993
+ function gt(t) {
1994
+ if (typeof File < "u" && t instanceof File) return t.name;
1995
+ if (t && typeof t == "object") {
1996
+ const e = t;
1997
+ return String(e.name ?? e.fileName ?? e.filename ?? e.url ?? "").trim();
1998
+ }
1999
+ return String(t ?? "").trim();
2000
+ }
2001
+ function ko(t) {
2002
+ return Array.isArray(t) ? t.map((e) => Ut(e) ? (console.error("[globalInfo] multi-row field item render failed", e), "") : e && typeof e == "object" ? JSON.stringify(e) : String(e)).filter(Boolean).join(`
2003
+ `) : String(t);
2004
+ }
2005
+ const Co = ["disabled", "accept", "multiple"], $o = {
2006
+ key: 0,
2007
+ class: "global-info-field-control__file-text"
2008
+ }, To = {
2009
+ key: 1,
2010
+ class: "global-info-field-control__file-upload"
2011
+ }, Bo = /* @__PURE__ */ U({
2012
+ name: "GlobalInfoFieldControl",
2013
+ __name: "GlobalInfoFieldControl",
2014
+ props: {
2015
+ field: {},
2016
+ modelValue: {},
2017
+ disabled: { type: Boolean, default: !1 }
2018
+ },
2019
+ emits: ["update:modelValue", "change", "loadOptions"],
2020
+ setup(t, { emit: e }) {
2021
+ const n = t, o = e, a = ["textarea", "html", "code", "multi-row"], s = I(() => _o(n.field)), v = I(() => n.disabled || n.field.disabled || n.field.readonly), p = I(() => n.modelValue === void 0 || n.modelValue === null ? "" : String(n.modelValue)), c = I(() => {
2022
+ if (n.modelValue === void 0 || n.modelValue === null || n.modelValue === "") return;
2023
+ const u = typeof n.modelValue == "number" ? n.modelValue : Number(n.modelValue);
2024
+ return Number.isFinite(u) ? u : void 0;
2025
+ }), b = I(() => {
2026
+ const u = n.field.props?.activeValue ?? n.field.props?.["active-value"], _ = n.field.props?.inactiveValue ?? n.field.props?.["inactive-value"];
2027
+ return u !== void 0 || _ !== void 0 ? n.modelValue ?? _ ?? !1 : Ht(n.modelValue);
2028
+ }), C = I(() => s.value === "code" ? 5 : 3), i = I(() => s.value === "file" && !ot(n.modelValue)), d = I(() => xt(n.field, n.modelValue, "请选择文件")), m = I(() => n.field.placeholder ? n.field.placeholder : s.value === "select" ? "请选择" : s.value === "date" ? "请选择日期" : s.value === "file" ? "请选择文件" : "请输入");
2029
+ function g(u) {
2030
+ o("update:modelValue", u);
2031
+ }
2032
+ function h(u) {
2033
+ o("change", u);
2034
+ }
2035
+ function S(u) {
2036
+ u && o("loadOptions");
2037
+ }
2038
+ function B(u) {
2039
+ const _ = u.target, V = Array.from(_.files ?? []), G = n.field.props?.multiple ? V : V[0] ?? null;
2040
+ g(G), h(G);
2041
+ }
2042
+ return (u, _) => {
2043
+ const V = Ct, G = kt, P = It, w = cn, R = dn, k = wt;
2044
+ return s.value === "select" ? (y(), F(G, D({
2045
+ key: 0,
2046
+ class: "global-info-field-control"
2047
+ }, u.field.props, {
2048
+ "model-value": u.modelValue,
2049
+ placeholder: m.value,
2050
+ disabled: v.value,
2051
+ clearable: "",
2052
+ onVisibleChange: S,
2053
+ "onUpdate:modelValue": g,
2054
+ onChange: h
2055
+ }), {
2056
+ default: M(() => [
2057
+ (y(!0), L(de, null, oe(u.field.options || [], (z) => (y(), F(V, {
2058
+ key: String(z.value),
2059
+ label: z.label,
2060
+ value: z.value
2061
+ }, null, 8, ["label", "value"]))), 128))
2062
+ ]),
2063
+ _: 1
2064
+ }, 16, ["model-value", "placeholder", "disabled"])) : s.value === "date" ? (y(), F(P, D({
2065
+ key: 1,
2066
+ class: "global-info-field-control"
2067
+ }, u.field.props, {
2068
+ "model-value": u.modelValue,
2069
+ placeholder: m.value,
2070
+ disabled: v.value,
2071
+ type: "date",
2072
+ "value-format": "YYYY-MM-DD",
2073
+ "onUpdate:modelValue": g,
2074
+ onChange: h
2075
+ }), null, 16, ["model-value", "placeholder", "disabled"])) : s.value === "number" ? (y(), F(w, D({
2076
+ key: 2,
2077
+ class: "global-info-field-control"
2078
+ }, u.field.props, {
2079
+ "model-value": c.value,
2080
+ placeholder: m.value,
2081
+ disabled: v.value,
2082
+ "controls-position": "right",
2083
+ "onUpdate:modelValue": g,
2084
+ onChange: h
2085
+ }), null, 16, ["model-value", "placeholder", "disabled"])) : s.value === "switch" ? (y(), F(R, D({
2086
+ key: 3,
2087
+ class: "global-info-field-control global-info-field-control--switch"
2088
+ }, u.field.props, {
2089
+ "model-value": b.value,
2090
+ disabled: v.value,
2091
+ "onUpdate:modelValue": g,
2092
+ onChange: h
2093
+ }), null, 16, ["model-value", "disabled"])) : s.value === "file" ? (y(), L("label", {
2094
+ key: 4,
2095
+ class: Ue(["global-info-field-control global-info-field-control--file", {
2096
+ "is-disabled": v.value,
2097
+ "is-empty": !i.value,
2098
+ "is-filled": i.value
2099
+ }])
2100
+ }, [
2101
+ J("input", {
2102
+ class: "global-info-field-control__file-input",
2103
+ type: "file",
2104
+ disabled: v.value,
2105
+ accept: String(u.field.props?.accept ?? ""),
2106
+ multiple: !!u.field.props?.multiple,
2107
+ onChange: B
2108
+ }, null, 40, Co),
2109
+ i.value ? (y(), L("span", $o, ee(d.value), 1)) : (y(), L("span", To, "上 传"))
2110
+ ], 2)) : s.value === "empty" ? (y(), F(k, {
2111
+ key: 5,
2112
+ class: "global-info-field-control",
2113
+ "model-value": "",
2114
+ disabled: "",
2115
+ placeholder: "-"
2116
+ })) : (y(), F(k, D({
2117
+ key: 6,
2118
+ class: ["global-info-field-control", { "global-info-field-control--code": s.value === "code" }]
2119
+ }, u.field.props, {
2120
+ "model-value": p.value,
2121
+ placeholder: m.value,
2122
+ disabled: v.value,
2123
+ type: a.includes(s.value) ? "textarea" : "text",
2124
+ rows: a.includes(s.value) ? C.value : void 0,
2125
+ "onUpdate:modelValue": g,
2126
+ onChange: h
2127
+ }), null, 16, ["class", "model-value", "placeholder", "disabled", "type", "rows"]));
2128
+ };
2129
+ }
2130
+ }), Wt = /* @__PURE__ */ X(Bo, [["__scopeId", "data-v-ba86a0ae"]]), Eo = ["innerHTML"], Mo = {
2131
+ key: 1,
2132
+ class: "global-info-field-value global-info-field-value--code"
2133
+ }, Fo = /* @__PURE__ */ U({
2134
+ name: "GlobalInfoFieldValue",
2135
+ __name: "GlobalInfoFieldValue",
2136
+ props: {
2137
+ field: {},
2138
+ value: {},
2139
+ emptyText: { default: "-" }
2140
+ },
2141
+ setup(t) {
2142
+ const e = t, n = I(() => Jt(e.field)), o = I(() => n.value === "empty" || ot(e.value)), a = I(() => xt(e.field, e.value, e.emptyText));
2143
+ return (s, v) => n.value === "html" && !o.value ? (y(), L("span", {
2144
+ key: 0,
2145
+ class: "global-info-field-value global-info-field-value--html",
2146
+ innerHTML: a.value
2147
+ }, null, 8, Eo)) : n.value === "code" && !o.value ? (y(), L("pre", Mo, ee(a.value), 1)) : (y(), L("span", {
2148
+ key: 2,
2149
+ class: Ue(["global-info-field-value", {
2150
+ "global-info-field-value--multi-row": n.value === "multi-row",
2151
+ "global-info-field-value--file": n.value === "file" && !o.value
2152
+ }])
2153
+ }, ee(a.value), 3));
2154
+ }
2155
+ }), Yt = /* @__PURE__ */ X(Fo, [["__scopeId", "data-v-aa0d493d"]]), Vo = { class: "global-info-form-renderer__label" }, Po = {
2156
+ key: 0,
2157
+ class: "global-info-form-renderer__required"
2158
+ }, Lo = /* @__PURE__ */ U({
2159
+ name: "GlobalInfoFormRenderer",
2160
+ __name: "GlobalInfoFormRenderer",
2161
+ props: {
2162
+ section: {},
2163
+ node: {},
2164
+ editing: { type: Boolean },
2165
+ state: {},
2166
+ actions: {},
2167
+ model: {},
2168
+ onUpdateModel: { type: Function }
2169
+ },
2170
+ setup(t) {
2171
+ const e = t, n = ve(), o = I(() => e.section.fields.filter((d) => d.visible)), a = I(() => e.model ?? e.section.model);
2172
+ function s(d, m) {
2173
+ const g = { ...a.value, [d.code]: m };
2174
+ (d.cascadeClearFields ?? []).forEach((h) => {
2175
+ g[h] = "";
2176
+ }), e.onUpdateModel?.(g), e.onUpdateModel || e.actions.updateField(e.section, d, m);
2177
+ }
2178
+ async function v(d) {
2179
+ try {
2180
+ await e.actions.loadFieldOptions(e.section, d, a.value);
2181
+ } catch (m) {
2182
+ console.error("[GlobalInfoFormRenderer] load field options failed", m);
2183
+ }
2184
+ }
2185
+ function p(d) {
2186
+ const m = a.value[d.code];
2187
+ return {
2188
+ field: d,
2189
+ section: e.section,
2190
+ sectionView: e.section,
2191
+ node: e.node,
2192
+ editing: e.editing,
2193
+ modelValue: m,
2194
+ value: m,
2195
+ state: e.state,
2196
+ actions: e.actions,
2197
+ updateModelValue: (g) => s(d, g)
2198
+ };
2199
+ }
2200
+ function c(d) {
2201
+ const m = String(d.id || d.key || d.code || "").trim(), g = m ? `field-${m}` : "";
2202
+ if (g && n[g]) return g;
2203
+ const h = g.toLowerCase();
2204
+ return h !== g && n[h] ? h : "";
2205
+ }
2206
+ function b(d) {
2207
+ return d.span ? Math.min(Math.max(d.span, 1), 24) : 6;
2208
+ }
2209
+ function C(d) {
2210
+ return d.key || d.id || d.code;
2211
+ }
2212
+ function i(d) {
2213
+ return d.required || d.isRequired;
2214
+ }
2215
+ return (d, m) => {
2216
+ const g = $t, h = fn, S = pn, B = Tt;
2217
+ return y(), F(B, {
2218
+ class: "global-info-form-renderer",
2219
+ model: a.value,
2220
+ "label-position": "top"
2221
+ }, {
2222
+ default: M(() => [
2223
+ re(S, { gutter: 24 }, {
2224
+ default: M(() => [
2225
+ (y(!0), L(de, null, oe(o.value, (u) => (y(), F(h, {
2226
+ key: C(u),
2227
+ span: b(u)
2228
+ }, {
2229
+ default: M(() => [
2230
+ re(g, D({
2231
+ prop: u.code,
2232
+ ref_for: !0
2233
+ }, u.formItemProps), {
2234
+ label: M(() => [
2235
+ J("span", Vo, [
2236
+ i(u) ? (y(), L("span", Po, "*")) : Z("", !0),
2237
+ Be(" " + ee(u.label), 1)
2238
+ ])
2239
+ ]),
2240
+ default: M(() => [
2241
+ c(u) ? j(d.$slots, c(u), D({
2242
+ key: 0,
2243
+ ref_for: !0
2244
+ }, p(u)), void 0, !0) : d.editing && !u.readonly ? (y(), F(Wt, {
2245
+ key: 1,
2246
+ field: u,
2247
+ "model-value": a.value[u.code],
2248
+ section: d.section,
2249
+ onLoadOptions: () => v(u),
2250
+ "onUpdate:modelValue": (_) => s(u, _)
2251
+ }, null, 8, ["field", "model-value", "section", "onLoadOptions", "onUpdate:modelValue"])) : (y(), F(Yt, {
2252
+ key: 2,
2253
+ field: u,
2254
+ value: a.value[u.code],
2255
+ section: d.section
2256
+ }, null, 8, ["field", "value", "section"]))
2257
+ ]),
2258
+ _: 2
2259
+ }, 1040, ["prop"])
2260
+ ]),
2261
+ _: 2
2262
+ }, 1032, ["span"]))), 128))
2263
+ ]),
2264
+ _: 3
2265
+ })
2266
+ ]),
2267
+ _: 3
2268
+ }, 8, ["model"]);
2269
+ };
2270
+ }
2271
+ }), Ro = /* @__PURE__ */ X(Lo, [["__scopeId", "data-v-9dcd2ba9"]]), No = /* @__PURE__ */ U({
2272
+ name: "GlobalInfoDeleteConfirm",
2273
+ __name: "GlobalInfoDeleteConfirm",
2274
+ props: {
2275
+ title: { default: "确认删除吗?" },
2276
+ confirmText: { default: "确认" },
2277
+ cancelText: { default: "取消" }
2278
+ },
2279
+ emits: ["confirm", "cancel"],
2280
+ setup(t) {
2281
+ return (e, n) => {
2282
+ const o = mn;
2283
+ return y(), F(o, {
2284
+ title: e.title,
2285
+ "confirm-button-text": e.confirmText,
2286
+ "cancel-button-text": e.cancelText,
2287
+ width: "240",
2288
+ "popper-class": "global-info-delete-confirm",
2289
+ onConfirm: n[0] || (n[0] = (a) => e.$emit("confirm")),
2290
+ onCancel: n[1] || (n[1] = (a) => e.$emit("cancel"))
2291
+ }, {
2292
+ reference: M(() => [
2293
+ j(e.$slots, "default")
2294
+ ]),
2295
+ _: 3
2296
+ }, 8, ["title", "confirm-button-text", "cancel-button-text"]);
2297
+ };
2298
+ }
2299
+ }), jo = { class: "global-info-table-renderer" }, zo = { class: "global-info-table-renderer__table-scroll" }, Oo = { class: "global-info-table-renderer__header" }, Go = {
2300
+ key: 0,
2301
+ class: "global-info-table-renderer__required"
2302
+ }, Ao = /* @__PURE__ */ U({
2303
+ name: "GlobalInfoTableRenderer",
2304
+ __name: "GlobalInfoTableRenderer",
2305
+ props: {
2306
+ section: {},
2307
+ node: {},
2308
+ editing: { type: Boolean },
2309
+ state: {},
2310
+ actions: {},
2311
+ showAdd: { type: Boolean, default: !0 },
2312
+ showDelete: { type: Boolean, default: !0 }
2313
+ },
2314
+ setup(t) {
2315
+ const e = t, n = ve(), o = I(() => e.section.fields.filter((u) => u.visible));
2316
+ function a(u) {
2317
+ e.actions.deleteRow(e.section, u);
2318
+ }
2319
+ function s(u, _, V, G) {
2320
+ const P = e.section.rows.slice(), w = V.cascadeClearFields ?? [], R = {
2321
+ ...u,
2322
+ __rowKey: S(u),
2323
+ [V.code]: G
2324
+ };
2325
+ w.forEach((k) => {
2326
+ R[k] = "";
2327
+ }), P[_] = {
2328
+ ...R
2329
+ }, e.actions.updateTableRows(e.section, P);
2330
+ }
2331
+ async function v(u, _) {
2332
+ try {
2333
+ await e.actions.loadFieldOptions(e.section, u, _);
2334
+ } catch (V) {
2335
+ console.error("[GlobalInfoTableRenderer] load field options failed", V);
2336
+ }
2337
+ }
2338
+ function p(u, _, V) {
2339
+ const G = _[u.code];
2340
+ return {
2341
+ field: u,
2342
+ section: e.section,
2343
+ sectionView: e.section,
2344
+ node: e.node,
2345
+ row: _,
2346
+ rowIndex: V,
2347
+ editing: e.editing,
2348
+ modelValue: G,
2349
+ value: G,
2350
+ state: e.state,
2351
+ actions: e.actions,
2352
+ updateModelValue: (P) => s(_, V, u, P)
2353
+ };
2354
+ }
2355
+ function c(u) {
2356
+ const _ = String(u.id || u.key || u.code || "").trim(), V = _ ? `field-${_}` : "";
2357
+ if (V && n[V]) return V;
2358
+ const G = V.toLowerCase();
2359
+ return G !== V && n[G] ? G : "";
2360
+ }
2361
+ function b(u) {
2362
+ return !u.readonly && !u.disabled;
2363
+ }
2364
+ function C(u) {
2365
+ return u.width ?? (m(u) ? 56 : void 0);
2366
+ }
2367
+ function i(u) {
2368
+ if (!u.width)
2369
+ return u.minWidth ?? (m(u) ? 56 : void 0);
2370
+ }
2371
+ function d(u) {
2372
+ return u.key || u.id || u.code;
2373
+ }
2374
+ function m(u) {
2375
+ return [u.label, u.name, u.code, u.key, u.id].map((V) => String(V ?? "").trim().toLowerCase()).some((V) => ["序号", "index", "idx", "seq", "serial", "order", "rownum", "row_no"].includes(V));
2376
+ }
2377
+ let g = 0;
2378
+ const h = /* @__PURE__ */ new WeakMap();
2379
+ function S(u) {
2380
+ const _ = u.__rowKey ?? u.key ?? u.id ?? u.setId ?? u.infSetId;
2381
+ if (_ != null && _ !== "") return String(_);
2382
+ const V = u, G = h.get(V);
2383
+ if (G) return G;
2384
+ g += 1;
2385
+ const P = `local-${g}`;
2386
+ return h.set(V, P), P;
2387
+ }
2388
+ function B(u) {
2389
+ return u.required || u.isRequired;
2390
+ }
2391
+ return (u, _) => {
2392
+ const V = Et, G = rn("Delete"), P = _t, w = nt, R = Bt;
2393
+ return y(), L("div", jo, [
2394
+ J("div", zo, [
2395
+ re(R, {
2396
+ class: "global-info-table-renderer__table",
2397
+ data: u.section.rows,
2398
+ "row-key": S
2399
+ }, {
2400
+ default: M(() => [
2401
+ (y(!0), L(de, null, oe(o.value, (k) => (y(), F(V, {
2402
+ key: d(k),
2403
+ prop: k.code,
2404
+ label: k.label,
2405
+ width: C(k),
2406
+ "min-width": i(k)
2407
+ }, {
2408
+ header: M(() => [
2409
+ J("span", Oo, [
2410
+ B(k) ? (y(), L("span", Go, "*")) : Z("", !0),
2411
+ J("span", null, ee(k.label), 1)
2412
+ ])
2413
+ ]),
2414
+ default: M(({ row: z, $index: ae }) => [
2415
+ c(k) ? j(u.$slots, c(k), D({
2416
+ key: 0,
2417
+ ref_for: !0
2418
+ }, p(k, z, ae)), void 0, !0) : u.editing && b(k) ? (y(), F(Wt, {
2419
+ key: 1,
2420
+ field: k,
2421
+ "model-value": z[k.code],
2422
+ section: u.section,
2423
+ row: z,
2424
+ "row-index": ae,
2425
+ onLoadOptions: () => v(k, z),
2426
+ "onUpdate:modelValue": (pe) => s(z, ae, k, pe)
2427
+ }, null, 8, ["field", "model-value", "section", "row", "row-index", "onLoadOptions", "onUpdate:modelValue"])) : (y(), F(Yt, {
2428
+ key: 2,
2429
+ field: k,
2430
+ value: z[k.code],
2431
+ section: u.section,
2432
+ row: z,
2433
+ "row-index": ae
2434
+ }, null, 8, ["field", "value", "section", "row", "row-index"]))
2435
+ ]),
2436
+ _: 2
2437
+ }, 1032, ["prop", "label", "width", "min-width"]))), 128)),
2438
+ u.editing ? (y(), F(V, {
2439
+ key: 0,
2440
+ label: "操作",
2441
+ width: "104",
2442
+ fixed: "right"
2443
+ }, {
2444
+ default: M(({ $index: k }) => [
2445
+ u.showDelete ? (y(), F(No, {
2446
+ key: 0,
2447
+ onConfirm: (z) => a(k)
2448
+ }, {
2449
+ default: M(() => [
2450
+ re(w, {
2451
+ class: "global-info-table-renderer__delete",
2452
+ link: "",
2453
+ type: "danger"
2454
+ }, {
2455
+ default: M(() => [
2456
+ re(P, { class: "global-info-table-renderer__delete-icon" }, {
2457
+ default: M(() => [
2458
+ re(G)
2459
+ ]),
2460
+ _: 1
2461
+ }),
2462
+ _[0] || (_[0] = Be(" 删除 "))
2463
+ ]),
2464
+ _: 1
2465
+ })
2466
+ ]),
2467
+ _: 2
2468
+ }, 1032, ["onConfirm"])) : Z("", !0)
2469
+ ]),
2470
+ _: 1
2471
+ })) : Z("", !0)
2472
+ ]),
2473
+ _: 3
2474
+ }, 8, ["data"])
2475
+ ])
2476
+ ]);
2477
+ };
2478
+ }
2479
+ }), Do = /* @__PURE__ */ X(Ao, [["__scopeId", "data-v-2fa29438"]]), Ko = /* @__PURE__ */ U({
2480
+ name: "GlobalInfoAutoRenderer",
2481
+ __name: "GlobalInfoAutoRenderer",
2482
+ props: {
2483
+ section: {},
2484
+ node: {},
2485
+ editing: { type: Boolean },
2486
+ state: {},
2487
+ actions: {}
2488
+ },
2489
+ setup(t) {
2490
+ return (e, n) => e.section.renderType === "table" ? (y(), F(Do, {
2491
+ key: 0,
2492
+ section: e.section,
2493
+ node: e.node,
2494
+ editing: e.editing,
2495
+ state: e.state,
2496
+ actions: e.actions
2497
+ }, null, 8, ["section", "node", "editing", "state", "actions"])) : (y(), F(Ro, {
2498
+ key: 1,
2499
+ section: e.section,
2500
+ node: e.node,
2501
+ editing: e.editing,
2502
+ state: e.state,
2503
+ actions: e.actions
2504
+ }, null, 8, ["section", "node", "editing", "state", "actions"]));
2505
+ }
2506
+ }), qo = /* @__PURE__ */ U({
2507
+ name: "GlobalInfoSectionOutlet",
2508
+ __name: "GlobalInfoSectionOutlet",
2509
+ props: {
2510
+ section: {},
2511
+ node: {},
2512
+ editing: { type: Boolean },
2513
+ state: {},
2514
+ actions: {}
2515
+ },
2516
+ setup(t) {
2517
+ const e = t, n = ve(), o = I(() => e.editing ?? e.actions.isEditing(e.section)), a = I(() => e.section.renderType === "table" ? e.section.rows.length === 0 : e.section.fields.length === 0), s = I(() => {
2518
+ const c = v(e.section.id || e.section.key), b = p(e.section.renderType);
2519
+ return [
2520
+ c,
2521
+ b,
2522
+ "default"
2523
+ ].find((C) => !!(C && n[C])) ?? "";
2524
+ });
2525
+ function v(c) {
2526
+ const b = String(c ?? "").trim();
2527
+ return b ? `section-${b}` : "";
2528
+ }
2529
+ function p(c) {
2530
+ return c === "form" || c === "table" ? c : "";
2531
+ }
2532
+ return (c, b) => s.value ? j(c.$slots, s.value, {
2533
+ key: 0,
2534
+ section: c.section,
2535
+ sectionView: c.section,
2536
+ node: c.node,
2537
+ editing: o.value,
2538
+ isEmpty: a.value,
2539
+ empty: a.value,
2540
+ fields: c.section.fields,
2541
+ state: c.state,
2542
+ actions: c.actions
2543
+ }) : (y(), F(Ko, {
2544
+ key: 1,
2545
+ section: c.section,
2546
+ node: c.node,
2547
+ editing: o.value,
2548
+ state: c.state,
2549
+ actions: c.actions
2550
+ }, null, 8, ["section", "node", "editing", "state", "actions"]));
2551
+ }
2552
+ }), Jo = U({
2553
+ name: "GlobalInfoSlotErrorBoundary",
2554
+ props: {
2555
+ boundaryKey: {
2556
+ type: [String, Number],
2557
+ default: ""
2558
+ },
2559
+ label: {
2560
+ type: String,
2561
+ default: ""
2562
+ }
2563
+ },
2564
+ emits: {
2565
+ error: (t) => !0
2566
+ },
2567
+ setup(t, { emit: e, slots: n }) {
2568
+ const o = ne(!1);
2569
+ Re(
2570
+ () => t.boundaryKey,
2571
+ () => {
2572
+ o.value = !1;
2573
+ }
2574
+ ), sn((s) => (a(s), !1));
2575
+ function a(s) {
2576
+ o.value = !0, console.error(`[GlobalInfoSlotErrorBoundary] ${t.label || "section"} slot render failed`, s), e("error", s);
2577
+ }
2578
+ return () => {
2579
+ if (o.value)
2580
+ return n.fallback?.() ?? null;
2581
+ try {
2582
+ return n.default?.() ?? null;
2583
+ } catch (s) {
2584
+ return a(s), n.fallback?.() ?? null;
2585
+ }
2586
+ };
2587
+ }
2588
+ }), Uo = { class: "global-info-section-block" }, xo = {
2589
+ key: 0,
2590
+ class: "global-info-section-block__header"
2591
+ }, Ho = { class: "global-info-section-block__title-wrap" }, Wo = { class: "global-info-section-block__title" }, Yo = {
2592
+ key: 0,
2593
+ class: "global-info-section-block__actions"
2594
+ }, Zo = { class: "global-info-section-block__body" }, Qo = /* @__PURE__ */ U({
2595
+ name: "GlobalInfoSectionBlock",
2596
+ __name: "GlobalInfoSectionBlock",
2597
+ props: {
2598
+ node: {},
2599
+ state: {},
2600
+ actions: {},
2601
+ hideHeader: { type: Boolean },
2602
+ onEdit: { type: Function },
2603
+ onCancel: { type: Function },
2604
+ onSave: { type: Function }
2605
+ },
2606
+ setup(t) {
2607
+ const e = t, n = ve(), o = ne(!1), a = ne(null), s = ne(null), v = I(() => !!e.hideHeader), p = I(() => e.actions.getSectionStatus(e.node)), c = I(() => e.actions.getSection(e.node) ?? s.value), b = I(() => c.value?.title || e.node.tagName || e.node.label || "-"), C = I(() => !!(c.value && e.actions.isEditing(c.value))), i = I(() => c.value?.renderType === "table"), d = I(() => o.value || p.value.loading), m = I(() => S(a.value || p.value.error)), g = I(() => {
2608
+ const w = c.value;
2609
+ return w ? w.renderType === "table" ? w.rows.length === 0 : w.fields.length === 0 : !0;
2610
+ }), h = I(() => ({
2611
+ node: e.node,
2612
+ section: c.value,
2613
+ sectionView: c.value,
2614
+ fields: c.value?.fields ?? [],
2615
+ title: b.value,
2616
+ editing: C.value,
2617
+ loading: d.value,
2618
+ error: a.value || p.value.error,
2619
+ errorMessage: m.value,
2620
+ isEmpty: g.value,
2621
+ empty: g.value,
2622
+ sectionStatus: p.value,
2623
+ state: e.state,
2624
+ actions: e.actions,
2625
+ reload: P,
2626
+ handleEdit: B,
2627
+ handleCancel: u,
2628
+ handleAddTableRow: _,
2629
+ handleSave: V
2630
+ }));
2631
+ function S(w) {
2632
+ return w ? w instanceof Error ? w.message : String(w) : "";
2633
+ }
2634
+ async function B() {
2635
+ const w = c.value;
2636
+ w && (await e.onEdit?.(w, e.node), e.onEdit || e.actions.startEdit(w));
2637
+ }
2638
+ async function u() {
2639
+ const w = c.value;
2640
+ w && (await e.onCancel?.(w, e.node), e.onCancel || e.actions.cancelEdit(w));
2641
+ }
2642
+ function _() {
2643
+ const w = c.value;
2644
+ if (!w) return;
2645
+ const R = w.fields.reduce((k, z) => (k[z.code] = z.value ?? "", k), { __rowKey: `new-${Date.now()}` });
2646
+ e.actions.saveRow(w, R, -1);
2647
+ }
2648
+ async function V() {
2649
+ const w = c.value;
2650
+ if (w)
2651
+ try {
2652
+ if (e.onSave) {
2653
+ await e.onSave(w, e.node);
2654
+ return;
2655
+ }
2656
+ await e.actions.saveSection(w);
2657
+ } catch (R) {
2658
+ a.value = R, console.error("[GlobalInfoSectionBlock] save section failed", R);
2659
+ }
2660
+ }
2661
+ function G(w) {
2662
+ a.value = w;
2663
+ }
2664
+ async function P() {
2665
+ o.value = !0, a.value = null, s.value = null;
2666
+ try {
2667
+ s.value = await e.actions.loadSection(e.node);
2668
+ } catch (w) {
2669
+ a.value = w, console.error("[GlobalInfoSectionBlock] load section failed", w);
2670
+ } finally {
2671
+ o.value = !1;
2672
+ }
2673
+ }
2674
+ return St(() => {
2675
+ P();
2676
+ }), Re(
2677
+ () => e.node.key,
2678
+ () => {
2679
+ P();
2680
+ }
2681
+ ), (w, R) => {
2682
+ const k = nt;
2683
+ return y(), L("section", Uo, [
2684
+ v.value ? Z("", !0) : (y(), L("header", xo, [
2685
+ j(w.$slots, "header", ce(me(h.value)), () => [
2686
+ J("div", Ho, [
2687
+ R[0] || (R[0] = J("span", { class: "global-info-section-block__marker" }, null, -1)),
2688
+ J("h3", Wo, ee(b.value), 1)
2689
+ ]),
2690
+ j(w.$slots, "actions", ce(me(h.value)), () => [
2691
+ c.value ? (y(), L("div", Yo, [
2692
+ C.value ? (y(), L(de, { key: 1 }, [
2693
+ re(k, {
2694
+ class: "global-info-section-block__cancel",
2695
+ link: "",
2696
+ disabled: p.value.saving,
2697
+ onClick: u
2698
+ }, {
2699
+ default: M(() => R[2] || (R[2] = [
2700
+ Be(" 取消 ")
2701
+ ])),
2702
+ _: 1
2703
+ }, 8, ["disabled"]),
2704
+ i.value ? (y(), F(k, {
2705
+ key: 0,
2706
+ class: "global-info-section-block__add",
2707
+ link: "",
2708
+ disabled: p.value.saving,
2709
+ onClick: _
2710
+ }, {
2711
+ default: M(() => R[3] || (R[3] = [
2712
+ Be(" 新增 ")
2713
+ ])),
2714
+ _: 1
2715
+ }, 8, ["disabled"])) : Z("", !0),
2716
+ re(k, {
2717
+ class: "global-info-section-block__confirm",
2718
+ link: "",
2719
+ type: "primary",
2720
+ loading: p.value.saving,
2721
+ onClick: V
2722
+ }, {
2723
+ default: M(() => [
2724
+ Be(ee(i.value ? "确认" : "保存"), 1)
2725
+ ]),
2726
+ _: 1
2727
+ }, 8, ["loading"])
2728
+ ], 64)) : (y(), F(k, {
2729
+ key: 0,
2730
+ class: "global-info-section-block__edit",
2731
+ link: "",
2732
+ type: "primary",
2733
+ disabled: p.value.saving || d.value,
2734
+ onClick: B
2735
+ }, {
2736
+ default: M(() => R[1] || (R[1] = [
2737
+ Be(" 编辑 ")
2738
+ ])),
2739
+ _: 1
2740
+ }, 8, ["disabled"]))
2741
+ ])) : Z("", !0)
2742
+ ], !0)
2743
+ ], !0)
2744
+ ])),
2745
+ J("div", Zo, [
2746
+ d.value ? j(w.$slots, "loading", ce(D({ key: 0 }, h.value)), () => [
2747
+ R[4] || (R[4] = J("div", { class: "global-info-section-block__status" }, "加载中...", -1))
2748
+ ], !0) : !c.value || g.value || m.value ? j(w.$slots, "empty", ce(D({ key: 1 }, h.value)), () => [
2749
+ R[5] || (R[5] = J("div", { class: "global-info-section-block__status" }, "暂无数据", -1))
2750
+ ], !0) : (y(), F(Jo, {
2751
+ key: 2,
2752
+ "boundary-key": w.node.key,
2753
+ label: b.value,
2754
+ onError: G
2755
+ }, {
2756
+ fallback: M(() => [
2757
+ j(w.$slots, "empty", ce(me(h.value)), () => [
2758
+ R[6] || (R[6] = J("div", { class: "global-info-section-block__status" }, "暂无数据", -1))
2759
+ ], !0)
2760
+ ]),
2761
+ default: M(() => [
2762
+ re(qo, {
2763
+ section: c.value,
2764
+ node: w.node,
2765
+ editing: C.value,
2766
+ state: w.state,
2767
+ actions: w.actions
2768
+ }, ke({ _: 2 }, [
2769
+ oe(q(n), (z, ae) => ({
2770
+ name: ae,
2771
+ fn: M((pe) => [
2772
+ j(w.$slots, ae, ce(me({ ...h.value, ...pe })), void 0, !0)
2773
+ ])
2774
+ }))
2775
+ ]), 1032, ["section", "node", "editing", "state", "actions"])
2776
+ ]),
2777
+ _: 3
2778
+ }, 8, ["boundary-key", "label"]))
2779
+ ])
2780
+ ]);
2781
+ };
2782
+ }
2783
+ }), Xo = /* @__PURE__ */ X(Qo, [["__scopeId", "data-v-0d8ae722"]]), ea = { class: "global-info-group" }, ta = { class: "global-info-group__header" }, na = { class: "global-info-group__title" }, oa = { class: "global-info-group__body" }, aa = ["id"], la = /* @__PURE__ */ U({
2784
+ name: "GlobalInfoGroup",
2785
+ __name: "GlobalInfoGroup",
2786
+ props: {
2787
+ group: {},
2788
+ children: {},
2789
+ state: {},
2790
+ actions: {},
2791
+ index: {}
2792
+ },
2793
+ setup(t) {
2794
+ const e = t, n = ve(), o = I(() => e.group.tagName || e.group.label || "-"), a = I(() => e.children.length <= 1);
2795
+ function s(i, d) {
2796
+ const m = e.actions.getSection(i);
2797
+ return {
2798
+ node: i,
2799
+ group: e.group,
2800
+ sectionNode: i,
2801
+ section: m,
2802
+ sectionView: m,
2803
+ state: e.state,
2804
+ actions: e.actions,
2805
+ index: d,
2806
+ editing: !!(m && e.actions.isEditing(m)),
2807
+ sectionStatus: e.actions.getSectionStatus(i),
2808
+ isSelfSection: b(i, 0) === b(e.group, 0),
2809
+ handleEdit: () => e.actions.startEdit(i),
2810
+ handleCancel: () => e.actions.cancelEdit(i),
2811
+ handleSave: () => e.actions.saveSection(i.key)
2812
+ };
2813
+ }
2814
+ function v(i) {
2815
+ return p("section", c(i));
2816
+ }
2817
+ function p(i, d) {
2818
+ if (!d) return "";
2819
+ const m = `${i}-${d}`;
2820
+ if (n[m]) return m;
2821
+ const g = m.toLowerCase();
2822
+ return g !== m && n[g] ? g : "";
2823
+ }
2824
+ function c(i) {
2825
+ return String(i.id || i.infSetId || i.tagId || i.key || i.code || "").trim();
2826
+ }
2827
+ function b(i, d) {
2828
+ return i.key || i.id || i.infSetId || i.tagId || `${d}`;
2829
+ }
2830
+ function C(i) {
2831
+ return `global-info-section-${b(i, 0)}`;
2832
+ }
2833
+ return (i, d) => (y(), L("section", ea, [
2834
+ j(i.$slots, "header", {
2835
+ group: i.group,
2836
+ children: i.children,
2837
+ state: i.state,
2838
+ actions: i.actions,
2839
+ title: o.value,
2840
+ index: i.index,
2841
+ isEmpty: i.children.length === 0
2842
+ }, () => [
2843
+ J("header", ta, [
2844
+ d[0] || (d[0] = J("span", { class: "global-info-group__marker" }, null, -1)),
2845
+ J("h2", na, ee(o.value), 1)
2846
+ ])
2847
+ ], !0),
2848
+ J("div", oa, [
2849
+ q(n).default ? j(i.$slots, "default", {
2850
+ key: 0,
2851
+ group: i.group,
2852
+ children: i.children,
2853
+ state: i.state,
2854
+ actions: i.actions,
2855
+ index: i.index,
2856
+ isEmpty: i.children.length === 0
2857
+ }, void 0, !0) : (y(), L(de, { key: 1 }, [
2858
+ (y(!0), L(de, null, oe(i.children, (m, g) => (y(), L("div", {
2859
+ id: C(m),
2860
+ key: b(m, g),
2861
+ class: "global-info-group__section"
2862
+ }, [
2863
+ v(m) ? j(i.$slots, v(m), D({
2864
+ key: 0,
2865
+ ref_for: !0
2866
+ }, s(m, g)), void 0, !0) : q(n).section ? j(i.$slots, "section", D({
2867
+ key: 1,
2868
+ ref_for: !0
2869
+ }, s(m, g)), void 0, !0) : (y(), F(Xo, {
2870
+ key: 2,
2871
+ node: m,
2872
+ state: i.state,
2873
+ actions: i.actions,
2874
+ "hide-header": a.value
2875
+ }, ke({ _: 2 }, [
2876
+ oe(q(n), (h, S) => ({
2877
+ name: S,
2878
+ fn: M((B) => [
2879
+ j(i.$slots, S, D({ ref_for: !0 }, B), void 0, !0)
2880
+ ])
2881
+ }))
2882
+ ]), 1032, ["node", "state", "actions", "hide-header"]))
2883
+ ], 8, aa))), 128)),
2884
+ i.children.length === 0 ? j(i.$slots, "empty", {
2885
+ key: 0,
2886
+ node: null,
2887
+ group: i.group,
2888
+ sectionNode: null,
2889
+ state: i.state,
2890
+ actions: i.actions,
2891
+ index: -1
2892
+ }, () => [
2893
+ d[1] || (d[1] = J("div", { class: "global-info-group__empty" }, "暂无数据", -1))
2894
+ ], !0) : Z("", !0)
2895
+ ], 64))
2896
+ ])
2897
+ ]));
2898
+ }
2899
+ }), ra = /* @__PURE__ */ X(la, [["__scopeId", "data-v-778e227f"]]), sa = { class: "global-info-sections" }, ia = /* @__PURE__ */ U({
2900
+ name: "GlobalInfoSections",
2901
+ __name: "GlobalInfoSections",
2902
+ props: {
2903
+ nodes: {},
2904
+ state: {},
2905
+ actions: {}
2906
+ },
2907
+ setup(t) {
2908
+ const e = t, n = ve(), o = I(() => {
2909
+ const d = e.nodes.filter((_) => a(_).length > 0), m = e.nodes.filter((_) => a(_).length === 0), g = m.filter((_) => s(_)), h = m.filter((_) => !s(_)), S = d.map((_) => ({ group: _, children: a(_) })), B = g.map((_) => ({ group: _, children: [_] }));
2910
+ if (S.length === 0)
2911
+ return g.length > 0 ? B : i(h);
2912
+ const u = i(h);
2913
+ return [...S, ...B, ...u];
2914
+ });
2915
+ function a(d) {
2916
+ return d.children ?? [];
2917
+ }
2918
+ function s(d) {
2919
+ return !String(d.parentId || d.parentTagId || "").trim();
2920
+ }
2921
+ function v(d) {
2922
+ return p("group", c(d));
2923
+ }
2924
+ function p(d, m) {
2925
+ if (!m) return "";
2926
+ const g = `${d}-${m}`;
2927
+ if (n[g]) return g;
2928
+ const h = g.toLowerCase();
2929
+ return h !== g && n[h] ? h : "";
2930
+ }
2931
+ function c(d) {
2932
+ return String(d.id || d.tagId || d.key || d.code || "").trim();
2933
+ }
2934
+ function b(d, m) {
2935
+ return d.key || d.id || d.tagId || `${m}`;
2936
+ }
2937
+ function C(d) {
2938
+ const m = d[0], g = m?.raw ?? {}, h = String(g.parentTagName || g.parentName || g.parentLabel || m?.parentId || "信息");
2939
+ return {
2940
+ ...m,
2941
+ key: `${m?.parentId || m?.parentTagId || m?.key || "global-info"}-group`,
2942
+ id: String(m?.parentId || m?.parentTagId || m?.id || "global-info-group"),
2943
+ tagId: String(m?.parentTagId || m?.parentId || m?.tagId || "global-info-group"),
2944
+ tagName: h,
2945
+ label: h,
2946
+ children: d
2947
+ };
2948
+ }
2949
+ function i(d) {
2950
+ const m = /* @__PURE__ */ new Map();
2951
+ return d.forEach((g) => {
2952
+ const h = String(g.parentId || g.parentTagId || "global-info-flat"), S = m.get(h) ?? [];
2953
+ S.push(g), m.set(h, S);
2954
+ }), Array.from(m.values()).map((g) => ({
2955
+ group: C(g),
2956
+ children: g
2957
+ }));
2958
+ }
2959
+ return (d, m) => (y(), L("div", sa, [
2960
+ (y(!0), L(de, null, oe(o.value, (g, h) => (y(), L(de, {
2961
+ key: b(g.group, h)
2962
+ }, [
2963
+ v(g.group) ? j(d.$slots, v(g.group), {
2964
+ key: 0,
2965
+ group: g.group,
2966
+ children: g.children,
2967
+ state: d.state,
2968
+ actions: d.actions,
2969
+ index: h,
2970
+ isEmpty: g.children.length === 0
2971
+ }, void 0, !0) : q(n).group ? j(d.$slots, "group", {
2972
+ key: 1,
2973
+ group: g.group,
2974
+ children: g.children,
2975
+ state: d.state,
2976
+ actions: d.actions,
2977
+ index: h,
2978
+ isEmpty: g.children.length === 0
2979
+ }, void 0, !0) : (y(), F(ra, {
2980
+ key: 2,
2981
+ group: g.group,
2982
+ children: g.children,
2983
+ state: d.state,
2984
+ actions: d.actions,
2985
+ index: h
2986
+ }, ke({ _: 2 }, [
2987
+ oe(q(n), (S, B) => ({
2988
+ name: B,
2989
+ fn: M((u) => [
2990
+ j(d.$slots, B, D({ ref_for: !0 }, u), void 0, !0)
2991
+ ])
2992
+ }))
2993
+ ]), 1032, ["group", "children", "state", "actions", "index"]))
2994
+ ], 64))), 128))
2995
+ ]));
2996
+ }
2997
+ }), Sa = /* @__PURE__ */ X(ia, [["__scopeId", "data-v-f15cf0fb"]]);
2998
+ export {
2999
+ Ko as GlobalInfoAutoRenderer,
3000
+ No as GlobalInfoDeleteConfirm,
3001
+ Wt as GlobalInfoFieldControl,
3002
+ Yt as GlobalInfoFieldValue,
3003
+ Ro as GlobalInfoFormRenderer,
3004
+ ra as GlobalInfoGroup,
3005
+ ba as GlobalInfoProvider,
3006
+ Xo as GlobalInfoSectionBlock,
3007
+ qo as GlobalInfoSectionOutlet,
3008
+ Sa as GlobalInfoSections,
3009
+ Do as GlobalInfoTableRenderer,
3010
+ Je as JtButton,
3011
+ Sn as JtCascader,
3012
+ va as JtCrudTable,
3013
+ In as JtDatePicker,
3014
+ Rn as JtFilterBar,
3015
+ Bn as JtFormItems,
3016
+ Ze as JtInput,
3017
+ ya as JtPageHeader,
3018
+ ga as JtPagination,
3019
+ Cn as JtSelect,
3020
+ Gn as JtTable,
3021
+ ao as buildGlobalInfoUpdatePayload,
3022
+ to as createEmptyGlobalInfoViewModel,
3023
+ ha as isGlobalInfoNode,
3024
+ Lt as mergeGlobalInfoChildren,
3025
+ no as normalizeGlobalInfoDetail,
3026
+ ut as normalizeGlobalInfoTree,
3027
+ oo as resolveGlobalInfoRenderType,
3028
+ So as useGlobalInfoController
3029
+ };