urit-qf-ui 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,18 @@
1
- var Me = Object.defineProperty;
2
- var Ee = (o, t, e) => t in o ? Me(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var x = (o, t, e) => Ee(o, typeof t != "symbol" ? t + "" : t, e);
4
- import Ue, { ElMessage as Te, ElMessageBox as De } from "element-plus";
1
+ var Be = Object.defineProperty;
2
+ var Fe = (o, t, e) => t in o ? Be(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var C = (o, t, e) => Fe(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import Le, { ElMessage as Ve, ElMessageBox as Te } from "element-plus";
5
5
  import "element-plus/dist/index.css";
6
- import { ElInput as Be, ElInputNumber as Fe, ElSelect as pe, ElOption as he, ElSwitch as Le, ElDatePicker as ze, ElMenu as Ne, ElSubMenu as We, ElMenuItem as qe, ElIcon as ge, ElButton as J, ElDialog as je, ElForm as Oe, ElTable as Ye, ElTableColumn as Qe, ElPagination as Ke, ElDrawer as He } from "element-plus/es";
6
+ import { ElInput as Ne, ElInputNumber as We, ElSelect as he, ElOption as ge, ElSwitch as ze, ElDatePicker as qe, ElMenu as Oe, ElSubMenu as je, ElMenuItem as Ye, ElIcon as ye, ElButton as X, ElDialog as Qe, ElForm as Ge, ElTable as Ke, ElTableColumn as He, ElPagination as Je, ElDrawer as Xe } from "element-plus/es";
7
7
  import "element-plus/es/components/base/style/css";
8
8
  import "element-plus/es/components/input/style/css";
9
- import { defineComponent as P, computed as v, openBlock as h, createElementBlock as y, normalizeClass as V, normalizeStyle as B, createTextVNode as F, toDisplayString as k, createElementVNode as C, createCommentVNode as D, createVNode as _, reactive as W, watch as L, withCtx as w, Fragment as I, renderList as E, createBlock as S, mergeProps as ce, ref as Q, markRaw as re, onMounted as oe, renderSlot as T, resolveDynamicComponent as H, toRefs as Ge, unref as N, useSlots as ye, createSlots as X, withModifiers as Je, normalizeProps as q, guardReactiveProps as j, useAttrs as Xe } from "vue";
9
+ import { defineComponent as V, computed as b, openBlock as g, createElementBlock as v, normalizeClass as P, normalizeStyle as B, createTextVNode as F, toDisplayString as T, createElementVNode as x, createCommentVNode as D, createVNode as _, reactive as z, watch as L, withCtx as w, Fragment as I, renderList as E, createBlock as S, mergeProps as de, ref as Q, markRaw as se, onMounted as oe, renderSlot as k, resolveDynamicComponent as J, toRefs as Ze, unref as W, useSlots as ve, createSlots as Z, withModifiers as et, normalizeProps as q, guardReactiveProps as O, useAttrs as tt } from "vue";
10
10
  import "element-plus/es/components/input-number/style/css";
11
11
  import "element-plus/es/components/select/style/css";
12
12
  import "element-plus/es/components/option/style/css";
13
- import Ve from "axios";
13
+ import at from "axios";
14
+ import ot from "mitt";
15
+ import lt from "mqtt";
14
16
  import "element-plus/es/components/switch/style/css";
15
17
  import "element-plus/es/components/date-picker/style/css";
16
18
  import "element-plus/es/components/button/style/css";
@@ -18,16 +20,15 @@ import "element-plus/es/components/menu/style/css";
18
20
  import "element-plus/es/components/sub-menu/style/css";
19
21
  import "element-plus/es/components/menu-item/style/css";
20
22
  import "element-plus/es/components/icon/style/css";
23
+ import * as $e from "@element-plus/icons-vue";
24
+ import { Loading as Pe } from "@element-plus/icons-vue";
21
25
  import "element-plus/es/components/form/style/css";
22
26
  import "element-plus/es/components/dialog/style/css";
23
- import { Loading as ke } from "@element-plus/icons-vue";
24
27
  import "element-plus/es/components/drawer/style/css";
25
28
  import "element-plus/es/components/table/style/css";
26
29
  import "element-plus/es/components/table-column/style/css";
27
30
  import "element-plus/es/components/pagination/style/css";
28
- import Ze from "mitt";
29
- import et from "mqtt";
30
- const tt = /* @__PURE__ */ P({
31
+ const nt = /* @__PURE__ */ V({
31
32
  __name: "UInput",
32
33
  props: {
33
34
  fieldLabel: {},
@@ -55,43 +56,43 @@ const tt = /* @__PURE__ */ P({
55
56
  },
56
57
  emits: ["update:modelValue"],
57
58
  setup(o, { emit: t }) {
58
- const e = o, l = t, d = v(() => {
59
- const s = {};
60
- return e.labelPosition === "left" && e.labelWidth && (s.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (s.textAlign = e.labelAlign), s;
61
- }), r = v(() => ({
59
+ const e = o, i = t, s = b(() => {
60
+ const c = {};
61
+ return e.labelPosition === "left" && e.labelWidth && (c.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (c.textAlign = e.labelAlign), c;
62
+ }), d = b(() => ({
62
63
  "u-input-label-left": e.labelPosition === "left",
63
64
  "u-input-label-top": e.labelPosition === "top"
64
- })), c = {
65
- onInput(s) {
66
- l("update:modelValue", s);
65
+ })), r = {
66
+ onInput(c) {
67
+ i("update:modelValue", c);
67
68
  }
68
69
  };
69
- return (s, a) => {
70
- const i = Be;
71
- return h(), y("div", {
72
- class: V(["u-input", r.value])
70
+ return (c, a) => {
71
+ const l = Ne;
72
+ return g(), v("div", {
73
+ class: P(["u-input", d.value])
73
74
  }, [
74
- o.fieldLabel ? (h(), y("div", {
75
+ o.fieldLabel ? (g(), v("div", {
75
76
  key: 0,
76
77
  class: "u-input-label",
77
- style: B(d.value)
78
+ style: B(s.value)
78
79
  }, [
79
- F(k(o.fieldLabel) + " ", 1),
80
- C("span", {
81
- class: V(["required-star", { "required-star--visible": o.required }])
80
+ F(T(o.fieldLabel) + " ", 1),
81
+ x("span", {
82
+ class: P(["required-star", { "required-star--visible": o.required }])
82
83
  }, "*", 2)
83
84
  ], 4)) : D("", !0),
84
- C("div", {
85
- class: V(["u-input-field", { "u-input-field--top": o.labelPosition === "top" }])
85
+ x("div", {
86
+ class: P(["u-input-field", { "u-input-field--top": o.labelPosition === "top" }])
86
87
  }, [
87
- _(i, {
88
+ _(l, {
88
89
  "model-value": o.modelValue,
89
90
  placeholder: o.placeholder,
90
91
  type: o.type,
91
92
  disabled: o.disable,
92
93
  readonly: o.readonly,
93
94
  maxlength: o.maxlength,
94
- "onUpdate:modelValue": c.onInput
95
+ "onUpdate:modelValue": r.onInput
95
96
  }, null, 8, ["model-value", "placeholder", "type", "disabled", "readonly", "maxlength", "onUpdate:modelValue"])
96
97
  ], 2)
97
98
  ], 2);
@@ -99,10 +100,10 @@ const tt = /* @__PURE__ */ P({
99
100
  }
100
101
  }), $ = (o, t) => {
101
102
  const e = o.__vccOpts || o;
102
- for (const [l, d] of t)
103
- e[l] = d;
103
+ for (const [i, s] of t)
104
+ e[i] = s;
104
105
  return e;
105
- }, te = /* @__PURE__ */ $(tt, [["__scopeId", "data-v-ecf5177c"]]), at = { class: "u-input-number-field" }, ot = /* @__PURE__ */ P({
106
+ }, te = /* @__PURE__ */ $(nt, [["__scopeId", "data-v-ecf5177c"]]), it = { class: "u-input-number-field" }, st = /* @__PURE__ */ V({
106
107
  __name: "UInputNumber",
107
108
  props: {
108
109
  fieldLabel: {},
@@ -130,34 +131,34 @@ const tt = /* @__PURE__ */ P({
130
131
  },
131
132
  emits: ["update:modelValue"],
132
133
  setup(o, { emit: t }) {
133
- const e = o, l = t, d = v(() => {
134
- const s = {};
135
- return e.labelPosition === "left" && e.labelWidth && (s.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (s.textAlign = e.labelAlign), s;
136
- }), r = v(() => ({
134
+ const e = o, i = t, s = b(() => {
135
+ const c = {};
136
+ return e.labelPosition === "left" && e.labelWidth && (c.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (c.textAlign = e.labelAlign), c;
137
+ }), d = b(() => ({
137
138
  "u-input-number-label-left": e.labelPosition === "left",
138
139
  "u-input-number-label-top": e.labelPosition === "top"
139
- })), c = {
140
- onUpdate(s) {
141
- l("update:modelValue", s === void 0 ? 0 : s);
140
+ })), r = {
141
+ onUpdate(c) {
142
+ i("update:modelValue", c === void 0 ? 0 : c);
142
143
  }
143
144
  };
144
- return (s, a) => {
145
- const i = Fe;
146
- return h(), y("div", {
147
- class: V(["u-input-number", r.value])
145
+ return (c, a) => {
146
+ const l = We;
147
+ return g(), v("div", {
148
+ class: P(["u-input-number", d.value])
148
149
  }, [
149
- o.fieldLabel ? (h(), y("div", {
150
+ o.fieldLabel ? (g(), v("div", {
150
151
  key: 0,
151
152
  class: "u-input-number-label",
152
- style: B(d.value)
153
+ style: B(s.value)
153
154
  }, [
154
- F(k(o.fieldLabel) + " ", 1),
155
- C("span", {
156
- class: V(["required-star", { "required-star--visible": o.required }])
155
+ F(T(o.fieldLabel) + " ", 1),
156
+ x("span", {
157
+ class: P(["required-star", { "required-star--visible": o.required }])
157
158
  }, "*", 2)
158
159
  ], 4)) : D("", !0),
159
- C("div", at, [
160
- _(i, {
160
+ x("div", it, [
161
+ _(l, {
161
162
  "model-value": o.modelValue,
162
163
  placeholder: o.placeholder || "请输入数值",
163
164
  disabled: o.disable,
@@ -168,56 +169,255 @@ const tt = /* @__PURE__ */ P({
168
169
  controls: !0,
169
170
  "controls-position": "right",
170
171
  style: { width: "100%" },
171
- onChange: c.onUpdate
172
+ onChange: r.onUpdate
172
173
  }, null, 8, ["model-value", "placeholder", "disabled", "min", "max", "step", "precision", "onChange"])
173
174
  ])
174
175
  ], 2);
175
176
  };
176
177
  }
177
- }), Pe = /* @__PURE__ */ $(ot, [["__scopeId", "data-v-cb70bd5b"]]), Z = Ve.create({
178
- timeout: 3e4,
179
- headers: {
180
- "Content-Type": "application/json"
178
+ }), Ae = /* @__PURE__ */ $(st, [["__scopeId", "data-v-cb70bd5b"]]);
179
+ function rt() {
180
+ var o, t;
181
+ try {
182
+ if (typeof document < "u" && document.baseURI) {
183
+ const e = new URL(document.baseURI);
184
+ if (e.origin && e.origin !== "null") {
185
+ let i = e.pathname;
186
+ return i.slice(i.lastIndexOf("/") + 1).includes(".") && (i = i.slice(0, i.lastIndexOf("/") + 1)), i = i.replace(/\/+$/, ""), e.origin + i;
187
+ }
188
+ }
189
+ } catch {
181
190
  }
182
- });
183
- Z.interceptors.request.use(
184
- (o) => {
185
- const t = localStorage.getItem("token");
186
- return t && (o.headers.Authorization = `Bearer ${t}`), o;
187
- },
188
- (o) => Promise.reject(o)
189
- );
190
- Z.interceptors.response.use(
191
- (o) => {
192
- const t = o.data;
193
- if (t && typeof t == "object" && !Array.isArray(t)) {
194
- if (t.status === void 0 && t.code !== void 0) {
195
- const e = t.code, l = e === 0 || e === 200 || Number(e) === 0 || Number(e) === 200;
196
- t.status = l ? 200 : Number(e);
191
+ try {
192
+ const e = (t = (o = window == null ? void 0 : window.$wujie) == null ? void 0 : o.location) == null ? void 0 : t.origin;
193
+ if (typeof e == "string" && e) return e;
194
+ } catch {
195
+ }
196
+ return typeof window < "u" ? window.location.origin : "";
197
+ }
198
+ function dt(o, t) {
199
+ const e = (o ?? "").trim();
200
+ return e !== "" && e !== "." && e !== "./" ? e : (t.value === void 0 && (t.value = rt()), t.value);
201
+ }
202
+ class ct {
203
+ constructor(t) {
204
+ C(this, "axiosInstance");
205
+ // 免配基地址缓存(baseUrl 留空/"./" 时生效,见 pickBaseUrl)
206
+ C(this, "baseCache", {});
207
+ this.axiosInstance = at.create({
208
+ timeout: 1e4,
209
+ baseURL: ""
210
+ }), this.axiosInstance.defaults.headers["Content-Type"] = "application/json;charset=utf-8", this.axiosInstance.interceptors.request.use(
211
+ (e) => (e.headers.token = localStorage.getItem("token"), e.baseURL = dt(t.baseUrl, this.baseCache), e),
212
+ (e) => Promise.reject(e)
213
+ ), this.axiosInstance.interceptors.response.use(
214
+ (e) => {
215
+ if (e.config.responseType === "blob")
216
+ return e;
217
+ const i = e.data;
218
+ if (i && typeof i == "object" && !Array.isArray(i) && i.status === void 0 && i.code !== void 0) {
219
+ const s = i.code, d = s === 0 || s === 200 || Number(s) === 0 || Number(s) === 200;
220
+ i.status = d ? 200 : Number(s);
221
+ }
222
+ return i;
223
+ },
224
+ (e) => Promise.reject(e)
225
+ );
226
+ }
227
+ /**
228
+ * GET 请求(params 会被 axios 序列化成 query string)
229
+ */
230
+ Get(t, e) {
231
+ return this.axiosInstance.get(t, { params: e });
232
+ }
233
+ /**
234
+ * POST 请求(body 支持普通对象与 FormData;
235
+ * FormData 时 axios 会自动让浏览器设置带 boundary 的 Content-Type)
236
+ */
237
+ Post(t, e) {
238
+ return this.axiosInstance.post(t, e);
239
+ }
240
+ /**
241
+ * DELETE 请求(参数走 query string,与后端路由约定一致)
242
+ */
243
+ Delete(t, e) {
244
+ return this.axiosInstance.delete(t, { params: e });
245
+ }
246
+ /**
247
+ * PUT 请求
248
+ */
249
+ Put(t, e) {
250
+ return this.axiosInstance.put(t, e);
251
+ }
252
+ /**
253
+ * 下载文件(GET + blob)—— 返回**完整 AxiosResponse**,调用方取 `res.data as Blob`
254
+ */
255
+ Download(t, e) {
256
+ return this.axiosInstance.get(t, {
257
+ params: e,
258
+ responseType: "blob"
259
+ });
260
+ }
261
+ /**
262
+ * 下载文件(POST + blob,用于「按查询条件导出」这类接口)——
263
+ * 同样返回完整 AxiosResponse。
264
+ */
265
+ PostDownload(t, e) {
266
+ return this.axiosInstance.post(t, e, {
267
+ responseType: "blob"
268
+ });
269
+ }
270
+ }
271
+ class ut {
272
+ //事件总线
273
+ constructor() {
274
+ C(this, "emitter");
275
+ this.emitter = ot();
276
+ }
277
+ On(t, e) {
278
+ this.emitter.on(t, e);
279
+ }
280
+ Emit(t, e) {
281
+ this.emitter.emit(t, e);
282
+ }
283
+ Off(t, e) {
284
+ this.emitter.off(t, e);
285
+ }
286
+ }
287
+ class ft {
288
+ constructor(t, e) {
289
+ C(this, "mqttClient", null);
290
+ C(this, "eventBus");
291
+ this.eventBus = t, this.connect(e).then();
292
+ }
293
+ async connect(t) {
294
+ const e = {
295
+ username: t.userName,
296
+ password: t.password,
297
+ clientId: `${t.module}_${this.randomStr(10)}`,
298
+ clean: !0,
299
+ keepalive: 50,
300
+ connectTimeout: 5e3,
301
+ reconnectPeriod: 5e3
302
+ };
303
+ let i = t.mqttUrl || "ws://127.0.0.1:5002/ws";
304
+ if (console.log(`connect to mqtt... url=${i}`), this.mqttClient = lt.connect(i, e), !this.mqttClient) {
305
+ console.log("connect mqtt failed");
306
+ return;
307
+ }
308
+ this.mqttClient.on("connect", () => {
309
+ console.log("=====> mqtt connect success!"), this.mqttClient.subscribe(ce, { qos: 0 }, (s) => {
310
+ console.log(s ? `mqtt subscribe [${ce}] failed` : `mqtt subscribe [${ce}] success`);
311
+ });
312
+ }), this.mqttClient.on("message", (s, d) => {
313
+ const r = d.toString();
314
+ if (!r) {
315
+ console.error("Received empty message", s);
316
+ return;
317
+ }
318
+ let c = null;
319
+ try {
320
+ c = JSON.parse(r);
321
+ } catch (a) {
322
+ console.error("Failed to parse message JSON", s, r, a);
323
+ return;
197
324
  }
198
- if (t.status !== void 0 && t.status !== 200) {
199
- const e = t.message || "请求失败";
200
- return console.error("[HTTP Error]", e), Promise.reject(new Error(e));
325
+ if (!c || c.Content === void 0 || c.Content === null || !c.PType) {
326
+ console.log("parse notice failed!", r);
327
+ return;
201
328
  }
202
- }
203
- return o;
204
- },
205
- (o) => {
206
- var e, l;
207
- const t = ((l = (e = o.response) == null ? void 0 : e.data) == null ? void 0 : l.message) || o.message || "请求失败";
208
- return console.error("[HTTP Error]", t), Promise.reject(o);
209
- }
210
- );
211
- const M = {
212
- get(o, t) {
213
- return Z.get(o, t).then((e) => e.data);
214
- },
215
- post(o, t, e) {
216
- return Z.post(o, t, e).then((l) => l.data);
217
- },
218
- // 原始 axios 实例,用于特殊需求
219
- instance: Z
220
- }, K = {
329
+ c.PType == mt && this.eventBus.Emit(c.Route, c.Content);
330
+ }), this.mqttClient.on(ne.OffLine, () => {
331
+ console.log("mqtt offline...");
332
+ }), this.mqttClient.on(ne.Reconnect, () => {
333
+ console.log("mqtt reconnecting...");
334
+ }), this.mqttClient.on(ne.Close, () => {
335
+ console.log("mqtt close");
336
+ }), this.mqttClient.on(ne.Error, (s) => {
337
+ console.log("mqtt error");
338
+ });
339
+ }
340
+ // 生成随机字符串
341
+ randomStr(t) {
342
+ const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
343
+ let i = "";
344
+ for (let s = 0; s < t; s++)
345
+ i += e.charAt(Math.floor(Math.random() * e.length));
346
+ return i;
347
+ }
348
+ }
349
+ const ce = "Notice", mt = "NOTICE", ne = {
350
+ OffLine: "offline",
351
+ Close: "close",
352
+ Reconnect: "reconnect",
353
+ Error: "error"
354
+ };
355
+ let H, me = !1;
356
+ const bo = (o) => {
357
+ if (!o)
358
+ throw new Error("QfOptions is undefined");
359
+ if ((!H || me) && (H = new Re(o), me = !1), !H)
360
+ throw new Error("Qf not initialized, please call GetQf(options) first");
361
+ return H;
362
+ }, M = () => (H || (H = new Re({
363
+ module: "",
364
+ useMqtt: !1,
365
+ baseUrl: "",
366
+ mqttUrl: "",
367
+ userName: "",
368
+ password: ""
369
+ }), me = !0), H);
370
+ class Re {
371
+ constructor(t) {
372
+ C(this, "EventBus");
373
+ C(this, "WebApi");
374
+ C(this, "Mqtt");
375
+ C(this, "options");
376
+ this.initQf(t);
377
+ }
378
+ /**
379
+ * 初始化 Qf
380
+ */
381
+ initQf(t) {
382
+ if (!t)
383
+ throw new Error(`StartQf failed! options is ${t}`);
384
+ this.options = t, console.log("StartQf(), qfOptions=", t), this.EventBus = new ut(), this.WebApi = new ct(t), this.options.useMqtt && (this.Mqtt = new ft(this.EventBus, t));
385
+ }
386
+ // ==================== EventBus 相关 ====================
387
+ On(t, e) {
388
+ this.EventBus.On(t, e);
389
+ }
390
+ Emit(t, e) {
391
+ this.EventBus.Emit(t, e);
392
+ }
393
+ Off(t, e) {
394
+ this.EventBus.Off(t, e);
395
+ }
396
+ // ==================== Http 相关 ====================
397
+ Post(t, e) {
398
+ return this.WebApi.Post(t, e);
399
+ }
400
+ Get(t, e) {
401
+ return this.WebApi.Get(t, e);
402
+ }
403
+ Delete(t, e) {
404
+ return this.WebApi.Delete(t, e);
405
+ }
406
+ Put(t, e) {
407
+ return this.WebApi.Put(t, e);
408
+ }
409
+ Download(t, e) {
410
+ return this.WebApi.Download(t, e);
411
+ }
412
+ PostDownload(t, e) {
413
+ return this.WebApi.PostDownload(t, e);
414
+ }
415
+ // ==================== MQTT 通知 ====================
416
+ RegNotice(t, e) {
417
+ this.EventBus.On(t, e);
418
+ }
419
+ }
420
+ const G = {
221
421
  /**
222
422
  * 获取表单配置:GET /api/form?type=<forms|tables|menus>&id=<配置文件名称>
223
423
  * 后端读取 ./config/<type>/<id>.yaml
@@ -242,7 +442,7 @@ const M = {
242
442
  cascaderApi(o, t = !0) {
243
443
  return `/api/dict/tree-list?dict_type=${o}&children=${t}`;
244
444
  }
245
- }, O = {}, ne = {};
445
+ }, j = {}, ie = {};
246
446
  function be(o) {
247
447
  const { children: t, ...e } = o;
248
448
  return {
@@ -251,23 +451,23 @@ function be(o) {
251
451
  ...e
252
452
  };
253
453
  }
254
- function ve(o) {
454
+ function we(o) {
255
455
  return Array.isArray(o) ? o.map((t) => {
256
456
  if (!t || typeof t != "object") return t;
257
- const e = be(t), l = t.children;
258
- return Array.isArray(l) && l.length > 0 && (e.children = ve(l)), e;
457
+ const e = be(t), i = t.children;
458
+ return Array.isArray(i) && i.length > 0 && (e.children = we(i)), e;
259
459
  }) : [];
260
460
  }
261
- function we(o) {
461
+ function Ce(o) {
262
462
  return Array.isArray(o) ? o.filter((t) => t && typeof t == "object").map((t) => be(t)) : [];
263
463
  }
264
- function po(o) {
464
+ function wo(o) {
265
465
  if (!Array.isArray(o)) return [];
266
- const t = [], e = (l) => {
267
- for (const d of l) {
268
- if (!d || typeof d != "object") continue;
269
- const r = d.children;
270
- t.push(be(d)), Array.isArray(r) && r.length > 0 && e(r);
466
+ const t = [], e = (i) => {
467
+ for (const s of i) {
468
+ if (!s || typeof s != "object") continue;
469
+ const d = s.children;
470
+ t.push(be(s)), Array.isArray(d) && d.length > 0 && e(d);
271
471
  }
272
472
  };
273
473
  return e(o), t;
@@ -275,59 +475,59 @@ function po(o) {
275
475
  async function ae(o) {
276
476
  if (!o)
277
477
  return [];
278
- if (O[o])
279
- return O[o];
280
- if (o in ne)
281
- return await ne[o];
478
+ if (j[o])
479
+ return j[o];
480
+ if (o in ie)
481
+ return await ie[o];
282
482
  const t = (async () => {
283
483
  try {
284
- const e = await M.get(K.dictApi(o));
484
+ const e = await M().Get(G.dictApi(o));
285
485
  if (e.status === 200) {
286
- const l = we(e.data);
287
- return O[o] = l, l;
486
+ const i = Ce(e.data);
487
+ return j[o] = i, i;
288
488
  }
289
489
  return [];
290
490
  } catch (e) {
291
491
  return console.error(`[dict] 加载字典 ${o} 失败:`, e), [];
292
492
  } finally {
293
- delete ne[o];
493
+ delete ie[o];
294
494
  }
295
495
  })();
296
- return ne[o] = t, t;
496
+ return ie[o] = t, t;
297
497
  }
298
- async function lt(o, t, e = "") {
498
+ async function pt(o, t, e = "") {
299
499
  if (t == null || t === "")
300
500
  return e;
301
- const l = O[o];
302
- if (l && l.length > 0)
303
- return me(l, t);
304
- const d = await ae(o);
305
- return d && d.length > 0 ? me(d, t) : e || String(t);
501
+ const i = j[o];
502
+ if (i && i.length > 0)
503
+ return pe(i, t);
504
+ const s = await ae(o);
505
+ return s && s.length > 0 ? pe(s, t) : e || String(t);
306
506
  }
307
- function me(o, t) {
507
+ function pe(o, t) {
308
508
  const e = o.find(
309
- (l) => l.value === t || String(l.value) === String(t)
509
+ (i) => i.value === t || String(i.value) === String(t)
310
510
  );
311
511
  return e ? e.label : String(t);
312
512
  }
313
- function ho(o, t, e = "") {
513
+ function Co(o, t, e = "") {
314
514
  if (t == null || t === "")
315
515
  return e;
316
- const l = O[o];
317
- return l && l.length > 0 ? me(l, t) : e || String(t);
516
+ const i = j[o];
517
+ return i && i.length > 0 ? pe(i, t) : e || String(t);
318
518
  }
319
- async function go(o) {
519
+ async function xo(o) {
320
520
  await Promise.all(o.map((t) => ae(t)));
321
521
  }
322
- function yo(o) {
323
- o ? delete O[o] : Object.keys(O).forEach((t) => {
324
- delete O[t];
522
+ function _o(o) {
523
+ o ? delete j[o] : Object.keys(j).forEach((t) => {
524
+ delete j[t];
325
525
  });
326
526
  }
327
- function bo(o, t) {
328
- O[o] = t;
527
+ function So(o, t) {
528
+ j[o] = t;
329
529
  }
330
- const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
530
+ const ht = { class: "u-dict-field" }, gt = /* @__PURE__ */ V({
331
531
  __name: "UDict",
332
532
  props: {
333
533
  fieldLabel: {},
@@ -352,66 +552,66 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
352
552
  },
353
553
  emits: ["update:modelValue"],
354
554
  setup(o, { emit: t }) {
355
- const e = o, l = t, d = W({
555
+ const e = o, i = t, s = z({
356
556
  excluded: ["fieldLabel", "labelPosition", "labelWidth", "labelAlign", "required", "modelValue", "dictType"],
357
557
  options: [],
358
558
  loading: !1
359
- }), r = async () => {
559
+ }), d = async () => {
360
560
  if (e.dictType) {
361
- d.loading = !0;
561
+ s.loading = !0;
362
562
  try {
363
- const i = await M.get(K.dictApi(e.dictType));
364
- i.status === 200 ? d.options = we(i.data) : (console.error("[UDict] 请求失败:", i.message), d.options = []);
365
- } catch (i) {
366
- console.error("[UDict] 加载字典失败:", i), d.options = [];
563
+ const l = await M().Get(G.dictApi(e.dictType));
564
+ l.status === 200 ? s.options = Ce(l.data) : (console.error("[UDict] 请求失败:", l.message), s.options = []);
565
+ } catch (l) {
566
+ console.error("[UDict] 加载字典失败:", l), s.options = [];
367
567
  } finally {
368
- d.loading = !1;
568
+ s.loading = !1;
369
569
  }
370
570
  }
371
571
  };
372
572
  L(() => e.dictType, () => {
373
- r();
573
+ d();
374
574
  }, { immediate: !0 });
375
- const c = v(() => {
376
- const i = {};
377
- return e.labelPosition === "left" && e.labelWidth && (i.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (i.textAlign = e.labelAlign), i;
378
- }), s = v(() => ({
575
+ const r = b(() => {
576
+ const l = {};
577
+ return e.labelPosition === "left" && e.labelWidth && (l.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (l.textAlign = e.labelAlign), l;
578
+ }), c = b(() => ({
379
579
  "u-dict-label-left": e.labelPosition === "left",
380
580
  "u-dict-label-top": e.labelPosition === "top"
381
581
  })), a = {
382
- onUpdate(i) {
383
- l("update:modelValue", i);
582
+ onUpdate(l) {
583
+ i("update:modelValue", l);
384
584
  }
385
585
  };
386
- return (i, n) => {
387
- const f = he, m = pe;
388
- return h(), y("div", {
389
- class: V(["u-dict", s.value])
586
+ return (l, n) => {
587
+ const u = ge, m = he;
588
+ return g(), v("div", {
589
+ class: P(["u-dict", c.value])
390
590
  }, [
391
- o.fieldLabel ? (h(), y("div", {
591
+ o.fieldLabel ? (g(), v("div", {
392
592
  key: 0,
393
593
  class: "u-dict-label",
394
- style: B(c.value)
594
+ style: B(r.value)
395
595
  }, [
396
- F(k(o.fieldLabel) + " ", 1),
397
- C("span", {
398
- class: V(["required-star", { "required-star--visible": o.required }])
596
+ F(T(o.fieldLabel) + " ", 1),
597
+ x("span", {
598
+ class: P(["required-star", { "required-star--visible": o.required }])
399
599
  }, "*", 2)
400
600
  ], 4)) : D("", !0),
401
- C("div", nt, [
601
+ x("div", ht, [
402
602
  _(m, {
403
603
  "model-value": o.modelValue,
404
604
  placeholder: o.placeholder || "请选择",
405
- loading: d.loading,
605
+ loading: s.loading,
406
606
  disabled: o.disable,
407
607
  style: { width: "100%" },
408
608
  onChange: a.onUpdate
409
609
  }, {
410
610
  default: w(() => [
411
- (h(!0), y(I, null, E(d.options, (u) => (h(), S(f, {
412
- key: u.value,
413
- label: u.label,
414
- value: u.value
611
+ (g(!0), v(I, null, E(s.options, (f) => (g(), S(u, {
612
+ key: f.value,
613
+ label: f.label,
614
+ value: f.value
415
615
  }, null, 8, ["label", "value"]))), 128))
416
616
  ]),
417
617
  _: 1
@@ -420,7 +620,7 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
420
620
  ], 2);
421
621
  };
422
622
  }
423
- }), ee = /* @__PURE__ */ $(it, [["__scopeId", "data-v-8bfd4dcf"]]), st = { class: "u-toggle-field" }, rt = /* @__PURE__ */ P({
623
+ }), ee = /* @__PURE__ */ $(gt, [["__scopeId", "data-v-d0ae00fe"]]), yt = { class: "u-toggle-field" }, vt = /* @__PURE__ */ V({
424
624
  __name: "UToggle",
425
625
  props: {
426
626
  fieldLabel: {},
@@ -444,42 +644,42 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
444
644
  },
445
645
  emits: ["update:modelValue"],
446
646
  setup(o, { emit: t }) {
447
- const e = o, l = t, d = W({
647
+ const e = o, i = t, s = z({
448
648
  excluded: ["fieldLabel", "labelPosition", "labelWidth", "labelAlign", "required", "modelValue", "trueValue", "falseValue", "activeText", "inactiveText", "activeColor", "inactiveColor"]
449
- }), r = () => {
649
+ }), d = () => {
450
650
  const a = {};
451
651
  return e.labelPosition === "left" && e.labelWidth && (a.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (a.textAlign = e.labelAlign), a;
452
- }, c = v({
652
+ }, r = b({
453
653
  get: () => e.modelValue === e.trueValue,
454
654
  set: (a) => {
455
- l("update:modelValue", a ? e.trueValue : e.falseValue);
655
+ i("update:modelValue", a ? e.trueValue : e.falseValue);
456
656
  }
457
- }), s = v(() => {
657
+ }), c = b(() => {
458
658
  const a = {};
459
- for (const i in e)
460
- !d.excluded.includes(i) && i !== "modelValue" && (a[i] = e[i]);
659
+ for (const l in e)
660
+ !s.excluded.includes(l) && l !== "modelValue" && (a[l] = e[l]);
461
661
  return a;
462
662
  });
463
- return (a, i) => {
464
- const n = Le;
465
- return h(), y("div", {
466
- class: V(["u-toggle", { "u-toggle-label-left": o.labelPosition === "left" }])
663
+ return (a, l) => {
664
+ const n = ze;
665
+ return g(), v("div", {
666
+ class: P(["u-toggle", { "u-toggle-label-left": o.labelPosition === "left" }])
467
667
  }, [
468
- o.fieldLabel ? (h(), y("div", {
668
+ o.fieldLabel ? (g(), v("div", {
469
669
  key: 0,
470
670
  class: "u-toggle-label",
471
- style: B(r())
671
+ style: B(d())
472
672
  }, [
473
- F(k(o.fieldLabel) + " ", 1),
474
- C("span", {
475
- class: V(["required-star", { "required-star--visible": o.required }])
673
+ F(T(o.fieldLabel) + " ", 1),
674
+ x("span", {
675
+ class: P(["required-star", { "required-star--visible": o.required }])
476
676
  }, "*", 2)
477
677
  ], 4)) : D("", !0),
478
- C("div", st, [
479
- _(n, ce({
480
- modelValue: c.value,
481
- "onUpdate:modelValue": i[0] || (i[0] = (f) => c.value = f)
482
- }, s.value, {
678
+ x("div", yt, [
679
+ _(n, de({
680
+ modelValue: r.value,
681
+ "onUpdate:modelValue": l[0] || (l[0] = (u) => r.value = u)
682
+ }, c.value, {
483
683
  "active-text": o.activeText,
484
684
  "inactive-text": o.inactiveText,
485
685
  "active-color": o.activeColor,
@@ -489,7 +689,7 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
489
689
  ], 2);
490
690
  };
491
691
  }
492
- }), $e = /* @__PURE__ */ $(rt, [["__scopeId", "data-v-94c1fd38"]]), dt = { class: "u-cascader-levels" }, ct = /* @__PURE__ */ P({
692
+ }), Ie = /* @__PURE__ */ $(vt, [["__scopeId", "data-v-94c1fd38"]]), bt = { class: "u-cascader-levels" }, wt = /* @__PURE__ */ V({
493
693
  __name: "UCascader",
494
694
  props: {
495
695
  fieldLabel: {},
@@ -503,63 +703,63 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
503
703
  },
504
704
  emits: ["update:modelValue"],
505
705
  setup(o, { emit: t }) {
506
- const e = o, l = t, d = () => {
706
+ const e = o, i = t, s = () => {
507
707
  const a = {};
508
708
  return e.labelPosition === "left" && e.labelWidth && (a.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (a.textAlign = e.labelAlign), a;
509
- }, r = Q([]), c = v(() => {
709
+ }, d = Q([]), r = b(() => {
510
710
  const a = [];
511
- let i = e.options || [];
711
+ let l = e.options || [];
512
712
  for (let n = 0; n < e.depth; n++)
513
- if (a.push(i), r.value[n] !== void 0) {
514
- const f = i.find((m) => m.value === r.value[n]);
515
- f && f.children ? i = f.children : i = [];
713
+ if (a.push(l), d.value[n] !== void 0) {
714
+ const u = l.find((m) => m.value === d.value[n]);
715
+ u && u.children ? l = u.children : l = [];
516
716
  } else
517
- i = [];
717
+ l = [];
518
718
  return a;
519
719
  });
520
720
  L(() => e.modelValue, (a) => {
521
- a != null ? r.value = Array.isArray(a) ? a : [a] : r.value = [];
721
+ a != null ? d.value = Array.isArray(a) ? a : [a] : d.value = [];
522
722
  }, { immediate: !0 });
523
- const s = (a, i) => {
524
- r.value[a] = i;
525
- for (let f = a + 1; f < e.depth; f++)
526
- r.value[f] = void 0;
527
- const n = r.value.filter((f) => f !== void 0);
528
- l("update:modelValue", n);
723
+ const c = (a, l) => {
724
+ d.value[a] = l;
725
+ for (let u = a + 1; u < e.depth; u++)
726
+ d.value[u] = void 0;
727
+ const n = d.value.filter((u) => u !== void 0);
728
+ i("update:modelValue", n);
529
729
  };
530
- return (a, i) => {
531
- const n = he, f = pe;
532
- return h(), y("div", {
533
- class: V(["u-cascader", { "u-cascader-label-left": o.labelPosition === "left" }])
730
+ return (a, l) => {
731
+ const n = ge, u = he;
732
+ return g(), v("div", {
733
+ class: P(["u-cascader", { "u-cascader-label-left": o.labelPosition === "left" }])
534
734
  }, [
535
- o.fieldLabel ? (h(), y("div", {
735
+ o.fieldLabel ? (g(), v("div", {
536
736
  key: 0,
537
737
  class: "u-cascader-label",
538
- style: B(d())
738
+ style: B(s())
539
739
  }, [
540
- F(k(o.fieldLabel) + " ", 1),
541
- C("span", {
542
- class: V(["required-star", { "required-star--visible": o.required }])
740
+ F(T(o.fieldLabel) + " ", 1),
741
+ x("span", {
742
+ class: P(["required-star", { "required-star--visible": o.required }])
543
743
  }, "*", 2)
544
744
  ], 4)) : D("", !0),
545
- C("div", dt, [
546
- (h(!0), y(I, null, E(o.depth, (m) => (h(), y("div", {
745
+ x("div", bt, [
746
+ (g(!0), v(I, null, E(o.depth, (m) => (g(), v("div", {
547
747
  key: m - 1,
548
748
  class: "u-cascader-level"
549
749
  }, [
550
- _(f, {
551
- "model-value": r.value[m - 1],
552
- options: c.value[m - 1] || [],
553
- disabled: m > 1 && r.value[m - 2] === void 0,
750
+ _(u, {
751
+ "model-value": d.value[m - 1],
752
+ options: r.value[m - 1] || [],
753
+ disabled: m > 1 && d.value[m - 2] === void 0,
554
754
  placeholder: `请选择${m}级`,
555
755
  style: { width: "100%" },
556
- onChange: (u) => s(m - 1, u)
756
+ onChange: (f) => c(m - 1, f)
557
757
  }, {
558
758
  default: w(() => [
559
- (h(!0), y(I, null, E(c.value[m - 1] || [], (u) => (h(), S(n, {
560
- key: u.value,
561
- label: u.label,
562
- value: u.value
759
+ (g(!0), v(I, null, E(r.value[m - 1] || [], (f) => (g(), S(n, {
760
+ key: f.value,
761
+ label: f.label,
762
+ value: f.value
563
763
  }, null, 8, ["label", "value"]))), 128))
564
764
  ]),
565
765
  _: 2
@@ -569,7 +769,7 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
569
769
  ], 2);
570
770
  };
571
771
  }
572
- }), Re = /* @__PURE__ */ $(ct, [["__scopeId", "data-v-d66c339c"]]), ut = { class: "u-date-field" }, ft = /* @__PURE__ */ P({
772
+ }), Me = /* @__PURE__ */ $(wt, [["__scopeId", "data-v-d66c339c"]]), Ct = { class: "u-date-field" }, xt = /* @__PURE__ */ V({
573
773
  __name: "UDate",
574
774
  props: {
575
775
  fieldLabel: {},
@@ -586,51 +786,51 @@ const nt = { class: "u-dict-field" }, it = /* @__PURE__ */ P({
586
786
  },
587
787
  emits: ["update:modelValue"],
588
788
  setup(o, { emit: t }) {
589
- const e = o, l = t, d = () => {
789
+ const e = o, i = t, s = () => {
590
790
  const a = {};
591
791
  return e.labelPosition === "left" && e.labelWidth && (a.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (a.textAlign = e.labelAlign), a;
592
- }, r = Q("");
792
+ }, d = Q("");
593
793
  L(() => e.modelValue, (a) => {
594
- e.mode === "single" ? r.value = a || "" : e.mode === "multiple" ? r.value = Array.isArray(a) ? a : a ? [a] : [] : e.mode === "range" && (a && typeof a == "object" && a.from && a.to ? r.value = [a.from, a.to] : r.value = []);
794
+ e.mode === "single" ? d.value = a || "" : e.mode === "multiple" ? d.value = Array.isArray(a) ? a : a ? [a] : [] : e.mode === "range" && (a && typeof a == "object" && a.from && a.to ? d.value = [a.from, a.to] : d.value = []);
595
795
  }, { immediate: !0 });
596
- const c = (a) => {
597
- a && (e.mode === "single" || e.mode === "multiple" ? l("update:modelValue", a) : e.mode === "range" && a && a.length === 2 && l("update:modelValue", { from: a[0], to: a[1] }));
598
- }, s = v(() => e.mode === "range" ? "daterange" : e.mode === "multiple" ? "dates" : "date");
599
- return (a, i) => {
600
- const n = ze;
601
- return h(), y("div", {
602
- class: V(["u-date", { "u-date-label-left": o.labelPosition === "left" }])
796
+ const r = (a) => {
797
+ a && (e.mode === "single" || e.mode === "multiple" ? i("update:modelValue", a) : e.mode === "range" && a && a.length === 2 && i("update:modelValue", { from: a[0], to: a[1] }));
798
+ }, c = b(() => e.mode === "range" ? "daterange" : e.mode === "multiple" ? "dates" : "date");
799
+ return (a, l) => {
800
+ const n = qe;
801
+ return g(), v("div", {
802
+ class: P(["u-date", { "u-date-label-left": o.labelPosition === "left" }])
603
803
  }, [
604
- o.fieldLabel ? (h(), y("div", {
804
+ o.fieldLabel ? (g(), v("div", {
605
805
  key: 0,
606
806
  class: "u-date-label",
607
- style: B(d())
807
+ style: B(s())
608
808
  }, [
609
- F(k(o.fieldLabel) + " ", 1),
610
- C("span", {
611
- class: V(["required-star", { "required-star--visible": o.required }])
809
+ F(T(o.fieldLabel) + " ", 1),
810
+ x("span", {
811
+ class: P(["required-star", { "required-star--visible": o.required }])
612
812
  }, "*", 2)
613
813
  ], 4)) : D("", !0),
614
- C("div", ut, [
814
+ x("div", Ct, [
615
815
  _(n, {
616
- modelValue: r.value,
617
- "onUpdate:modelValue": i[0] || (i[0] = (f) => r.value = f),
618
- type: s.value,
816
+ modelValue: d.value,
817
+ "onUpdate:modelValue": l[0] || (l[0] = (u) => d.value = u),
818
+ type: c.value,
619
819
  placeholder: o.locale === "en-US" ? "Select date" : "选择日期",
620
820
  "range-separator": o.locale === "en-US" ? "to" : "至",
621
821
  "start-placeholder": o.locale === "en-US" ? "Start date" : "开始日期",
622
822
  "end-placeholder": o.locale === "en-US" ? "End date" : "结束日期",
623
823
  format: o.mask.replace("YYYY", "YYYY").replace("MM", "MM").replace("DD", "DD"),
624
824
  "value-format": o.mask.replace("YYYY", "YYYY").replace("MM", "MM").replace("DD", "DD"),
625
- onChange: c
825
+ onChange: r
626
826
  }, null, 8, ["modelValue", "type", "placeholder", "range-separator", "start-placeholder", "end-placeholder", "format", "value-format"])
627
827
  ])
628
828
  ], 2);
629
829
  };
630
830
  }
631
- }), de = /* @__PURE__ */ $(ft, [["__scopeId", "data-v-9cd05064"]]);
831
+ }), re = /* @__PURE__ */ $(xt, [["__scopeId", "data-v-9cd05064"]]);
632
832
  function le(o, t = "info") {
633
- Te({
833
+ Ve({
634
834
  message: o,
635
835
  type: t,
636
836
  duration: 1e3,
@@ -638,39 +838,39 @@ function le(o, t = "info") {
638
838
  });
639
839
  }
640
840
  function U(o) {
641
- Te({
841
+ Ve({
642
842
  message: o,
643
843
  type: "error",
644
844
  duration: 2e3,
645
845
  showClose: !1
646
846
  });
647
847
  }
648
- function mt(o) {
848
+ function _t(o) {
649
849
  le(o, "success");
650
850
  }
651
- function pt(o) {
851
+ function St(o) {
652
852
  le(o, "error");
653
853
  }
654
- function ht(o) {
854
+ function Dt(o) {
655
855
  le(o, "warning");
656
856
  }
657
- function gt(o) {
857
+ function kt(o) {
658
858
  le(o, "info");
659
859
  }
660
- const z = {
860
+ const N = {
661
861
  notify: le,
662
- success: mt,
663
- error: pt,
664
- warning: ht,
665
- info: gt,
862
+ success: _t,
863
+ error: St,
864
+ warning: Dt,
865
+ info: kt,
666
866
  alertError: U
667
- }, yt = {
867
+ }, Tt = {
668
868
  key: 0,
669
869
  class: "u-menu-brand"
670
- }, bt = ["src"], vt = { class: "u-menu-brand-text" }, wt = {
870
+ }, Pt = ["src"], Vt = { class: "u-menu-brand-text" }, $t = {
671
871
  key: 1,
672
872
  class: "u-menu-logout"
673
- }, xt = /* @__PURE__ */ P({
873
+ }, At = /* @__PURE__ */ V({
674
874
  __name: "UMenu",
675
875
  props: {
676
876
  menuId: { default: "menu" },
@@ -682,7 +882,7 @@ const z = {
682
882
  },
683
883
  emits: ["menu-click", "logout"],
684
884
  setup(o, { expose: t, emit: e }) {
685
- const l = o, d = e, r = W({
885
+ const i = o, s = e, d = z({
686
886
  // 菜单配置
687
887
  config: null,
688
888
  // 实际渲染的菜单列表(静态配置或字典菜单)
@@ -693,86 +893,86 @@ const z = {
693
893
  iconMap: {},
694
894
  // 图标是否已加载
695
895
  iconsLoaded: !1
696
- }), c = v(() => {
697
- var a, i, n, f, m, u, g, p;
896
+ }), r = b(() => {
897
+ var a, l, n, u, m, f, p, h;
698
898
  return {
699
899
  // 项目名称:为空则不显示
700
- projectName: l.projectName ?? ((a = r.config) == null ? void 0 : a.projectName) ?? "",
900
+ projectName: i.projectName ?? ((a = d.config) == null ? void 0 : a.projectName) ?? "",
701
901
  // 项目 logo
702
- logo: ((i = r.config) == null ? void 0 : i.logo) || "",
902
+ logo: ((l = d.config) == null ? void 0 : l.logo) || "",
703
903
  // 菜单模式
704
- mode: l.mode ?? ((n = r.config) == null ? void 0 : n.mode) ?? "sidebar",
904
+ mode: i.mode ?? ((n = d.config) == null ? void 0 : n.mode) ?? "sidebar",
705
905
  // 是否水平模式
706
- isHorizontal: (l.mode ?? ((f = r.config) == null ? void 0 : f.mode) ?? "sidebar") === "horizontal",
906
+ isHorizontal: (i.mode ?? ((u = d.config) == null ? void 0 : u.mode) ?? "sidebar") === "horizontal",
707
907
  // el-menu 的 mode
708
- elMode: (l.mode ?? ((m = r.config) == null ? void 0 : m.mode) ?? "sidebar") === "horizontal" ? "horizontal" : "vertical",
908
+ elMode: (i.mode ?? ((m = d.config) == null ? void 0 : m.mode) ?? "sidebar") === "horizontal" ? "horizontal" : "vertical",
709
909
  // 菜单宽度(仅 sidebar 生效)
710
- width: l.width ?? ((u = r.config) == null ? void 0 : u.width) ?? 220,
910
+ width: i.width ?? ((f = d.config) == null ? void 0 : f.width) ?? 220,
711
911
  // 菜单列表
712
- menus: r.menus,
912
+ menus: d.menus,
713
913
  // 当前激活项的 el-menu index
714
- activeIndex: s.getIndexByPath(r.activePath),
914
+ activeIndex: c.getIndexByPath(d.activePath),
715
915
  // 是否显示退出登录区域
716
- showLogout: ((g = r.config) == null ? void 0 : g.showLogout) !== !1,
916
+ showLogout: ((p = d.config) == null ? void 0 : p.showLogout) !== !1,
717
917
  // 退出登录按钮文本
718
- logoutText: ((p = r.config) == null ? void 0 : p.logoutText) || "退出登录",
918
+ logoutText: ((h = d.config) == null ? void 0 : h.logoutText) || "退出登录",
719
919
  // 图标映射
720
- iconMap: r.iconMap
920
+ iconMap: d.iconMap
721
921
  };
722
- }), s = {
922
+ }), c = {
723
923
  // 初始化
724
924
  async init() {
725
- await s.ensureIcons(), l.config ? (r.config = l.config, r.menus = s.normalizeMenus(l.config.menus)) : await s.loadConfig(l.menuId), r.activePath = l.activePath || r.activePath;
925
+ await c.ensureIcons(), i.config ? (d.config = i.config, d.menus = c.normalizeMenus(i.config.menus)) : await c.loadConfig(i.menuId), d.activePath = i.activePath || d.activePath;
726
926
  },
727
927
  // 加载菜单配置(与 UDict 一致:http + status === 200 判断)
728
928
  async loadConfig(a) {
729
929
  if (a)
730
930
  try {
731
- const i = await M.get(K.formCfgApi(a, "menus"));
732
- if (i.status !== 200) {
733
- U(i.message || "获取菜单配置失败");
931
+ const l = await M().Get(G.formCfgApi(a, "menus"));
932
+ if (l.status !== 200) {
933
+ U(l.message || "获取菜单配置失败");
734
934
  return;
735
935
  }
736
- const n = i.data || {};
737
- r.config = n, n.dictType ? await s.loadDictMenus(n.dictType) : r.menus = s.normalizeMenus(n.menus);
738
- } catch (i) {
739
- U((i == null ? void 0 : i.message) || "获取菜单配置失败"), r.menus = [];
936
+ const n = l.data || {};
937
+ d.config = n, n.dictType ? await c.loadDictMenus(n.dictType) : d.menus = c.normalizeMenus(n.menus);
938
+ } catch (l) {
939
+ U((l == null ? void 0 : l.message) || "获取菜单配置失败"), d.menus = [];
740
940
  }
741
941
  },
742
942
  // 加载字典菜单(参考 UDict 的字典数据来源,字典树对应菜单的 1、2 级)
743
943
  async loadDictMenus(a) {
744
944
  try {
745
- const i = await M.get(K.cascaderApi(a));
746
- if (i.status !== 200) {
747
- U(i.message || "获取菜单字典失败");
945
+ const l = await M().Get(G.cascaderApi(a));
946
+ if (l.status !== 200) {
947
+ U(l.message || "获取菜单字典失败");
748
948
  return;
749
949
  }
750
- r.menus = s.normalizeMenus(ve(i.data));
751
- } catch (i) {
752
- U((i == null ? void 0 : i.message) || "获取菜单字典失败"), r.menus = [];
950
+ d.menus = c.normalizeMenus(we(l.data));
951
+ } catch (l) {
952
+ U((l == null ? void 0 : l.message) || "获取菜单字典失败"), d.menus = [];
753
953
  }
754
954
  },
755
955
  // 规范化菜单列表(最多 2 级,第二级的 children 不再展开)
756
956
  normalizeMenus(a) {
757
- return Array.isArray(a) ? a.map((i) => s.normalizeMenuNode(i)).filter(Boolean) : [];
957
+ return Array.isArray(a) ? a.map((l) => c.normalizeMenuNode(l)).filter(Boolean) : [];
758
958
  },
759
959
  // 规范化单个菜单节点(兼容静态配置与字典节点两种结构)
760
960
  normalizeMenuNode(a) {
761
961
  if (!a || typeof a != "object") return null;
762
- const i = s.parseInfo(a.info), n = a.label ?? a.dict_value ?? a.name;
962
+ const l = c.parseInfo(a.info), n = a.label ?? a.dict_value ?? a.name;
763
963
  if (!n) return null;
764
- const f = i.path ?? a.path ?? a.dict_code ?? a.value ?? "", m = i.type ?? a.type ?? "route", u = {
964
+ const u = l.path ?? a.path ?? a.dict_code ?? a.value ?? "", m = l.type ?? a.type ?? "route", f = {
765
965
  ...a,
766
966
  label: String(n),
767
967
  type: m,
768
- path: String(f ?? ""),
769
- icon: i.icon ?? a.icon ?? ""
770
- }, g = i.id ?? a.id;
771
- g != null && g !== "" && (u.id = String(g));
772
- const p = i.open ?? a.open;
773
- (p === "new" || p === "self") && (u.open = p), delete u.children;
774
- const b = a.children;
775
- return Array.isArray(b) && b.length > 0 && (u.children = b.map((R) => s.normalizeMenuNode(R)).filter(Boolean)), u;
968
+ path: String(u ?? ""),
969
+ icon: l.icon ?? a.icon ?? ""
970
+ }, p = l.id ?? a.id;
971
+ p != null && p !== "" && (f.id = String(p));
972
+ const h = l.open ?? a.open;
973
+ (h === "new" || h === "self") && (f.open = h), delete f.children;
974
+ const y = a.children;
975
+ return Array.isArray(y) && y.length > 0 && (f.children = y.map((A) => c.normalizeMenuNode(A)).filter(Boolean)), f;
776
976
  },
777
977
  // 解析字典节点的 info(可能是 JSON 字符串,也可能是对象)
778
978
  parseInfo(a) {
@@ -780,20 +980,20 @@ const z = {
780
980
  if (typeof a == "object") return a;
781
981
  if (typeof a == "string")
782
982
  try {
783
- const i = JSON.parse(a);
784
- return i && typeof i == "object" ? i : {};
983
+ const l = JSON.parse(a);
984
+ return l && typeof l == "object" ? l : {};
785
985
  } catch {
786
986
  return { path: a };
787
987
  }
788
988
  return {};
789
989
  },
790
990
  // 生成 el-menu 的 index(一级)
791
- itemIndex(a, i) {
792
- return a.path || `menu-${i}`;
991
+ itemIndex(a, l) {
992
+ return a.path || `menu-${l}`;
793
993
  },
794
994
  // 生成 el-menu 的 index(二级)
795
- childIndex(a, i, n, f) {
796
- return n.path ? n.path : `${s.itemIndex(a, i)}-${f}`;
995
+ childIndex(a, l, n, u) {
996
+ return n.path ? n.path : `${c.itemIndex(a, l)}-${u}`;
797
997
  },
798
998
  // 是否有二级菜单(最多支持 2 级)
799
999
  hasChildren(a) {
@@ -802,67 +1002,67 @@ const z = {
802
1002
  // 根据跳转目标找到 el-menu index(用于 default-active)
803
1003
  getIndexByPath(a) {
804
1004
  if (!a) return "";
805
- for (let i = 0; i < r.menus.length; i++) {
806
- const n = r.menus[i];
807
- if (n.path === a) return s.itemIndex(n, i);
808
- const f = n.children || [];
809
- for (let m = 0; m < f.length; m++)
810
- if (f[m].path === a) return s.childIndex(n, i, f[m], m);
1005
+ for (let l = 0; l < d.menus.length; l++) {
1006
+ const n = d.menus[l];
1007
+ if (n.path === a) return c.itemIndex(n, l);
1008
+ const u = n.children || [];
1009
+ for (let m = 0; m < u.length; m++)
1010
+ if (u[m].path === a) return c.childIndex(n, l, u[m], m);
811
1011
  }
812
1012
  return "";
813
1013
  },
814
1014
  // 根据 el-menu index 找到菜单项
815
- findItemByIndex(a, i) {
816
- for (let n = 0; n < r.menus.length; n++) {
817
- const f = r.menus[n], m = s.itemIndex(f, n);
1015
+ findItemByIndex(a, l) {
1016
+ for (let n = 0; n < d.menus.length; n++) {
1017
+ const u = d.menus[n], m = c.itemIndex(u, n);
818
1018
  if (m === a)
819
- return { item: f, level: 1, indexPath: i || [m], index: a };
820
- const u = f.children || [];
821
- for (let g = 0; g < u.length; g++) {
822
- const p = u[g], b = s.childIndex(f, n, p, g);
823
- if (b === a)
824
- return { item: p, level: 2, indexPath: i || [m, b], index: a };
1019
+ return { item: u, level: 1, indexPath: l || [m], index: a };
1020
+ const f = u.children || [];
1021
+ for (let p = 0; p < f.length; p++) {
1022
+ const h = f[p], y = c.childIndex(u, n, h, p);
1023
+ if (y === a)
1024
+ return { item: h, level: 2, indexPath: l || [m, y], index: a };
825
1025
  }
826
1026
  }
827
1027
  return null;
828
1028
  },
829
1029
  // 解析跳转目标:外部可直接通过 type 判断跳转类型
830
1030
  resolveTarget(a) {
831
- const i = a.type || "route", n = a.path || "";
832
- return i === "url" ? { type: i, path: n, url: n, open: a.open || "new" } : i === "form" || i === "table" || i === "menu" ? { type: i, path: n, id: a.id || n } : { type: "route", path: n, route: n };
1031
+ const l = a.type || "route", n = a.path || "";
1032
+ return l === "url" ? { type: l, path: n, url: n, open: a.open || "new" } : l === "form" || l === "table" || l === "menu" ? { type: l, path: n, id: a.id || n } : { type: "route", path: n, route: n };
833
1033
  },
834
1034
  // 菜单点击
835
- handleSelect(a, i) {
836
- const n = s.findItemByIndex(a, i);
837
- if (!n || s.hasChildren(n.item)) return;
838
- const f = s.resolveTarget(n.item);
839
- r.activePath = n.item.path || a;
1035
+ handleSelect(a, l) {
1036
+ const n = c.findItemByIndex(a, l);
1037
+ if (!n || c.hasChildren(n.item)) return;
1038
+ const u = c.resolveTarget(n.item);
1039
+ d.activePath = n.item.path || a;
840
1040
  const m = {
841
- ...f,
1041
+ ...u,
842
1042
  item: n.item,
843
1043
  level: n.level,
844
1044
  indexPath: n.indexPath,
845
1045
  index: a
846
1046
  };
847
- d("menu-click", m);
1047
+ s("menu-click", m);
848
1048
  },
849
1049
  // 退出登录
850
1050
  handleLogout() {
851
- d("logout");
1051
+ s("logout");
852
1052
  },
853
1053
  // 设置激活项
854
1054
  setActivePath(a) {
855
- r.activePath = a;
1055
+ d.activePath = a;
856
1056
  },
857
- // 加载图标(按需 import,避免无图标时把整包图标打进产物)
1057
+ // 加载图标(静态引入见文件顶部;iconsLoaded 只保证转换一次的幂等)
858
1058
  async ensureIcons() {
859
- if (!r.iconsLoaded) {
860
- r.iconsLoaded = !0;
1059
+ if (!d.iconsLoaded) {
1060
+ d.iconsLoaded = !0;
861
1061
  try {
862
- const a = await import("@element-plus/icons-vue"), i = a != null && a.default ? { ...a.default, ...a } : { ...a }, n = {};
863
- for (const [f, m] of Object.entries(i))
864
- n[f] = re(m);
865
- r.iconMap = n;
1062
+ const a = $e, l = a != null && a.default ? { ...a.default, ...a } : { ...a }, n = {};
1063
+ for (const [u, m] of Object.entries(l))
1064
+ n[u] = se(m);
1065
+ d.iconMap = n;
866
1066
  } catch (a) {
867
1067
  console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略", a);
868
1068
  }
@@ -870,122 +1070,122 @@ const z = {
870
1070
  },
871
1071
  // 取图标组件
872
1072
  getIcon(a) {
873
- return a && r.iconMap[a] || null;
1073
+ return a && d.iconMap[a] || null;
874
1074
  }
875
1075
  };
876
- return L(() => l.menuId, (a) => {
877
- l.config || s.loadConfig(a);
878
- }), L(() => l.activePath, (a) => {
879
- r.activePath = a || "";
880
- }), L(() => l.config, (a) => {
881
- a && (r.config = a, r.menus = s.normalizeMenus(a.menus));
1076
+ return L(() => i.menuId, (a) => {
1077
+ i.config || c.loadConfig(a);
1078
+ }), L(() => i.activePath, (a) => {
1079
+ d.activePath = a || "";
1080
+ }), L(() => i.config, (a) => {
1081
+ a && (d.config = a, d.menus = c.normalizeMenus(a.menus));
882
1082
  }), oe(() => {
883
- s.init();
1083
+ c.init();
884
1084
  }), t({
885
- loadConfig: s.loadConfig,
886
- setActivePath: s.setActivePath
887
- }), (a, i) => {
888
- const n = ge, f = qe, m = We, u = Ne, g = J;
889
- return h(), y("div", {
890
- class: V(["u-menu", [`u-menu--${c.value.mode}`, { "u-menu--no-brand": !c.value.projectName }]]),
891
- style: B(c.value.isHorizontal ? {} : { width: c.value.width + "px" })
1085
+ loadConfig: c.loadConfig,
1086
+ setActivePath: c.setActivePath
1087
+ }), (a, l) => {
1088
+ const n = ye, u = Ye, m = je, f = Oe, p = X;
1089
+ return g(), v("div", {
1090
+ class: P(["u-menu", [`u-menu--${r.value.mode}`, { "u-menu--no-brand": !r.value.projectName }]]),
1091
+ style: B(r.value.isHorizontal ? {} : { width: r.value.width + "px" })
892
1092
  }, [
893
- c.value.projectName ? (h(), y("div", yt, [
894
- T(a.$slots, "brand", {
895
- projectName: c.value.projectName,
896
- mode: c.value.mode
1093
+ r.value.projectName ? (g(), v("div", Tt, [
1094
+ k(a.$slots, "brand", {
1095
+ projectName: r.value.projectName,
1096
+ mode: r.value.mode
897
1097
  }, () => [
898
- c.value.logo ? (h(), y("img", {
1098
+ r.value.logo ? (g(), v("img", {
899
1099
  key: 0,
900
1100
  class: "u-menu-logo",
901
- src: c.value.logo,
1101
+ src: r.value.logo,
902
1102
  alt: "logo"
903
- }, null, 8, bt)) : D("", !0),
904
- C("span", vt, k(c.value.projectName), 1)
1103
+ }, null, 8, Pt)) : D("", !0),
1104
+ x("span", Vt, T(r.value.projectName), 1)
905
1105
  ], !0)
906
1106
  ])) : D("", !0),
907
- _(u, {
1107
+ _(f, {
908
1108
  class: "u-menu-list",
909
- mode: c.value.elMode,
910
- "default-active": c.value.activeIndex,
911
- "unique-opened": !c.value.isHorizontal,
912
- onSelect: s.handleSelect
1109
+ mode: r.value.elMode,
1110
+ "default-active": r.value.activeIndex,
1111
+ "unique-opened": !r.value.isHorizontal,
1112
+ onSelect: c.handleSelect
913
1113
  }, {
914
1114
  default: w(() => [
915
- (h(!0), y(I, null, E(c.value.menus, (p, b) => (h(), y(I, {
916
- key: s.itemIndex(p, b)
1115
+ (g(!0), v(I, null, E(r.value.menus, (h, y) => (g(), v(I, {
1116
+ key: c.itemIndex(h, y)
917
1117
  }, [
918
- s.hasChildren(p) ? (h(), S(m, {
1118
+ c.hasChildren(h) ? (g(), S(m, {
919
1119
  key: 0,
920
- index: s.itemIndex(p, b)
1120
+ index: c.itemIndex(h, y)
921
1121
  }, {
922
1122
  title: w(() => [
923
- T(a.$slots, "menu-title", {
924
- item: p,
1123
+ k(a.$slots, "menu-title", {
1124
+ item: h,
925
1125
  level: 1,
926
- index: b
1126
+ index: y
927
1127
  }, () => [
928
- s.getIcon(p.icon) ? (h(), S(n, {
1128
+ c.getIcon(h.icon) ? (g(), S(n, {
929
1129
  key: 0,
930
1130
  class: "u-menu-icon"
931
1131
  }, {
932
1132
  default: w(() => [
933
- (h(), S(H(s.getIcon(p.icon))))
1133
+ (g(), S(J(c.getIcon(h.icon))))
934
1134
  ]),
935
1135
  _: 2
936
1136
  }, 1024)) : D("", !0),
937
- C("span", null, k(p.label), 1)
1137
+ x("span", null, T(h.label), 1)
938
1138
  ], !0)
939
1139
  ]),
940
1140
  default: w(() => [
941
- (h(!0), y(I, null, E(p.children, (R, G) => (h(), S(f, {
942
- key: s.childIndex(p, b, R, G),
943
- index: s.childIndex(p, b, R, G)
1141
+ (g(!0), v(I, null, E(h.children, (A, K) => (g(), S(u, {
1142
+ key: c.childIndex(h, y, A, K),
1143
+ index: c.childIndex(h, y, A, K)
944
1144
  }, {
945
1145
  default: w(() => [
946
- T(a.$slots, "menu-item", {
947
- item: R,
1146
+ k(a.$slots, "menu-item", {
1147
+ item: A,
948
1148
  level: 2,
949
- index: G,
950
- parent: p
1149
+ index: K,
1150
+ parent: h
951
1151
  }, () => [
952
- s.getIcon(R.icon) ? (h(), S(n, {
1152
+ c.getIcon(A.icon) ? (g(), S(n, {
953
1153
  key: 0,
954
1154
  class: "u-menu-icon"
955
1155
  }, {
956
1156
  default: w(() => [
957
- (h(), S(H(s.getIcon(R.icon))))
1157
+ (g(), S(J(c.getIcon(A.icon))))
958
1158
  ]),
959
1159
  _: 2
960
1160
  }, 1024)) : D("", !0),
961
- C("span", null, k(R.label), 1)
1161
+ x("span", null, T(A.label), 1)
962
1162
  ], !0)
963
1163
  ]),
964
1164
  _: 2
965
1165
  }, 1032, ["index"]))), 128))
966
1166
  ]),
967
1167
  _: 2
968
- }, 1032, ["index"])) : (h(), S(f, {
1168
+ }, 1032, ["index"])) : (g(), S(u, {
969
1169
  key: 1,
970
- index: s.itemIndex(p, b)
1170
+ index: c.itemIndex(h, y)
971
1171
  }, {
972
1172
  default: w(() => [
973
- T(a.$slots, "menu-item", {
974
- item: p,
1173
+ k(a.$slots, "menu-item", {
1174
+ item: h,
975
1175
  level: 1,
976
- index: b,
1176
+ index: y,
977
1177
  parent: null
978
1178
  }, () => [
979
- s.getIcon(p.icon) ? (h(), S(n, {
1179
+ c.getIcon(h.icon) ? (g(), S(n, {
980
1180
  key: 0,
981
1181
  class: "u-menu-icon"
982
1182
  }, {
983
1183
  default: w(() => [
984
- (h(), S(H(s.getIcon(p.icon))))
1184
+ (g(), S(J(c.getIcon(h.icon))))
985
1185
  ]),
986
1186
  _: 2
987
1187
  }, 1024)) : D("", !0),
988
- C("span", null, k(p.label), 1)
1188
+ x("span", null, T(h.label), 1)
989
1189
  ], !0)
990
1190
  ]),
991
1191
  _: 2
@@ -994,17 +1194,17 @@ const z = {
994
1194
  ]),
995
1195
  _: 3
996
1196
  }, 8, ["mode", "default-active", "unique-opened", "onSelect"]),
997
- c.value.showLogout ? (h(), y("div", wt, [
998
- T(a.$slots, "logout", {
999
- mode: c.value.mode
1197
+ r.value.showLogout ? (g(), v("div", $t, [
1198
+ k(a.$slots, "logout", {
1199
+ mode: r.value.mode
1000
1200
  }, () => [
1001
- _(g, {
1201
+ _(p, {
1002
1202
  class: "u-menu-logout-btn",
1003
1203
  text: "",
1004
- onClick: s.handleLogout
1204
+ onClick: c.handleLogout
1005
1205
  }, {
1006
1206
  default: w(() => [
1007
- F(k(c.value.logoutText), 1)
1207
+ F(T(r.value.logoutText), 1)
1008
1208
  ]),
1009
1209
  _: 1
1010
1210
  }, 8, ["onClick"])
@@ -1013,16 +1213,16 @@ const z = {
1013
1213
  ], 6);
1014
1214
  };
1015
1215
  }
1016
- }), Ct = /* @__PURE__ */ $(xt, [["__scopeId", "data-v-fe63251c"]]), _t = { class: "form-content" }, St = {
1216
+ }), Rt = /* @__PURE__ */ $(At, [["__scopeId", "data-v-41cadcd8"]]), It = { class: "form-content" }, Mt = {
1017
1217
  key: 1,
1018
1218
  class: "form-layout"
1019
- }, Dt = {
1219
+ }, Et = {
1020
1220
  key: 0,
1021
1221
  class: "form-header"
1022
- }, kt = { class: "title" }, Tt = { class: "form-body" }, Vt = {
1222
+ }, Ut = { class: "title" }, Bt = { class: "form-body" }, Ft = {
1023
1223
  key: 1,
1024
1224
  class: "form-footer"
1025
- }, Pt = /* @__PURE__ */ P({
1225
+ }, Lt = /* @__PURE__ */ V({
1026
1226
  __name: "FormContainer",
1027
1227
  props: {
1028
1228
  visible: { type: Boolean },
@@ -1032,98 +1232,98 @@ const z = {
1032
1232
  },
1033
1233
  emits: ["update:visible", "close", "closed"],
1034
1234
  setup(o, { emit: t }) {
1035
- const e = o, l = t, { visible: d } = Ge(e), r = v(() => e.layout.open === "normal"), c = v(() => e.layout.width || 400), s = {
1235
+ const e = o, i = t, { visible: s } = Ze(e), d = b(() => e.layout.open === "normal"), r = b(() => e.layout.width || 400), c = {
1036
1236
  handleClose() {
1037
- l("update:visible", !1), l("close");
1237
+ i("update:visible", !1), i("close");
1038
1238
  },
1039
1239
  handleClosed() {
1040
- l("closed");
1240
+ i("closed");
1041
1241
  },
1042
1242
  updateVisible(a) {
1043
- l("update:visible", a);
1243
+ i("update:visible", a);
1044
1244
  }
1045
1245
  };
1046
- return (a, i) => {
1047
- const n = ge, f = je;
1048
- return r.value ? N(d) ? (h(), y("div", St, [
1049
- o.title ? (h(), y("div", Dt, [
1050
- C("div", kt, k(o.title), 1)
1246
+ return (a, l) => {
1247
+ const n = ye, u = Qe;
1248
+ return d.value ? W(s) ? (g(), v("div", Mt, [
1249
+ o.title ? (g(), v("div", Et, [
1250
+ x("div", Ut, T(o.title), 1)
1051
1251
  ])) : D("", !0),
1052
- C("div", Tt, [
1053
- o.loading ? (h(), S(n, {
1252
+ x("div", Bt, [
1253
+ o.loading ? (g(), S(n, {
1054
1254
  key: 0,
1055
1255
  class: "is-loading",
1056
1256
  size: 40
1057
1257
  }, {
1058
1258
  default: w(() => [
1059
- _(N(ke))
1259
+ _(W(Pe))
1060
1260
  ]),
1061
1261
  _: 1
1062
- })) : T(a.$slots, "default", {}, void 0, !0, 1)
1262
+ })) : k(a.$slots, "default", {}, void 0, !0, 1)
1063
1263
  ]),
1064
- a.$slots.actions ? (h(), y("div", Vt, [
1065
- T(a.$slots, "actions", {}, void 0, !0)
1264
+ a.$slots.actions ? (g(), v("div", Ft, [
1265
+ k(a.$slots, "actions", {}, void 0, !0)
1066
1266
  ])) : D("", !0)
1067
- ])) : D("", !0) : (h(), S(f, {
1267
+ ])) : D("", !0) : (g(), S(u, {
1068
1268
  key: 0,
1069
- "model-value": N(d),
1269
+ "model-value": W(s),
1070
1270
  title: o.title,
1071
- width: c.value,
1271
+ width: r.value,
1072
1272
  "close-on-click-modal": !1,
1073
- "onUpdate:modelValue": s.updateVisible,
1074
- onClose: s.handleClose,
1075
- onClosed: s.handleClosed
1273
+ "onUpdate:modelValue": c.updateVisible,
1274
+ onClose: c.handleClose,
1275
+ onClosed: c.handleClosed
1076
1276
  }, {
1077
1277
  footer: w(() => [
1078
- T(a.$slots, "actions", {}, void 0, !0)
1278
+ k(a.$slots, "actions", {}, void 0, !0)
1079
1279
  ]),
1080
1280
  default: w(() => [
1081
- C("div", _t, [
1082
- o.loading ? (h(), S(n, {
1281
+ x("div", It, [
1282
+ o.loading ? (g(), S(n, {
1083
1283
  key: 0,
1084
1284
  class: "is-loading",
1085
1285
  size: 40
1086
1286
  }, {
1087
1287
  default: w(() => [
1088
- _(N(ke))
1288
+ _(W(Pe))
1089
1289
  ]),
1090
1290
  _: 1
1091
- })) : T(a.$slots, "default", {}, void 0, !0, 1)
1291
+ })) : k(a.$slots, "default", {}, void 0, !0, 1)
1092
1292
  ])
1093
1293
  ]),
1094
1294
  _: 3
1095
1295
  }, 8, ["model-value", "title", "width", "onUpdate:modelValue", "onClose", "onClosed"]));
1096
1296
  };
1097
1297
  }
1098
- }), $t = /* @__PURE__ */ $(Pt, [["__scopeId", "data-v-83362259"]]), Rt = /* @__PURE__ */ P({
1298
+ }), Nt = /* @__PURE__ */ $(Lt, [["__scopeId", "data-v-83362259"]]), Wt = /* @__PURE__ */ V({
1099
1299
  __name: "FormGrid",
1100
1300
  props: {
1101
1301
  fields: {},
1102
1302
  layout: {}
1103
1303
  },
1104
1304
  setup(o) {
1105
- const t = o, e = W({
1106
- columns: v(() => t.layout.columns || 1)
1107
- }), l = {
1108
- getColSpan(d) {
1109
- const r = d.colSpan || 1;
1110
- return Math.min(r, e.columns);
1305
+ const t = o, e = z({
1306
+ columns: b(() => t.layout.columns || 1)
1307
+ }), i = {
1308
+ getColSpan(s) {
1309
+ const d = s.colSpan || 1;
1310
+ return Math.min(d, e.columns);
1111
1311
  }
1112
1312
  };
1113
- return (d, r) => (h(), y("div", {
1313
+ return (s, d) => (g(), v("div", {
1114
1314
  class: "form-grid",
1115
1315
  style: B({ "--grid-columns": e.columns })
1116
1316
  }, [
1117
- (h(!0), y(I, null, E(o.fields, (c) => (h(), y("div", {
1118
- key: c.field,
1317
+ (g(!0), v(I, null, E(o.fields, (r) => (g(), v("div", {
1318
+ key: r.field,
1119
1319
  class: "form-grid-item",
1120
- style: B({ gridColumn: `span ${l.getColSpan(c)}` })
1320
+ style: B({ gridColumn: `span ${i.getColSpan(r)}` })
1121
1321
  }, [
1122
- T(d.$slots, "default", { field: c }, void 0, !0)
1322
+ k(s.$slots, "default", { field: r }, void 0, !0)
1123
1323
  ], 4))), 128))
1124
1324
  ], 4));
1125
1325
  }
1126
- }), At = /* @__PURE__ */ $(Rt, [["__scopeId", "data-v-90ed35a4"]]), It = { class: "form-field" }, Mt = /* @__PURE__ */ P({
1326
+ }), zt = /* @__PURE__ */ $(Wt, [["__scopeId", "data-v-90ed35a4"]]), qt = { class: "form-field" }, Ot = /* @__PURE__ */ V({
1127
1327
  __name: "FormField",
1128
1328
  props: {
1129
1329
  field: {},
@@ -1134,112 +1334,112 @@ const z = {
1134
1334
  },
1135
1335
  emits: ["update:modelValue"],
1136
1336
  setup(o, { emit: t }) {
1137
- const e = o, l = t, d = W({
1138
- componentMap: re({
1337
+ const e = o, i = t, s = z({
1338
+ componentMap: se({
1139
1339
  input: te,
1140
- "input-number": Pe,
1340
+ "input-number": Ae,
1141
1341
  dict: ee,
1142
- switch: $e,
1143
- cascader: Re,
1144
- date: de
1342
+ switch: Ie,
1343
+ cascader: Me,
1344
+ date: re
1145
1345
  }),
1146
1346
  cascaderOptions: []
1147
1347
  });
1148
1348
  L(() => e.field.cascaderKey, () => {
1149
- e.field.cascaderKey && M.get(K.cascaderApi(e.field.cascaderKey)).then((n) => {
1150
- n.status === 200 && (d.cascaderOptions = ve(n.data));
1349
+ e.field.cascaderKey && M().Get(G.cascaderApi(e.field.cascaderKey)).then((n) => {
1350
+ n.status === 200 && (s.cascaderOptions = we(n.data));
1151
1351
  });
1152
1352
  }, { immediate: !0 });
1153
- const c = v(() => d.componentMap[e.field.type] || te), s = v(() => {
1353
+ const r = b(() => s.componentMap[e.field.type] || te), c = b(() => {
1154
1354
  if ((e.layout.labelPosition || "top") === "left") {
1155
- const f = e.layout.labelWidth || 0, m = typeof f == "number" ? f + 4 : f;
1355
+ const u = e.layout.labelWidth || 0, m = typeof u == "number" ? u + 4 : u;
1156
1356
  return { marginLeft: typeof m == "number" ? `${m}px` : m };
1157
1357
  }
1158
1358
  return {};
1159
- }), a = v(() => {
1160
- const { field: n, modelValue: f, layout: m, disabled: u } = e;
1161
- let g = f;
1162
- n.type === "switch" && f == null && (g = !1);
1163
- const p = {
1359
+ }), a = b(() => {
1360
+ const { field: n, modelValue: u, layout: m, disabled: f } = e;
1361
+ let p = u;
1362
+ n.type === "switch" && u == null && (p = !1);
1363
+ const h = {
1164
1364
  fieldLabel: n.label,
1165
- modelValue: g,
1365
+ modelValue: p,
1166
1366
  labelPosition: m.labelPosition || "top",
1167
- disable: u,
1367
+ disable: f,
1168
1368
  name: n.field,
1169
1369
  required: n.required
1170
1370
  };
1171
- if (m.labelWidth && (p.labelWidth = m.labelWidth), m.labelAlign && (p.labelAlign = m.labelAlign), n.maxlength && (p.maxlength = n.maxlength), n.placeholder && (p.placeholder = n.placeholder), n.readonly && (p.readonly = n.readonly), n.lineCount && n.lineCount >= 2 ? (p.type = "textarea", p.rows = n.lineCount) : n.inputType && (p.type = n.inputType), n.type === "switch" && (n.activeText && (p.activeText = n.activeText), n.inactiveText && (p.inactiveText = n.inactiveText), n.activeColor && (p.activeColor = n.activeColor), n.inactiveColor && (p.inactiveColor = n.inactiveColor), n.trueValue !== void 0 && (p.trueValue = n.trueValue), n.falseValue !== void 0 && (p.falseValue = n.falseValue)), n.dictType && (p.dictType = n.dictType), n.cascaderKey && (p.options = d.cascaderOptions, p.depth = n.cascaderDepth || 2), n.type === "date") {
1172
- n.mode && (p.mode = n.mode), n.locale && (p.locale = n.locale), n.format ? p.mask = n.format : n.mask && (p.mask = n.mask);
1173
- const b = n.dateMin ?? n.min, R = n.dateMax ?? n.max;
1174
- b != null && (p.min = b), R != null && (p.max = R);
1371
+ if (m.labelWidth && (h.labelWidth = m.labelWidth), m.labelAlign && (h.labelAlign = m.labelAlign), n.maxlength && (h.maxlength = n.maxlength), n.placeholder && (h.placeholder = n.placeholder), n.readonly && (h.readonly = n.readonly), n.lineCount && n.lineCount >= 2 ? (h.type = "textarea", h.rows = n.lineCount) : n.inputType && (h.type = n.inputType), n.type === "switch" && (n.activeText && (h.activeText = n.activeText), n.inactiveText && (h.inactiveText = n.inactiveText), n.activeColor && (h.activeColor = n.activeColor), n.inactiveColor && (h.inactiveColor = n.inactiveColor), n.trueValue !== void 0 && (h.trueValue = n.trueValue), n.falseValue !== void 0 && (h.falseValue = n.falseValue)), n.dictType && (h.dictType = n.dictType), n.cascaderKey && (h.options = s.cascaderOptions, h.depth = n.cascaderDepth || 2), n.type === "date") {
1372
+ n.mode && (h.mode = n.mode), n.locale && (h.locale = n.locale), n.format ? h.mask = n.format : n.mask && (h.mask = n.mask);
1373
+ const y = n.dateMin ?? n.min, A = n.dateMax ?? n.max;
1374
+ y != null && (h.min = y), A != null && (h.max = A);
1175
1375
  }
1176
- return n.type === "input-number" && (n.min !== void 0 && (p.min = n.min), n.max !== void 0 && (p.max = n.max), n.step && (p.step = n.step), n.precision !== void 0 && (p.precision = n.precision)), p;
1177
- }), i = {
1376
+ return n.type === "input-number" && (n.min !== void 0 && (h.min = n.min), n.max !== void 0 && (h.max = n.max), n.step && (h.step = n.step), n.precision !== void 0 && (h.precision = n.precision)), h;
1377
+ }), l = {
1178
1378
  handleUpdate(n) {
1179
- l("update:modelValue", n);
1379
+ i("update:modelValue", n);
1180
1380
  }
1181
1381
  };
1182
- return (n, f) => (h(), y("div", It, [
1183
- (h(), S(H(c.value), ce(a.value, {
1184
- "onUpdate:modelValue": i.handleUpdate
1382
+ return (n, u) => (g(), v("div", qt, [
1383
+ (g(), S(J(r.value), de(a.value, {
1384
+ "onUpdate:modelValue": l.handleUpdate
1185
1385
  }), null, 16, ["onUpdate:modelValue"])),
1186
- C("div", {
1187
- class: V(["field-error", { "field-error--visible": o.error }]),
1188
- style: B(s.value)
1189
- }, k(o.error || ""), 7)
1386
+ x("div", {
1387
+ class: P(["field-error", { "field-error--visible": o.error }]),
1388
+ style: B(c.value)
1389
+ }, T(o.error || ""), 7)
1190
1390
  ]));
1191
1391
  }
1192
- }), Et = /* @__PURE__ */ $(Mt, [["__scopeId", "data-v-10299c8d"]]);
1193
- class Ut {
1392
+ }), jt = /* @__PURE__ */ $(Ot, [["__scopeId", "data-v-96994a9a"]]);
1393
+ class Yt {
1194
1394
  constructor() {
1195
- x(this, "formConfig", null);
1196
- x(this, "formData", {});
1197
- x(this, "loading", !1);
1198
- x(this, "submitting", !1);
1199
- x(this, "visible", !1);
1200
- x(this, "isEditMode", !1);
1201
- x(this, "errors", []);
1202
- x(this, "currentQuery", {});
1395
+ C(this, "formConfig", null);
1396
+ C(this, "formData", {});
1397
+ C(this, "loading", !1);
1398
+ C(this, "submitting", !1);
1399
+ C(this, "visible", !1);
1400
+ C(this, "isEditMode", !1);
1401
+ C(this, "errors", []);
1402
+ C(this, "currentQuery", {});
1203
1403
  }
1204
1404
  }
1205
- let Bt = class {
1405
+ let Qt = class {
1206
1406
  constructor() {
1207
1407
  // 响应式数据
1208
- x(this, "data", W(new Ut()));
1408
+ C(this, "data", z(new Yt()));
1209
1409
  }
1210
1410
  // 解析 query 字符串
1211
1411
  parseQuery(t) {
1212
1412
  if (!t) return {};
1213
- const e = {}, l = t.split("&");
1214
- for (const d of l) {
1215
- const [r, c] = d.split("=");
1216
- r && (e[r] = c || "");
1413
+ const e = {}, i = t.split("&");
1414
+ for (const s of i) {
1415
+ const [d, r] = s.split("=");
1416
+ d && (e[d] = r || "");
1217
1417
  }
1218
1418
  return e;
1219
1419
  }
1220
1420
  // 获取表单配置(type=forms,对应后端 config/forms/<formId>.yaml)
1221
1421
  async fetchFormConfig(t) {
1222
- const e = await M.get(K.formCfgApi(t, "forms"));
1422
+ const e = await M().Get(G.formCfgApi(t, "forms"));
1223
1423
  if (e.status !== 200)
1224
1424
  throw new Error(e.message || "获取表单配置失败");
1225
1425
  return e.data;
1226
1426
  }
1227
1427
  // 获取表单数据
1228
1428
  async fetchFormData(t, e) {
1229
- const l = e ? `${t}?${e}` : t, d = await M.get(l);
1230
- if (d.status !== 200)
1231
- throw new Error(d.message || "获取表单数据失败");
1232
- return d.data;
1429
+ const i = e ? `${t}?${e}` : t, s = await M().Get(i);
1430
+ if (s.status !== 200)
1431
+ throw new Error(s.message || "获取表单数据失败");
1432
+ return s.data;
1233
1433
  }
1234
1434
  // 提交表单
1235
1435
  async submitForm(t, e) {
1236
- return await M.post(t, e);
1436
+ return await M().Post(t, e);
1237
1437
  }
1238
1438
  // 构建字段初始值
1239
1439
  buildInitialData(t) {
1240
1440
  const e = {};
1241
- for (const l of t)
1242
- l.default !== void 0 ? e[l.field] = l.default : e[l.field] = null;
1441
+ for (const i of t)
1442
+ i.default !== void 0 ? e[i.field] = i.default : e[i.field] = null;
1243
1443
  return e;
1244
1444
  }
1245
1445
  // 判断编辑模式
@@ -1251,21 +1451,21 @@ let Bt = class {
1251
1451
  var e;
1252
1452
  this.data.errors = [];
1253
1453
  const t = ((e = this.data.formConfig) == null ? void 0 : e.fields) || [];
1254
- for (const l of t) {
1255
- const d = this.data.formData[l.field];
1256
- if (l.required && (d == null || d === "")) {
1454
+ for (const i of t) {
1455
+ const s = this.data.formData[i.field];
1456
+ if (i.required && (s == null || s === "")) {
1257
1457
  this.data.errors.push({
1258
- field: l.field,
1259
- message: `${l.label}为必填项`
1458
+ field: i.field,
1459
+ message: `${i.label}为必填项`
1260
1460
  });
1261
1461
  continue;
1262
1462
  }
1263
- if (l.rules && l.rules.length > 0 && d) {
1264
- for (const r of l.rules)
1265
- if (r.pattern && !new RegExp(r.pattern).test(d)) {
1463
+ if (i.rules && i.rules.length > 0 && s) {
1464
+ for (const d of i.rules)
1465
+ if (d.pattern && !new RegExp(d.pattern).test(s)) {
1266
1466
  this.data.errors.push({
1267
- field: l.field,
1268
- message: r.message || `${l.label}格式不正确`
1467
+ field: i.field,
1468
+ message: d.message || `${i.label}格式不正确`
1269
1469
  });
1270
1470
  break;
1271
1471
  }
@@ -1275,7 +1475,7 @@ let Bt = class {
1275
1475
  }
1276
1476
  // 获取字段错误信息
1277
1477
  getFieldError(t) {
1278
- const e = this.data.errors.find((l) => l.field === t);
1478
+ const e = this.data.errors.find((i) => i.field === t);
1279
1479
  return e ? e.message : null;
1280
1480
  }
1281
1481
  // 清除错误
@@ -1286,13 +1486,13 @@ let Bt = class {
1286
1486
  async openForm(t, e) {
1287
1487
  this.data.loading = !0, this.data.visible = !0, this.clearErrors(), this.data.currentQuery = this.parseQuery(e || "");
1288
1488
  try {
1289
- const l = await this.fetchFormConfig(t);
1290
- if (this.data.formConfig = l, this.data.isEditMode = this.checkIsEditMode(e || ""), this.data.formData = this.buildInitialData(l.fields), this.data.isEditMode && l.api.get && e) {
1291
- const d = await this.fetchFormData(l.api.get, e), r = this.nestedToFlat(d);
1292
- this.data.formData = { ...this.data.formData, ...r };
1489
+ const i = await this.fetchFormConfig(t);
1490
+ if (this.data.formConfig = i, this.data.isEditMode = this.checkIsEditMode(e || ""), this.data.formData = this.buildInitialData(i.fields), this.data.isEditMode && i.api.get && e) {
1491
+ const s = await this.fetchFormData(i.api.get, e), d = this.nestedToFlat(s);
1492
+ this.data.formData = { ...this.data.formData, ...d };
1293
1493
  }
1294
- } catch (l) {
1295
- throw console.error("[FormRender] 打开表单失败:", l), this.data.visible = !1, l;
1494
+ } catch (i) {
1495
+ throw console.error("[FormRender] 打开表单失败:", i), this.data.visible = !1, i;
1296
1496
  } finally {
1297
1497
  this.data.loading = !1;
1298
1498
  }
@@ -1306,13 +1506,13 @@ let Bt = class {
1306
1506
  let e = this.data.isEditMode ? t.edit : t.add;
1307
1507
  if (!e)
1308
1508
  throw new Error("提交地址未配置");
1309
- let l = { ...this.data.formData };
1310
- l = this.flattenToNested(l), this.data.isEditMode && this.data.currentQuery.id && (l.id = Number(this.data.currentQuery.id)), this.data.submitting = !0;
1509
+ let i = { ...this.data.formData };
1510
+ i = this.flattenToNested(i), this.data.isEditMode && this.data.currentQuery.id && (i.id = Number(this.data.currentQuery.id)), this.data.submitting = !0;
1311
1511
  try {
1312
- const d = await this.submitForm(e, l);
1313
- if (d.status === 200)
1314
- return d.data;
1315
- throw new Error(d.message || "提交失败");
1512
+ const s = await this.submitForm(e, i);
1513
+ if (s.status === 200)
1514
+ return s.data;
1515
+ throw new Error(s.message || "提交失败");
1316
1516
  } finally {
1317
1517
  this.data.submitting = !1;
1318
1518
  }
@@ -1335,46 +1535,46 @@ let Bt = class {
1335
1535
  // 扁平字段转嵌套对象(如 info.address -> { info: { address: xxx } })
1336
1536
  flattenToNested(t) {
1337
1537
  const e = {};
1338
- for (const l in t) {
1339
- const d = t[l];
1340
- if (l.includes(".")) {
1341
- const r = l.split(".");
1342
- let c = e;
1343
- for (let s = 0; s < r.length - 1; s++) {
1344
- const a = r[s];
1345
- c[a] || (c[a] = {}), c = c[a];
1538
+ for (const i in t) {
1539
+ const s = t[i];
1540
+ if (i.includes(".")) {
1541
+ const d = i.split(".");
1542
+ let r = e;
1543
+ for (let c = 0; c < d.length - 1; c++) {
1544
+ const a = d[c];
1545
+ r[a] || (r[a] = {}), r = r[a];
1346
1546
  }
1347
- c[r[r.length - 1]] = d;
1547
+ r[d[d.length - 1]] = s;
1348
1548
  } else
1349
- e[l] = d;
1549
+ e[i] = s;
1350
1550
  }
1351
1551
  return e;
1352
1552
  }
1353
1553
  // 嵌套对象展平为扁平字段(如 { info: { address: "xxx" } } -> { "info.address": "xxx" })
1354
1554
  // 注意:只展平 YAML 中配置的点号分隔字段(如 info.address),不展平已经是对象的字段(如 dateRange: { from, to })
1355
1555
  nestedToFlat(t, e = "") {
1356
- const l = {};
1357
- for (const d in t) {
1358
- const r = t[d], c = e ? `${e}.${d}` : d;
1359
- r && typeof r == "object" && !Array.isArray(r) ? Object.keys(r).length === 2 && "from" in r && "to" in r ? l[c] = r : Object.assign(l, this.nestedToFlat(r, c)) : l[c] = r;
1556
+ const i = {};
1557
+ for (const s in t) {
1558
+ const d = t[s], r = e ? `${e}.${s}` : s;
1559
+ d && typeof d == "object" && !Array.isArray(d) ? Object.keys(d).length === 2 && "from" in d && "to" in d ? i[r] = d : Object.assign(i, this.nestedToFlat(d, r)) : i[r] = d;
1360
1560
  }
1361
- return l;
1561
+ return i;
1362
1562
  }
1363
1563
  };
1364
- const Ft = /* @__PURE__ */ P({
1564
+ const Gt = /* @__PURE__ */ V({
1365
1565
  __name: "FormRender",
1366
1566
  setup(o, { expose: t }) {
1367
- const e = new Bt(), l = Q(null), d = W({
1567
+ const e = new Qt(), i = Q(null), s = z({
1368
1568
  currentQuery: {},
1369
1569
  submitResolve: null
1370
- }), r = v(() => {
1371
- var u;
1570
+ }), d = b(() => {
1571
+ var f;
1372
1572
  const m = {};
1373
- if (!e.data.isEditMode || !d.currentQuery) return m;
1374
- for (const g of ((u = e.data.formConfig) == null ? void 0 : u.fields) || [])
1375
- d.currentQuery[g.field] !== void 0 && (m[g.field] = !0);
1573
+ if (!e.data.isEditMode || !s.currentQuery) return m;
1574
+ for (const p of ((f = e.data.formConfig) == null ? void 0 : f.fields) || [])
1575
+ s.currentQuery[p.field] !== void 0 && (m[p.field] = !0);
1376
1576
  return m;
1377
- }), c = v(() => {
1577
+ }), r = b(() => {
1378
1578
  var m;
1379
1579
  return ((m = e.data.formConfig) == null ? void 0 : m.layout) || {
1380
1580
  open: "dialog",
@@ -1382,39 +1582,39 @@ const Ft = /* @__PURE__ */ P({
1382
1582
  labelPosition: "top",
1383
1583
  buttonAlign: "right"
1384
1584
  };
1385
- }), s = v(() => {
1585
+ }), c = b(() => {
1386
1586
  var m;
1387
1587
  return ((m = e.data.formConfig) == null ? void 0 : m.fields) || [];
1388
- }), a = v(() => {
1389
- var m, u;
1390
- return ((u = (m = e.data.formConfig) == null ? void 0 : m.meta) == null ? void 0 : u.title) || "表单";
1391
- }), i = v(() => c.value.buttonAlign || "right"), n = v(() => c.value.open === "normal"), f = {
1392
- async showForm(m, u) {
1393
- d.currentQuery = e.parseQuery(u || "");
1588
+ }), a = b(() => {
1589
+ var m, f;
1590
+ return ((f = (m = e.data.formConfig) == null ? void 0 : m.meta) == null ? void 0 : f.title) || "表单";
1591
+ }), l = b(() => r.value.buttonAlign || "right"), n = b(() => r.value.open === "normal"), u = {
1592
+ async showForm(m, f) {
1593
+ s.currentQuery = e.parseQuery(f || "");
1394
1594
  try {
1395
- await e.openForm(m, u);
1396
- } catch (g) {
1397
- return U((g == null ? void 0 : g.message) || "打开表单失败"), null;
1595
+ await e.openForm(m, f);
1596
+ } catch (p) {
1597
+ return U((p == null ? void 0 : p.message) || "打开表单失败"), null;
1398
1598
  }
1399
- return new Promise((g) => {
1400
- d.submitResolve = g;
1599
+ return new Promise((p) => {
1600
+ s.submitResolve = p;
1401
1601
  });
1402
1602
  },
1403
1603
  async handleSubmit() {
1404
- var m, u;
1604
+ var m, f;
1405
1605
  try {
1406
- const g = await e.doSubmit(), p = ((u = (m = e.data.formConfig) == null ? void 0 : m.meta) == null ? void 0 : u.title) + "保存成功";
1407
- return z.success(p), d.submitResolve && (d.submitResolve(g), d.submitResolve = null), n.value || e.closeForm(), g;
1408
- } catch (g) {
1409
- return d.submitResolve && (d.submitResolve(null), d.submitResolve = null), g != null && g.message && g.message !== "请完善表单信息" && U(g.message), null;
1606
+ const p = await e.doSubmit(), h = ((f = (m = e.data.formConfig) == null ? void 0 : m.meta) == null ? void 0 : f.title) + "保存成功";
1607
+ return N.success(h), s.submitResolve && (s.submitResolve(p), s.submitResolve = null), n.value || e.closeForm(), p;
1608
+ } catch (p) {
1609
+ return s.submitResolve && (s.submitResolve(null), s.submitResolve = null), p != null && p.message && p.message !== "请完善表单信息" && U(p.message), null;
1410
1610
  }
1411
1611
  },
1412
1612
  // 结束等待:把 submitResolve 以 null 收尾(取消/关闭时调用,避免 Promise 永远悬挂)
1413
1613
  resolvePending() {
1414
- d.submitResolve && (d.submitResolve(null), d.submitResolve = null);
1614
+ s.submitResolve && (s.submitResolve(null), s.submitResolve = null);
1415
1615
  },
1416
1616
  handleCancel() {
1417
- n.value || (f.resolvePending(), e.closeForm());
1617
+ n.value || (u.resolvePending(), e.closeForm());
1418
1618
  },
1419
1619
  // 获取字段错误信息
1420
1620
  getFieldError(m) {
@@ -1422,7 +1622,7 @@ const Ft = /* @__PURE__ */ P({
1422
1622
  },
1423
1623
  // 关闭(点右上角 X / 遮罩):同样以 null 收尾再关闭
1424
1624
  handleClose() {
1425
- f.resolvePending(), e.closeForm();
1625
+ u.resolvePending(), e.closeForm();
1426
1626
  },
1427
1627
  // 退出动画播完:这时才真正清空表单配置/数据(见 ts/form-render.ts closeForm 的说明)
1428
1628
  handleClosed() {
@@ -1430,36 +1630,36 @@ const Ft = /* @__PURE__ */ P({
1430
1630
  }
1431
1631
  };
1432
1632
  return t({
1433
- showForm: f.showForm
1434
- }), (m, u) => {
1435
- const g = Oe, p = J;
1436
- return h(), S($t, {
1437
- visible: N(e).data.visible,
1438
- "onUpdate:visible": u[0] || (u[0] = (b) => N(e).data.visible = b),
1439
- layout: c.value,
1633
+ showForm: u.showForm
1634
+ }), (m, f) => {
1635
+ const p = Ge, h = X;
1636
+ return g(), S(Nt, {
1637
+ visible: W(e).data.visible,
1638
+ "onUpdate:visible": f[0] || (f[0] = (y) => W(e).data.visible = y),
1639
+ layout: r.value,
1440
1640
  title: a.value,
1441
- loading: N(e).data.loading,
1442
- onClose: f.handleClose,
1443
- onClosed: f.handleClosed
1641
+ loading: W(e).data.loading,
1642
+ onClose: u.handleClose,
1643
+ onClosed: u.handleClosed
1444
1644
  }, {
1445
1645
  actions: w(() => [
1446
- C("div", {
1447
- class: V(["form-actions", i.value === "right" ? "justify-end" : "justify-start"])
1646
+ x("div", {
1647
+ class: P(["form-actions", l.value === "right" ? "justify-end" : "justify-start"])
1448
1648
  }, [
1449
- _(p, {
1450
- onClick: f.handleCancel
1649
+ _(h, {
1650
+ onClick: u.handleCancel
1451
1651
  }, {
1452
- default: w(() => [...u[1] || (u[1] = [
1652
+ default: w(() => [...f[1] || (f[1] = [
1453
1653
  F("取消", -1)
1454
1654
  ])]),
1455
1655
  _: 1
1456
1656
  }, 8, ["onClick"]),
1457
- _(p, {
1657
+ _(h, {
1458
1658
  type: "primary",
1459
- loading: N(e).data.submitting,
1460
- onClick: f.handleSubmit
1659
+ loading: W(e).data.submitting,
1660
+ onClick: u.handleSubmit
1461
1661
  }, {
1462
- default: w(() => [...u[2] || (u[2] = [
1662
+ default: w(() => [...f[2] || (f[2] = [
1463
1663
  F("提交", -1)
1464
1664
  ])]),
1465
1665
  _: 1
@@ -1467,25 +1667,25 @@ const Ft = /* @__PURE__ */ P({
1467
1667
  ], 2)
1468
1668
  ]),
1469
1669
  default: w(() => [
1470
- _(g, {
1670
+ _(p, {
1471
1671
  ref_key: "formRef",
1472
- ref: l,
1672
+ ref: i,
1473
1673
  class: "form-render",
1474
1674
  "label-position": "top"
1475
1675
  }, {
1476
1676
  default: w(() => [
1477
- _(At, {
1478
- fields: s.value,
1479
- layout: c.value
1677
+ _(zt, {
1678
+ fields: c.value,
1679
+ layout: r.value
1480
1680
  }, {
1481
- default: w(({ field: b }) => [
1482
- _(Et, {
1483
- modelValue: N(e).data.formData[b.field],
1484
- "onUpdate:modelValue": (R) => N(e).data.formData[b.field] = R,
1485
- field: b,
1486
- layout: c.value,
1487
- disabled: r.value[b.field],
1488
- error: f.getFieldError(b.field)
1681
+ default: w(({ field: y }) => [
1682
+ _(jt, {
1683
+ modelValue: W(e).data.formData[y.field],
1684
+ "onUpdate:modelValue": (A) => W(e).data.formData[y.field] = A,
1685
+ field: y,
1686
+ layout: r.value,
1687
+ disabled: d.value[y.field],
1688
+ error: u.getFieldError(y.field)
1489
1689
  }, null, 8, ["modelValue", "onUpdate:modelValue", "field", "layout", "disabled", "error"])
1490
1690
  ]),
1491
1691
  _: 1
@@ -1498,8 +1698,8 @@ const Ft = /* @__PURE__ */ P({
1498
1698
  }, 8, ["visible", "layout", "title", "loading", "onClose", "onClosed"]);
1499
1699
  };
1500
1700
  }
1501
- }), Ae = /* @__PURE__ */ $(Ft, [["__scopeId", "data-v-b3267c00"]]);
1502
- class Lt {
1701
+ }), Ee = /* @__PURE__ */ $(Gt, [["__scopeId", "data-v-b3267c00"]]);
1702
+ class Kt {
1503
1703
  constructor(t) {
1504
1704
  this.config = t;
1505
1705
  }
@@ -1507,24 +1707,24 @@ class Lt {
1507
1707
  * 获取列表数据
1508
1708
  */
1509
1709
  async fetchList(t, e) {
1510
- const l = {
1710
+ const i = {
1511
1711
  page: e.page,
1512
1712
  pageSize: e.pageSize,
1513
1713
  ...t
1514
- }, d = {};
1515
- for (const a in l) {
1516
- const i = l[a];
1517
- i !== "" && i !== null && i !== void 0 && (d[a] = i);
1714
+ }, s = {};
1715
+ for (const a in i) {
1716
+ const l = i[a];
1717
+ l !== "" && l !== null && l !== void 0 && (s[a] = l);
1518
1718
  }
1519
- const r = new URLSearchParams();
1520
- for (const a in d)
1521
- r.append(a, String(d[a]));
1522
- const c = `${this.config.api.list}${r.toString() ? "?" + r.toString() : ""}`, s = await M.get(c);
1523
- if (s.status === 200) {
1524
- const a = s.data;
1719
+ const d = new URLSearchParams();
1720
+ for (const a in s)
1721
+ d.append(a, String(s[a]));
1722
+ const r = `${this.config.api.list}${d.toString() ? "?" + d.toString() : ""}`, c = await M().Get(r);
1723
+ if (c.status === 200) {
1724
+ const a = c.data;
1525
1725
  return Array.isArray(a) ? { rows: a, total: a.length } : a || { rows: [], total: 0 };
1526
1726
  }
1527
- throw new Error(s.message || "获取列表数据失败");
1727
+ throw new Error(c.message || "获取列表数据失败");
1528
1728
  }
1529
1729
  /**
1530
1730
  * 删除单行
@@ -1532,9 +1732,9 @@ class Lt {
1532
1732
  async deleteRow(t) {
1533
1733
  if (!this.config.api.delete)
1534
1734
  throw new Error("未配置删除API");
1535
- const e = this.config.key || "id", l = t[e], d = `${this.config.api.delete}?${encodeURIComponent(e)}=${encodeURIComponent(String(l ?? ""))}`, r = await M.post(d);
1536
- if (r.status !== 200)
1537
- throw new Error(r.message || "删除失败");
1735
+ const e = this.config.key || "id", i = t[e], s = `${this.config.api.delete}?${encodeURIComponent(e)}=${encodeURIComponent(String(i ?? ""))}`, d = await M().Post(s);
1736
+ if (d.status !== 200)
1737
+ throw new Error(d.message || "删除失败");
1538
1738
  }
1539
1739
  /**
1540
1740
  * 批量删除
@@ -1542,7 +1742,7 @@ class Lt {
1542
1742
  async batchDelete(t) {
1543
1743
  if (!this.config.api.delete)
1544
1744
  throw new Error("未配置删除API");
1545
- const e = await M.post(this.config.api.delete, t);
1745
+ const e = await M().Post(this.config.api.delete, t);
1546
1746
  if (e.status !== 200)
1547
1747
  throw new Error(e.message || "批量删除失败");
1548
1748
  }
@@ -1552,10 +1752,8 @@ class Lt {
1552
1752
  async exportData(t) {
1553
1753
  if (!this.config.api.export)
1554
1754
  throw new Error("未配置导出API");
1555
- const l = (await M.post(this.config.api.export, t, {
1556
- responseType: "blob"
1557
- })).data, d = window.URL.createObjectURL(l), r = document.createElement("a");
1558
- r.href = d, r.download = `export_${Date.now()}.xlsx`, r.click(), window.URL.revokeObjectURL(d);
1755
+ const i = (await M().PostDownload(this.config.api.export, t)).data, s = window.URL.createObjectURL(i), d = document.createElement("a");
1756
+ d.href = s, d.download = `export_${Date.now()}.xlsx`, d.click(), window.URL.revokeObjectURL(s);
1559
1757
  }
1560
1758
  /**
1561
1759
  * 下载导入模板
@@ -1563,10 +1761,8 @@ class Lt {
1563
1761
  async downloadTemplate() {
1564
1762
  if (!this.config.api.import)
1565
1763
  throw new Error("未配置导入API");
1566
- const e = (await M.get(`${this.config.api.import}/template`, {
1567
- responseType: "blob"
1568
- })).data, l = window.URL.createObjectURL(e), d = document.createElement("a");
1569
- d.href = l, d.download = `template_${Date.now()}.xlsx`, d.click(), window.URL.revokeObjectURL(l);
1764
+ const e = (await M().Download(`${this.config.api.import}/template`)).data, i = window.URL.createObjectURL(e), s = document.createElement("a");
1765
+ s.href = i, s.download = `template_${Date.now()}.xlsx`, s.click(), window.URL.revokeObjectURL(i);
1570
1766
  }
1571
1767
  /**
1572
1768
  * 导入数据
@@ -1576,70 +1772,66 @@ class Lt {
1576
1772
  throw new Error("未配置导入API");
1577
1773
  const e = new FormData();
1578
1774
  e.append("file", t);
1579
- const l = await M.post(this.config.api.import, e, {
1580
- headers: {
1581
- "Content-Type": "multipart/form-data"
1582
- }
1583
- });
1584
- if (l.status !== 200)
1585
- throw new Error(l.message || "导入失败");
1586
- return l.data;
1775
+ const i = await M().Post(this.config.api.import, e);
1776
+ if (i.status !== 200)
1777
+ throw new Error(i.message || "导入失败");
1778
+ return i.data;
1587
1779
  }
1588
1780
  }
1589
- class zt {
1781
+ class Ht {
1590
1782
  constructor() {
1591
- x(this, "tableConfig", null);
1592
- x(this, "rows", []);
1593
- x(this, "total", 0);
1594
- x(this, "loading", !1);
1595
- x(this, "searchParams", {});
1596
- x(this, "pagination", { page: 1, pageSize: 20 });
1783
+ C(this, "tableConfig", null);
1784
+ C(this, "rows", []);
1785
+ C(this, "total", 0);
1786
+ C(this, "loading", !1);
1787
+ C(this, "searchParams", {});
1788
+ C(this, "pagination", { page: 1, pageSize: 20 });
1597
1789
  // 当前行:点击某行后即为当前行,toolbar 上的 edit / delete / preview 作用于它
1598
- x(this, "currentRow", null);
1599
- x(this, "detailVisible", !1);
1600
- x(this, "detailData", null);
1601
- x(this, "detailLoading", !1);
1790
+ C(this, "currentRow", null);
1791
+ C(this, "detailVisible", !1);
1792
+ C(this, "detailData", null);
1793
+ C(this, "detailLoading", !1);
1602
1794
  // 预览抽屉(action: preview 触发,独立于 detail 配置)
1603
1795
  // previewVisible —— 显隐(交给 el-drawer 的 :model-value)
1604
1796
  // previewMounted —— 是否挂载。打开时置 true;退场动画播完(@closed)才置 false。
1605
1797
  // 为什么要两个:抽屉**只在打开时挂载**(省 DOM),但挂载开关不能跟着显隐一起变,
1606
1798
  // 否则关闭瞬间组件就被卸载,el-drawer 的退场动画没机会播(见 closePreview 注释)。
1607
- x(this, "previewVisible", !1);
1608
- x(this, "previewMounted", !1);
1609
- x(this, "previewRow", null);
1799
+ C(this, "previewVisible", !1);
1800
+ C(this, "previewMounted", !1);
1801
+ C(this, "previewRow", null);
1610
1802
  }
1611
1803
  }
1612
- let Nt = class {
1804
+ let Jt = class {
1613
1805
  constructor() {
1614
1806
  // 响应式数据
1615
- x(this, "data", W(new zt()));
1807
+ C(this, "data", z(new Ht()));
1616
1808
  // 数据服务
1617
- x(this, "dataService", null);
1809
+ C(this, "dataService", null);
1618
1810
  }
1619
1811
  /**
1620
1812
  * 加载表格配置
1621
1813
  */
1622
1814
  async loadConfig(t) {
1623
- var d;
1624
- const e = K.formCfgApi(t, "tables");
1815
+ var s;
1816
+ const e = G.formCfgApi(t, "tables");
1625
1817
  console.log("load config url =", e);
1626
- const l = await M.get(e);
1627
- if (console.log("---"), l.status !== 200)
1628
- throw new Error(l.message || "获取表格配置失败");
1629
- this.data.tableConfig = l.data, this.dataService = new Lt(l.data), this.data.currentRow = null, this.data.detailVisible = !1, this.data.detailData = null, this.data.previewVisible = !1, this.data.previewMounted = !1, this.data.previewRow = null, typeof console < "u" && console.log("[TableRender] loadConfig:", {
1818
+ const i = await M().Get(e);
1819
+ if (console.log("---"), i.status !== 200)
1820
+ throw new Error(i.message || "获取表格配置失败");
1821
+ this.data.tableConfig = i.data, this.dataService = new Kt(i.data), this.data.currentRow = null, this.data.detailVisible = !1, this.data.detailData = null, this.data.previewVisible = !1, this.data.previewMounted = !1, this.data.previewRow = null, typeof console < "u" && console.log("[TableRender] loadConfig:", {
1630
1822
  tableId: t,
1631
1823
  hasDetail: this.hasDetail(),
1632
- detail: (d = this.data.tableConfig) == null ? void 0 : d.detail
1824
+ detail: (s = this.data.tableConfig) == null ? void 0 : s.detail
1633
1825
  }), this.initSearchParams();
1634
1826
  }
1635
1827
  /**
1636
1828
  * 初始化搜索参数
1637
1829
  */
1638
1830
  initSearchParams() {
1639
- var l;
1640
- const t = {}, e = ((l = this.data.tableConfig) == null ? void 0 : l.search) || [];
1641
- for (const d of e)
1642
- t[d.field] = "";
1831
+ var i;
1832
+ const t = {}, e = ((i = this.data.tableConfig) == null ? void 0 : i.search) || [];
1833
+ for (const s of e)
1834
+ t[s.field] = "";
1643
1835
  this.data.searchParams = t;
1644
1836
  }
1645
1837
  /**
@@ -1666,8 +1858,8 @@ let Nt = class {
1666
1858
  syncRowRefs() {
1667
1859
  const { currentRow: t, detailData: e } = this.data;
1668
1860
  if (!t && !e) return;
1669
- const l = this.getKeyField(), d = (r) => r && this.data.rows.find((c) => c[l] === r[l]) || null;
1670
- this.data.currentRow = d(t), this.data.detailData && (this.data.detailData = d(this.data.detailData), this.data.detailData || (this.data.detailVisible = !1));
1861
+ const i = this.getKeyField(), s = (d) => d && this.data.rows.find((r) => r[i] === d[i]) || null;
1862
+ this.data.currentRow = s(t), this.data.detailData && (this.data.detailData = s(this.data.detailData), this.data.detailData || (this.data.detailVisible = !1));
1671
1863
  }
1672
1864
  /**
1673
1865
  * 搜索
@@ -1817,8 +2009,8 @@ let Nt = class {
1817
2009
  * 详情宽度:数字按 px 处理,字符串原样使用,默认 400px
1818
2010
  */
1819
2011
  getDetailWidth() {
1820
- var e, l;
1821
- const t = (l = (e = this.data.tableConfig) == null ? void 0 : e.detail) == null ? void 0 : l.width;
2012
+ var e, i;
2013
+ const t = (i = (e = this.data.tableConfig) == null ? void 0 : e.detail) == null ? void 0 : i.width;
1822
2014
  return typeof t == "number" && t > 0 ? `${t}px` : typeof t == "string" && t ? t : "400px";
1823
2015
  }
1824
2016
  /**
@@ -1949,7 +2141,7 @@ let Nt = class {
1949
2141
  return ((t = this.data.tableConfig) == null ? void 0 : t.pagination) || "page";
1950
2142
  }
1951
2143
  };
1952
- const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { class: "search-actions" }, Ot = /* @__PURE__ */ P({
2144
+ const Xt = { class: "table-search" }, Zt = { class: "search-fields" }, ea = { class: "search-actions" }, ta = /* @__PURE__ */ V({
1953
2145
  __name: "TableSearch",
1954
2146
  props: {
1955
2147
  fields: {},
@@ -1957,87 +2149,87 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
1957
2149
  },
1958
2150
  emits: ["update:modelValue", "search", "reset"],
1959
2151
  setup(o, { emit: t }) {
1960
- const e = o, l = t, d = {
2152
+ const e = o, i = t, s = {
1961
2153
  input: te,
1962
2154
  dict: ee,
1963
2155
  dept: ee,
1964
2156
  role: ee,
1965
- date: de,
1966
- daterange: de
1967
- }, r = {
2157
+ date: re,
2158
+ daterange: re
2159
+ }, d = {
1968
2160
  // 组件映射
1969
- getComponent(c) {
1970
- return d[c] || te;
2161
+ getComponent(r) {
2162
+ return s[r] || te;
1971
2163
  },
1972
2164
  // 更新搜索值
1973
- updateValue(c, s) {
1974
- const a = { ...e.modelValue, [c]: s };
1975
- l("update:modelValue", a);
2165
+ updateValue(r, c) {
2166
+ const a = { ...e.modelValue, [r]: c };
2167
+ i("update:modelValue", a);
1976
2168
  },
1977
2169
  // 搜索(查询字段值自动去除首尾空格)
1978
2170
  handleSearch() {
1979
- const c = {};
1980
- for (const s in e.modelValue) {
1981
- const a = e.modelValue[s];
1982
- c[s] = typeof a == "string" ? a.trim() : a;
2171
+ const r = {};
2172
+ for (const c in e.modelValue) {
2173
+ const a = e.modelValue[c];
2174
+ r[c] = typeof a == "string" ? a.trim() : a;
1983
2175
  }
1984
- l("update:modelValue", c), l("search");
2176
+ i("update:modelValue", r), i("search");
1985
2177
  },
1986
2178
  // 重置
1987
2179
  handleReset() {
1988
- l("reset");
2180
+ i("reset");
1989
2181
  }
1990
2182
  };
1991
- return (c, s) => {
1992
- const a = J;
1993
- return h(), y("div", Wt, [
1994
- C("div", qt, [
1995
- (h(!0), y(I, null, E(e.fields, (i) => (h(), y("div", {
1996
- key: i.field,
2183
+ return (r, c) => {
2184
+ const a = X;
2185
+ return g(), v("div", Xt, [
2186
+ x("div", Zt, [
2187
+ (g(!0), v(I, null, E(e.fields, (l) => (g(), v("div", {
2188
+ key: l.field,
1997
2189
  class: "search-field"
1998
2190
  }, [
1999
- (h(), S(H(r.getComponent(i.type)), {
2000
- "model-value": e.modelValue[i.field],
2001
- "field-label": i.label,
2002
- "dict-type": i.dictType,
2003
- mode: i.type === "daterange" ? "range" : void 0,
2191
+ (g(), S(J(d.getComponent(l.type)), {
2192
+ "model-value": e.modelValue[l.field],
2193
+ "field-label": l.label,
2194
+ "dict-type": l.dictType,
2195
+ mode: l.type === "daterange" ? "range" : void 0,
2004
2196
  "label-position": "left",
2005
- "onUpdate:modelValue": (n) => r.updateValue(i.field, n)
2197
+ "onUpdate:modelValue": (n) => d.updateValue(l.field, n)
2006
2198
  }, null, 8, ["model-value", "field-label", "dict-type", "mode", "onUpdate:modelValue"]))
2007
2199
  ]))), 128)),
2008
- T(c.$slots, "search-extra", {
2200
+ k(r.$slots, "search-extra", {
2009
2201
  params: e.modelValue,
2010
- update: r.updateValue
2202
+ update: d.updateValue
2011
2203
  }, void 0, !0)
2012
2204
  ]),
2013
- C("div", jt, [
2205
+ x("div", ea, [
2014
2206
  _(a, {
2015
2207
  type: "primary",
2016
- onClick: r.handleSearch
2208
+ onClick: d.handleSearch
2017
2209
  }, {
2018
- default: w(() => [...s[0] || (s[0] = [
2210
+ default: w(() => [...c[0] || (c[0] = [
2019
2211
  F("查询", -1)
2020
2212
  ])]),
2021
2213
  _: 1
2022
2214
  }, 8, ["onClick"]),
2023
2215
  _(a, {
2024
- onClick: r.handleReset
2216
+ onClick: d.handleReset
2025
2217
  }, {
2026
- default: w(() => [...s[1] || (s[1] = [
2218
+ default: w(() => [...c[1] || (c[1] = [
2027
2219
  F("重置", -1)
2028
2220
  ])]),
2029
2221
  _: 1
2030
2222
  }, 8, ["onClick"]),
2031
- T(c.$slots, "search-actions", {
2223
+ k(r.$slots, "search-actions", {
2032
2224
  params: e.modelValue,
2033
- search: r.handleSearch,
2034
- reset: r.handleReset
2225
+ search: d.handleSearch,
2226
+ reset: d.handleReset
2035
2227
  }, void 0, !0)
2036
2228
  ])
2037
2229
  ]);
2038
2230
  };
2039
2231
  }
2040
- }), Yt = /* @__PURE__ */ $(Ot, [["__scopeId", "data-v-09e61a77"]]), Qt = { class: "table-toolbar" }, Kt = { class: "toolbar-items" }, Ht = { key: 1 }, Gt = /* @__PURE__ */ P({
2232
+ }), aa = /* @__PURE__ */ $(ta, [["__scopeId", "data-v-0281d2ce"]]), oa = { class: "table-toolbar" }, la = { class: "toolbar-items" }, na = { key: 1 }, ia = /* @__PURE__ */ V({
2041
2233
  __name: "TableToolbar",
2042
2234
  props: {
2043
2235
  items: {},
@@ -2045,99 +2237,99 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2045
2237
  },
2046
2238
  emits: ["action"],
2047
2239
  setup(o, { emit: t }) {
2048
- const e = o, l = t, d = W({
2240
+ const e = o, i = t, s = z({
2049
2241
  // 图标组件缓存(@element-plus/icons-vue 按需加载)
2050
2242
  iconMap: {}
2051
- }), r = v(() => ({
2243
+ }), d = b(() => ({
2052
2244
  // 是否有当前行
2053
2245
  hasCurrentRow: !!e.currentRow
2054
- })), c = {
2246
+ })), r = {
2055
2247
  // 需要目标行的动作
2056
- needRow(s) {
2057
- return s === "edit" || s === "delete" || s === "preview";
2248
+ needRow(c) {
2249
+ return c === "edit" || c === "delete" || c === "preview";
2058
2250
  },
2059
2251
  // 按钮文字:不写按 action 取默认
2060
- getText(s) {
2061
- return s.text ? s.text : {
2252
+ getText(c) {
2253
+ return c.text ? c.text : {
2062
2254
  add: "新增",
2063
2255
  edit: "编辑",
2064
2256
  delete: "删除",
2065
2257
  preview: "预览",
2066
2258
  back: "返回"
2067
- }[s.action] || "";
2259
+ }[c.action] || "";
2068
2260
  },
2069
2261
  // 按钮样式:直接作为 el-button 的 type
2070
- getButtonType(s) {
2071
- return s.style ? s.style === "default" ? "" : s.style : {
2262
+ getButtonType(c) {
2263
+ return c.style ? c.style === "default" ? "" : c.style : {
2072
2264
  add: "primary",
2073
2265
  edit: "primary",
2074
2266
  delete: "danger",
2075
2267
  preview: "primary",
2076
2268
  back: "primary"
2077
- }[s.action] || "";
2269
+ }[c.action] || "";
2078
2270
  },
2079
2271
  // 是否禁用
2080
- isDisabled(s) {
2081
- return s.disabled ? !0 : c.needRow(s.action) && !r.value.hasCurrentRow;
2272
+ isDisabled(c) {
2273
+ return c.disabled ? !0 : r.needRow(c.action) && !d.value.hasCurrentRow;
2082
2274
  },
2083
2275
  // 图标组件
2084
- getIcon(s) {
2085
- return s.icon ? d.iconMap[s.icon] : null;
2276
+ getIcon(c) {
2277
+ return c.icon ? s.iconMap[c.icon] : null;
2086
2278
  },
2087
2279
  // 点击按钮:把 action 抛给父组件
2088
- handleClick(s) {
2089
- l("action", {
2090
- action: s.action,
2091
- item: s,
2280
+ handleClick(c) {
2281
+ i("action", {
2282
+ action: c.action,
2283
+ item: c,
2092
2284
  row: e.currentRow
2093
2285
  });
2094
2286
  },
2095
- // 按需加载图标(避免整包图标进产物)
2287
+ // 从静态引入的图标包中挑出用到的图标(静态引入见文件顶部注释)
2096
2288
  async ensureIcons() {
2097
- const s = [...new Set(e.items.map((n) => n.icon).filter(Boolean))];
2098
- if (s.length === 0) return;
2099
- const a = await import("@element-plus/icons-vue"), i = { ...d.iconMap };
2100
- for (const n of s)
2101
- a[n] && (i[n] = re(a[n]));
2102
- d.iconMap = re(i);
2289
+ const c = [...new Set(e.items.map((n) => n.icon).filter(Boolean))];
2290
+ if (c.length === 0) return;
2291
+ const a = $e, l = { ...s.iconMap };
2292
+ for (const n of c)
2293
+ a[n] && (l[n] = se(a[n]));
2294
+ s.iconMap = se(l);
2103
2295
  }
2104
2296
  };
2105
2297
  return oe(() => {
2106
- c.ensureIcons();
2298
+ r.ensureIcons();
2107
2299
  }), L(() => e.items, () => {
2108
- c.ensureIcons();
2109
- }), (s, a) => {
2110
- const i = ge, n = J;
2111
- return h(), y("div", Qt, [
2112
- T(s.$slots, "toolbar-left", {
2300
+ r.ensureIcons();
2301
+ }), (c, a) => {
2302
+ const l = ye, n = X;
2303
+ return g(), v("div", oa, [
2304
+ k(c.$slots, "toolbar-left", {
2113
2305
  currentRow: e.currentRow
2114
2306
  }, void 0, !0),
2115
- C("div", Kt, [
2116
- (h(!0), y(I, null, E(e.items, (f, m) => (h(), S(n, {
2307
+ x("div", la, [
2308
+ (g(!0), v(I, null, E(e.items, (u, m) => (g(), S(n, {
2117
2309
  key: m,
2118
- type: c.getButtonType(f),
2119
- disabled: c.isDisabled(f),
2120
- onClick: (u) => c.handleClick(f)
2310
+ type: r.getButtonType(u),
2311
+ disabled: r.isDisabled(u),
2312
+ onClick: (f) => r.handleClick(u)
2121
2313
  }, {
2122
2314
  default: w(() => [
2123
- c.getIcon(f) ? (h(), S(i, { key: 0 }, {
2315
+ r.getIcon(u) ? (g(), S(l, { key: 0 }, {
2124
2316
  default: w(() => [
2125
- (h(), S(H(c.getIcon(f))))
2317
+ (g(), S(J(r.getIcon(u))))
2126
2318
  ]),
2127
2319
  _: 2
2128
2320
  }, 1024)) : D("", !0),
2129
- c.getText(f) ? (h(), y("span", Ht, k(c.getText(f)), 1)) : D("", !0)
2321
+ r.getText(u) ? (g(), v("span", na, T(r.getText(u)), 1)) : D("", !0)
2130
2322
  ]),
2131
2323
  _: 2
2132
2324
  }, 1032, ["type", "disabled", "onClick"]))), 128))
2133
2325
  ]),
2134
- T(s.$slots, "toolbar-extra", {
2326
+ k(c.$slots, "toolbar-extra", {
2135
2327
  currentRow: e.currentRow
2136
2328
  }, void 0, !0)
2137
2329
  ]);
2138
2330
  };
2139
2331
  }
2140
- }), Jt = /* @__PURE__ */ $(Gt, [["__scopeId", "data-v-8f722515"]]), Xt = /* @__PURE__ */ P({
2332
+ }), sa = /* @__PURE__ */ $(ia, [["__scopeId", "data-v-2a87e101"]]), ra = /* @__PURE__ */ V({
2141
2333
  __name: "UInputShow",
2142
2334
  props: {
2143
2335
  modelValue: {},
@@ -2145,20 +2337,20 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2145
2337
  maxLines: { default: 0 }
2146
2338
  },
2147
2339
  setup(o) {
2148
- const t = o, e = v(() => t.modelValue === null || t.modelValue === void 0 ? "" : String(t.modelValue)), l = v(() => t.multiline || e.value.includes(`
2149
- `)), d = v(() => t.maxLines > 0 && l.value ? {
2340
+ const t = o, e = b(() => t.modelValue === null || t.modelValue === void 0 ? "" : String(t.modelValue)), i = b(() => t.multiline || e.value.includes(`
2341
+ `)), s = b(() => t.maxLines > 0 && i.value ? {
2150
2342
  display: "-webkit-box",
2151
2343
  WebkitLineClamp: t.maxLines,
2152
2344
  WebkitBoxOrient: "vertical",
2153
2345
  overflow: "hidden",
2154
2346
  textOverflow: "ellipsis"
2155
2347
  } : {});
2156
- return (r, c) => (h(), y("div", {
2157
- class: V(["u-input-show", { "u-input-multiline": l.value }]),
2158
- style: B(d.value)
2159
- }, k(e.value), 7));
2348
+ return (d, r) => (g(), v("div", {
2349
+ class: P(["u-input-show", { "u-input-multiline": i.value }]),
2350
+ style: B(s.value)
2351
+ }, T(e.value), 7));
2160
2352
  }
2161
- }), Zt = /* @__PURE__ */ $(Xt, [["__scopeId", "data-v-c78b151e"]]), ea = /* @__PURE__ */ P({
2353
+ }), da = /* @__PURE__ */ $(ra, [["__scopeId", "data-v-c78b151e"]]), ca = /* @__PURE__ */ V({
2162
2354
  __name: "UDictShow",
2163
2355
  props: {
2164
2356
  modelValue: {},
@@ -2166,7 +2358,7 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2166
2358
  defaultText: { default: "" }
2167
2359
  },
2168
2360
  setup(o) {
2169
- const t = o, e = Q(""), l = Q(!1), d = async () => {
2361
+ const t = o, e = Q(""), i = Q(!1), s = async () => {
2170
2362
  if (t.modelValue === null || t.modelValue === void 0 || t.modelValue === "") {
2171
2363
  e.value = t.defaultText;
2172
2364
  return;
@@ -2175,25 +2367,25 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2175
2367
  e.value = String(t.modelValue);
2176
2368
  return;
2177
2369
  }
2178
- l.value = !0;
2370
+ i.value = !0;
2179
2371
  try {
2180
- const r = await lt(t.dictType, t.modelValue, t.defaultText);
2181
- e.value = r;
2182
- } catch (r) {
2183
- console.error("[UDictShow] 翻译失败:", r), e.value = String(t.modelValue);
2372
+ const d = await pt(t.dictType, t.modelValue, t.defaultText);
2373
+ e.value = d;
2374
+ } catch (d) {
2375
+ console.error("[UDictShow] 翻译失败:", d), e.value = String(t.modelValue);
2184
2376
  } finally {
2185
- l.value = !1;
2377
+ i.value = !1;
2186
2378
  }
2187
2379
  };
2188
- return L(() => t.modelValue, d, { immediate: !0 }), L(() => t.dictType, () => {
2189
- t.dictType && ae(t.dictType).then(() => d());
2380
+ return L(() => t.modelValue, s, { immediate: !0 }), L(() => t.dictType, () => {
2381
+ t.dictType && ae(t.dictType).then(() => s());
2190
2382
  }), oe(() => {
2191
- t.dictType ? ae(t.dictType).then(() => d()) : d();
2192
- }), (r, c) => (h(), y("div", {
2193
- class: V(["u-dict-show", { "u-dict-loading": l.value }])
2194
- }, k(e.value), 3));
2383
+ t.dictType ? ae(t.dictType).then(() => s()) : s();
2384
+ }), (d, r) => (g(), v("div", {
2385
+ class: P(["u-dict-show", { "u-dict-loading": i.value }])
2386
+ }, T(e.value), 3));
2195
2387
  }
2196
- }), ta = /* @__PURE__ */ $(ea, [["__scopeId", "data-v-908045c4"]]), aa = /* @__PURE__ */ P({
2388
+ }), ua = /* @__PURE__ */ $(ca, [["__scopeId", "data-v-908045c4"]]), fa = /* @__PURE__ */ V({
2197
2389
  __name: "UToggleShow",
2198
2390
  props: {
2199
2391
  modelValue: {},
@@ -2202,12 +2394,12 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2202
2394
  useYesNo: { type: Boolean, default: !1 }
2203
2395
  },
2204
2396
  setup(o) {
2205
- const t = o, e = v(() => t.useYesNo ? "是" : t.trueText), l = v(() => t.useYesNo ? "否" : t.falseText), d = v(() => t.modelValue === !0 || t.modelValue === "true" ? e.value : t.modelValue === !1 || t.modelValue === "false" ? l.value : String(t.modelValue ?? "")), r = v(() => t.modelValue === !0 || t.modelValue === "true" ? "toggle-true" : t.modelValue === !1 || t.modelValue === "false" ? "toggle-false" : "toggle-default");
2206
- return (c, s) => (h(), y("div", {
2207
- class: V(["u-toggle-show", r.value])
2208
- }, k(d.value), 3));
2397
+ const t = o, e = b(() => t.useYesNo ? "是" : t.trueText), i = b(() => t.useYesNo ? "否" : t.falseText), s = b(() => t.modelValue === !0 || t.modelValue === "true" ? e.value : t.modelValue === !1 || t.modelValue === "false" ? i.value : String(t.modelValue ?? "")), d = b(() => t.modelValue === !0 || t.modelValue === "true" ? "toggle-true" : t.modelValue === !1 || t.modelValue === "false" ? "toggle-false" : "toggle-default");
2398
+ return (r, c) => (g(), v("div", {
2399
+ class: P(["u-toggle-show", d.value])
2400
+ }, T(s.value), 3));
2209
2401
  }
2210
- }), oa = /* @__PURE__ */ $(aa, [["__scopeId", "data-v-bac05efc"]]), la = /* @__PURE__ */ P({
2402
+ }), ma = /* @__PURE__ */ $(fa, [["__scopeId", "data-v-bac05efc"]]), pa = /* @__PURE__ */ V({
2211
2403
  __name: "UCascaderShow",
2212
2404
  props: {
2213
2405
  modelValue: {},
@@ -2216,35 +2408,35 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2216
2408
  showRawValue: { type: Boolean, default: !0 }
2217
2409
  },
2218
2410
  setup(o) {
2219
- const t = o, e = Q(""), l = Q(!1), d = async () => {
2411
+ const t = o, e = Q(""), i = Q(!1), s = async () => {
2220
2412
  if (!t.modelValue || !Array.isArray(t.modelValue)) {
2221
2413
  e.value = "";
2222
2414
  return;
2223
2415
  }
2224
- const r = t.modelValue;
2416
+ const d = t.modelValue;
2225
2417
  if (t.cascaderKey) {
2226
- l.value = !0;
2418
+ i.value = !0;
2227
2419
  try {
2228
- const c = await ae(t.cascaderKey), a = r.map((i) => {
2229
- const n = c.find((f) => f.value === i || String(f.value) === String(i));
2230
- return n ? n.label : t.showRawValue ? String(i) : "";
2231
- }).filter((i) => i !== "");
2420
+ const r = await ae(t.cascaderKey), a = d.map((l) => {
2421
+ const n = r.find((u) => u.value === l || String(u.value) === String(l));
2422
+ return n ? n.label : t.showRawValue ? String(l) : "";
2423
+ }).filter((l) => l !== "");
2232
2424
  e.value = a.join(t.separator);
2233
- } catch (c) {
2234
- console.error("[UCascaderShow] 翻译失败:", c), e.value = t.showRawValue ? r.join(t.separator) : "";
2425
+ } catch (r) {
2426
+ console.error("[UCascaderShow] 翻译失败:", r), e.value = t.showRawValue ? d.join(t.separator) : "";
2235
2427
  } finally {
2236
- l.value = !1;
2428
+ i.value = !1;
2237
2429
  }
2238
2430
  } else
2239
- e.value = r.join(t.separator);
2431
+ e.value = d.join(t.separator);
2240
2432
  };
2241
- return L(() => t.modelValue, d, { immediate: !0 }), oe(() => {
2242
- d();
2243
- }), (r, c) => (h(), y("div", {
2244
- class: V(["u-cascader-show", { "u-cascader-loading": l.value }])
2245
- }, k(e.value), 3));
2433
+ return L(() => t.modelValue, s, { immediate: !0 }), oe(() => {
2434
+ s();
2435
+ }), (d, r) => (g(), v("div", {
2436
+ class: P(["u-cascader-show", { "u-cascader-loading": i.value }])
2437
+ }, T(e.value), 3));
2246
2438
  }
2247
- }), na = /* @__PURE__ */ $(la, [["__scopeId", "data-v-5d84df67"]]), ia = /* @__PURE__ */ P({
2439
+ }), ha = /* @__PURE__ */ $(pa, [["__scopeId", "data-v-5d84df67"]]), ga = /* @__PURE__ */ V({
2248
2440
  __name: "UDateShow",
2249
2441
  props: {
2250
2442
  modelValue: {},
@@ -2255,19 +2447,19 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2255
2447
  rangeSeparator: { default: " ~ " }
2256
2448
  },
2257
2449
  setup(o) {
2258
- const t = o, e = v(() => t.locale === "en-US" ? t.mode === "range" ? " - " : ", " : t.mode === "range" ? t.rangeSeparator : t.separator), l = v(() => {
2259
- const c = t.modelValue;
2260
- return t.mode === "single" ? c ? d(c, t.format) : "" : t.mode === "multiple" ? c ? Array.isArray(c) ? c.map((s) => d(s, t.format)).join(e.value) : String(c) : "" : t.mode === "range" ? c ? typeof c == "object" && c.from && c.to ? `${d(c.from, t.format)}${e.value}${d(c.to, t.format)}` : Array.isArray(c) && c.length >= 2 ? `${d(c[0], t.format)}${e.value}${d(c[1], t.format)}` : String(c) : "" : String(c ?? "");
2450
+ const t = o, e = b(() => t.locale === "en-US" ? t.mode === "range" ? " - " : ", " : t.mode === "range" ? t.rangeSeparator : t.separator), i = b(() => {
2451
+ const r = t.modelValue;
2452
+ return t.mode === "single" ? r ? s(r, t.format) : "" : t.mode === "multiple" ? r ? Array.isArray(r) ? r.map((c) => s(c, t.format)).join(e.value) : String(r) : "" : t.mode === "range" ? r ? typeof r == "object" && r.from && r.to ? `${s(r.from, t.format)}${e.value}${s(r.to, t.format)}` : Array.isArray(r) && r.length >= 2 ? `${s(r[0], t.format)}${e.value}${s(r[1], t.format)}` : String(r) : "" : String(r ?? "");
2261
2453
  });
2262
- function d(c, s) {
2263
- return c || "";
2454
+ function s(r, c) {
2455
+ return r || "";
2264
2456
  }
2265
- const r = v(() => !l.value);
2266
- return (c, s) => (h(), y("div", {
2267
- class: V(["u-date-show", { "u-date-empty": r.value }])
2268
- }, k(l.value || (o.locale === "en-US" ? "Empty" : "暂无")), 3));
2457
+ const d = b(() => !i.value);
2458
+ return (r, c) => (g(), v("div", {
2459
+ class: P(["u-date-show", { "u-date-empty": d.value }])
2460
+ }, T(i.value || (o.locale === "en-US" ? "Empty" : "暂无")), 3));
2269
2461
  }
2270
- }), sa = /* @__PURE__ */ $(ia, [["__scopeId", "data-v-930657df"]]), ra = /* @__PURE__ */ P({
2462
+ }), ya = /* @__PURE__ */ $(ga, [["__scopeId", "data-v-930657df"]]), va = /* @__PURE__ */ V({
2271
2463
  __name: "UFieldView",
2272
2464
  props: {
2273
2465
  type: { default: "text" },
@@ -2285,20 +2477,20 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2285
2477
  defaultText: { default: "" }
2286
2478
  },
2287
2479
  setup(o) {
2288
- const t = o, e = v(() => {
2480
+ const t = o, e = b(() => {
2289
2481
  if (!t.text) return null;
2290
- const c = t.text.split("/");
2291
- return c.length >= 2 ? {
2292
- trueText: c[0].trim(),
2293
- falseText: c[1].trim()
2482
+ const r = t.text.split("/");
2483
+ return r.length >= 2 ? {
2484
+ trueText: r[0].trim(),
2485
+ falseText: r[1].trim()
2294
2486
  } : null;
2295
- }), l = v(() => {
2296
- var c;
2297
- return t.trueText || ((c = e.value) == null ? void 0 : c.trueText) || "开启";
2298
- }), d = v(() => {
2299
- var c;
2300
- return t.falseText || ((c = e.value) == null ? void 0 : c.falseText) || "关闭";
2301
- }), r = v(() => {
2487
+ }), i = b(() => {
2488
+ var r;
2489
+ return t.trueText || ((r = e.value) == null ? void 0 : r.trueText) || "开启";
2490
+ }), s = b(() => {
2491
+ var r;
2492
+ return t.falseText || ((r = e.value) == null ? void 0 : r.falseText) || "关闭";
2493
+ }), d = b(() => {
2302
2494
  switch (t.type) {
2303
2495
  case "dict":
2304
2496
  return "UDictShow";
@@ -2314,21 +2506,21 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2314
2506
  return "UInputShow";
2315
2507
  }
2316
2508
  });
2317
- return (c, s) => (h(), S(H(r.value === "UDictShow" ? ta : r.value === "UToggleShow" ? oa : r.value === "UCascaderShow" ? na : r.value === "UDateShow" ? sa : Zt), {
2509
+ return (r, c) => (g(), S(J(d.value === "UDictShow" ? ua : d.value === "UToggleShow" ? ma : d.value === "UCascaderShow" ? ha : d.value === "UDateShow" ? ya : da), {
2318
2510
  "model-value": o.modelValue,
2319
2511
  "dict-type": o.type === "dict" ? o.dictType : void 0,
2320
2512
  "cascader-key": o.type === "cascader" ? o.cascaderKey : void 0,
2321
2513
  mode: o.type === "date" ? o.mode : void 0,
2322
2514
  locale: o.type === "date" ? o.locale : void 0,
2323
2515
  format: o.type === "date" ? o.format : void 0,
2324
- "true-text": o.type === "switch" ? l.value : void 0,
2325
- "false-text": o.type === "switch" ? d.value : void 0,
2516
+ "true-text": o.type === "switch" ? i.value : void 0,
2517
+ "false-text": o.type === "switch" ? s.value : void 0,
2326
2518
  "use-yes-no": o.type === "switch" ? o.useYesNo : void 0,
2327
2519
  multiline: o.type === "input" || o.type === "text" ? o.multiline : void 0,
2328
2520
  "default-text": o.type === "dict" ? o.defaultText : void 0
2329
2521
  }, null, 8, ["model-value", "dict-type", "cascader-key", "mode", "locale", "format", "true-text", "false-text", "use-yes-no", "multiline", "default-text"]));
2330
2522
  }
2331
- }), xe = /* @__PURE__ */ $(ra, [["__scopeId", "data-v-fedb54d7"]]), da = { class: "table-grid" }, ca = /* @__PURE__ */ P({
2523
+ }), xe = /* @__PURE__ */ $(va, [["__scopeId", "data-v-05ef52d9"]]), ba = { class: "table-grid" }, ue = "col-", wa = 160, Ca = /* @__PURE__ */ V({
2332
2524
  // 属性/事件手动透传给 el-table,不再自动落到根节点
2333
2525
  inheritAttrs: !1,
2334
2526
  __name: "TableGrid",
@@ -2337,6 +2529,7 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2337
2529
  columns: {},
2338
2530
  loading: { type: Boolean },
2339
2531
  actions: {},
2532
+ actionsWidth: {},
2340
2533
  keyField: {},
2341
2534
  selection: { type: [String, Boolean] },
2342
2535
  dictData: {},
@@ -2344,206 +2537,240 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2344
2537
  },
2345
2538
  emits: ["rowAction", "rowClick", "selectionChange"],
2346
2539
  setup(o, { emit: t }) {
2347
- const e = o, l = ye(), d = t, r = v(() => ({
2348
- // 行操作按钮
2349
- actionList: e.actions || [],
2350
- // 操作列宽度:按按钮文字估算
2351
- actionColumnWidth: s.getActionColumnWidth(),
2352
- // 用户自己提供了 empty 插槽就用用户的,否则用内置空状态
2353
- hasUserEmpty: !!l.empty,
2354
- // 透传给 el-table 的插槽(default 由 <slot name="default"/> 单独渲染)
2355
- forwardSlots: Object.keys(l).filter((a) => a !== "default")
2356
- })), c = v(() => {
2357
- const a = e.columns.map((i) => {
2358
- const n = {
2359
- prop: i.field,
2360
- label: i.label
2540
+ const e = o, i = ve(), s = t;
2541
+ function d(l) {
2542
+ return l === "actions" || l === "actions-extra" || l.startsWith(ue);
2543
+ }
2544
+ const r = b(() => {
2545
+ var l, n;
2546
+ return {
2547
+ // 行操作按钮
2548
+ actionList: e.actions || [],
2549
+ // 操作列宽度:
2550
+ // 1) 显式配了 actionsWidth 就用它(插槽接管操作列时用得上,见文件头)
2551
+ // 2) 否则按 yaml actions 的文字长度估算
2552
+ // 3) yaml 没配 actions、只有插槽时给个兜底宽度,不然列会被挤成一条缝
2553
+ actionColumnWidth: e.actionsWidth ?? ((l = e.actions) != null && l.length ? a.getActionColumnWidth() : wa),
2554
+ // 用户自己提供了 empty 插槽就用用户的,否则用内置空状态
2555
+ hasUserEmpty: !!i.empty,
2556
+ // 透传给 el-table 的插槽(default 由 <slot name="default"/> 单独渲染,列插槽自己消费)
2557
+ forwardSlots: Object.keys(i).filter((u) => u !== "default" && !d(u)),
2558
+ // 使用方开了哪些列插槽(列名 = col-<field>)
2559
+ colSlots: Object.keys(i).filter((u) => u.startsWith(ue)),
2560
+ // 操作列是否被使用方接管(接管 = 替换 yaml 的那几个按钮)
2561
+ hasActionsSlot: !!i.actions,
2562
+ // 是否要在 yaml 按钮后面追加按钮
2563
+ hasActionsExtra: !!i["actions-extra"],
2564
+ // 操作列要不要出现:yaml 配了 actions、或使用方开了插槽
2565
+ showActionColumn: (((n = e.actions) == null ? void 0 : n.length) || 0) > 0 || !!i.actions || !!i["actions-extra"]
2566
+ };
2567
+ }), c = b(() => {
2568
+ const l = e.columns.map((n) => {
2569
+ const u = {
2570
+ prop: n.field,
2571
+ label: n.label
2361
2572
  };
2362
- return typeof i.width == "number" && (n.width = i.width), n;
2573
+ return typeof n.width == "number" && (u.width = n.width), u;
2363
2574
  });
2364
- return r.value.actionList.length > 0 && a.push({
2575
+ return r.value.showActionColumn && l.push({
2365
2576
  prop: "actions",
2366
2577
  label: "操作",
2367
2578
  width: r.value.actionColumnWidth,
2368
2579
  fixed: "right"
2369
- }), a;
2370
- }), s = {
2580
+ }), l;
2581
+ }), a = {
2582
+ /** field → 列插槽名(`login_id` → `col-login_id`,点号原样保留) */
2583
+ colSlotName(l) {
2584
+ return ue + l;
2585
+ },
2586
+ /** 该列是否被使用方的插槽接管 */
2587
+ hasColSlot(l) {
2588
+ return r.value.colSlots.includes(a.colSlotName(l));
2589
+ },
2371
2590
  // 行操作按钮文字
2372
- actionText(a) {
2373
- return a.text ? a.text : {
2591
+ actionText(l) {
2592
+ return l.text ? l.text : {
2374
2593
  add: "新增",
2375
2594
  edit: "编辑",
2376
2595
  delete: "删除",
2377
2596
  preview: "预览",
2378
2597
  back: "返回"
2379
- }[a.action] || "";
2598
+ }[l.action] || "";
2380
2599
  },
2381
2600
  // 行操作按钮样式(操作列里统一用 link 按钮,只换颜色)
2382
- actionType(a) {
2383
- return a.style ? a.style === "default" ? "" : a.style : {
2601
+ actionType(l) {
2602
+ return l.style ? l.style === "default" ? "" : l.style : {
2384
2603
  add: "primary",
2385
2604
  edit: "primary",
2386
2605
  delete: "danger",
2387
2606
  preview: "primary",
2388
2607
  back: "primary"
2389
- }[a.action] || "primary";
2608
+ }[l.action] || "primary";
2390
2609
  },
2391
2610
  // 操作列宽度:按各按钮文字长度估算
2392
2611
  getActionColumnWidth() {
2393
- const i = (e.actions || []).reduce((n, f) => n + Math.max(52, s.actionText(f).length * 16 + 12), 0);
2394
- return Math.max(80, Math.ceil(i) + 16);
2612
+ const n = (e.actions || []).reduce((u, m) => u + Math.max(52, a.actionText(m).length * 16 + 12), 0);
2613
+ return Math.max(80, Math.ceil(n) + 16);
2395
2614
  },
2396
2615
  // 手机号脱敏
2397
- maskPhone(a) {
2398
- return !a || a.length < 7 ? a : a.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
2616
+ maskPhone(l) {
2617
+ return !l || l.length < 7 ? l : l.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
2399
2618
  },
2400
2619
  // 身份证脱敏
2401
- maskIdCard(a) {
2402
- return !a || a.length < 8 ? a : a.replace(/(\d{3})\d{11}(\d{4})/, "$1***********$2");
2620
+ maskIdCard(l) {
2621
+ return !l || l.length < 8 ? l : l.replace(/(\d{3})\d{11}(\d{4})/, "$1***********$2");
2403
2622
  },
2404
2623
  // 金额格式化
2405
- formatMoney(a) {
2406
- const i = Number(a);
2407
- return isNaN(i) ? String(a) : i.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
2624
+ formatMoney(l) {
2625
+ const n = Number(l);
2626
+ return isNaN(n) ? String(l) : n.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
2408
2627
  },
2409
2628
  // 根据 format 类型格式化
2410
- formatByType(a, i) {
2411
- if (!a)
2629
+ formatByType(l, n) {
2630
+ if (!l)
2412
2631
  return "";
2413
- switch (i) {
2632
+ switch (n) {
2414
2633
  case "phone":
2415
- return s.maskPhone(a);
2634
+ return a.maskPhone(l);
2416
2635
  case "idcard":
2417
- return s.maskIdCard(a);
2636
+ return a.maskIdCard(l);
2418
2637
  case "money":
2419
- return s.formatMoney(a);
2638
+ return a.formatMoney(l);
2420
2639
  case "percent":
2421
- return String(a * 100) + "%";
2640
+ return String(l * 100) + "%";
2422
2641
  default:
2423
- return i && i.includes("{}") ? i.replace("{}", String(a)) : String(a);
2642
+ return n && n.includes("{}") ? n.replace("{}", String(l)) : String(l);
2424
2643
  }
2425
2644
  },
2426
2645
  // 获取嵌套字段值
2427
- getNestedValue(a, i) {
2428
- if (!i.includes("."))
2429
- return a[i];
2430
- const n = i.split(".");
2431
- let f = a;
2432
- for (const m of n)
2433
- if (f && typeof f == "object" && m in f)
2434
- f = f[m];
2646
+ getNestedValue(l, n) {
2647
+ if (!n.includes("."))
2648
+ return l[n];
2649
+ const u = n.split(".");
2650
+ let m = l;
2651
+ for (const f of u)
2652
+ if (m && typeof m == "object" && f in m)
2653
+ m = m[f];
2435
2654
  else
2436
2655
  return;
2437
- return f;
2656
+ return m;
2438
2657
  },
2439
2658
  // 判断是否需要使用 UFieldView 组件
2440
- useFieldView(a) {
2441
- return a.type ? ["dict", "switch", "cascader", "date", "input", "text"].includes(a.type) : !1;
2659
+ useFieldView(l) {
2660
+ return l.type ? ["dict", "switch", "cascader", "date", "input", "text"].includes(l.type) : !1;
2442
2661
  },
2443
2662
  // 当前行高亮(与详情/预览对应)
2444
- rowClassName({ row: a }) {
2445
- if (!a || e.activeKey === void 0 || e.activeKey === null) return "";
2446
- const i = e.keyField || "id";
2447
- return a[i] === e.activeKey ? "table-grid-active-row" : "";
2663
+ rowClassName({ row: l }) {
2664
+ if (!l || e.activeKey === void 0 || e.activeKey === null) return "";
2665
+ const n = e.keyField || "id";
2666
+ return l[n] === e.activeKey ? "table-grid-active-row" : "";
2448
2667
  },
2449
2668
  // 选择变化
2450
- onSelectionChange(a) {
2451
- d("selectionChange", a);
2669
+ onSelectionChange(l) {
2670
+ s("selectionChange", l);
2452
2671
  },
2453
2672
  // 行点击
2454
- onRowClick(a) {
2455
- d("rowClick", a);
2673
+ onRowClick(l) {
2674
+ s("rowClick", l);
2456
2675
  },
2457
2676
  // 行操作按钮点击
2458
- onRowAction(a, i) {
2459
- d("rowAction", {
2460
- action: a.action,
2461
- item: a,
2462
- row: i
2677
+ onRowAction(l, n) {
2678
+ s("rowAction", {
2679
+ action: l.action,
2680
+ item: l,
2681
+ row: n
2463
2682
  });
2464
2683
  }
2465
2684
  };
2466
- return (a, i) => {
2467
- const n = Qe, f = J, m = Ye;
2468
- return h(), y("div", da, [
2469
- _(m, ce({ stripe: !0, border: !0, ...a.$attrs }, {
2685
+ return (l, n) => {
2686
+ const u = He, m = X, f = Ke;
2687
+ return g(), v("div", ba, [
2688
+ _(f, de({ stripe: !0, border: !0, ...l.$attrs }, {
2470
2689
  data: e.rows.length ? e.rows : [{}],
2471
2690
  loading: e.loading,
2472
2691
  "row-key": e.keyField || "id",
2473
- "row-class-name": s.rowClassName,
2474
- onSelectionChange: s.onSelectionChange,
2475
- onRowClick: i[0] || (i[0] = (u) => s.onRowClick(u))
2476
- }), X({
2692
+ "row-class-name": a.rowClassName,
2693
+ onSelectionChange: a.onSelectionChange,
2694
+ onRowClick: n[0] || (n[0] = (p) => a.onRowClick(p))
2695
+ }), Z({
2477
2696
  default: w(() => [
2478
- e.selection ? (h(), S(n, {
2697
+ e.selection ? (g(), S(u, {
2479
2698
  key: 0,
2480
2699
  type: "selection",
2481
2700
  width: "55"
2482
2701
  })) : D("", !0),
2483
- (h(!0), y(I, null, E(c.value, (u) => (h(), S(n, {
2484
- key: u.prop,
2485
- prop: u.prop,
2486
- label: u.label,
2487
- width: u.width,
2488
- fixed: u.fixed
2702
+ (g(!0), v(I, null, E(c.value, (p) => (g(), S(u, {
2703
+ key: p.prop,
2704
+ prop: p.prop,
2705
+ label: p.label,
2706
+ width: p.width,
2707
+ fixed: p.fixed
2489
2708
  }, {
2490
- default: w(({ row: g }) => [
2491
- u.prop === "actions" ? (h(), y(I, { key: 0 }, [
2492
- Object.keys(g).length > 0 ? (h(!0), y(I, { key: 0 }, E(r.value.actionList, (p, b) => (h(), S(f, {
2493
- key: b,
2494
- link: "",
2495
- type: s.actionType(p),
2496
- disabled: p.disabled === !0,
2497
- size: "small",
2498
- onClick: Je((R) => s.onRowAction(p, g), ["stop"])
2499
- }, {
2500
- default: w(() => [
2501
- F(k(s.actionText(p)), 1)
2502
- ]),
2503
- _: 2
2504
- }, 1032, ["type", "disabled", "onClick"]))), 128)) : D("", !0)
2505
- ], 64)) : (h(), y(I, { key: 1 }, [
2506
- Object.keys(g).length > 0 ? (h(!0), y(I, { key: 0 }, E(e.columns, (p) => (h(), y(I, {
2507
- key: p.field
2709
+ default: w(({ row: h }) => [
2710
+ Object.keys(h).length > 0 ? (g(), v(I, { key: 0 }, [
2711
+ p.prop === "actions" ? (g(), v(I, { key: 0 }, [
2712
+ r.value.hasActionsSlot ? k(l.$slots, "actions", {
2713
+ row: h,
2714
+ actions: r.value.actionList
2715
+ }, void 0, !0, 1) : (g(!0), v(I, { key: 0 }, E(r.value.actionList, (y, A) => (g(), S(m, {
2716
+ key: A,
2717
+ link: "",
2718
+ type: a.actionType(y),
2719
+ disabled: y.disabled === !0,
2720
+ size: "small",
2721
+ onClick: et((K) => a.onRowAction(y, h), ["stop"])
2722
+ }, {
2723
+ default: w(() => [
2724
+ F(T(a.actionText(y)), 1)
2725
+ ]),
2726
+ _: 2
2727
+ }, 1032, ["type", "disabled", "onClick"]))), 128)),
2728
+ k(l.$slots, "actions-extra", { row: h }, void 0, !0)
2729
+ ], 64)) : a.hasColSlot(p.prop) ? k(l.$slots, a.colSlotName(p.prop), {
2730
+ row: h,
2731
+ value: a.getNestedValue(h, p.prop),
2732
+ column: p
2733
+ }, void 0, !0, 1) : (g(!0), v(I, { key: 2 }, E(e.columns, (y) => (g(), v(I, {
2734
+ key: y.field
2508
2735
  }, [
2509
- p.field === u.prop && s.useFieldView(p) ? (h(), S(xe, {
2736
+ y.field === p.prop && a.useFieldView(y) ? (g(), S(xe, {
2510
2737
  key: 0,
2511
- type: p.type,
2512
- "model-value": s.getNestedValue(g, p.field),
2513
- "dict-type": p.dictType,
2514
- mode: p.mode,
2515
- locale: p.locale,
2516
- format: p.format,
2517
- text: p.text,
2518
- "true-text": p.trueText,
2519
- "false-text": p.falseText,
2520
- "use-yes-no": p.useYesNo,
2521
- "cascader-key": p.cascaderKey,
2522
- multiline: p.multiline,
2523
- "default-text": p.defaultText
2524
- }, null, 8, ["type", "model-value", "dict-type", "mode", "locale", "format", "text", "true-text", "false-text", "use-yes-no", "cascader-key", "multiline", "default-text"])) : p.field === u.prop ? (h(), y("span", {
2738
+ type: y.type,
2739
+ "model-value": a.getNestedValue(h, y.field),
2740
+ "dict-type": y.dictType,
2741
+ mode: y.mode,
2742
+ locale: y.locale,
2743
+ format: y.format,
2744
+ text: y.text,
2745
+ "true-text": y.trueText,
2746
+ "false-text": y.falseText,
2747
+ "use-yes-no": y.useYesNo,
2748
+ "cascader-key": y.cascaderKey,
2749
+ multiline: y.multiline,
2750
+ "default-text": y.defaultText
2751
+ }, null, 8, ["type", "model-value", "dict-type", "mode", "locale", "format", "text", "true-text", "false-text", "use-yes-no", "cascader-key", "multiline", "default-text"])) : y.field === p.prop ? (g(), v("span", {
2525
2752
  key: 1,
2526
- class: V({ "table-grid-format": p.format })
2527
- }, k(s.formatByType(s.getNestedValue(g, p.field), p.format || "")), 3)) : D("", !0)
2528
- ], 64))), 128)) : D("", !0)
2529
- ], 64))
2753
+ class: P({ "table-grid-format": y.format })
2754
+ }, T(a.formatByType(a.getNestedValue(h, y.field), y.format || "")), 3)) : D("", !0)
2755
+ ], 64))), 128))
2756
+ ], 64)) : D("", !0)
2530
2757
  ]),
2531
2758
  _: 2
2532
2759
  }, 1032, ["prop", "label", "width", "fixed"]))), 128)),
2533
- T(a.$slots, "default", {}, void 0, !0)
2760
+ k(l.$slots, "default", {}, void 0, !0)
2534
2761
  ]),
2535
2762
  _: 2
2536
2763
  }, [
2537
- E(r.value.forwardSlots, (u) => ({
2538
- name: u,
2539
- fn: w((g) => [
2540
- T(a.$slots, u, q(j(g || {})), void 0, !0)
2764
+ E(r.value.forwardSlots, (p) => ({
2765
+ name: p,
2766
+ fn: w((h) => [
2767
+ k(l.$slots, p, q(O(h || {})), void 0, !0)
2541
2768
  ])
2542
2769
  })),
2543
2770
  r.value.hasUserEmpty ? void 0 : {
2544
2771
  name: "empty",
2545
2772
  fn: w(() => [
2546
- i[1] || (i[1] = C("div", { class: "no-data" }, "暂无数据", -1))
2773
+ n[1] || (n[1] = x("div", { class: "no-data" }, "暂无数据", -1))
2547
2774
  ]),
2548
2775
  key: "0"
2549
2776
  }
@@ -2551,13 +2778,13 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2551
2778
  ]);
2552
2779
  };
2553
2780
  }
2554
- }), ua = /* @__PURE__ */ $(ca, [["__scopeId", "data-v-ca606e7b"]]), fa = { class: "table-pagination" }, ma = { class: "page-size-select" }, pa = { class: "total-text" }, ha = {
2781
+ }), xa = /* @__PURE__ */ $(Ca, [["__scopeId", "data-v-d3eed11d"]]), _a = { class: "table-pagination" }, Sa = { class: "page-size-select" }, Da = { class: "total-text" }, ka = {
2555
2782
  key: 1,
2556
2783
  class: "load-more"
2557
- }, ga = {
2784
+ }, Ta = {
2558
2785
  key: 2,
2559
2786
  class: "total-text"
2560
- }, ya = /* @__PURE__ */ P({
2787
+ }, Pa = /* @__PURE__ */ V({
2561
2788
  __name: "TablePagination",
2562
2789
  props: {
2563
2790
  page: {},
@@ -2567,88 +2794,88 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2567
2794
  },
2568
2795
  emits: ["update:page", "update:pageSize"],
2569
2796
  setup(o, { emit: t }) {
2570
- const e = o, l = t, d = v(() => ({
2797
+ const e = o, i = t, s = b(() => ({
2571
2798
  // 总页数
2572
2799
  totalPages: Math.ceil(e.total / e.pageSize),
2573
2800
  // 是否显示分页
2574
2801
  showPagination: e.type === "page" && e.total > 0
2575
- })), r = {
2802
+ })), d = {
2576
2803
  // 页码变化
2577
- onPageChange: (c) => {
2578
- l("update:page", c);
2804
+ onPageChange: (r) => {
2805
+ i("update:page", r);
2579
2806
  },
2580
2807
  // 每页条数变化
2581
- onPageSizeChange: (c) => {
2582
- l("update:pageSize", c);
2808
+ onPageSizeChange: (r) => {
2809
+ i("update:pageSize", r);
2583
2810
  }
2584
2811
  };
2585
- return (c, s) => {
2586
- const a = Ke, i = he, n = pe, f = J;
2587
- return h(), y("div", fa, [
2588
- d.value.showPagination ? (h(), y(I, { key: 0 }, [
2812
+ return (r, c) => {
2813
+ const a = Je, l = ge, n = he, u = X;
2814
+ return g(), v("div", _a, [
2815
+ s.value.showPagination ? (g(), v(I, { key: 0 }, [
2589
2816
  _(a, {
2590
2817
  "current-page": e.page,
2591
- "page-count": d.value.totalPages,
2818
+ "page-count": s.value.totalPages,
2592
2819
  "page-sizes": [10, 20, 50, 100],
2593
2820
  "page-size": e.pageSize,
2594
2821
  layout: "total, prev, pager, next, jumper",
2595
- onCurrentChange: r.onPageChange,
2596
- onSizeChange: r.onPageSizeChange
2822
+ onCurrentChange: d.onPageChange,
2823
+ onSizeChange: d.onPageSizeChange
2597
2824
  }, null, 8, ["current-page", "page-count", "page-size", "onCurrentChange", "onSizeChange"]),
2598
- C("div", ma, [
2825
+ x("div", Sa, [
2599
2826
  _(n, {
2600
2827
  "model-value": e.pageSize,
2601
2828
  style: { width: "100px" },
2602
- onChange: r.onPageSizeChange
2829
+ onChange: d.onPageSizeChange
2603
2830
  }, {
2604
2831
  default: w(() => [
2605
- _(i, {
2832
+ _(l, {
2606
2833
  value: 10,
2607
2834
  label: "10条/页"
2608
2835
  }),
2609
- _(i, {
2836
+ _(l, {
2610
2837
  value: 20,
2611
2838
  label: "20条/页"
2612
2839
  }),
2613
- _(i, {
2840
+ _(l, {
2614
2841
  value: 50,
2615
2842
  label: "50条/页"
2616
2843
  }),
2617
- _(i, {
2844
+ _(l, {
2618
2845
  value: 100,
2619
2846
  label: "100条/页"
2620
2847
  })
2621
2848
  ]),
2622
2849
  _: 1
2623
2850
  }, 8, ["model-value", "onChange"]),
2624
- C("span", pa, "共 " + k(e.total) + " 条", 1)
2851
+ x("span", Da, "共 " + T(e.total) + " 条", 1)
2625
2852
  ])
2626
- ], 64)) : e.type === "auto" ? (h(), y("div", ha, [
2627
- _(f, {
2853
+ ], 64)) : e.type === "auto" ? (g(), v("div", ka, [
2854
+ _(u, {
2628
2855
  disabled: e.page * e.pageSize >= e.total
2629
2856
  }, {
2630
- default: w(() => [...s[0] || (s[0] = [
2857
+ default: w(() => [...c[0] || (c[0] = [
2631
2858
  F("加载更多", -1)
2632
2859
  ])]),
2633
2860
  _: 1
2634
2861
  }, 8, ["disabled"])
2635
- ])) : e.type === "all" ? (h(), y("div", ga, "共 " + k(e.total) + " 条", 1)) : D("", !0)
2862
+ ])) : e.type === "all" ? (g(), v("div", Ta, "共 " + T(e.total) + " 条", 1)) : D("", !0)
2636
2863
  ]);
2637
2864
  };
2638
2865
  }
2639
- }), ba = /* @__PURE__ */ $(ya, [["__scopeId", "data-v-53e593aa"]]), va = { class: "table-detail" }, wa = {
2866
+ }), Va = /* @__PURE__ */ $(Pa, [["__scopeId", "data-v-2ca77d18"]]), $a = { class: "table-detail" }, Aa = {
2640
2867
  key: 0,
2641
2868
  class: "detail-header"
2642
- }, xa = { class: "detail-title" }, Ca = { class: "detail-body" }, _a = {
2869
+ }, Ra = { class: "detail-title" }, Ia = { class: "detail-body" }, Ma = {
2643
2870
  key: 0,
2644
2871
  class: "detail-status"
2645
- }, Sa = {
2872
+ }, Ea = {
2646
2873
  key: 1,
2647
2874
  class: "detail-content"
2648
- }, Da = { class: "detail-label" }, ka = { class: "detail-value" }, Ta = {
2875
+ }, Ua = { class: "detail-label" }, Ba = { class: "detail-value" }, Fa = {
2649
2876
  key: 2,
2650
2877
  class: "detail-status"
2651
- }, Va = /* @__PURE__ */ P({
2878
+ }, La = /* @__PURE__ */ V({
2652
2879
  __name: "TableDetail",
2653
2880
  props: {
2654
2881
  showHeader: { type: Boolean },
@@ -2660,7 +2887,7 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2660
2887
  extraMode: {}
2661
2888
  },
2662
2889
  setup(o) {
2663
- const t = o, e = ye(), l = v(() => !!e["detail-extra"]), d = v(() => l.value), r = v(() => !l.value || t.extraMode === "append"), c = v(() => ({
2890
+ const t = o, e = ve(), i = b(() => !!e["detail-extra"]), s = b(() => i.value), d = b(() => !i.value || t.extraMode === "append"), r = b(() => ({
2664
2891
  // 标题栏
2665
2892
  showHeader: t.showHeader !== !1,
2666
2893
  // 面板标题
@@ -2669,38 +2896,38 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2669
2896
  emptyText: t.emptyText || "暂无数据",
2670
2897
  // 是否有记录可展示
2671
2898
  hasRow: !!t.rowData
2672
- })), s = {
2899
+ })), c = {
2673
2900
  // 获取嵌套字段值
2674
- getNestedValue(a, i) {
2675
- if (!a || !i) return "";
2676
- if (!i.includes("."))
2677
- return a[i];
2678
- const n = i.split(".");
2679
- let f = a;
2901
+ getNestedValue(a, l) {
2902
+ if (!a || !l) return "";
2903
+ if (!l.includes("."))
2904
+ return a[l];
2905
+ const n = l.split(".");
2906
+ let u = a;
2680
2907
  for (const m of n)
2681
- if (f && typeof f == "object" && m in f)
2682
- f = f[m];
2908
+ if (u && typeof u == "object" && m in u)
2909
+ u = u[m];
2683
2910
  else
2684
2911
  return "";
2685
- return f;
2912
+ return u;
2686
2913
  }
2687
2914
  };
2688
- return (a, i) => (h(), y("div", va, [
2689
- c.value.showHeader ? (h(), y("div", wa, [
2690
- C("div", xa, k(c.value.title), 1)
2915
+ return (a, l) => (g(), v("div", $a, [
2916
+ r.value.showHeader ? (g(), v("div", Aa, [
2917
+ x("div", Ra, T(r.value.title), 1)
2691
2918
  ])) : D("", !0),
2692
- C("div", Ca, [
2693
- r.value ? (h(), y(I, { key: 0 }, [
2694
- t.loading ? (h(), y("div", _a, "加载中...")) : c.value.hasRow ? (h(), y("div", Sa, [
2695
- (h(!0), y(I, null, E(t.columns, (n) => (h(), y("div", {
2919
+ x("div", Ia, [
2920
+ d.value ? (g(), v(I, { key: 0 }, [
2921
+ t.loading ? (g(), v("div", Ma, "加载中...")) : r.value.hasRow ? (g(), v("div", Ea, [
2922
+ (g(!0), v(I, null, E(t.columns, (n) => (g(), v("div", {
2696
2923
  key: n.field,
2697
2924
  class: "detail-item"
2698
2925
  }, [
2699
- C("div", Da, k(n.label), 1),
2700
- C("div", ka, [
2926
+ x("div", Ua, T(n.label), 1),
2927
+ x("div", Ba, [
2701
2928
  _(xe, {
2702
2929
  type: n.type,
2703
- "model-value": s.getNestedValue(t.rowData, n.field),
2930
+ "model-value": c.getNestedValue(t.rowData, n.field),
2704
2931
  "dict-type": n.dictType,
2705
2932
  mode: n.mode,
2706
2933
  locale: n.locale,
@@ -2715,16 +2942,16 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2715
2942
  }, null, 8, ["type", "model-value", "dict-type", "mode", "locale", "format", "text", "true-text", "false-text", "use-yes-no", "cascader-key", "multiline", "default-text"])
2716
2943
  ])
2717
2944
  ]))), 128))
2718
- ])) : (h(), y("div", Ta, k(c.value.emptyText), 1))
2945
+ ])) : (g(), v("div", Fa, T(r.value.emptyText), 1))
2719
2946
  ], 64)) : D("", !0),
2720
- d.value ? T(a.$slots, "detail-extra", {
2947
+ s.value ? k(a.$slots, "detail-extra", {
2721
2948
  rowData: t.rowData,
2722
2949
  columns: t.columns
2723
2950
  }, void 0, !0, 1) : D("", !0)
2724
2951
  ])
2725
2952
  ]));
2726
2953
  }
2727
- }), ue = /* @__PURE__ */ $(Va, [["__scopeId", "data-v-3314a22f"]]), Pa = { class: "table-body" }, $a = { class: "table-container" }, Ra = /* @__PURE__ */ P({
2954
+ }), fe = /* @__PURE__ */ $(La, [["__scopeId", "data-v-7e47b0ba"]]), Na = { class: "table-body" }, Wa = { class: "table-container" }, za = /* @__PURE__ */ V({
2728
2955
  // 属性/事件手动处理:class/style 留根节点,其余透传给 el-table
2729
2956
  inheritAttrs: !1,
2730
2957
  __name: "TableRender",
@@ -2734,7 +2961,7 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2734
2961
  },
2735
2962
  emits: ["back", "toolbar-action", "row-action"],
2736
2963
  setup(o, { expose: t, emit: e }) {
2737
- const l = ["search-extra", "search-actions", "toolbar-left", "toolbar-extra", "detail-extra"], d = o, r = Xe(), c = ye(), s = e, a = new Nt(), i = Q(null), n = W({
2964
+ const i = ["search-extra", "search-actions", "toolbar-left", "toolbar-extra", "detail-extra"], s = o, d = tt(), r = ve(), c = e, a = new Jt(), l = Q(null), n = z({
2738
2965
  // 内部搜索参数
2739
2966
  searchParams: {},
2740
2967
  // 是否已加载配置
@@ -2743,9 +2970,9 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2743
2970
  dictData: {}
2744
2971
  });
2745
2972
  oe(async () => {
2746
- d.formId && await m.loadConfig(d.formId);
2973
+ s.formId && await m.loadConfig(s.formId);
2747
2974
  });
2748
- const f = v(() => ({
2975
+ const u = b(() => ({
2749
2976
  // 表格配置
2750
2977
  tableConfig: a.data.tableConfig,
2751
2978
  // 表格数据
@@ -2797,15 +3024,15 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2797
3024
  // ============ 透传相关 ============
2798
3025
  // 透传给 el-table 的属性/事件(class、style 留在本组件根节点)
2799
3026
  getTableAttrs() {
2800
- const { class: u, style: g, ...p } = r;
2801
- return p;
3027
+ const { class: f, style: p, ...h } = d;
3028
+ return h;
2802
3029
  },
2803
3030
  // 透传给 el-table 的插槽(本组件自己消费的插槽除外)
2804
3031
  getTableSlots() {
2805
- const u = {};
2806
- for (const g of Object.keys(c))
2807
- l.includes(g) || (u[g] = !0);
2808
- return u;
3032
+ const f = {};
3033
+ for (const p of Object.keys(r))
3034
+ i.includes(p) || (f[p] = !0);
3035
+ return f;
2809
3036
  },
2810
3037
  // 转发给 TableDetail 的插槽:**页面真的给了才转发**。
2811
3038
  // 为什么必须判断:TableDetail 用「有没有 detail-extra 插槽」决定要不要渲染默认的
@@ -2813,19 +3040,19 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2813
3040
  // 认为「有插槽」→ replace 模式下详情区会变成空白。
2814
3041
  // (返回类型必须显式写:否则与 slots 互相推导会触发 TS7022/TS7023)
2815
3042
  getDetailSlots() {
2816
- return c["detail-extra"] ? ["detail-extra"] : [];
3043
+ return r["detail-extra"] ? ["detail-extra"] : [];
2817
3044
  },
2818
3045
  // 传给 TableDetail 的插槽/默认内容关系(页面没给插槽时无所谓,给了才生效)
2819
3046
  getDetailExtraMode() {
2820
- return d.detailExtraMode === "append" ? "append" : "replace";
3047
+ return s.detailExtraMode === "append" ? "append" : "replace";
2821
3048
  },
2822
3049
  // ============ 配置与数据 ============
2823
3050
  // 加载配置
2824
- async loadConfig(u) {
3051
+ async loadConfig(f) {
2825
3052
  try {
2826
- await a.loadConfig(u);
2827
- } catch (g) {
2828
- U((g == null ? void 0 : g.message) || "获取表格配置失败");
3053
+ await a.loadConfig(f);
3054
+ } catch (p) {
3055
+ U((p == null ? void 0 : p.message) || "获取表格配置失败");
2829
3056
  return;
2830
3057
  }
2831
3058
  n.searchParams = { ...a.data.searchParams }, n.loaded = !0, await m.loadDictData(), await m.handleLoadData();
@@ -2834,21 +3061,21 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2834
3061
  async handleLoadData() {
2835
3062
  try {
2836
3063
  await a.loadData();
2837
- } catch (u) {
2838
- U((u == null ? void 0 : u.message) || "加载数据失败");
3064
+ } catch (f) {
3065
+ U((f == null ? void 0 : f.message) || "加载数据失败");
2839
3066
  }
2840
3067
  },
2841
3068
  // 加载字典数据
2842
3069
  async loadDictData() {
2843
- const u = a.getColumns(), g = /* @__PURE__ */ new Set();
2844
- for (const p of u)
2845
- p.type === "dict" && p.dictType && g.add(p.dictType);
2846
- for (const p of g)
3070
+ const f = a.getColumns(), p = /* @__PURE__ */ new Set();
3071
+ for (const h of f)
3072
+ h.type === "dict" && h.dictType && p.add(h.dictType);
3073
+ for (const h of p)
2847
3074
  try {
2848
- const b = await M.get(K.dictApi(p));
2849
- b.status === 200 && (n.dictData[p] = we(b.data));
2850
- } catch (b) {
2851
- console.error(`[TableRender] 加载字典 ${p} 失败:`, b);
3075
+ const y = await M().Get(G.dictApi(h));
3076
+ y.status === 200 && (n.dictData[h] = Ce(y.data));
3077
+ } catch (y) {
3078
+ console.error(`[TableRender] 加载字典 ${h} 失败:`, y);
2852
3079
  }
2853
3080
  },
2854
3081
  // 搜索
@@ -2856,8 +3083,8 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2856
3083
  a.data.searchParams = { ...n.searchParams };
2857
3084
  try {
2858
3085
  await a.search();
2859
- } catch (u) {
2860
- U((u == null ? void 0 : u.message) || "查询失败");
3086
+ } catch (f) {
3087
+ U((f == null ? void 0 : f.message) || "查询失败");
2861
3088
  }
2862
3089
  },
2863
3090
  // 重置
@@ -2865,34 +3092,34 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2865
3092
  n.searchParams = {};
2866
3093
  try {
2867
3094
  await a.reset();
2868
- } catch (u) {
2869
- U((u == null ? void 0 : u.message) || "重置失败");
3095
+ } catch (f) {
3096
+ U((f == null ? void 0 : f.message) || "重置失败");
2870
3097
  }
2871
3098
  },
2872
3099
  // 更新搜索参数
2873
- updateSearchParam(u, g) {
2874
- n.searchParams[u] = g;
3100
+ updateSearchParam(f, p) {
3101
+ n.searchParams[f] = p;
2875
3102
  },
2876
3103
  // 分页变化
2877
- async handlePageChange(u) {
3104
+ async handlePageChange(f) {
2878
3105
  try {
2879
- await a.changePage(u);
2880
- } catch (g) {
2881
- U((g == null ? void 0 : g.message) || "加载数据失败");
3106
+ await a.changePage(f);
3107
+ } catch (p) {
3108
+ U((p == null ? void 0 : p.message) || "加载数据失败");
2882
3109
  }
2883
3110
  },
2884
3111
  // 每页条数变化
2885
- async handlePageSizeChange(u) {
3112
+ async handlePageSizeChange(f) {
2886
3113
  try {
2887
- await a.changePageSize(u);
2888
- } catch (g) {
2889
- U((g == null ? void 0 : g.message) || "加载数据失败");
3114
+ await a.changePageSize(f);
3115
+ } catch (p) {
3116
+ U((p == null ? void 0 : p.message) || "加载数据失败");
2890
3117
  }
2891
3118
  },
2892
3119
  // ============ 行 / 详情 / 预览 ============
2893
3120
  // 行点击:设为当前行(配置了 detail 时同时刷新详情区)
2894
- handleRowClick(u) {
2895
- a.setCurrentRow(u);
3121
+ handleRowClick(f) {
3122
+ a.setCurrentRow(f);
2896
3123
  },
2897
3124
  // 关闭详情
2898
3125
  handleDetailClose() {
@@ -2911,81 +3138,81 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2911
3138
  a.resetPreview();
2912
3139
  },
2913
3140
  // 预览一行(只读,用抽屉展示)
2914
- handlePreview(u) {
2915
- if (!u) {
2916
- z.warning("请先点击表格中的一行数据");
3141
+ handlePreview(f) {
3142
+ if (!f) {
3143
+ N.warning("请先点击表格中的一行数据");
2917
3144
  return;
2918
3145
  }
2919
- a.openPreview(u);
3146
+ a.openPreview(f);
2920
3147
  },
2921
3148
  // ============ 按钮动作分发 ============
2922
3149
  // 工具栏按钮点击
2923
- handleToolbarAction(u) {
2924
- s("toolbar-action", u), m.dispatchAction(u);
3150
+ handleToolbarAction(f) {
3151
+ c("toolbar-action", f), m.dispatchAction(f);
2925
3152
  },
2926
3153
  // 行操作按钮点击
2927
- handleRowAction(u) {
2928
- s("row-action", u), m.dispatchAction(u);
3154
+ handleRowAction(f) {
3155
+ c("row-action", f), m.dispatchAction(f);
2929
3156
  },
2930
3157
  // 按 action 分发
2931
- async dispatchAction(u) {
2932
- switch (u.action) {
3158
+ async dispatchAction(f) {
3159
+ switch (f.action) {
2933
3160
  case "add":
2934
- await m.handleAdd(u.item);
3161
+ await m.handleAdd(f.item);
2935
3162
  break;
2936
3163
  case "edit":
2937
- await m.handleEdit(u.row, u.item);
3164
+ await m.handleEdit(f.row, f.item);
2938
3165
  break;
2939
3166
  case "delete":
2940
- await m.handleDelete(u.row, u.item);
3167
+ await m.handleDelete(f.row, f.item);
2941
3168
  break;
2942
3169
  case "preview":
2943
- m.handlePreview(u.row);
3170
+ m.handlePreview(f.row);
2944
3171
  break;
2945
3172
  case "back":
2946
- s("back", u);
3173
+ c("back", f);
2947
3174
  break;
2948
3175
  case "export":
2949
3176
  await m.handleExport();
2950
3177
  break;
2951
3178
  default:
2952
- await m.handleCustomAction(u);
3179
+ await m.handleCustomAction(f);
2953
3180
  }
2954
3181
  },
2955
3182
  // 新增:打开表单(表单 id 优先取按钮自己的 form)
2956
- async handleAdd(u) {
2957
- const g = u ? a.getButtonFormId(u) : a.getFormId();
2958
- if (!g) {
2959
- z.warning("未配置表单,无法新增");
3183
+ async handleAdd(f) {
3184
+ const p = f ? a.getButtonFormId(f) : a.getFormId();
3185
+ if (!p) {
3186
+ N.warning("未配置表单,无法新增");
2960
3187
  return;
2961
3188
  }
2962
- if (!i.value) return;
2963
- await i.value.showForm(g) != null && await m.handleLoadData();
3189
+ if (!l.value) return;
3190
+ await l.value.showForm(p) != null && await m.handleLoadData();
2964
3191
  },
2965
3192
  // 编辑:打开表单并回显目标行
2966
- async handleEdit(u, g) {
2967
- if (!u) {
2968
- z.warning("请先点击表格中的一行数据");
3193
+ async handleEdit(f, p) {
3194
+ if (!f) {
3195
+ N.warning("请先点击表格中的一行数据");
2969
3196
  return;
2970
3197
  }
2971
- const p = g ? a.getButtonFormId(g) : a.getFormId();
2972
- if (!p) {
2973
- z.warning("未配置表单,无法编辑");
3198
+ const h = p ? a.getButtonFormId(p) : a.getFormId();
3199
+ if (!h) {
3200
+ N.warning("未配置表单,无法编辑");
2974
3201
  return;
2975
3202
  }
2976
- if (!i.value) return;
2977
- const b = a.getKeyField();
2978
- await i.value.showForm(p, `${b}=${u[b]}`) != null && await m.handleLoadData();
3203
+ if (!l.value) return;
3204
+ const y = a.getKeyField();
3205
+ await l.value.showForm(h, `${y}=${f[y]}`) != null && await m.handleLoadData();
2979
3206
  },
2980
3207
  // 删除:二次确认后删除目标行
2981
- async handleDelete(u, g) {
2982
- if (!u) {
2983
- z.warning("请先点击表格中的一行数据");
3208
+ async handleDelete(f, p) {
3209
+ if (!f) {
3210
+ N.warning("请先点击表格中的一行数据");
2984
3211
  return;
2985
3212
  }
2986
3213
  try {
2987
- await De.confirm(
2988
- (g == null ? void 0 : g.confirm) || "确定要删除这条数据吗?",
3214
+ await Te.confirm(
3215
+ (p == null ? void 0 : p.confirm) || "确定要删除这条数据吗?",
2989
3216
  "确认删除",
2990
3217
  {
2991
3218
  confirmButtonText: "确定",
@@ -2997,28 +3224,28 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
2997
3224
  return;
2998
3225
  }
2999
3226
  try {
3000
- await a.deleteRow(u), z.success("删除成功");
3001
- } catch (p) {
3002
- U((p == null ? void 0 : p.message) || "删除失败");
3227
+ await a.deleteRow(f), N.success("删除成功");
3228
+ } catch (h) {
3229
+ U((h == null ? void 0 : h.message) || "删除失败");
3003
3230
  }
3004
3231
  },
3005
3232
  // 导出(需要配置 api.export)
3006
3233
  async handleExport() {
3007
3234
  try {
3008
- await a.exportData(), z.success("导出成功");
3009
- } catch (u) {
3010
- U((u == null ? void 0 : u.message) || "导出失败");
3235
+ await a.exportData(), N.success("导出成功");
3236
+ } catch (f) {
3237
+ U((f == null ? void 0 : f.message) || "导出失败");
3011
3238
  }
3012
3239
  },
3013
3240
  // 自定义动作:按钮配了 url 就 POST 该地址(body = 目标行)
3014
- async handleCustomAction(u) {
3015
- const { item: g, row: p } = u;
3016
- if (!(g != null && g.url)) {
3017
- z.warning(`未识别的按钮动作:${u.action}`);
3241
+ async handleCustomAction(f) {
3242
+ const { item: p, row: h } = f;
3243
+ if (!(p != null && p.url)) {
3244
+ N.warning(`未识别的按钮动作:${f.action}`);
3018
3245
  return;
3019
3246
  }
3020
3247
  try {
3021
- await De.confirm(g.confirm || "确定执行该操作吗?", "确认", {
3248
+ await Te.confirm(p.confirm || "确定执行该操作吗?", "确认", {
3022
3249
  confirmButtonText: "确定",
3023
3250
  cancelButtonText: "取消",
3024
3251
  type: "warning"
@@ -3027,413 +3254,209 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, jt = { cl
3027
3254
  return;
3028
3255
  }
3029
3256
  try {
3030
- const b = await M.post(g.url, p || {});
3031
- if (b.status !== 200)
3032
- throw new Error(b.message || "操作失败");
3033
- z.success(b.message || "操作成功"), await m.handleLoadData();
3034
- } catch (b) {
3035
- U((b == null ? void 0 : b.message) || "操作失败");
3257
+ const y = await M().Post(p.url, h || {});
3258
+ if (y.status !== 200)
3259
+ throw new Error(y.message || "操作失败");
3260
+ N.success(y.message || "操作成功"), await m.handleLoadData();
3261
+ } catch (y) {
3262
+ U((y == null ? void 0 : y.message) || "操作失败");
3036
3263
  }
3037
3264
  }
3038
3265
  };
3039
3266
  return t({
3040
3267
  loadConfig: m.loadConfig
3041
- }), (u, g) => {
3042
- var b, R, G, Ce, _e, Se;
3043
- const p = He;
3044
- return h(), y("div", {
3045
- class: V(["table-render", u.$attrs.class]),
3046
- style: B(u.$attrs.style)
3268
+ }), (f, p) => {
3269
+ var y, A, K, _e, Se, De, ke;
3270
+ const h = Xe;
3271
+ return g(), v("div", {
3272
+ class: P(["table-render", f.$attrs.class]),
3273
+ style: B(f.$attrs.style)
3047
3274
  }, [
3048
- f.value.hasSearch ? (h(), S(Yt, {
3275
+ u.value.hasSearch ? (g(), S(aa, {
3049
3276
  key: 0,
3050
- fields: f.value.searchFields,
3277
+ fields: u.value.searchFields,
3051
3278
  modelValue: n.searchParams,
3052
- "onUpdate:modelValue": g[0] || (g[0] = (A) => n.searchParams = A),
3279
+ "onUpdate:modelValue": p[0] || (p[0] = (R) => n.searchParams = R),
3053
3280
  onSearch: m.handleSearch,
3054
3281
  onReset: m.handleReset
3055
3282
  }, {
3056
- "search-extra": w((A) => [
3057
- T(u.$slots, "search-extra", q(j(A || {})), void 0, !0)
3283
+ "search-extra": w((R) => [
3284
+ k(f.$slots, "search-extra", q(O(R || {})), void 0, !0)
3058
3285
  ]),
3059
- "search-actions": w((A) => [
3060
- T(u.$slots, "search-actions", q(j(A || {})), void 0, !0)
3286
+ "search-actions": w((R) => [
3287
+ k(f.$slots, "search-actions", q(O(R || {})), void 0, !0)
3061
3288
  ]),
3062
3289
  _: 3
3063
3290
  }, 8, ["fields", "modelValue", "onSearch", "onReset"])) : D("", !0),
3064
- C("div", Pa, [
3065
- C("div", $a, [
3066
- _(ua, ce(m.getTableAttrs(), {
3067
- rows: f.value.rows,
3068
- columns: f.value.columns,
3069
- loading: f.value.loading,
3070
- actions: f.value.actions,
3071
- "key-field": (b = f.value.tableConfig) == null ? void 0 : b.key,
3072
- "dict-data": f.value.dictData,
3073
- "active-key": f.value.currentKey,
3291
+ x("div", Na, [
3292
+ x("div", Wa, [
3293
+ _(xa, de(m.getTableAttrs(), {
3294
+ rows: u.value.rows,
3295
+ columns: u.value.columns,
3296
+ loading: u.value.loading,
3297
+ actions: u.value.actions,
3298
+ "actions-width": (y = u.value.tableConfig) == null ? void 0 : y.actionsWidth,
3299
+ "key-field": (A = u.value.tableConfig) == null ? void 0 : A.key,
3300
+ "dict-data": u.value.dictData,
3301
+ "active-key": u.value.currentKey,
3074
3302
  onRowAction: m.handleRowAction,
3075
3303
  onRowClick: m.handleRowClick
3076
- }), X({ _: 2 }, [
3077
- E(m.getTableSlots(), (A, Y) => ({
3304
+ }), Z({ _: 2 }, [
3305
+ E(m.getTableSlots(), (R, Y) => ({
3078
3306
  name: Y,
3079
- fn: w((Ie) => [
3080
- T(u.$slots, Y, q(j(Ie || {})), void 0, !0)
3307
+ fn: w((Ue) => [
3308
+ k(f.$slots, Y, q(O(Ue || {})), void 0, !0)
3081
3309
  ])
3082
3310
  }))
3083
- ]), 1040, ["rows", "columns", "loading", "actions", "key-field", "dict-data", "active-key", "onRowAction", "onRowClick"]),
3084
- _(ba, {
3311
+ ]), 1040, ["rows", "columns", "loading", "actions", "actions-width", "key-field", "dict-data", "active-key", "onRowAction", "onRowClick"]),
3312
+ _(Va, {
3085
3313
  class: "table-pagination",
3086
- page: f.value.pagination.page,
3087
- "page-size": f.value.pagination.pageSize,
3088
- total: f.value.total,
3089
- type: (R = f.value.tableConfig) == null ? void 0 : R.pagination,
3314
+ page: u.value.pagination.page,
3315
+ "page-size": u.value.pagination.pageSize,
3316
+ total: u.value.total,
3317
+ type: (K = u.value.tableConfig) == null ? void 0 : K.pagination,
3090
3318
  "onUpdate:page": m.handlePageChange,
3091
3319
  "onUpdate:pageSize": m.handlePageSizeChange
3092
3320
  }, null, 8, ["page", "page-size", "total", "type", "onUpdate:page", "onUpdate:pageSize"])
3093
3321
  ]),
3094
- f.value.showDetail && f.value.detailMode === "inline" ? (h(), S(ue, {
3322
+ u.value.showDetail && u.value.detailMode === "inline" ? (g(), S(fe, {
3095
3323
  key: 0,
3096
- class: V(["table-detail-inline", `table-detail-inline-${f.value.detailSide}`]),
3097
- style: B({ width: f.value.detailWidth }),
3098
- title: (Ce = (G = f.value.tableConfig) == null ? void 0 : G.meta) == null ? void 0 : Ce.title,
3099
- loading: f.value.detailLoading,
3100
- "row-data": f.value.detailData,
3101
- columns: f.value.columns,
3102
- "empty-text": f.value.detailSide === "left" ? "请点击右侧表格行查看详情" : "请点击左侧表格行查看详情",
3324
+ class: P(["table-detail-inline", `table-detail-inline-${u.value.detailSide}`]),
3325
+ style: B({ width: u.value.detailWidth }),
3326
+ title: (Se = (_e = u.value.tableConfig) == null ? void 0 : _e.meta) == null ? void 0 : Se.title,
3327
+ loading: u.value.detailLoading,
3328
+ "row-data": u.value.detailData,
3329
+ columns: u.value.columns,
3330
+ "empty-text": u.value.detailSide === "left" ? "请点击右侧表格行查看详情" : "请点击左侧表格行查看详情",
3103
3331
  "extra-mode": m.getDetailExtraMode()
3104
- }, X({ _: 2 }, [
3105
- E(m.getDetailSlots(), (A) => ({
3106
- name: A,
3332
+ }, Z({ _: 2 }, [
3333
+ E(m.getDetailSlots(), (R) => ({
3334
+ name: R,
3107
3335
  fn: w((Y) => [
3108
- T(u.$slots, A, q(j(Y || {})), void 0, !0)
3336
+ k(f.$slots, R, q(O(Y || {})), void 0, !0)
3109
3337
  ])
3110
3338
  }))
3111
3339
  ]), 1032, ["class", "style", "title", "loading", "row-data", "columns", "empty-text", "extra-mode"])) : D("", !0)
3112
3340
  ]),
3113
- f.value.showDetail && f.value.detailMode === "drawer" ? (h(), S(p, {
3341
+ u.value.showDetail && u.value.detailMode === "drawer" ? (g(), S(h, {
3114
3342
  key: 1,
3115
- "model-value": f.value.detailVisible,
3116
- direction: f.value.detailDirection,
3117
- size: f.value.detailWidth,
3118
- title: ((Se = (_e = f.value.tableConfig) == null ? void 0 : _e.meta) == null ? void 0 : Se.title) || "详情",
3343
+ "model-value": u.value.detailVisible,
3344
+ direction: u.value.detailDirection,
3345
+ size: u.value.detailWidth,
3346
+ title: ((ke = (De = u.value.tableConfig) == null ? void 0 : De.meta) == null ? void 0 : ke.title) || "详情",
3119
3347
  onClose: m.handleDetailClose,
3120
3348
  onClosed: m.handleDetailClosed
3121
3349
  }, {
3122
3350
  default: w(() => [
3123
- _(ue, {
3351
+ _(fe, {
3124
3352
  "show-header": !1,
3125
- loading: f.value.detailLoading,
3126
- "row-data": f.value.detailData,
3127
- columns: f.value.columns,
3353
+ loading: u.value.detailLoading,
3354
+ "row-data": u.value.detailData,
3355
+ columns: u.value.columns,
3128
3356
  "extra-mode": m.getDetailExtraMode()
3129
- }, X({ _: 2 }, [
3130
- E(m.getDetailSlots(), (A) => ({
3131
- name: A,
3357
+ }, Z({ _: 2 }, [
3358
+ E(m.getDetailSlots(), (R) => ({
3359
+ name: R,
3132
3360
  fn: w((Y) => [
3133
- T(u.$slots, A, q(j(Y || {})), void 0, !0)
3361
+ k(f.$slots, R, q(O(Y || {})), void 0, !0)
3134
3362
  ])
3135
3363
  }))
3136
3364
  ]), 1032, ["loading", "row-data", "columns", "extra-mode"])
3137
3365
  ]),
3138
3366
  _: 3
3139
3367
  }, 8, ["model-value", "direction", "size", "title", "onClose", "onClosed"])) : D("", !0),
3140
- f.value.previewMounted ? (h(), S(p, {
3368
+ u.value.previewMounted ? (g(), S(h, {
3141
3369
  key: 2,
3142
- "model-value": f.value.previewVisible,
3143
- direction: f.value.detailDirection,
3144
- size: f.value.detailWidth,
3370
+ "model-value": u.value.previewVisible,
3371
+ direction: u.value.detailDirection,
3372
+ size: u.value.detailWidth,
3145
3373
  title: "详情",
3146
3374
  onClose: m.handlePreviewClose,
3147
3375
  onClosed: m.handlePreviewClosed
3148
3376
  }, {
3149
3377
  default: w(() => [
3150
- _(ue, {
3378
+ _(fe, {
3151
3379
  "show-header": !1,
3152
- "row-data": f.value.previewRow,
3153
- columns: f.value.columns,
3380
+ "row-data": u.value.previewRow,
3381
+ columns: u.value.columns,
3154
3382
  "extra-mode": m.getDetailExtraMode()
3155
- }, X({ _: 2 }, [
3156
- E(m.getDetailSlots(), (A) => ({
3157
- name: A,
3383
+ }, Z({ _: 2 }, [
3384
+ E(m.getDetailSlots(), (R) => ({
3385
+ name: R,
3158
3386
  fn: w((Y) => [
3159
- T(u.$slots, A, q(j(Y || {})), void 0, !0)
3387
+ k(f.$slots, R, q(O(Y || {})), void 0, !0)
3160
3388
  ])
3161
3389
  }))
3162
3390
  ]), 1032, ["row-data", "columns", "extra-mode"])
3163
3391
  ]),
3164
3392
  _: 3
3165
3393
  }, 8, ["model-value", "direction", "size", "onClose", "onClosed"])) : D("", !0),
3166
- f.value.hasToolbar ? (h(), S(Jt, {
3394
+ u.value.hasToolbar ? (g(), S(sa, {
3167
3395
  key: 3,
3168
3396
  class: "table-toolbar-bottom",
3169
- items: f.value.toolbar,
3170
- "current-row": f.value.currentRow,
3397
+ items: u.value.toolbar,
3398
+ "current-row": u.value.currentRow,
3171
3399
  onAction: m.handleToolbarAction
3172
3400
  }, {
3173
- "toolbar-left": w((A) => [
3174
- T(u.$slots, "toolbar-left", q(j(A || {})), void 0, !0)
3401
+ "toolbar-left": w((R) => [
3402
+ k(f.$slots, "toolbar-left", q(O(R || {})), void 0, !0)
3175
3403
  ]),
3176
- "toolbar-extra": w((A) => [
3177
- T(u.$slots, "toolbar-extra", q(j(A || {})), void 0, !0)
3404
+ "toolbar-extra": w((R) => [
3405
+ k(f.$slots, "toolbar-extra", q(O(R || {})), void 0, !0)
3178
3406
  ]),
3179
3407
  _: 3
3180
3408
  }, 8, ["items", "current-row", "onAction"])) : D("", !0),
3181
- _(Ae, {
3409
+ _(Ee, {
3182
3410
  ref_key: "formRef",
3183
- ref: i
3411
+ ref: l
3184
3412
  }, null, 512)
3185
3413
  ], 6);
3186
3414
  };
3187
3415
  }
3188
- }), Aa = /* @__PURE__ */ $(Ra, [["__scopeId", "data-v-00444d8c"]]);
3189
- function Ia() {
3190
- var o, t;
3191
- try {
3192
- if (typeof document < "u" && document.baseURI) {
3193
- const e = new URL(document.baseURI).origin;
3194
- if (e && e !== "null") return e;
3195
- }
3196
- } catch {
3197
- }
3198
- try {
3199
- const e = (t = (o = window == null ? void 0 : window.$wujie) == null ? void 0 : o.location) == null ? void 0 : t.origin;
3200
- if (typeof e == "string" && e) return e;
3201
- } catch {
3202
- }
3203
- return typeof window < "u" ? window.location.origin : "";
3204
- }
3205
- class Ma {
3206
- constructor(t) {
3207
- x(this, "axiosInstance");
3208
- // 免配基地址:只解析一次并缓存(一个页面生命周期内不会变)
3209
- x(this, "baseUrl", "");
3210
- this.axiosInstance = Ve.create({
3211
- timeout: 1e4,
3212
- baseURL: ""
3213
- }), this.axiosInstance.defaults.headers["Content-Type"] = "application/json;charset=utf-8", this.axiosInstance.interceptors.request.use(
3214
- (e) => (e.headers.token = localStorage.getItem("token"), t.baseUrl ? e.baseURL = t.baseUrl : (this.baseUrl || (this.baseUrl = Ia()), e.baseURL = this.baseUrl), e),
3215
- (e) => Promise.reject(e)
3216
- ), this.axiosInstance.interceptors.response.use(
3217
- (e) => e.config.responseType === "blob" ? e : e.data,
3218
- (e) => Promise.reject(e)
3219
- );
3220
- }
3221
- /**
3222
- * POST 请求
3223
- */
3224
- Post(t, e) {
3225
- return this.axiosInstance.post(t, e);
3226
- }
3227
- /**
3228
- * GET 请求
3229
- */
3230
- Get(t, e) {
3231
- return this.axiosInstance.get(t, { params: e });
3232
- }
3233
- /**
3234
- * DELETE 请求
3235
- */
3236
- Delete(t, e) {
3237
- return this.axiosInstance.delete(t, { params: e });
3238
- }
3239
- /**
3240
- * PUT 请求
3241
- */
3242
- Put(t, e) {
3243
- return this.axiosInstance.put(t, e);
3244
- }
3245
- /**
3246
- * 下载文件
3247
- */
3248
- Download(t, e) {
3249
- return this.axiosInstance.get(t, {
3250
- params: e,
3251
- responseType: "blob"
3252
- });
3253
- }
3254
- }
3255
- class Ea {
3256
- //事件总线
3257
- constructor() {
3258
- x(this, "emitter");
3259
- this.emitter = Ze();
3260
- }
3261
- On(t, e) {
3262
- this.emitter.on(t, e);
3263
- }
3264
- Emit(t, e) {
3265
- this.emitter.emit(t, e);
3266
- }
3267
- Off(t, e) {
3268
- this.emitter.off(t, e);
3269
- }
3270
- }
3271
- class Ua {
3272
- constructor(t, e) {
3273
- x(this, "mqttClient", null);
3274
- x(this, "eventBus");
3275
- this.eventBus = t, this.connect(e).then();
3276
- }
3277
- async connect(t) {
3278
- const e = {
3279
- username: t.userName,
3280
- password: t.password,
3281
- clientId: `${t.module}_${this.randomStr(10)}`,
3282
- clean: !0,
3283
- keepalive: 50,
3284
- connectTimeout: 5e3,
3285
- reconnectPeriod: 5e3
3286
- };
3287
- let l = t.mqttUrl || "ws://127.0.0.1:5002/ws";
3288
- if (console.log("connect to mqtt..."), this.mqttClient = et.connect(l, e), !this.mqttClient) {
3289
- console.log("connect mqtt failed");
3290
- return;
3291
- }
3292
- this.mqttClient.on("connect", () => {
3293
- console.log("=====> mqtt connect success!"), this.mqttClient.subscribe(fe, { qos: 0 }, (d) => {
3294
- console.log(d ? `mqtt subscribe [${fe}] failed` : `mqtt subscribe [${fe}] success`);
3295
- });
3296
- }), this.mqttClient.on("message", (d, r) => {
3297
- const c = r.toString();
3298
- if (!c) {
3299
- console.error("Received empty message", d);
3300
- return;
3301
- }
3302
- let s = null;
3303
- try {
3304
- s = JSON.parse(c);
3305
- } catch (a) {
3306
- console.error("Failed to parse message JSON", d, c, a);
3307
- return;
3308
- }
3309
- if (!s || s.Content === void 0 || s.Content === null || !s.PType) {
3310
- console.log("parse notice failed!", c);
3311
- return;
3312
- }
3313
- s.PType == Ba && this.eventBus.Emit(s.Route, s.Content);
3314
- }), this.mqttClient.on(ie.OffLine, () => {
3315
- console.log("mqtt offline...");
3316
- }), this.mqttClient.on(ie.Reconnect, () => {
3317
- console.log("mqtt reconnecting...");
3318
- }), this.mqttClient.on(ie.Close, () => {
3319
- console.log("mqtt close");
3320
- }), this.mqttClient.on(ie.Error, (d) => {
3321
- console.log("mqtt error");
3322
- });
3323
- }
3324
- // 生成随机字符串
3325
- randomStr(t) {
3326
- const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
3327
- let l = "";
3328
- for (let d = 0; d < t; d++)
3329
- l += e.charAt(Math.floor(Math.random() * e.length));
3330
- return l;
3331
- }
3332
- }
3333
- const fe = "Notice", Ba = "NOTICE", ie = {
3334
- OffLine: "offline",
3335
- Close: "close",
3336
- Reconnect: "reconnect",
3337
- Error: "error"
3338
- };
3339
- let se;
3340
- const xo = (o) => {
3341
- if (!o)
3342
- throw new Error("QfOptions is undefined");
3343
- if (!se && o && (se = new Fa(o)), !se)
3344
- throw new Error("Qf not initialized, please call GetQf(options) first");
3345
- return se;
3346
- };
3347
- class Fa {
3348
- constructor(t) {
3349
- x(this, "EventBus");
3350
- x(this, "WebApi");
3351
- x(this, "Mqtt");
3352
- x(this, "options");
3353
- this.initQf(t);
3354
- }
3355
- /**
3356
- * 初始化 Qf
3357
- */
3358
- initQf(t) {
3359
- if (!t)
3360
- throw new Error(`StartQf failed! options is ${t}`);
3361
- this.options = t, console.log("StartQf(), qfOptions=", t), this.EventBus = new Ea(), this.WebApi = new Ma(t), this.options.useMqtt && (this.Mqtt = new Ua(this.EventBus, t));
3362
- }
3363
- // ==================== EventBus 相关 ====================
3364
- On(t, e) {
3365
- this.EventBus.On(t, e);
3366
- }
3367
- Emit(t, e) {
3368
- this.EventBus.Emit(t, e);
3369
- }
3370
- Off(t, e) {
3371
- this.EventBus.Off(t, e);
3372
- }
3373
- // ==================== Http 相关 ====================
3374
- Post(t, e) {
3375
- return this.WebApi.Post(t, e);
3376
- }
3377
- Get(t, e) {
3378
- return this.WebApi.Get(t, e);
3379
- }
3380
- Delete(t, e) {
3381
- return this.WebApi.Delete(t, e);
3382
- }
3383
- Put(t, e) {
3384
- return this.WebApi.Put(t, e);
3385
- }
3386
- Download(t, e) {
3387
- return this.WebApi.Download(t, e);
3388
- }
3389
- // ==================== MQTT 通知 ====================
3390
- RegNotice(t, e) {
3391
- this.EventBus.On(t, e);
3392
- }
3393
- }
3394
- const La = {
3416
+ }), qa = /* @__PURE__ */ $(za, [["__scopeId", "data-v-1d0ae5e9"]]), Oa = {
3395
3417
  UInput: te,
3396
- UInputNumber: Pe,
3418
+ UInputNumber: Ae,
3397
3419
  UDict: ee,
3398
- UToggle: $e,
3399
- UCascader: Re,
3400
- UDate: de,
3401
- UMenu: Ct,
3402
- FormRender: Ae,
3403
- TableRender: Aa,
3420
+ UToggle: Ie,
3421
+ UCascader: Me,
3422
+ UDate: re,
3423
+ UMenu: Rt,
3424
+ FormRender: Ee,
3425
+ TableRender: qa,
3404
3426
  UFieldView: xe
3405
- }, Co = {
3427
+ }, To = {
3406
3428
  install(o) {
3407
- o.use(Ue);
3408
- for (const [t, e] of Object.entries(La))
3429
+ o.use(Le);
3430
+ for (const [t, e] of Object.entries(Oa))
3409
3431
  o.component(t, e);
3410
3432
  }
3411
3433
  };
3412
3434
  export {
3413
- Ae as FormRender,
3414
- xo as GetQf,
3415
- Aa as TableRender,
3416
- Re as UCascader,
3417
- de as UDate,
3435
+ Ee as FormRender,
3436
+ bo as GetQf,
3437
+ qa as TableRender,
3438
+ Me as UCascader,
3439
+ re as UDate,
3418
3440
  ee as UDict,
3419
3441
  xe as UFieldView,
3420
3442
  te as UInput,
3421
- Pe as UInputNumber,
3422
- Ct as UMenu,
3423
- $e as UToggle,
3424
- K as apis,
3425
- yo as clearDictCache,
3426
- Co as default,
3427
- po as flattenDictTree,
3443
+ Ae as UInputNumber,
3444
+ Rt as UMenu,
3445
+ Ie as UToggle,
3446
+ G as apis,
3447
+ _o as clearDictCache,
3448
+ To as default,
3449
+ wo as flattenDictTree,
3428
3450
  ae as getDict,
3429
- ve as mapDictTree,
3451
+ M as getQf,
3452
+ we as mapDictTree,
3430
3453
  be as normalizeDictNode,
3431
- z as notify,
3454
+ N as notify,
3432
3455
  le as notifyUtil,
3433
- go as preloadDicts,
3434
- Ia as resolveBaseUrl,
3435
- bo as setDictCache,
3436
- we as toDictOptions,
3437
- lt as translateDict,
3438
- ho as translateDictSync
3456
+ xo as preloadDicts,
3457
+ rt as resolveAppBase,
3458
+ So as setDictCache,
3459
+ Ce as toDictOptions,
3460
+ pt as translateDict,
3461
+ Co as translateDictSync
3439
3462
  };