@skyfox2000/webui 1.3.19 → 1.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/lib/AceEditor.d.ts +1 -0
  2. package/lib/BasicLayout.d.ts +1 -0
  3. package/lib/Error403.d.ts +1 -0
  4. package/lib/Error404.d.ts +1 -0
  5. package/lib/ExcelForm.d.ts +1 -0
  6. package/lib/MenuLayout.d.ts +1 -0
  7. package/lib/UploadForm.d.ts +1 -0
  8. package/lib/assets/modules/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  9. package/lib/assets/modules/baseLayout-B9dSxkYo.js +79 -0
  10. package/lib/assets/modules/file-upload-JBIvw5Xx.js +204 -0
  11. package/lib/assets/modules/index-BMkaOjBS.js +380 -0
  12. package/lib/assets/modules/index-BOYtm8ib.js +112 -0
  13. package/lib/assets/modules/index-BkChvyed.js +109 -0
  14. package/lib/assets/modules/menuTabs-BFPjaQRI.js +671 -0
  15. package/lib/assets/modules/toolIcon-XOgjdQdO.js +50 -0
  16. package/lib/assets/modules/uploadList-BedljASx.js +2407 -0
  17. package/lib/assets/modules/uploadList-CW7OIDS3.js +382 -0
  18. package/lib/components/common/alert/index.vue.d.ts +13 -0
  19. package/lib/components/common/button/index.vue.d.ts +41 -0
  20. package/lib/components/common/icon/appicon.vue.d.ts +11 -0
  21. package/lib/components/common/icon/fullscreen.vue.d.ts +3 -0
  22. package/lib/components/common/icon/helper.vue.d.ts +23 -0
  23. package/lib/components/common/icon/index.vue.d.ts +243 -0
  24. package/lib/components/common/icon/layoutIcon.vue.d.ts +43 -0
  25. package/lib/components/common/icon/projectIcon.vue.d.ts +59 -0
  26. package/lib/components/common/icon/toolIcon.vue.d.ts +43 -0
  27. package/lib/components/common/index.d.ts +22 -0
  28. package/lib/components/common/loading/index.vue.d.ts +3 -0
  29. package/lib/components/common/tooltip/index.vue.d.ts +21 -0
  30. package/lib/components/content/dialog/index.vue.d.ts +35 -0
  31. package/lib/components/content/drawer/index.vue.d.ts +28 -0
  32. package/lib/components/content/form/formItem.vue.d.ts +28 -0
  33. package/lib/components/content/form/index.vue.d.ts +25 -0
  34. package/lib/components/content/index.d.ts +22 -0
  35. package/lib/components/content/search/index.vue.d.ts +32 -0
  36. package/lib/components/content/search/searchItem.vue.d.ts +23 -0
  37. package/lib/components/content/table/index.vue.d.ts +127 -0
  38. package/lib/components/content/table/tableOperate.vue.d.ts +18 -0
  39. package/lib/components/content/toolbar/icontool.vue.d.ts +7 -0
  40. package/lib/components/content/toolbar/index.vue.d.ts +18 -0
  41. package/lib/components/content/tree/index.vue.d.ts +46 -0
  42. package/lib/components/form/aceEditor/aceConfig.d.ts +8 -0
  43. package/lib/components/form/autoComplete/index.vue.d.ts +101 -0
  44. package/lib/components/form/cascader/index.vue.d.ts +80 -0
  45. package/lib/components/form/checkbox/index.vue.d.ts +100 -0
  46. package/lib/components/form/datePicker/index.vue.d.ts +6 -0
  47. package/lib/components/form/index.d.ts +41 -0
  48. package/lib/components/form/input/index.vue.d.ts +29 -0
  49. package/lib/components/form/input/inputIcon.vue.d.ts +10 -0
  50. package/lib/components/form/input/inputNumber.vue.d.ts +3 -0
  51. package/lib/components/form/input/inputPassword.vue.d.ts +3 -0
  52. package/lib/components/form/propEditor/index.vue.d.ts +15 -0
  53. package/lib/components/form/radio/index.vue.d.ts +105 -0
  54. package/lib/components/form/radio/radioStatus.vue.d.ts +31 -0
  55. package/lib/components/form/rangePicker/index.vue.d.ts +16 -0
  56. package/lib/components/form/select/index.vue.d.ts +119 -0
  57. package/lib/components/form/switch/index.vue.d.ts +76 -0
  58. package/lib/components/form/textarea/index.vue.d.ts +3 -0
  59. package/lib/components/form/timePicker/index.vue.d.ts +6 -0
  60. package/lib/components/form/transfer/index.vue.d.ts +38 -0
  61. package/lib/components/form/transfer/transferTable.vue.d.ts +38 -0
  62. package/lib/components/form/treeSelect/index.vue.d.ts +47 -0
  63. package/lib/components/form/upload/uploadList.vue.d.ts +488 -0
  64. package/lib/components/index.d.ts +4 -0
  65. package/lib/components/layout/breadcrumb/index.vue.d.ts +3 -0
  66. package/lib/components/layout/content/index.vue.d.ts +22 -0
  67. package/lib/components/layout/datetime/index.vue.d.ts +3 -0
  68. package/lib/components/layout/header/headerExits.vue.d.ts +3 -0
  69. package/lib/components/layout/header/index.vue.d.ts +3 -0
  70. package/lib/components/layout/header/user.vue.d.ts +3 -0
  71. package/lib/components/layout/index.d.ts +14 -0
  72. package/lib/components/layout/menu/index.vue.d.ts +6 -0
  73. package/lib/components/layout/menu/menuTabs.vue.d.ts +3 -0
  74. package/lib/const/options.d.ts +32 -0
  75. package/lib/directives/enter-submit.d.ts +4 -0
  76. package/lib/directives/index.d.ts +2 -0
  77. package/lib/directives/permission.d.ts +5 -0
  78. package/lib/es/AceEditor/index.js +167 -0
  79. package/lib/es/BasicLayout/index.js +54 -0
  80. package/lib/es/Error403/index.js +39 -0
  81. package/lib/es/Error404/index.js +39 -0
  82. package/lib/es/ExcelForm/index.js +491 -0
  83. package/lib/es/MenuLayout/index.js +54 -0
  84. package/lib/es/UploadForm/index.js +110 -0
  85. package/lib/index.d.ts +46 -0
  86. package/lib/router/index.d.ts +15 -0
  87. package/lib/stores/appInfo.d.ts +31 -0
  88. package/lib/stores/hostInfo.d.ts +11 -0
  89. package/lib/stores/pageInfo.d.ts +18 -0
  90. package/lib/stores/pinia.d.ts +3 -0
  91. package/lib/stores/settingInfo.d.ts +8 -0
  92. package/lib/stores/userInfo.d.ts +25 -0
  93. package/lib/typings/data.d.ts +80 -0
  94. package/lib/typings/form.d.ts +206 -0
  95. package/lib/typings/menu.d.ts +7 -0
  96. package/lib/typings/option.d.ts +209 -0
  97. package/lib/typings/page.d.ts +70 -0
  98. package/lib/typings/table.d.ts +181 -0
  99. package/lib/typings/tools.d.ts +130 -0
  100. package/lib/typings/tree.d.ts +72 -0
  101. package/lib/typings/upload.d.ts +161 -0
  102. package/lib/typings/urls.d.ts +69 -0
  103. package/lib/utils/cache.d.ts +23 -0
  104. package/lib/utils/data.d.ts +6 -0
  105. package/lib/utils/download.d.ts +6 -0
  106. package/lib/utils/eventbus.d.ts +16 -0
  107. package/lib/utils/excel-preview.d.ts +24 -0
  108. package/lib/utils/excel-view.d.ts +25 -0
  109. package/lib/utils/export-table.d.ts +12 -0
  110. package/lib/utils/file-upload.d.ts +17 -0
  111. package/lib/utils/form-csv.d.ts +18 -0
  112. package/lib/utils/form-excel.d.ts +36 -0
  113. package/lib/utils/form-validate.d.ts +29 -0
  114. package/lib/utils/form.d.ts +9 -0
  115. package/lib/utils/icon-loader.d.ts +125 -0
  116. package/lib/utils/isEmpty.d.ts +1 -0
  117. package/lib/utils/main-openapis.d.ts +8 -0
  118. package/lib/utils/menu.d.ts +6 -0
  119. package/lib/utils/options.d.ts +7 -0
  120. package/lib/utils/page.d.ts +30 -0
  121. package/lib/utils/table.d.ts +21 -0
  122. package/lib/utils/tools.d.ts +18 -0
  123. package/lib/utils/tree.d.ts +3 -0
  124. package/lib/vite-env.d.ts +8 -0
  125. package/lib/webui.css +1 -0
  126. package/lib/webui.es.js +2345 -0
  127. package/package.json +1 -1
  128. package/.cursorignore +0 -8
  129. package/scripts/userInput.py +0 -2
@@ -0,0 +1,2407 @@
1
+ var ma = Object.defineProperty;
2
+ var va = (e, t, a) => t in e ? ma(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var $ = (e, t, a) => va(e, typeof t != "symbol" ? t + "" : t, a);
4
+ import { inject as te, ref as f, provide as Le, watch as g, toRaw as Ze, h as U, nextTick as ga, shallowRef as K, defineComponent as X, reactive as ya, onMounted as xe, onUnmounted as ie, createBlock as Ae, createCommentVNode as B, openBlock as E, unref as b, mergeProps as le, useAttrs as Ee, createElementBlock as L, createVNode as C, withCtx as V, createTextVNode as Oe, toDisplayString as z, Fragment as ne, renderList as Ue, normalizeClass as ea, createElementVNode as Sa } from "vue";
5
+ import { Switch as ba, AutoComplete as Ia, Input as xa, CheckboxGroup as Aa, Checkbox as Ea, RadioGroup as Oa, Radio as Ra, Select as Ta, SelectOption as wa } from "ant-design-vue";
6
+ import { createPinia as Pa, defineStore as ue } from "pinia";
7
+ import ka from "pinia-plugin-persistedstate";
8
+ import { combineParams as ce, EnvConfig as ye, AppAction as Be, AppSource as Ce, isMicroApp as Se, mainAppApis as N, isBaseMicroApp as La } from "@skyfox2000/microbase";
9
+ import { ResStatus as T, httpPost as G, setToken as me, fieldMapping as $a, parseFieldTemplate as be, API_HOST as $e, SERVER_HOST as Fa } from "@skyfox2000/fapi";
10
+ import x from "vue-m-message";
11
+ import He from "async-validator";
12
+ import { createRouter as Ma, createWebHashHistory as _a } from "vue-router";
13
+ import "dayjs";
14
+ import "vue-draggable-next";
15
+ const Na = Pa();
16
+ Na.use(ka);
17
+ var D = /* @__PURE__ */ ((e) => (e.PageControl = "Page.PageControl", e.EditorControl = "Page.EditorControl", e.GridControl = "Page.GridControl", e.LabelText = "FormItem.LabelText", e.LabelWidth = "FormItem.LabelWidth", e.RuleKey = "FormItem.RuleKey", e.ErrInfo = "FormItem.ErrInfo", e))(D || {});
18
+ const w = class w {
19
+ };
20
+ $(w, "dict", {}), $(w, "Keys", {
21
+ EnableDisable: "EnableDisable",
22
+ SuccessResult: "SuccessResult",
23
+ YesNo: "YesNo",
24
+ MaleFemale: "MaleFemale"
25
+ }), /**
26
+ * 静态选择项列表
27
+ * @param key 名称
28
+ * @returns
29
+ */
30
+ $(w, "getOptions", (t) => w.dict[t]), /**
31
+ * 静态选择项对象
32
+ * @param key 名称
33
+ * @param value 值
34
+ * @returns
35
+ */
36
+ $(w, "getOptionItem", (t, a) => w.dict[t].find((s) => s.value === a)), /**
37
+ * 设置静态选择项
38
+ * @param key 名称
39
+ * @param list 列表
40
+ */
41
+ $(w, "setOptions", (t, a) => {
42
+ w.dict[t] = a;
43
+ }), /**
44
+ * 启用/停用选项
45
+ * - 启用 1
46
+ * - 停用 0
47
+ */
48
+ $(w, "EnableDisable", [
49
+ {
50
+ label: "启用",
51
+ text: "✅ 启用",
52
+ value: 1
53
+ },
54
+ {
55
+ label: "停用",
56
+ text: "🚫 停用",
57
+ value: 0
58
+ }
59
+ ]), /**
60
+ * 成功/失败选项
61
+ * - 成功 1
62
+ * - 失败 0
63
+ */
64
+ $(w, "SuccessResult", [
65
+ {
66
+ label: "成功",
67
+ text: "✅ 成功",
68
+ value: 1
69
+ },
70
+ {
71
+ label: "失败",
72
+ text: "🚫 失败",
73
+ value: 0
74
+ }
75
+ ]), /**
76
+ * 是/否选项
77
+ * - 是 1
78
+ * - 否 0
79
+ */
80
+ $(w, "YesNo", [
81
+ {
82
+ label: "是",
83
+ text: "✅ 是",
84
+ value: 1
85
+ },
86
+ {
87
+ label: "否",
88
+ text: "❎ 否",
89
+ value: 0
90
+ }
91
+ ]), /**
92
+ * 男/女选项
93
+ * - 男 M
94
+ * - 女 F
95
+ */
96
+ $(w, "MaleFemale", [
97
+ {
98
+ label: "男",
99
+ text: "男 👨",
100
+ value: "M"
101
+ },
102
+ {
103
+ label: "女",
104
+ text: "女 👩",
105
+ value: "F"
106
+ }
107
+ ]);
108
+ let M = w;
109
+ M.setOptions("EnableDisable", M.EnableDisable);
110
+ M.setOptions("SuccessResult", M.SuccessResult);
111
+ M.setOptions("YesNo", M.YesNo);
112
+ M.setOptions("MaleFemale", M.MaleFemale);
113
+ const fe = {
114
+ /**
115
+ * 选项数据接口
116
+ */
117
+ url: {
118
+ type: Object,
119
+ required: !1
120
+ },
121
+ /**
122
+ * 选项数据
123
+ */
124
+ data: {
125
+ type: Array,
126
+ required: !1
127
+ },
128
+ /**
129
+ * 返回文字内容或文字内容数组
130
+ */
131
+ labels: {
132
+ type: [String, Number, Array],
133
+ required: !1
134
+ },
135
+ /**
136
+ * 表单数据
137
+ */
138
+ formData: {
139
+ type: Object,
140
+ required: !1
141
+ },
142
+ /**
143
+ * 输出字段转换控制
144
+ * - Key:目的字段,支持 "." 嵌套
145
+ * - Value:源字段,支持模板 ${} 或者 ${index} 或者 ${index}.${key}
146
+ */
147
+ outFields: {
148
+ type: Object,
149
+ required: !1
150
+ },
151
+ /**
152
+ * 通过消息重载数据,只允许改变查询条件
153
+ * - eventBus.on(组件限定前缀 +"."+ reloadEvent, { Q参数 } | 数据[])
154
+ * - 数据组仅用于联动显示
155
+ * - 其它情况使用Query参数
156
+ */
157
+ reloadEvent: {
158
+ type: String,
159
+ required: !1
160
+ },
161
+ /**
162
+ * 通过消息触发事件,只允许改变查询条件
163
+ * - eventBus.emit(changeEvent, { Q参数 } | 数据[])
164
+ * - 数据组仅用于联动显示
165
+ * - 其它情况使用Query参数
166
+ * - 第一个参数为事件名,第二个参数为事件参数模板,支持模板 ${selectedValues}
167
+ */
168
+ changeEvent: {
169
+ type: Array,
170
+ required: !1
171
+ },
172
+ optionCtrl: {
173
+ type: Object,
174
+ required: !1
175
+ }
176
+ }, F = (e) => e == null || e === "" ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1, Re = (e, t) => {
177
+ var n;
178
+ const a = e.page;
179
+ return {
180
+ url: "",
181
+ ...e.url,
182
+ ...(n = a.urls) == null ? void 0 : n[t.urlKey],
183
+ ...t.url,
184
+ loadingText: t.loadingText
185
+ };
186
+ }, Te = (e, t) => {
187
+ const a = e.page, s = t.url;
188
+ if (!s || !s.url) {
189
+ const o = `URL未设置: ${t.urlKey}`;
190
+ return console.warn(o), Promise.reject(new Error(o));
191
+ }
192
+ s.api || (s.api = a.api), s.authorize === void 0 && (s.authorize = a.authorize);
193
+ let n = ce(
194
+ JSON.parse(JSON.stringify(s.params ?? {})),
195
+ JSON.parse(JSON.stringify(t.params ?? {}))
196
+ );
197
+ return t.processParams && (n = t.processParams(n)), t.loadingState && (t.loadingState.value = !0), t.hideErrorToast && (s.hideErrorToast = !0), G(s, n).then((o) => (t.loadingState && (t.loadingState.value = !1), o)).catch((o) => (t.loadingState && (t.loadingState.value = !1), null));
198
+ }, Ve = (e, t) => {
199
+ t.params || (t.params = {}), t.params.Query || (t.params.Query = {});
200
+ const a = Re(e, t);
201
+ return t.url = a, Te(e, t);
202
+ }, $t = (e, t) => (t.params || (t.params = {}), t.params.Query || (t.params.Query = {}), t.loadingText = t.loadingText === !1 ? !1 : t.loadingText || "开始执行...", t.url = Re(e, t), Te(e, t).then((a) => ((a == null ? void 0 : a.status) === T.SUCCESS && (t.hideErrorToast || x.success("执行成功!")), a))), aa = (e, t = {}) => {
203
+ const a = t.primaryKey || "Id";
204
+ if (t.params || (t.params = {}), t.params.Query || (t.params.Query = {}), !t.params.Data)
205
+ return x.error("错误!无保存数据!"), Promise.resolve(null);
206
+ const s = {
207
+ ...t,
208
+ urlKey: t.urlKey || "save",
209
+ loadingText: t.loadingText === !1 ? !1 : t.loadingText || "数据保存中..."
210
+ };
211
+ s.params.Query[a] = s.params.Data[a];
212
+ const n = Re(e, s);
213
+ return s.url = n, Te(e, s).then((o) => ((o == null ? void 0 : o.status) === T.SUCCESS && (t.hideErrorToast || x.success("保存成功!")), o));
214
+ }, Da = (e, t, a = {}) => {
215
+ const s = a.primaryKey || "Id";
216
+ a.params || (a.params = {}), a.params.Query || (a.params.Query = {});
217
+ const n = {
218
+ ...a,
219
+ urlKey: "delete",
220
+ loadingText: a.loadingText === !1 ? !1 : a.loadingText || "数据删除中..."
221
+ };
222
+ if (Array.isArray(t) ? n.params.Query[s] = t : n.params.Query[s] = t[s], F(n.params.Query) || F(n.params.Query[s]))
223
+ return x.error("错误!禁止无条件删除数据!"), Promise.resolve(null);
224
+ const o = Re(e, n);
225
+ return n.url = o, Te(e, n).then((r) => ((r == null ? void 0 : r.status) === T.SUCCESS && (a.hideErrorToast || x.success("删除成功!")), r));
226
+ }, Ua = (e, t) => Ve(e, {
227
+ urlKey: "tree",
228
+ params: {},
229
+ loadingState: e.isTreeLoading,
230
+ loadingText: !1,
231
+ processParams: () => ce(e.treeQuery, t)
232
+ }).then((a) => (a == null ? void 0 : a.status) === T.SUCCESS ? (e.data.value = a.data, e.data.value) : []);
233
+ let re;
234
+ const Ft = (e) => {
235
+ re = new He({}), re.messages({
236
+ required: "${label}不能为空",
237
+ types: {
238
+ number: "${label}必须是数字"
239
+ },
240
+ enum: "${label}必须是${enum}中的一个",
241
+ string: {
242
+ len: "${label}长度必须为${len}",
243
+ min: "${label}长度不能小于${min}",
244
+ max: "${label}长度不能大于${max}",
245
+ range: "${label}长度必须在${min}和${max}之间"
246
+ },
247
+ number: {
248
+ len: "${label}必须为${len}",
249
+ min: "${label}不能小于${min}",
250
+ max: "${label}不能大于${max}",
251
+ range: "${label}必须在${min}和${max}之间"
252
+ },
253
+ array: {
254
+ len: "${label}长度必须为${len}",
255
+ min: "${label}长度不能小于${min}",
256
+ max: "${label}长度不能大于${max}",
257
+ range: "${label}长度必须在${min}和${max}之间"
258
+ },
259
+ ...e
260
+ });
261
+ }, Mt = (e) => {
262
+ if (!e || F(e))
263
+ return [];
264
+ const t = [], a = re.messages(), s = (o, r, l) => {
265
+ const u = r.type;
266
+ if (u && a.types && u in a.types) {
267
+ const c = a.types[u];
268
+ n(c, o, { type: u }, l);
269
+ }
270
+ const i = ["string", "number", "array"];
271
+ for (const c of i)
272
+ if (u === c && a[c]) {
273
+ const p = a[c], v = ["len", "min", "max", "range"];
274
+ for (const d of v)
275
+ d === "range" && r.min != null && r.max != null && p.range ? n(p.range, o, { min: r.min, max: r.max }, l) : d !== "range" && r[d] != null && p[d] && n(p[d], o, { [d]: r[d] }, l);
276
+ }
277
+ if (r.required && a.required && n(a.required, o, {}, l), r.pattern && a.pattern && n(r.message, o, {}, l), r.enum && Array.isArray(r.enum) && a.enum) {
278
+ const c = r.enum.join(", ");
279
+ n(a.enum, o, { enum: c }, l);
280
+ }
281
+ }, n = (o, r, l, u) => {
282
+ if (o)
283
+ try {
284
+ let i;
285
+ if (typeof o == "function") {
286
+ const c = [r];
287
+ for (const p in l)
288
+ c.push(l[p]);
289
+ i = o.apply(null, c), i && u.push(i);
290
+ } else {
291
+ i = String(o);
292
+ for (const c in l)
293
+ i = i.replace(new RegExp(`\\$\\{${c}\\}`, "g"), l[c]);
294
+ i = i.replace(/\$\{label\}/g, ""), i && u.push(i);
295
+ }
296
+ } catch (i) {
297
+ console.error("格式化验证消息出错:", i);
298
+ }
299
+ };
300
+ return Object.keys(e).forEach((o) => {
301
+ const r = e[o], l = [];
302
+ try {
303
+ s(o, r, l), Array.isArray(r) && r.forEach((i) => {
304
+ i && typeof i == "object" && s(o, i, l);
305
+ }), r && typeof r == "object" && "fields" in r;
306
+ } catch (i) {
307
+ console.error("处理验证规则出错:", i);
308
+ }
309
+ const u = Array.from(new Set(l));
310
+ o && u.length > 0 && t.push({
311
+ field: o,
312
+ rules: u
313
+ });
314
+ }), t;
315
+ }, pe = async (e) => {
316
+ const t = e.formData.value, a = e.formRules.value;
317
+ F(a) || (Ke(e), e.ruleValidator || (e.ruleValidator = new He({}), e.ruleValidator.messages(re.messages()), e.ruleValidator.define(a)), e.ruleResults.value = await e.ruleValidator.validate(t).then(() => {
318
+ }).catch(({ fields: s }) => s));
319
+ }, _t = async (e, t, a) => (a || (a = new He({}), a.messages(re.messages()), a.define(t)), a.validate(e).then(() => {
320
+ }).catch(({ fields: s }) => s)), Ke = (e) => {
321
+ e.ruleResults.value = void 0;
322
+ }, Y = () => {
323
+ const e = te(D.EditorControl, void 0), t = f(te(D.LabelText, "")), a = f(te(D.RuleKey, "")), s = te(D.ErrInfo, void 0);
324
+ return {
325
+ editorCtrl: e,
326
+ labelText: t,
327
+ ruleKey: a,
328
+ errInfo: s
329
+ };
330
+ }, Ha = (e, t) => {
331
+ let a = f({
332
+ msg: "",
333
+ errClass: ""
334
+ });
335
+ if (!e.label || !e.rule)
336
+ return a;
337
+ const s = t == null ? void 0 : t.ruleResults;
338
+ return g(
339
+ () => s == null ? void 0 : s.value,
340
+ (n) => {
341
+ if (a.value.errClass = "", a.value.msg = "", !F(n)) {
342
+ const o = Va(
343
+ {
344
+ label: e.label,
345
+ rule: e.rule
346
+ },
347
+ t == null ? void 0 : t.formRules.value,
348
+ Ze(n)
349
+ );
350
+ a.value.errClass = o.errClass.value, a.value.msg = o.msg.value;
351
+ }
352
+ },
353
+ { deep: !0 }
354
+ ), a;
355
+ }, Va = (e, t, a) => {
356
+ const s = f([]), n = f(""), o = f("");
357
+ if (!e.rule || !t || !a)
358
+ return { msg: n, ruleErrors: s, errClass: o };
359
+ e.rule.split("|").forEach((u) => {
360
+ if (u = u.trim(), u)
361
+ if (a[u])
362
+ s.value.push(...a[u]);
363
+ else {
364
+ const i = [];
365
+ for (let c in a)
366
+ c !== u && c.startsWith(u + ".") && i.push(...a[c]);
367
+ i.length > 0 && s.value.push(...i);
368
+ }
369
+ });
370
+ const l = /\${\w+}/g;
371
+ return s.value.forEach((u) => {
372
+ n.value && (n.value += " / "), n.value += u.message.replace("${label}", e.label ?? "");
373
+ const i = t[u.field];
374
+ if (i) {
375
+ const c = n.value.match(l);
376
+ c && c.forEach((p) => {
377
+ const v = p.replace("${", "").replace("}", "");
378
+ n.value = n.value.replace(p, i[v] ?? "");
379
+ });
380
+ }
381
+ }), s.value.length > 0 && (o.value = "error"), { msg: n, ruleErrors: s, errClass: o };
382
+ }, Nt = (e, t) => {
383
+ Le(D.LabelText, e.label || ""), Le(D.RuleKey, e.rule || "");
384
+ const a = Ha(e, t);
385
+ return Le(D.ErrInfo, a), a;
386
+ }, Dt = (e) => {
387
+ ta(e);
388
+ }, Ut = (e) => {
389
+ const t = e.page, a = e.formData.value;
390
+ a[e.primaryKey ?? t.primaryKey] = null, ta(e);
391
+ }, Ht = (e) => {
392
+ Qe(e), e.visible.value = !1;
393
+ }, ta = async (e) => {
394
+ var s;
395
+ const t = e.page;
396
+ if (e.isFormSaving.value = !0, Ke(e), e.beforeSave && e.beforeSave() === !1)
397
+ return e.isFormSaving.value = !1, Promise.resolve();
398
+ if (e.formRules.value && await pe(e), e.ruleResults.value)
399
+ return x.error("提交表单时,验证失败!"), console.error("表单验证失败!", e.ruleResults.value), e.isFormSaving.value = !1, Promise.resolve();
400
+ const a = e.formData.value;
401
+ return aa(
402
+ {
403
+ page: t,
404
+ // 转换为AnyControl接口
405
+ reload: (s = e.grid) == null ? void 0 : s.reload
406
+ },
407
+ {
408
+ url: e.saveUrl,
409
+ primaryKey: e.primaryKey ?? t.primaryKey,
410
+ params: {
411
+ Data: a,
412
+ Query: {}
413
+ },
414
+ hideErrorToast: !0,
415
+ // 隐藏自动错误提示,特殊判断控制
416
+ loadingState: e.isFormSaving
417
+ }
418
+ ).then((n) => {
419
+ var o, r;
420
+ if ((n == null ? void 0 : n.status) === T.SUCCESS)
421
+ x.success("保存成功!"), e.grid && (e.grid.reload.value = !0), e.afterSave && e.afterSave(), e.autoClose !== !1 && (e.visible.value = !1);
422
+ else if (n != null && n.msg && ((o = n == null ? void 0 : n.msg) == null ? void 0 : o.indexOf("Duplicate entry")) > -1) {
423
+ const l = (r = n == null ? void 0 : n.msg) == null ? void 0 : r.match(/Duplicate entry '([^']+)' for key '([^']+)'/);
424
+ if (l && l.length > 2 && l[1] && l[2]) {
425
+ const u = l[1], i = l[2].replace(/Idx_/g, "").split("_"), c = e.formRules.value;
426
+ if (c && i.length > 0) {
427
+ const p = {};
428
+ i.forEach((v) => {
429
+ c[v] && (p[v] = [
430
+ {
431
+ field: v,
432
+ fieldValue: u,
433
+ message: "数据重复"
434
+ }
435
+ ]);
436
+ }), Object.keys(p).length > 0 && (console.error("保存失败!", p), e.ruleResults.value = p);
437
+ }
438
+ x.error(`保存失败!数据 \`${u}\` 已存在!`);
439
+ } else x.error((n == null ? void 0 : n.msg) ?? "保存失败!");
440
+ } else
441
+ x.error((n == null ? void 0 : n.msg) ?? "保存失败!");
442
+ });
443
+ }, Vt = async (e) => {
444
+ const t = e.page, a = e.grid;
445
+ e.isFormLoading.value = !0;
446
+ const s = e.formData.value, n = e.primaryKey ?? t.primaryKey;
447
+ return ua(a, { [n]: s[n] }, e.detailUrl).then((o) => {
448
+ e.isFormLoading.value = !1, o && sa(e, o);
449
+ });
450
+ }, Kt = (e) => {
451
+ const t = e.grid;
452
+ t && (t.rowData.value = void 0), e && (Qe(e), e.visible && (e.visible.value = !1), setTimeout(() => {
453
+ e.visible.value = !0;
454
+ }, 1));
455
+ }, sa = (e, t) => {
456
+ Qe(e);
457
+ const a = { ...e.formData.value, ...t };
458
+ e.formData.value = JSON.parse(JSON.stringify(a));
459
+ }, Qe = (e) => {
460
+ e.formData.value = e.default ? JSON.parse(JSON.stringify(e.default)) : {}, Ke(e);
461
+ }, Ie = "/login/", ge = [], Ka = (e) => {
462
+ for (const t of e) {
463
+ const a = ge.findIndex((s) => s.path === t.path);
464
+ a !== -1 && ge.splice(a, 1), ge.push(t), oe.addRoute(t);
465
+ }
466
+ }, na = (e, t, a, s = "") => {
467
+ const n = s + (s ? "/" : "") + e.path;
468
+ t[n] = { ...e, parent: a }, e.children && e.children.forEach((o) => na(o, t, e, n));
469
+ }, oe = Ma({
470
+ history: _a("/"),
471
+ routes: ge
472
+ }), Qa = (e, t) => {
473
+ var n, o;
474
+ const a = ((n = e.meta) == null ? void 0 : n.roles) ?? [], s = (o = e.meta) == null ? void 0 : o.permission;
475
+ if (!t)
476
+ return a.length === 0 && !s;
477
+ if (t) {
478
+ const r = j();
479
+ if (ye.VITE_PERMISSION_MODE === "role")
480
+ return a.length === 0 ? !0 : r.hasRole(a);
481
+ if (ye.VITE_PERMISSION_MODE === "permit") {
482
+ if (a.length === 0 && !s)
483
+ return !0;
484
+ let l = !1, u = !1;
485
+ return a.length > 0 && (l = r.hasRole(a)), s && (u = r.hasPermit(e.path, ":page")), l || u;
486
+ }
487
+ }
488
+ return !1;
489
+ }, se = f(null);
490
+ oe.beforeEach((e, t, a) => {
491
+ var l;
492
+ const s = e;
493
+ if (e.path.startsWith("/error/") || e.path.startsWith(Ie))
494
+ return a();
495
+ const n = s.meta, r = ((n == null ? void 0 : n.roles) ?? []).length > 0 || ((l = n == null ? void 0 : n.permission) == null ? void 0 : l.length);
496
+ if (e.path === "/") {
497
+ const u = H();
498
+ if (!u.menuLoaded) {
499
+ se.value = {
500
+ to: e,
501
+ next: (i) => {
502
+ a({ path: i });
503
+ }
504
+ };
505
+ return;
506
+ }
507
+ u.toDefaultApp();
508
+ return;
509
+ }
510
+ if (!r)
511
+ a();
512
+ else {
513
+ const u = j();
514
+ if (!u.isLogin)
515
+ a({ path: Ie });
516
+ else {
517
+ if (!H().menuLoaded) {
518
+ se.value = {
519
+ to: e,
520
+ next: a
521
+ };
522
+ return;
523
+ }
524
+ const c = Qa(s, u.isLogin);
525
+ a();
526
+ }
527
+ }
528
+ });
529
+ const Ja = (e) => {
530
+ if (se.value) {
531
+ const { to: t, next: a } = se.value;
532
+ se.value = null, t.path === "/" ? a(e) : a(t.path);
533
+ }
534
+ }, ja = (e) => {
535
+ const t = Je();
536
+ if (t.TabEnabled) {
537
+ if (Ga(e.key, t.TabPanes))
538
+ return;
539
+ t.TabPanes.push(e);
540
+ }
541
+ }, Ga = (e, t) => t.find((a) => a.key === e), Je = ue("pageInfo", {
542
+ state: () => ({
543
+ TabActive: "",
544
+ TabPanes: [],
545
+ TabEnabled: !0
546
+ }),
547
+ actions: {
548
+ /**
549
+ * 删除Tab,页面缓存不卸载
550
+ * @param path 路由地址:路由地址
551
+ */
552
+ removeTabPane(e) {
553
+ if (this.TabEnabled) {
554
+ H().excludeComponent(e);
555
+ let a = 0, s = [...this.TabPanes];
556
+ for (let n = 0; n < s.length; n++)
557
+ if (s[n].key === e) {
558
+ s.splice(n, 1), a = n - 1 < 0 ? 0 : n - 1;
559
+ break;
560
+ }
561
+ for (let n = 0; n < s.length; n++)
562
+ if (s[n].key === this.TabActive) {
563
+ a = n;
564
+ break;
565
+ }
566
+ this.TabPanes = s, this.setTabActive(s[a].key);
567
+ }
568
+ },
569
+ /**
570
+ * 新增或激活Tab
571
+ * @param path 路由地址:路由地址
572
+ * @returns
573
+ */
574
+ async setTabActive(e) {
575
+ let a = H().findRoute(e);
576
+ if (!a) return;
577
+ const s = {
578
+ key: e,
579
+ title: a.name.toString(),
580
+ content: "",
581
+ closable: !0,
582
+ // 根据路由的meta.keepAlive确定是否加入对应缓存
583
+ // 默认为true
584
+ keepAlive: !(a.meta && !a.meta.keepAlive)
585
+ };
586
+ ja(s), this.TabActive = e;
587
+ }
588
+ },
589
+ persist: !1
590
+ }), Wa = {
591
+ appList: {
592
+ api: "PLATFORM_API",
593
+ authorize: !0,
594
+ url: "/api/RCTenanetOpSrv/getApps",
595
+ loadingText: !1
596
+ }
597
+ }, Fe = /* @__PURE__ */ new Map(), qa = (e) => {
598
+ const t = j(), { roles: a, permission: s } = e.meta || {};
599
+ if (F(a) && F(s))
600
+ return !0;
601
+ if (ye.VITE_PERMISSION_MODE === "role")
602
+ return F(a) ? !0 : t.hasRole(a);
603
+ if (ye.VITE_PERMISSION_MODE === "permit") {
604
+ let n = !1, o = !1;
605
+ return F(a) || (n = t.hasRole(a)), t.isAdmin() ? n : (F(s) || (o = t.hasPermit(e.path, s)), n || o);
606
+ }
607
+ return !1;
608
+ }, ra = (e) => e.map((t) => {
609
+ const a = { ...t };
610
+ return qa(a) ? (a.children && (a.children = ra(a.children)), a) : null;
611
+ }).filter(Boolean), oa = (e, t = "") => {
612
+ for (const a of e) {
613
+ if (!a.children && !a.redirect) {
614
+ let s = t + a.path;
615
+ return s.startsWith("/") || (s = "/" + s), s;
616
+ }
617
+ if (a.children && a.children.length > 0 && a.path !== "/error" && a.path !== "/login" && a.path !== "/:page(.*)") {
618
+ const s = oa(a.children, t + a.path + "/");
619
+ if (s)
620
+ return s;
621
+ }
622
+ }
623
+ }, H = ue("appInfo", {
624
+ state: () => ({
625
+ appInfo: {
626
+ Id: "",
627
+ Name: "",
628
+ AppCode: "",
629
+ Version: "",
630
+ Host: "",
631
+ Source: Ce.Manual,
632
+ Action: Be.App,
633
+ Path: "",
634
+ Icon: "",
635
+ Routes: [],
636
+ flattenRoutes: {},
637
+ defaultPage: "",
638
+ Enabled: 1
639
+ },
640
+ appList: [],
641
+ CachedComponents: [],
642
+ ExcludeComponents: [],
643
+ menuLoaded: !1
644
+ }),
645
+ actions: {
646
+ /**
647
+ * 加载授权应用列表
648
+ */
649
+ async loadAppList(e) {
650
+ return new Promise(async (t) => {
651
+ e && e.length > 0 ? (this.appList.length = 0, setTimeout(async () => {
652
+ this.appList.push(...e), t();
653
+ }, 1e3)) : (this.appList.length === 0 && await this.getRemoteAppList(), t());
654
+ });
655
+ },
656
+ async getRemoteAppList() {
657
+ return G(Wa.appList, {
658
+ Query: {
659
+ AppCode: this.appInfo.AppCode,
660
+ Enabled: 1
661
+ }
662
+ }).then((e) => {
663
+ (e == null ? void 0 : e.status) === T.SUCCESS && e.data && (this.appList.length = 0, this.appList.push(...e.data));
664
+ });
665
+ },
666
+ async toDefaultApp(e) {
667
+ if (this.appList.length === 0 && await this.loadAppList(), this.appList.length === 0) {
668
+ x.error("加载应用列表失败");
669
+ return;
670
+ }
671
+ let t = "";
672
+ const a = window.location.pathname.split("/");
673
+ if (a.length > 1) {
674
+ for (let n = a.length - 1; n >= 0; n--)
675
+ if (a[n] !== "") {
676
+ t = a[n];
677
+ break;
678
+ }
679
+ }
680
+ let s = null;
681
+ t && t != "login" ? s = this.appList.find((n) => n.AppCode === t) : s = this.appList.find((n) => n.Default), t = s ? s.AppCode : this.appList[0].AppCode, await this.setActiveApp(t), (!e || e.startsWith("/#/") || e.includes("/error/") || window.location.hash.includes("/error/")) && this.push(this.appInfo.defaultPage);
682
+ },
683
+ /**
684
+ * 设置当前应用
685
+ * @param key 应用码
686
+ * @returns
687
+ */
688
+ async setActiveApp(e, t) {
689
+ this.menuLoaded = !1;
690
+ const a = this.appList.find((s) => s.AppCode === e);
691
+ a && (a.AppCode !== this.appInfo.AppCode && (this.appInfo = {
692
+ ...a,
693
+ flattenRoutes: {},
694
+ Routes: t ?? [],
695
+ defaultPage: ""
696
+ }), (!Se() || !La()) && (await j().getRolePermits(a.Id), this.appInfo.Routes.length && this.setAppRoutes(this.appInfo.Routes)));
697
+ },
698
+ /**
699
+ * 设置当前应用路由信息
700
+ * @param routes 路由信息
701
+ */
702
+ setAppRoutes(e) {
703
+ this.appInfo = {
704
+ ...this.appInfo,
705
+ flattenRoutes: {},
706
+ Routes: e,
707
+ defaultPage: ""
708
+ };
709
+ const t = this.appInfo.flattenRoutes;
710
+ for (const a of e)
711
+ na(a, t, void 0);
712
+ if (Object.keys(t).forEach((a) => {
713
+ const s = t[a];
714
+ s.children || !s.component || (s.meta && s.meta.keepAlive === !1 ? this.ExcludeComponents.push(a) : this.CachedComponents.push(a));
715
+ }), j().isLogin) {
716
+ const a = ra(this.appInfo.Routes);
717
+ if (Ka(a), this.appInfo.defaultPage = oa(a) || "", this.appInfo.defaultPage) {
718
+ if (this.menuLoaded = !0, N.value && N.value.mainAppPush) {
719
+ const s = this.formatRoute(this.appInfo.defaultPage);
720
+ N.value.mainAppPush(s);
721
+ }
722
+ Ja(this.appInfo.defaultPage);
723
+ }
724
+ }
725
+ },
726
+ /**
727
+ * 根据地址,返回组合地址结构,/类型/子应用名/#/路由地址
728
+ * @param path 路由地址
729
+ * @returns
730
+ */
731
+ formatRoute(e) {
732
+ let t = e;
733
+ return e.includes("#") ? e.startsWith("#") && (t = "/" + this.appInfo.Action.toLowerCase() + "/" + this.appInfo.AppCode + "/" + e) : this.appInfo.AppCode ? t = "/" + this.appInfo.Action.toLowerCase() + "/" + this.appInfo.AppCode + "/#" + e : t = "/#" + e, t;
734
+ },
735
+ /**
736
+ * 应用导航,菜单路由,都使用此处导航
737
+ * @param path 路由地址
738
+ */
739
+ push(e) {
740
+ this.findRoute(e) && Je().setTabActive(e), ga(() => {
741
+ if (oe.push({ path: e }), N.value && N.value.mainAppPush) {
742
+ const a = this.formatRoute(e);
743
+ N.value.mainAppPush(a);
744
+ }
745
+ });
746
+ },
747
+ /**
748
+ * 快速查找路由信息
749
+ * @param key 路由地址
750
+ * @returns
751
+ */
752
+ findRoute(e) {
753
+ return this.appInfo.flattenRoutes[e];
754
+ },
755
+ /**
756
+ * 根据路由信息返回组件实例
757
+ * @param component 组件
758
+ * @param route 路由
759
+ * @returns 组件实例
760
+ */
761
+ cacheComponent(e, t) {
762
+ let a = Fe.get(t.path);
763
+ if (!a)
764
+ if (this.CachedComponents.includes(t.path))
765
+ a = {
766
+ // 设置组件包装器的名称为路由路径
767
+ name: t.path,
768
+ render() {
769
+ return U(e);
770
+ }
771
+ }, Fe.set(t.path, a);
772
+ else return e;
773
+ return a;
774
+ },
775
+ /**
776
+ * 删除缓存组件
777
+ * @param path 路由地址
778
+ */
779
+ excludeComponent(e) {
780
+ this.ExcludeComponents.includes(e) || this.ExcludeComponents.push(e), this.CachedComponents.splice(this.CachedComponents.indexOf(e), 1), Fe.delete(e);
781
+ },
782
+ /**
783
+ * 路由路径层级查询,返回面包屑
784
+ */
785
+ matchedRoutes(e) {
786
+ const t = [], a = this.findRoute(e);
787
+ if (a && (t.push(a), a.parent)) {
788
+ const s = this.matchedRoutes(a.parent.path);
789
+ t.push(...s);
790
+ }
791
+ return t.reverse();
792
+ },
793
+ clean() {
794
+ this.appInfo = {
795
+ Id: "",
796
+ Name: "",
797
+ AppCode: "",
798
+ Version: "",
799
+ Host: "",
800
+ Source: Ce.Manual,
801
+ Action: Be.App,
802
+ Path: "",
803
+ Icon: "",
804
+ Routes: [],
805
+ flattenRoutes: {},
806
+ defaultPage: "",
807
+ Enabled: 1
808
+ }, this.CachedComponents.splice(0, this.CachedComponents.length), this.ExcludeComponents.splice(0, this.ExcludeComponents.length), this.appList.splice(0, this.appList.length), this.menuLoaded = !1;
809
+ },
810
+ logout() {
811
+ this.clean(), oe.push({ path: Ie + "#/" }), Se() && N.value && N.value.mainAppPush && N.value.mainAppPush(Ie + "#/");
812
+ }
813
+ },
814
+ persist: !1
815
+ }), ia = "Token解析失败", ze = "登录过期,请重新登录", je = {
816
+ login: {
817
+ api: "PLATFORM_API",
818
+ url: "/openapi/LoginSrv/login",
819
+ loadingText: !1
820
+ },
821
+ auth: {
822
+ api: "PLATFORM_API",
823
+ authorize: !0,
824
+ url: "/api/RCAccountOpSrv/getPermits",
825
+ loadingText: !1
826
+ },
827
+ logout: {
828
+ api: "PLATFORM_API",
829
+ authorize: !0,
830
+ url: "/api/LoginSrv/logout",
831
+ loadingText: "正在退出..."
832
+ }
833
+ }, Ba = (e) => {
834
+ let t = {
835
+ Option: {
836
+ Mode: "MicroApp"
837
+ },
838
+ Query: e
839
+ };
840
+ return G(je.login, t).then((a) => (a == null ? void 0 : a.status) === T.SUCCESS ? a : null);
841
+ }, Ca = (e) => {
842
+ let t = {
843
+ Query: {
844
+ AppId: e
845
+ }
846
+ };
847
+ return G(je.auth, t).then((a) => (a == null ? void 0 : a.status) === T.SUCCESS ? a.data : (x.error("获取授权信息失败," + (a == null ? void 0 : a.msg)), null));
848
+ }, za = () => {
849
+ let e = {
850
+ Option: {},
851
+ Query: {}
852
+ };
853
+ return G(je.logout, e).then((t) => (t == null ? void 0 : t.status) === T.SUCCESS ? t.data : null);
854
+ }, Ya = (e) => {
855
+ try {
856
+ const a = JSON.parse(atob(e.split(".")[1])).exp;
857
+ return Date.now() / 1e3 > a;
858
+ } catch (t) {
859
+ return console.error(ia, t), !0;
860
+ }
861
+ }, Me = (e, t) => e == "" ? (x.error(ze, {
862
+ duration: 3e3,
863
+ onClose: t
864
+ }), !1) : Ya(e) ? (x.error(ze, {
865
+ duration: 3e3,
866
+ onClose: t
867
+ }), !1) : !0, Xa = (e) => {
868
+ try {
869
+ const t = JSON.parse(atob(e.token.split(".")[1]));
870
+ return t.user = JSON.parse(t.user), e.UserInfo = t.user, !0;
871
+ } catch (t) {
872
+ return console.error(ia, t), !1;
873
+ }
874
+ }, k = f(""), ee = f(null), j = ue("userInfo", {
875
+ state: () => ({
876
+ isLogin: !1,
877
+ userInfo: {
878
+ Id: "",
879
+ Name: "",
880
+ Code: "",
881
+ TenantId: null,
882
+ UserLevel: ""
883
+ },
884
+ token: "",
885
+ refreshToken: ""
886
+ }),
887
+ actions: {
888
+ /**
889
+ * 启动时初始化用户信息
890
+ */
891
+ init() {
892
+ Se() || (this.token ? (Me(this.token, () => this.clean()), me(this.token), k.value = this.userInfo.UserLevel, this.isLogin = !0) : this.clean());
893
+ },
894
+ /**
895
+ * 登录操作
896
+ * @param loginInfo 登录信息
897
+ * @returns
898
+ */
899
+ async login(e, t) {
900
+ const a = await Ba(e);
901
+ if (a) {
902
+ const s = a;
903
+ if (s.errno)
904
+ return s;
905
+ {
906
+ const n = a.data;
907
+ if (this.token = n.token, me(this.token), this.isLogin = !0, Xa(n))
908
+ this.userInfo = {
909
+ ...this.userInfo,
910
+ ...n.UserInfo
911
+ }, k.value = n.UserInfo.UserLevel;
912
+ else {
913
+ x.error("用户信息解析失败");
914
+ return;
915
+ }
916
+ t && H().toDefaultApp();
917
+ }
918
+ }
919
+ },
920
+ /**
921
+ * 获取应用授权信息
922
+ * @param appId 应用ID
923
+ * @returns 是否获取成功
924
+ */
925
+ async getRolePermits(e) {
926
+ if (!this.isLogin || !this.token)
927
+ return !1;
928
+ if (ee.value && ee.value.appId === e)
929
+ return !0;
930
+ try {
931
+ const t = await Ca(e);
932
+ return t ? (ee.value = {
933
+ appId: e,
934
+ permits: t.permits || [],
935
+ lastTime: t.lastTime
936
+ }, !0) : !1;
937
+ } catch (t) {
938
+ return console.error("获取授权信息出错", t), !1;
939
+ }
940
+ },
941
+ /**
942
+ * 检查角色权限
943
+ * @param role 资源角色编码需求
944
+ * @returns 是否有角色权限
945
+ */
946
+ hasRole(e) {
947
+ return k.value ? Array.isArray(e) ? e.includes(k.value) : k.value === e : !1;
948
+ },
949
+ /**
950
+ * 检查功能权限
951
+ * @param url 所在页面
952
+ * @param permitCode 资源权限编码
953
+ * @returns 是否有功能权限
954
+ */
955
+ hasPermit(e, t) {
956
+ var s;
957
+ const a = ee.value;
958
+ return !a || !a.permits ? !1 : ((s = a.permits[e]) == null ? void 0 : s.includes(t)) ?? !1;
959
+ },
960
+ /**
961
+ * 获取用户信息
962
+ * @returns 用户Token
963
+ */
964
+ getUserInfo() {
965
+ return this.userInfo;
966
+ },
967
+ /**
968
+ * 设置用户信息
969
+ * 仅允许设置一次,启动时设置,避免通过其它方式设置
970
+ * @param userInfo 用户信息
971
+ * @param token 用户Token
972
+ */
973
+ setUserInfo(e, t) {
974
+ if (!Me(t)) {
975
+ this.clean();
976
+ return;
977
+ }
978
+ k.value || (k.value = e.UserLevel, this.userInfo = {
979
+ ...this.userInfo,
980
+ ...e
981
+ }, this.token = t, me(this.token), this.isLogin = !0);
982
+ },
983
+ /**
984
+ * 获取用户Token
985
+ * @returns 用户Token
986
+ */
987
+ getToken() {
988
+ return Me(this.token, () => {
989
+ this.clean(), this.logout();
990
+ }) ? this.token : "";
991
+ },
992
+ /**
993
+ * 是否超级管理员
994
+ */
995
+ isSuperAdmin() {
996
+ return k.value === "Super";
997
+ },
998
+ /**
999
+ * 是否管理员
1000
+ */
1001
+ isAdmin() {
1002
+ return k.value === "Super" || k.value === "Admin";
1003
+ },
1004
+ /**
1005
+ * 获取用户级别
1006
+ * @returns 用户级别
1007
+ */
1008
+ getUserLevel() {
1009
+ return k.value;
1010
+ },
1011
+ /*
1012
+ * 清理登录信息
1013
+ */
1014
+ async clean() {
1015
+ return this.userInfo = {
1016
+ Id: "",
1017
+ Name: "",
1018
+ Code: "",
1019
+ TenantId: "",
1020
+ UserLevel: ""
1021
+ }, this.token = "", me(this.token), this.isLogin = !1, ee.value = null, k.value = "", H().clean(), Promise.resolve();
1022
+ },
1023
+ /**
1024
+ * 登出操作
1025
+ * @returns
1026
+ */
1027
+ async logout() {
1028
+ try {
1029
+ await za();
1030
+ } catch (e) {
1031
+ console.error("调用登出接口失败", e);
1032
+ } finally {
1033
+ await this.clean(), setTimeout(async () => {
1034
+ x.success("已退出登录");
1035
+ }, 1e3), setTimeout(async () => {
1036
+ H().logout();
1037
+ }, 2e3);
1038
+ }
1039
+ return Promise.resolve();
1040
+ }
1041
+ },
1042
+ persist: Se() ? !1 : {
1043
+ key: "MICROAPP_USER_INFO",
1044
+ storage: localStorage,
1045
+ pick: ["token", "userInfo"],
1046
+ // 只存储token和userInfo
1047
+ afterHydrate: (e) => {
1048
+ e.store.init();
1049
+ }
1050
+ }
1051
+ }), Qt = (e, t) => {
1052
+ const a = j();
1053
+ return e.filter((n) => n.role && !a.hasRole(n.role) || n.permit && !a.hasPermit(oe.currentRoute.value.path, n.permit) || n.enabled === !1 ? !1 : typeof n.enabled == "function" ? n.enabled() : !0).filter((n) => {
1054
+ if (!t) {
1055
+ if (n.visible === !1)
1056
+ return !1;
1057
+ if (typeof n.visible == "function")
1058
+ return n.visible();
1059
+ }
1060
+ return !0;
1061
+ });
1062
+ }, Jt = (e, t) => {
1063
+ const a = t == null ? void 0 : t.filter((s) => {
1064
+ const n = e.find(
1065
+ (o) => o.dataIndex === s.dataIndex || o.key === s.key || o.title === s.title
1066
+ );
1067
+ return n ? { ...s, ...n } : !1;
1068
+ });
1069
+ return [...a || [], ...e.filter((s) => !(a != null && a.includes(s)))];
1070
+ }, Za = (e) => (e.remotePage = !1, la(e).then((t) => t.rows)), la = (e) => {
1071
+ e.gridQuery || (e.gridQuery = {});
1072
+ const t = e.remotePage ? "find" : "list";
1073
+ return Ve(e, {
1074
+ urlKey: t,
1075
+ url: e.gridUrl,
1076
+ params: e.gridQuery,
1077
+ loadingState: e.isGridLoading,
1078
+ processParams: (a) => {
1079
+ var n;
1080
+ return e.remotePage && (a.Query.$limit = [(e.pageNo.value - 1) * e.pageSize.value, e.pageSize.value]), ce((n = e.gridUrl) == null ? void 0 : n.params, a, e.gridQuery);
1081
+ }
1082
+ }).then((a) => {
1083
+ if ((a == null ? void 0 : a.status) === T.SUCCESS) {
1084
+ let s = a.data;
1085
+ return s.rows ? (e.tableData.value = s.rows, e.total.value = s.total) : (e.tableData.value = a.data, e.total.value = a.data.length, s = {
1086
+ total: e.total.value,
1087
+ rows: a.data
1088
+ }, e.afterLoad && e.afterLoad(s)), s;
1089
+ }
1090
+ return e.tableData.value = [], e.total.value = 0, {
1091
+ total: 0,
1092
+ rows: []
1093
+ };
1094
+ });
1095
+ }, et = (e, t, a = {}) => aa(e, {
1096
+ urlKey: "update",
1097
+ url: e.updateUrl,
1098
+ params: {
1099
+ Query: { [e.primaryKey]: t[e.primaryKey] },
1100
+ Data: t
1101
+ },
1102
+ loadingState: e.isGridSaving,
1103
+ ...a
1104
+ }).then((s) => ((s == null ? void 0 : s.status) === T.SUCCESS && setTimeout(() => {
1105
+ e.reload.value = !0, e.afterUpdate && e.afterUpdate(t);
1106
+ }, 50), s)), jt = (e, t) => {
1107
+ const a = {};
1108
+ return a[e.primaryKey] = t[e.primaryKey], a[e.statusKey] = t[e.statusKey], et(e, a, {
1109
+ loadingText: !1,
1110
+ hideErrorToast: !0
1111
+ });
1112
+ }, ua = async (e, t, a) => await Ve(e, {
1113
+ urlKey: "detail",
1114
+ url: a,
1115
+ params: t,
1116
+ loadingState: e.isGridLoading
1117
+ }), Gt = (e, t) => {
1118
+ const a = t;
1119
+ return ua(e, { [e.primaryKey]: a[e.primaryKey] }).then((s) => ((s == null ? void 0 : s.status) === T.SUCCESS && s.data && (e.expandRows.value[a[e.primaryKey]] = s), s));
1120
+ }, Wt = (e, t) => {
1121
+ let a = e.editor;
1122
+ e.rowData.value = t, a && (sa(a, t), a.visible.value = !0);
1123
+ }, qt = (e, t) => Da(e, t, {
1124
+ url: e.deleteUrl,
1125
+ primaryKey: e.primaryKey
1126
+ }).then((a) => ((a == null ? void 0 : a.status) === T.SUCCESS && setTimeout(() => {
1127
+ e.reload.value = !0, e.afterDelete && !Array.isArray(t) && e.afterDelete(t);
1128
+ }, 50), a));
1129
+ var Ne = /* @__PURE__ */ ((e) => (e.SelectReload = "Select.Reload", e.RadioReload = "Radio.Reload", e.CheckboxReload = "Checkbox.Reload", e.TreeSelectReload = "TreeSelect.Reload", e.TreeCheckReload = "TreeCheck.Reload", e))(Ne || {});
1130
+ class at {
1131
+ constructor() {
1132
+ $(this, "listeners", {});
1133
+ }
1134
+ // 检查事件名是否符合前缀
1135
+ isValidPrefix(t) {
1136
+ return Object.values(Ne).some((a) => t.startsWith(a + "."));
1137
+ }
1138
+ /**
1139
+ * 事件订阅
1140
+ * @param event 事件名
1141
+ * @param listener 处理器
1142
+ */
1143
+ on(t, a) {
1144
+ if (!this.isValidPrefix(t)) {
1145
+ console.error(`事件前缀不正确: ${t}, 事件名必须以 ${Object.values(Ne).join(", ")} 开头`);
1146
+ return;
1147
+ }
1148
+ this.listeners[t] || (this.listeners[t] = []), this.listeners[t].push(a);
1149
+ }
1150
+ /**
1151
+ * 取消订阅事件
1152
+ * @param event 事件名
1153
+ * @param listener 处理器
1154
+ */
1155
+ off(t, a) {
1156
+ if (!this.isValidPrefix(t)) {
1157
+ console.error(`事件前缀不正确: ${t}`);
1158
+ return;
1159
+ }
1160
+ this.listeners[t] && (this.listeners[t] = this.listeners[t].filter((s) => s !== a));
1161
+ }
1162
+ //
1163
+ /**
1164
+ * 触发事件
1165
+ * @param event 事件名
1166
+ * @param args 参数
1167
+ */
1168
+ emit(t, ...a) {
1169
+ if (!this.isValidPrefix(t)) {
1170
+ console.error(`事件前缀不正确: ${t}`);
1171
+ return;
1172
+ }
1173
+ this.listeners[t] && this.listeners[t].forEach((s) => s(t, ...a));
1174
+ }
1175
+ }
1176
+ const q = new at(), Z = (e, t, a) => {
1177
+ if (t.inputFactory && (a != null && a.reloadEvent)) {
1178
+ const s = t.inputFactory.value;
1179
+ s.reloadHandler = (n, o) => {
1180
+ tt(t.url, t, o);
1181
+ }, q.on(a.reloadEvent, s.reloadHandler);
1182
+ }
1183
+ if (a != null && a.data)
1184
+ g(
1185
+ () => a.data,
1186
+ () => {
1187
+ Ge(t, a.data, !0);
1188
+ },
1189
+ { deep: !0, immediate: !0 }
1190
+ );
1191
+ else if (t.url && t.url.url)
1192
+ e && ca(t.url, t, t.params ?? {});
1193
+ else {
1194
+ const s = f(te(D.LabelText, ""));
1195
+ x.error("`" + s.value + "` 未配置选项数据!", {
1196
+ duration: 5e3
1197
+ });
1198
+ }
1199
+ }, Ge = (e, t, a) => {
1200
+ if (a) {
1201
+ const s = {
1202
+ ...e.fieldMap
1203
+ };
1204
+ t = $a(s, t);
1205
+ }
1206
+ t = JSON.parse(JSON.stringify(t ?? [])), e.all && t.unshift({
1207
+ label: "全部",
1208
+ value: e.allValue ?? void 0
1209
+ }), e.options.value = t;
1210
+ }, tt = (e, t, a) => {
1211
+ Array.isArray(a) ? Ge(t, a, !0) : ca(e, t, a);
1212
+ }, de = (e, t) => {
1213
+ var a;
1214
+ (a = e.inputFactory) != null && a.value && t.reloadEvent && e.inputFactory.value.reloadHandler && q.off(t.reloadEvent, e.inputFactory.value.reloadHandler);
1215
+ }, ca = (e, t, a) => {
1216
+ const s = JSON.parse(JSON.stringify(e.params ?? {})), n = JSON.parse(JSON.stringify(t.params ?? {})), o = ce(s, n, a);
1217
+ st(e, t, t.fieldMap, o).then((r) => {
1218
+ Ge(t, r, !1);
1219
+ });
1220
+ }, st = (e, t, a, s) => {
1221
+ const { fieldMap: n, ...o } = e, l = {
1222
+ ...{
1223
+ url: "",
1224
+ cacheTime: 6e4,
1225
+ fieldMap: {
1226
+ ...e.fieldMap,
1227
+ ...a
1228
+ }
1229
+ },
1230
+ ...o
1231
+ };
1232
+ return l.loadingText = !1, s || (s = {}), s.Query || (s.Query = {}), t.optionQuery = s, t.isOptionLoading.value = !0, G(l, s).then((u) => (u == null ? void 0 : u.status) === T.SUCCESS && u.data ? u.data : []).finally(() => {
1233
+ t.isOptionLoading.value = !1;
1234
+ });
1235
+ }, nt = (e, t, a) => {
1236
+ if (e === void 0) return;
1237
+ const s = (o) => {
1238
+ const r = { ...o };
1239
+ return a && o.children && o.children.length > 0 ? r.children = o.children.map((l) => s(l)) : delete r.children, r;
1240
+ }, n = (o, r) => {
1241
+ const l = [];
1242
+ for (const u of r)
1243
+ if (o.includes(u.value) && l.push(s(u)), u.children && u.children.length > 0) {
1244
+ const i = n(o, u.children);
1245
+ l.push(...i);
1246
+ }
1247
+ return l;
1248
+ };
1249
+ if (Array.isArray(e))
1250
+ return n(e, t);
1251
+ {
1252
+ const o = n([e], t);
1253
+ return o.length > 0 ? o[0] : void 0;
1254
+ }
1255
+ }, we = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map((t) => t.label) : [e.label], ae = (e, t, a) => {
1256
+ const s = t.split(".");
1257
+ let n = e;
1258
+ for (let o = 0; o < s.length - 1; o++) {
1259
+ const r = s[o];
1260
+ n[r] || (n[r] = {}), n = n[r];
1261
+ }
1262
+ n[s[s.length - 1]] = a;
1263
+ }, fa = (e, t, a) => {
1264
+ if (a == null) {
1265
+ Object.entries(t).forEach(([s]) => {
1266
+ ae(e, s, a);
1267
+ });
1268
+ return;
1269
+ }
1270
+ Array.isArray(a) ? Object.entries(t).forEach(([s, n]) => {
1271
+ var r;
1272
+ if (/^\$\{\d+\}/.test(n))
1273
+ try {
1274
+ const l = parseInt(((r = n.match(/\$\{(\d+)\}/)) == null ? void 0 : r[1]) ?? "0"), u = a[l], i = n.replace(/\$\{\d+\}\./, "");
1275
+ if (i && u) {
1276
+ const c = be(i, u);
1277
+ ae(e, s, c);
1278
+ } else
1279
+ ae(e, s, u);
1280
+ } catch {
1281
+ console.error("outFields 格式错误:" + n, "必须是 ${index} 或者 ${index}.${key}");
1282
+ }
1283
+ else
1284
+ console.error("outFields 格式错误:" + n, "必须是 ${index} 或者 ${index}.${key}");
1285
+ }) : Object.entries(t).forEach(([s, n]) => {
1286
+ if (n.includes("${")) {
1287
+ const o = be(n, a);
1288
+ ae(e, s, o);
1289
+ } else
1290
+ ae(e, s, a[n]);
1291
+ });
1292
+ }, Pe = (e, t, a) => {
1293
+ var o, r;
1294
+ const s = (o = e.inputFactory) == null ? void 0 : o.value;
1295
+ s != null && s.editorCtrl && ((r = s.errInfo) != null && r.value.errClass) && pe(s.editorCtrl), e.selected.value = a;
1296
+ const n = nt(a, e.options.value);
1297
+ if (e.selectedOptions.value = n, t.formData && t.outFields && fa(t.formData, t.outFields, n), t.changeEvent) {
1298
+ const [l, u] = t.changeEvent;
1299
+ if (u)
1300
+ if (Array.isArray(l))
1301
+ l.every((i) => {
1302
+ const c = be(u, { selectedValues: a });
1303
+ try {
1304
+ const p = JSON.parse(c);
1305
+ q.emit(i, p, a, n);
1306
+ } catch (p) {
1307
+ console.error("eventParamsValue: ", c, p);
1308
+ }
1309
+ });
1310
+ else {
1311
+ const i = be(u, { selectedValues: a });
1312
+ try {
1313
+ const c = JSON.parse(i);
1314
+ q.emit(l, c, a, n);
1315
+ } catch (c) {
1316
+ console.error("eventParamsValue: ", i, c);
1317
+ }
1318
+ }
1319
+ else
1320
+ Array.isArray(l) ? l.every((i) => {
1321
+ q.emit(i, n, a);
1322
+ }) : q.emit(l, n, a);
1323
+ }
1324
+ return s != null && s.inputEmit && s.inputEmit("change", a, n), n;
1325
+ }, S = {
1326
+ PageOption: {
1327
+ primaryKey: "Id",
1328
+ statusKey: "Enabled"
1329
+ },
1330
+ GridOption: {
1331
+ autoload: !0,
1332
+ primaryKey: "Id",
1333
+ statusKey: "Enabled",
1334
+ remotePage: !0,
1335
+ tableSize: f("small"),
1336
+ selectable: f(!1),
1337
+ searchBar: f(!0),
1338
+ pageSize: f(10),
1339
+ rowExpand: f(!1),
1340
+ buttons: f(["New"]),
1341
+ tools: ["Reload", "RowHeight", "TableHeadset"],
1342
+ operates: ["Edit", "Delete"]
1343
+ },
1344
+ EditorOption: {
1345
+ primaryKey: "Id",
1346
+ autoClose: !0,
1347
+ autoDetail: !1,
1348
+ saveBtnVisible: !0,
1349
+ saveAsBtnVisible: !0
1350
+ },
1351
+ TreeOption: {
1352
+ autoload: !0
1353
+ },
1354
+ OptionOption: {
1355
+ all: !1,
1356
+ allValue: [0, 1],
1357
+ autoload: !0,
1358
+ fieldMap: {
1359
+ label: "Name",
1360
+ value: "Id"
1361
+ }
1362
+ }
1363
+ }, Bt = (e) => {
1364
+ S.PageOption = {
1365
+ ...S.PageOption,
1366
+ ...e.pageOption
1367
+ }, S.GridOption = {
1368
+ ...S.GridOption,
1369
+ ...e.gridOption
1370
+ }, S.EditorOption = {
1371
+ ...S.EditorOption,
1372
+ ...e.editorOptions
1373
+ }, S.TreeOption = {
1374
+ ...S.TreeOption,
1375
+ ...e.treeOption
1376
+ };
1377
+ }, ke = (e) => {
1378
+ for (let t in e.urls)
1379
+ e.urls[t].api || (e.urls[t].api = e.api), e.urls[t].authorize === void 0 && (e.urls[t].authorize = e.authorize);
1380
+ }, rt = (e, t, a, s) => (ke(e), {
1381
+ editorCtrl: {
1382
+ ...S.EditorOption,
1383
+ name: "",
1384
+ default: a ? JSON.parse(JSON.stringify(a)) : void 0,
1385
+ visible: f(!1),
1386
+ page: t,
1387
+ formData: f(a ? JSON.parse(JSON.stringify(a)) : void 0),
1388
+ formRules: f(s),
1389
+ ruleResults: f({}),
1390
+ updateData: f(void 0),
1391
+ saveUrl: e.urls.save,
1392
+ detailUrl: e.urls.detail,
1393
+ isFormSaving: f(!1),
1394
+ isFormLoading: f(!1)
1395
+ }
1396
+ }), ot = (e, t, a) => {
1397
+ ke(e);
1398
+ const s = {
1399
+ ...S.GridOption,
1400
+ tableSize: f(S.GridOption.tableSize.value),
1401
+ selectable: f(S.GridOption.selectable.value),
1402
+ searchBar: f(S.GridOption.searchBar.value),
1403
+ pageSize: f(S.GridOption.pageSize.value),
1404
+ rowExpand: f(S.GridOption.rowExpand.value),
1405
+ buttons: f([...S.GridOption.buttons.value]),
1406
+ tools: [...S.GridOption.tools],
1407
+ operates: [...S.GridOption.operates],
1408
+ columns: f(a || []),
1409
+ reload: f(!1),
1410
+ pageNo: f(1),
1411
+ total: f(0),
1412
+ page: t,
1413
+ selectKeys: f([]),
1414
+ selectRows: f([]),
1415
+ rowData: f(void 0),
1416
+ gridQuery: {},
1417
+ tableData: K(void 0),
1418
+ expandRows: f({}),
1419
+ isGridLoading: f(!1),
1420
+ isGridSaving: f(!1),
1421
+ gridUrl: e.urls.list || e.urls.find,
1422
+ updateUrl: e.urls.update,
1423
+ deleteUrl: e.urls.delete
1424
+ };
1425
+ return g(
1426
+ () => s.reload.value,
1427
+ (n) => {
1428
+ n && (setTimeout(() => {
1429
+ s.reload.value = !1;
1430
+ }, 1), s.remotePage ? la(s) : Za(s));
1431
+ }
1432
+ ), {
1433
+ gridCtrl: s
1434
+ };
1435
+ }, Ct = (e, t) => {
1436
+ ke(e);
1437
+ const a = {
1438
+ ...S.TreeOption,
1439
+ reload: f(!1),
1440
+ page: t,
1441
+ node: f(void 0),
1442
+ url: e.urls.tree,
1443
+ data: K(void 0),
1444
+ isTreeLoading: f(!1)
1445
+ };
1446
+ return g(
1447
+ () => a.reload.value,
1448
+ (s) => {
1449
+ s && (setTimeout(() => {
1450
+ a.reload.value = !1;
1451
+ }, 1), Ua(a));
1452
+ }
1453
+ ), {
1454
+ treeCtrl: a
1455
+ };
1456
+ }, he = (e, t) => {
1457
+ const a = {
1458
+ ...S.OptionOption,
1459
+ url: e,
1460
+ reload: f(!1),
1461
+ optionQuery: {},
1462
+ data: K([]),
1463
+ selected: f([]),
1464
+ selectedOptions: f([]),
1465
+ options: f([]),
1466
+ isOptionLoading: f(!1)
1467
+ };
1468
+ return g(
1469
+ () => a.reload.value,
1470
+ (s) => {
1471
+ s && (setTimeout(() => {
1472
+ a.reload.value = !1;
1473
+ }, 1), Z(!0, a, t));
1474
+ }
1475
+ ), {
1476
+ optionCtrl: a
1477
+ };
1478
+ }, zt = (e, t, a) => {
1479
+ ke(e);
1480
+ const s = {
1481
+ ...S.PageOption,
1482
+ ...e
1483
+ }, { editorCtrl: n } = rt(e, s, t, a), { gridCtrl: o } = ot(e, s);
1484
+ return s.editor = n, s.grid = o, o.editor = n, o.tools = ["Reload", "RowHeight", "TableHeadset", "Fullscreen"], n.grid = o, {
1485
+ pageCtrl: s,
1486
+ editorCtrl: n,
1487
+ gridCtrl: o
1488
+ };
1489
+ }, it = 7 * 24 * 60 * 60 * 1e3, _e = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Set(), J = f({}), Yt = J, Xt = (e) => {
1490
+ var n;
1491
+ if (!e.iconUrl) return De;
1492
+ const t = f(!0), a = f("");
1493
+ let s = !0;
1494
+ return (n = e.icons) != null && n.length && (s = e.icons.every((o) => J.value[o] !== void 0)), (e.icon && !J.value[e.icon] || !s) && lt(e, t).then(() => {
1495
+ ft(e.iconUrl, e.monoColor || !1), t.value = !0;
1496
+ }), X({
1497
+ props: {
1498
+ icon: {
1499
+ type: String
1500
+ },
1501
+ icons: {
1502
+ type: Array
1503
+ },
1504
+ iconIndex: {
1505
+ type: Number
1506
+ },
1507
+ clickable: {
1508
+ type: Boolean
1509
+ },
1510
+ angle: {
1511
+ type: Number
1512
+ },
1513
+ flip: {
1514
+ type: Boolean
1515
+ },
1516
+ class: {
1517
+ type: [String, Array],
1518
+ default: ""
1519
+ }
1520
+ },
1521
+ emits: ["update:iconIndex"],
1522
+ setup(o, { emit: r }) {
1523
+ const l = f(o.icon), u = f(0), i = () => {
1524
+ o.icons && u.value++;
1525
+ };
1526
+ return g(
1527
+ () => o.iconIndex,
1528
+ (c) => {
1529
+ c !== void 0 && (u.value = c);
1530
+ },
1531
+ { immediate: !0 }
1532
+ ), g(
1533
+ () => u.value,
1534
+ (c) => {
1535
+ o.icons && (c >= o.icons.length && (u.value = 0), l.value = o.icons[u.value], ve(a, l, l.value), r("update:iconIndex", u.value));
1536
+ },
1537
+ { immediate: !0 }
1538
+ ), g(
1539
+ () => J.value,
1540
+ () => {
1541
+ ve(a, l, l.value);
1542
+ },
1543
+ { deep: !0 }
1544
+ ), g(
1545
+ () => o.icon,
1546
+ (c) => {
1547
+ ve(a, l, c);
1548
+ }
1549
+ ), ve(a, l, l.value), { isLoaded: t, Icon: a, handleClick: i };
1550
+ },
1551
+ render() {
1552
+ if (!t.value)
1553
+ return De;
1554
+ let o = this.class, r = "";
1555
+ Array.isArray(o) ? r = o.join(" ") : typeof o == "string" && (r = o);
1556
+ let l = [r];
1557
+ return !/\bw-/.test(r) && !/$w-/.test(r) && l.push("w-4"), !/\bh-/.test(r) && !/$h-/.test(r) && l.push("h-4"), a.value ? U(Ze(a.value), {
1558
+ onClick: this.$props.clickable ? this.handleClick : void 0,
1559
+ class: `${l.join(" ")}`,
1560
+ style: {
1561
+ fill: "currentColor",
1562
+ cursor: this.$props.clickable ? "pointer" : "default",
1563
+ transform: dt(this.angle, this.flip)
1564
+ }
1565
+ }) : U("div", { class: "w-[14px] h-[14px]" });
1566
+ }
1567
+ });
1568
+ }, lt = (e, t) => {
1569
+ let a = e.iconUrl;
1570
+ if (!a)
1571
+ return console.error("图标库地址不能为空"), Promise.resolve();
1572
+ if (_e.has(a))
1573
+ return Promise.resolve();
1574
+ const s = da(a);
1575
+ if (s)
1576
+ return new Promise(async (o) => (pa(s.scriptContent), o()));
1577
+ t.value = !1;
1578
+ const n = new Promise(async (o) => {
1579
+ await ut(a, e.monoColor || !1), o(), _e.delete(a);
1580
+ });
1581
+ return _e.set(a, n), n;
1582
+ }, ut = async (e, t) => {
1583
+ try {
1584
+ const a = await fetch(e);
1585
+ if (!a.ok) {
1586
+ x.error("网络异常,无法加载图标库!");
1587
+ return;
1588
+ }
1589
+ let s = await a.text();
1590
+ s = t ? s.replace(/fill=\"[^\"]*\"/gi, "") : s;
1591
+ let n = /^window\.(\w+)\s*=/;
1592
+ const o = s.match(n);
1593
+ if (o && o.length > 1) {
1594
+ let r = o[1];
1595
+ ct(e, r, t, s);
1596
+ }
1597
+ pa(s);
1598
+ return;
1599
+ } catch (a) {
1600
+ return console.error("网络异常,无法加载图标库:", a), null;
1601
+ }
1602
+ }, pa = (e) => {
1603
+ const t = document.createElement("script");
1604
+ t.textContent = e, document.head.appendChild(t);
1605
+ }, ct = (e, t, a, s) => {
1606
+ let n = `icon_cache:${e}`;
1607
+ const o = {
1608
+ windowKey: t,
1609
+ monoColor: a,
1610
+ scriptContent: s,
1611
+ expireTime: Date.now() + it
1612
+ // 缓存时间:7天
1613
+ };
1614
+ localStorage.setItem(n, JSON.stringify(o));
1615
+ }, da = (e) => {
1616
+ let t = `icon_cache:${e}`;
1617
+ const a = localStorage.getItem(t);
1618
+ if (!a) return null;
1619
+ let s;
1620
+ try {
1621
+ s = JSON.parse(a);
1622
+ } catch (n) {
1623
+ return console.error("解析缓存失败:", n), null;
1624
+ }
1625
+ return s.expireTime < Date.now() ? (localStorage.removeItem(e), null) : s;
1626
+ }, Zt = () => {
1627
+ const e = Date.now();
1628
+ for (const t in localStorage)
1629
+ if (t.startsWith("icon_cache:")) {
1630
+ const a = localStorage.getItem(t);
1631
+ a && JSON.parse(a).expireTime < e && localStorage.removeItem(t);
1632
+ }
1633
+ }, ve = (e, t, a) => {
1634
+ setTimeout(() => {
1635
+ t.value = a, t.value && (e.value = J.value[t.value]);
1636
+ }, 1);
1637
+ }, De = U(
1638
+ "svg",
1639
+ { class: "w-4 h-4", viewBox: "0 0 50 50", style: { animation: "rotate 2s linear infinite" } },
1640
+ [
1641
+ U("circle", {
1642
+ cx: "25",
1643
+ cy: "25",
1644
+ r: "20",
1645
+ stroke: "currentColor",
1646
+ fill: "none",
1647
+ style: { strokeWidth: "3 !important" }
1648
+ // 强制应用线宽
1649
+ }),
1650
+ U("circle", {
1651
+ cx: "25",
1652
+ cy: "6",
1653
+ r: "6",
1654
+ fill: "currentColor"
1655
+ })
1656
+ ]
1657
+ ), ft = (e, t) => {
1658
+ const a = da(e);
1659
+ Object.keys(window).forEach((s) => {
1660
+ s.startsWith("_iconfont_svg_string_") && (a == null ? void 0 : a.windowKey) === s && !Ye.has(s) && (Ye.add(s), pt(s, t));
1661
+ });
1662
+ }, pt = (e, t) => {
1663
+ const a = window[e], o = new DOMParser().parseFromString(a, "image/svg+xml").getElementsByTagName("symbol"), r = document.querySelectorAll("symbol");
1664
+ for (const l of o) {
1665
+ const u = l.id, i = Array.from(r).find((c) => c.id === u);
1666
+ i && t && (i.innerHTML = l.innerHTML, i.querySelectorAll("*").forEach((c) => {
1667
+ c.hasAttribute("fill") && c.removeAttribute("fill");
1668
+ })), J.value[u] || (J.value[u] = U("svg", { fill: "currentColor" }, [U("use", { "xlink:href": `#${u}` })]));
1669
+ }
1670
+ }, dt = (e, t) => {
1671
+ let a = "";
1672
+ return e && (a += `rotate(${e}deg)`), t && (a += " scaleX(-1)"), a;
1673
+ }, es = (e, t, a, s) => {
1674
+ ha(e, [], a, s).forEach((o) => t.push(o));
1675
+ }, ha = (e, t, a, s) => {
1676
+ var r, l, u, i, c;
1677
+ const n = [], o = j();
1678
+ for (const p of e) {
1679
+ if (p.redirect || p.path.includes("/login") || p.path.includes("/error") || p.path.includes("/:page(.*)") || (l = (r = p.meta) == null ? void 0 : r.roles) != null && l.length && !o.hasRole(p.meta.roles) && (u = p.meta) != null && u.permission && !o.hasPermit(p.meta.permission, ":page"))
1680
+ continue;
1681
+ const v = p.path.split("/");
1682
+ v.unshift(...t);
1683
+ const d = ha(p.children || [], v, a, s), O = {
1684
+ key: v.join("/"),
1685
+ label: ((i = p.name) == null ? void 0 : i.toString()) ?? "",
1686
+ title: ((c = p.name) == null ? void 0 : c.toString()) ?? "",
1687
+ icon: p.icon ? U(a, { ...s, icon: p.icon }) : void 0,
1688
+ children: d.length > 0 ? d : void 0
1689
+ };
1690
+ (d.length > 0 || !p.children) && n.push(O);
1691
+ }
1692
+ return n;
1693
+ }, Xe = ya([]), as = () => {
1694
+ Xe.length = 0;
1695
+ const e = H();
1696
+ let a = Je().TabActive;
1697
+ e.matchedRoutes(a).forEach((n, o) => {
1698
+ var l;
1699
+ const r = {
1700
+ index: o,
1701
+ path: n.path,
1702
+ breadcrumbName: ((l = n.name) == null ? void 0 : l.toString()) ?? ""
1703
+ };
1704
+ Xe.push(r);
1705
+ });
1706
+ }, ht = {
1707
+ host: {
1708
+ api: "SITEHOST_API",
1709
+ url: "/openapi/RCSiteHostSrv/get",
1710
+ fieldMap: {
1711
+ hostId: "Id",
1712
+ hostName: "Title"
1713
+ },
1714
+ loadingText: "站点配置加载中……",
1715
+ // 不显示错误
1716
+ hideErrorToast: !0
1717
+ }
1718
+ }, ts = ue("hostInfo", {
1719
+ state: () => ({
1720
+ hostInfo: {
1721
+ Host: "",
1722
+ Title: "",
1723
+ API_HOST: {},
1724
+ SERVER_HOST: {},
1725
+ ExtraProps: {},
1726
+ ExtraPropLines: []
1727
+ }
1728
+ }),
1729
+ actions: {
1730
+ /**
1731
+ * 获取站点API地址
1732
+ */
1733
+ getSiteHostApi() {
1734
+ return "";
1735
+ },
1736
+ /**
1737
+ * 加载站点信息
1738
+ * @param hostApi 启动配置主机地址
1739
+ * @param hostKey 站点信息,默认为当前主域名
1740
+ * @param mainOpenApis 宿主机开放接口
1741
+ */
1742
+ async loadHostInfo(e, t, a) {
1743
+ if (a) {
1744
+ this._setHostInfo(a.getHostInfo());
1745
+ return;
1746
+ }
1747
+ let s = (e || this.getSiteHostApi()).trim();
1748
+ return (!s || s === "/") && (s = window.location.origin), s.endsWith("/") && (s = s.slice(0, -1)), new Promise((n) => {
1749
+ $e.SITEHOST_API || ($e.SITEHOST_API = s);
1750
+ const o = t || window.location.origin;
1751
+ G(ht.host, {
1752
+ Query: {
1753
+ Host: o
1754
+ }
1755
+ }).then((r) => {
1756
+ if ((r == null ? void 0 : r.status) === T.SUCCESS && r.data) {
1757
+ const l = r.data;
1758
+ this._setHostInfo(l);
1759
+ } else
1760
+ this._setHostInfo(null);
1761
+ n();
1762
+ });
1763
+ });
1764
+ },
1765
+ /**
1766
+ * 清除主机信息
1767
+ */
1768
+ clear() {
1769
+ this.hostInfo = {
1770
+ Host: "",
1771
+ Title: "",
1772
+ API_HOST: {},
1773
+ SERVER_HOST: {},
1774
+ MIDDLEWARES: {},
1775
+ ExtraProps: {},
1776
+ ExtraPropLines: []
1777
+ };
1778
+ },
1779
+ /**
1780
+ * 设置主机信息
1781
+ */
1782
+ _setHostInfo(e) {
1783
+ if (this.hostInfo = {
1784
+ ...this.hostInfo,
1785
+ ...e
1786
+ }, this.hostInfo.API_HOST)
1787
+ for (const t in this.hostInfo.API_HOST) {
1788
+ let a = this.hostInfo.API_HOST[t];
1789
+ a = a.startsWith("http://") || a.startsWith("https://") || a.startsWith("//") ? a : window.location.origin + a, a.endsWith("/") && (a = a.slice(0, -1)), this.hostInfo.API_HOST[t] = a, $e[t] = a;
1790
+ }
1791
+ if (this.hostInfo.SERVER_HOST)
1792
+ for (const t in this.hostInfo.SERVER_HOST) {
1793
+ let a = this.hostInfo.SERVER_HOST[t];
1794
+ a = a.startsWith("http://") || a.startsWith("https://") || a.startsWith("//") ? a : window.location.origin + a, a.endsWith("/") && (a = a.slice(0, -1)), this.hostInfo.SERVER_HOST[t] = a, Fa[t] = a;
1795
+ }
1796
+ },
1797
+ getHostInfo() {
1798
+ return this.hostInfo;
1799
+ }
1800
+ },
1801
+ // 使用自定义数据缓存
1802
+ persist: !1
1803
+ // persist: {
1804
+ // key: HOSTINFO_STORE_KEY,
1805
+ // storage: localStorage,
1806
+ // pick: ['hostInfo'],
1807
+ // },
1808
+ }), ss = ue("settingInfo", {
1809
+ state: () => ({
1810
+ fullscreen: !1,
1811
+ menuCollapse: !1,
1812
+ tableColumns: {}
1813
+ }),
1814
+ actions: {
1815
+ /**
1816
+ * 设置全屏
1817
+ */
1818
+ setFullscreen(e) {
1819
+ this.$patch({
1820
+ fullscreen: e
1821
+ });
1822
+ },
1823
+ /**
1824
+ * 设置主菜单区折叠
1825
+ */
1826
+ setMenuCollapse(e) {
1827
+ this.$patch({
1828
+ menuCollapse: e
1829
+ });
1830
+ },
1831
+ /**
1832
+ * 获取表格头配置
1833
+ */
1834
+ getTableColumns(e) {
1835
+ return this.tableColumns[e];
1836
+ },
1837
+ /**
1838
+ * 设置表格头配置
1839
+ */
1840
+ setTableColumns(e, t) {
1841
+ this.$patch({
1842
+ tableColumns: {
1843
+ ...this.tableColumns,
1844
+ [e]: t
1845
+ }
1846
+ });
1847
+ }
1848
+ },
1849
+ persist: !1
1850
+ }), ns = /* @__PURE__ */ X({
1851
+ __name: "index",
1852
+ props: {
1853
+ ...fe,
1854
+ /**
1855
+ * 选择项数据
1856
+ */
1857
+ data: {
1858
+ type: Array,
1859
+ required: !0
1860
+ }
1861
+ },
1862
+ emits: ["change"],
1863
+ setup(e, { emit: t }) {
1864
+ const a = e, s = Y(), n = he(a.url, a), o = a.optionCtrl ?? n.optionCtrl;
1865
+ o.inputFactory = K(s);
1866
+ const r = f([]);
1867
+ o && g(
1868
+ () => o.options.value,
1869
+ (p) => {
1870
+ r.value = p || [];
1871
+ },
1872
+ { immediate: !0, deep: !0 }
1873
+ );
1874
+ const l = t, { editorCtrl: u, errInfo: i } = Y(), c = (p) => {
1875
+ i != null && i.value.errClass && u && pe(u), l("change", p);
1876
+ };
1877
+ return xe(() => {
1878
+ if (!a.data || a.data.length != 2) {
1879
+ console.error("Switch组件: ", a.data), x.error("Switch组件必须有且只有两个选项");
1880
+ return;
1881
+ }
1882
+ o && Z(o.autoload, o, a);
1883
+ }), ie(() => {
1884
+ o && de(o, a);
1885
+ }), (p, v) => {
1886
+ var d;
1887
+ return r.value.length === 2 ? (E(), Ae(b(ba), le({
1888
+ key: 0,
1889
+ class: [
1890
+ ((d = b(i)) == null ? void 0 : d.errClass) === "error" ? "error !border-red-300 shadow-[0_0_3px_0px_#ff4d4f]" : "",
1891
+ "bg-blue-300",
1892
+ "w-[58px]"
1893
+ ],
1894
+ checkedChildren: r.value[0].label,
1895
+ checkedValue: r.value[0].value,
1896
+ unCheckedChildren: r.value[1].label,
1897
+ unCheckedValue: r.value[1].value,
1898
+ onChange: c
1899
+ }, p.$attrs), null, 16, ["class", "checkedChildren", "checkedValue", "unCheckedChildren", "unCheckedValue"])) : B("", !0);
1900
+ };
1901
+ }
1902
+ }), rs = /* @__PURE__ */ X({
1903
+ inheritAttrs: !1,
1904
+ __name: "index",
1905
+ props: {
1906
+ ...fe,
1907
+ value: {
1908
+ type: [String, Number, Array, null],
1909
+ default: void 0
1910
+ },
1911
+ /**
1912
+ * 修改输入数据则自动清空关联数据
1913
+ * - FormData: 表单数据
1914
+ * - outFields: 输出字段
1915
+ */
1916
+ autoClean: {
1917
+ type: Boolean,
1918
+ default: !0
1919
+ }
1920
+ },
1921
+ emits: ["update:value", "select", "change", "update:labels"],
1922
+ setup(e, { emit: t }) {
1923
+ const a = e, s = Ee(), n = Y(), o = he(a.url, a), r = a.optionCtrl ?? o.optionCtrl;
1924
+ r.inputFactory = K(n), r.fieldMap = {
1925
+ label: "Name",
1926
+ value: "Id",
1927
+ ...r == null ? void 0 : r.fieldMap
1928
+ };
1929
+ const l = f(void 0);
1930
+ g(
1931
+ () => a.value,
1932
+ () => {
1933
+ l.value = a.value;
1934
+ },
1935
+ { immediate: !0 }
1936
+ ), g(
1937
+ () => l.value,
1938
+ (y) => {
1939
+ a.autoClean && a.formData && a.outFields && y !== a.value && fa(a.formData, a.outFields, null);
1940
+ }
1941
+ );
1942
+ const { editorCtrl: u, errInfo: i, labelText: c } = n, p = t;
1943
+ n.inputEmit = p;
1944
+ const v = f((r == null ? void 0 : r.options.value) || []);
1945
+ r && g(
1946
+ () => r.options.value,
1947
+ (y) => {
1948
+ v.value = y || [];
1949
+ },
1950
+ { immediate: !0, deep: !0 }
1951
+ );
1952
+ const d = (y) => {
1953
+ if (v.value = [], y === "") return;
1954
+ let h = {
1955
+ Query: {
1956
+ SearchField: "%" + y.trim() + "%"
1957
+ }
1958
+ };
1959
+ r.params = ce(r.params, h), r && Z(!0, r, a);
1960
+ }, O = (y) => {
1961
+ const A = Pe(r, a, y);
1962
+ p("update:value", y), p("select", y);
1963
+ const h = we(A);
1964
+ p("update:labels", h), i != null && i.value.errClass && u && pe(u);
1965
+ };
1966
+ return ie(() => {
1967
+ r && de(r, a);
1968
+ }), (y, A) => {
1969
+ var h;
1970
+ return E(), L("div", null, [
1971
+ C(b(Ia), le({
1972
+ value: l.value,
1973
+ "onUpdate:value": A[0] || (A[0] = (I) => l.value = I),
1974
+ class: ["w-full", (h = b(i)) == null ? void 0 : h.errClass],
1975
+ options: v.value,
1976
+ onSearch: d,
1977
+ onSelect: O
1978
+ }, b(s), { "allow-clear": !1 }), {
1979
+ option: V(({ label: I }) => [
1980
+ Oe(z(I), 1)
1981
+ ]),
1982
+ default: V(() => [
1983
+ C(b(xa), {
1984
+ "allow-clear": "",
1985
+ placeholder: "请输入并选择" + b(c)
1986
+ }, null, 8, ["placeholder"])
1987
+ ]),
1988
+ _: 1
1989
+ }, 16, ["value", "class", "options"])
1990
+ ]);
1991
+ };
1992
+ }
1993
+ }), mt = { class: "min-h-[32px] pt-[5px]" }, vt = {
1994
+ key: 1,
1995
+ class: "text-center text-gray-500"
1996
+ }, os = /* @__PURE__ */ X({
1997
+ inheritAttrs: !1,
1998
+ __name: "index",
1999
+ props: {
2000
+ ...fe,
2001
+ nodata: {
2002
+ type: String,
2003
+ default: ""
2004
+ },
2005
+ /**
2006
+ * 换行数量
2007
+ */
2008
+ wrap: {
2009
+ type: Number
2010
+ },
2011
+ disabledItems: {
2012
+ type: Array
2013
+ }
2014
+ },
2015
+ emits: ["change", "update:labels"],
2016
+ setup(e, { emit: t }) {
2017
+ var v, d, O;
2018
+ const a = e, s = Ee(), n = Y(), o = he(a.url, a), r = a.optionCtrl ?? o.optionCtrl;
2019
+ r.inputFactory = K(n);
2020
+ const l = f({
2021
+ ...r == null ? void 0 : r.url,
2022
+ url: ((v = r == null ? void 0 : r.url) == null ? void 0 : v.url) || "",
2023
+ fieldMap: (r == null ? void 0 : r.fieldMap) || ((d = r == null ? void 0 : r.url) == null ? void 0 : d.fieldMap),
2024
+ params: (r == null ? void 0 : r.params) || ((O = r == null ? void 0 : r.url) == null ? void 0 : O.params),
2025
+ loadingText: !1
2026
+ }), { errInfo: u } = n, i = t;
2027
+ n.inputEmit = i;
2028
+ const c = f((r == null ? void 0 : r.options.value) || []);
2029
+ r && g(
2030
+ () => r.options.value,
2031
+ (y) => {
2032
+ c.value = y || [];
2033
+ },
2034
+ { immediate: !0, deep: !0 }
2035
+ );
2036
+ const p = (y) => {
2037
+ const h = Pe(r, a, y), I = we(h);
2038
+ i("update:labels", I);
2039
+ };
2040
+ return xe(() => {
2041
+ l.value && !l.value.fieldMap && (l.value.fieldMap = {
2042
+ title: "Name",
2043
+ label: "Name",
2044
+ value: "Id",
2045
+ key: "Id"
2046
+ }), r && Z(r.autoload, r, a);
2047
+ }), ie(() => {
2048
+ r && de(r, a);
2049
+ }), (y, A) => (E(), L("div", mt, [
2050
+ C(b(Aa), le({
2051
+ onChange: p,
2052
+ class: "w-full mb-[-3px]"
2053
+ }, b(s)), {
2054
+ default: V(() => [
2055
+ c.value.length > 0 ? (E(!0), L(ne, { key: 0 }, Ue(c.value, (h) => {
2056
+ var I;
2057
+ return E(), Ae(b(Ea), {
2058
+ key: h.value,
2059
+ value: h.value,
2060
+ disabled: h.disabled || h.value && e.disabledItems && e.disabledItems.indexOf(h.value.toString()) > -1,
2061
+ class: ea([
2062
+ ((I = b(u)) == null ? void 0 : I.errClass) === "error" ? "error !text-red-400" : "",
2063
+ "text-nowrap",
2064
+ "pb-1",
2065
+ e.wrap ? `w-1/${a.wrap}` : ""
2066
+ ])
2067
+ }, {
2068
+ default: V(() => [
2069
+ Oe(z(h.label), 1)
2070
+ ]),
2071
+ _: 2
2072
+ }, 1032, ["value", "disabled", "class"]);
2073
+ }), 128)) : e.nodata ? (E(), L("div", vt, z(e.nodata), 1)) : B("", !0)
2074
+ ]),
2075
+ _: 1
2076
+ }, 16)
2077
+ ]));
2078
+ }
2079
+ }), gt = { class: "min-h-[32px] pt-1" }, yt = {
2080
+ key: 1,
2081
+ class: "text-center text-gray-500"
2082
+ }, is = /* @__PURE__ */ X({
2083
+ inheritAttrs: !1,
2084
+ __name: "index",
2085
+ props: {
2086
+ ...fe,
2087
+ value: {
2088
+ type: [String, Number, null, Array],
2089
+ default: void 0
2090
+ },
2091
+ nodata: {
2092
+ type: String,
2093
+ default: "无数据"
2094
+ },
2095
+ /**
2096
+ * 换行数量
2097
+ */
2098
+ wrap: {
2099
+ type: Number
2100
+ }
2101
+ },
2102
+ emits: ["change", "update:value", "update:labels"],
2103
+ setup(e, { emit: t }) {
2104
+ var O, y, A;
2105
+ const a = e, s = Ee(), n = Y(), o = he(a.url, a), r = a.optionCtrl ?? o.optionCtrl;
2106
+ r.inputFactory = K(n);
2107
+ const l = f({
2108
+ ...r == null ? void 0 : r.url,
2109
+ url: ((O = r == null ? void 0 : r.url) == null ? void 0 : O.url) || "",
2110
+ fieldMap: (r == null ? void 0 : r.fieldMap) || ((y = r == null ? void 0 : r.url) == null ? void 0 : y.fieldMap),
2111
+ params: (r == null ? void 0 : r.params) || ((A = r == null ? void 0 : r.url) == null ? void 0 : A.params),
2112
+ loadingText: !1
2113
+ }), u = f(a.value), { errInfo: i } = n, c = f((r == null ? void 0 : r.options.value) || []), p = t;
2114
+ n.inputEmit = p, r && g(
2115
+ () => r.options.value,
2116
+ (h) => {
2117
+ c.value = h || [];
2118
+ },
2119
+ { immediate: !0, deep: !0 }
2120
+ ), g(
2121
+ () => a.value,
2122
+ (h) => {
2123
+ u.value = h;
2124
+ }
2125
+ ), g(
2126
+ () => u.value,
2127
+ (h) => {
2128
+ p("update:value", h);
2129
+ }
2130
+ );
2131
+ const v = (h, I) => {
2132
+ if (typeof h == "object" && typeof I == "object") {
2133
+ const R = JSON.stringify(h) === JSON.stringify(I);
2134
+ return R && (u.value = h), R;
2135
+ }
2136
+ return h === I;
2137
+ }, d = (h) => {
2138
+ const I = h.target.value, R = Pe(r, a, I), Q = we(R);
2139
+ p("update:labels", Q);
2140
+ };
2141
+ return xe(() => {
2142
+ l.value && !l.value.fieldMap && (l.value.fieldMap = {
2143
+ label: "Name",
2144
+ value: "Id",
2145
+ key: "Id"
2146
+ }), r && Z(r.autoload, r, a);
2147
+ }), ie(() => {
2148
+ r && de(r, a);
2149
+ }), (h, I) => (E(), L("div", gt, [
2150
+ C(b(Oa), le({
2151
+ value: u.value,
2152
+ "onUpdate:value": I[0] || (I[0] = (R) => u.value = R),
2153
+ autocheck: !1,
2154
+ onChange: d,
2155
+ class: "w-full flex align-items flex-wrap mb-[-3px]"
2156
+ }, b(s)), {
2157
+ default: V(() => [
2158
+ c.value.length > 0 ? (E(!0), L(ne, { key: 0 }, Ue(c.value, (R) => {
2159
+ var Q;
2160
+ return E(), L(ne, {
2161
+ key: R.value
2162
+ }, [
2163
+ R.visible !== !1 ? (E(), Ae(b(Ra), {
2164
+ key: 0,
2165
+ checked: v(R.value, a.value),
2166
+ value: R.value,
2167
+ class: ea([
2168
+ ((Q = b(i)) == null ? void 0 : Q.errClass) === "error" ? "error !text-red-400" : "",
2169
+ "text-nowrap",
2170
+ "pb-1",
2171
+ e.wrap ? `w-1/${a.wrap}` : ""
2172
+ ])
2173
+ }, {
2174
+ default: V(() => [
2175
+ Oe(z(R.label), 1)
2176
+ ]),
2177
+ _: 2
2178
+ }, 1032, ["checked", "value", "class"])) : B("", !0)
2179
+ ], 64);
2180
+ }), 128)) : e.nodata ? (E(), L("div", yt, z(e.nodata), 1)) : B("", !0)
2181
+ ]),
2182
+ _: 1
2183
+ }, 16, ["value"])
2184
+ ]));
2185
+ }
2186
+ }), St = {
2187
+ key: 0,
2188
+ class: "absolute z-10 mt-[5px] mr-[10px] text-[#999] flex items-center"
2189
+ }, ls = /* @__PURE__ */ X({
2190
+ inheritAttrs: !1,
2191
+ __name: "index",
2192
+ props: {
2193
+ ...fe,
2194
+ value: {
2195
+ type: [String, Number, Array, null],
2196
+ default: void 0
2197
+ },
2198
+ /**
2199
+ * 自动选择第一个选项
2200
+ */
2201
+ selectFirst: {
2202
+ type: Boolean,
2203
+ default: !1
2204
+ },
2205
+ /**
2206
+ * 数据源OPTIONS的key
2207
+ */
2208
+ dataKey: {
2209
+ type: String,
2210
+ required: !1
2211
+ },
2212
+ /**
2213
+ * 清空时设置的值
2214
+ * - false,则清空时设置为 null
2215
+ * - true,则清空时设置为 undefined
2216
+ */
2217
+ undefValue: {
2218
+ type: Boolean,
2219
+ default: !1
2220
+ }
2221
+ },
2222
+ emits: ["change", "update:value", "update:label", "update:labels"],
2223
+ setup(e, { emit: t }) {
2224
+ var I, R, Q;
2225
+ const a = e, s = a.value === void 0 ? !0 : a.undefValue, n = Y(), { editorCtrl: o, errInfo: r, labelText: l } = n, u = he(a.url, a), i = a.optionCtrl ?? u.optionCtrl;
2226
+ i.inputFactory = K(n);
2227
+ const c = Ee(), p = f({
2228
+ ...i == null ? void 0 : i.url,
2229
+ url: ((I = i == null ? void 0 : i.url) == null ? void 0 : I.url) || "",
2230
+ fieldMap: (i == null ? void 0 : i.fieldMap) || ((R = i == null ? void 0 : i.url) == null ? void 0 : R.fieldMap),
2231
+ params: (i == null ? void 0 : i.params) || ((Q = i == null ? void 0 : i.url) == null ? void 0 : Q.params),
2232
+ loadingText: !1
2233
+ }), v = f(c.placeholder), d = f(i == null ? void 0 : i.selected.value), O = t;
2234
+ n.inputEmit = O;
2235
+ const y = (m) => {
2236
+ const P = Pe(i, a, m), _ = we(P);
2237
+ d.value = m, O("update:labels", _), O("update:label", _.join(";")), O("change", m), r != null && r.value.errClass && o && pe(o);
2238
+ }, A = f((i == null ? void 0 : i.options.value) || []), h = (m) => {
2239
+ if (m.length > 0 && F(a.value) && a.selectFirst)
2240
+ for (let P = 0; P < m.length; P++) {
2241
+ const _ = m[P];
2242
+ if (_.disabled === void 0 || _.disabled === !1) {
2243
+ d.value = _.value;
2244
+ break;
2245
+ }
2246
+ }
2247
+ else m.length > 0 && (d.value = a.value === null ? void 0 : a.value);
2248
+ m.length > 0 && d.value !== void 0 && y(d.value);
2249
+ };
2250
+ return i && (g(
2251
+ () => i.options.value,
2252
+ (m) => {
2253
+ A.value = m || [];
2254
+ },
2255
+ { immediate: !0, deep: !0 }
2256
+ ), g(
2257
+ () => i.selected.value,
2258
+ (m) => {
2259
+ d.value = m;
2260
+ }
2261
+ )), g(
2262
+ () => A.value,
2263
+ (m) => {
2264
+ h(m);
2265
+ }
2266
+ ), g(
2267
+ () => p.value.loading,
2268
+ (m) => {
2269
+ m ? v.value = "" : v.value || (v.value = "请选择" + l.value);
2270
+ },
2271
+ { immediate: !0 }
2272
+ ), g(
2273
+ () => a.value,
2274
+ (m) => {
2275
+ d.value = m;
2276
+ },
2277
+ { immediate: !0 }
2278
+ ), g(
2279
+ () => d.value,
2280
+ (m) => {
2281
+ const P = m === void 0 ? s ? void 0 : null : m;
2282
+ i && (i.selected.value = P), O("update:value", P);
2283
+ }
2284
+ ), xe(() => {
2285
+ if (p.value && !p.value.fieldMap && (p.value.fieldMap = {
2286
+ label: "Name",
2287
+ value: "Id",
2288
+ key: "Id"
2289
+ }), a.dataKey) {
2290
+ const m = JSON.parse(JSON.stringify(M.getOptions(a.dataKey)));
2291
+ A.value = m, h(m);
2292
+ } else if (i) {
2293
+ const m = i.options.value || [];
2294
+ m.length > 0 ? (A.value = m, h(m)) : Z(i.autoload, i, a);
2295
+ }
2296
+ }), ie(() => {
2297
+ i && de(i, a);
2298
+ }), (m, P) => {
2299
+ var _, We, qe;
2300
+ return E(), L("div", null, [
2301
+ (We = (_ = b(i)) == null ? void 0 : _.url) != null && We.loading ? (E(), L("div", St, [
2302
+ C(b(De), { class: "text-[#555] mx-[5px] !ml-[10px] !w-4 !h-4" }),
2303
+ P[1] || (P[1] = Sa("span", null, "数据加载中...", -1))
2304
+ ])) : B("", !0),
2305
+ C(b(Ta), le({
2306
+ class: [(qe = b(r)) == null ? void 0 : qe.errClass, "w-full"],
2307
+ value: d.value,
2308
+ "onUpdate:value": P[0] || (P[0] = (W) => d.value = W),
2309
+ "allow-clear": !0,
2310
+ onChange: y,
2311
+ placeholder: v.value,
2312
+ "label-in-value": !1
2313
+ }, b(c)), {
2314
+ default: V(() => [
2315
+ (E(!0), L(ne, null, Ue(A.value, (W) => (E(), L(ne, {
2316
+ key: W.value
2317
+ }, [
2318
+ W.visible !== !1 ? (E(), Ae(b(wa), {
2319
+ key: 0,
2320
+ value: W.value
2321
+ }, {
2322
+ default: V(() => [
2323
+ Oe(z(W.label), 1)
2324
+ ]),
2325
+ _: 2
2326
+ }, 1032, ["value"])) : B("", !0)
2327
+ ], 64))), 128))
2328
+ ]),
2329
+ _: 1
2330
+ }, 16, ["class", "value", "placeholder"])
2331
+ ]);
2332
+ };
2333
+ }
2334
+ });
2335
+ export {
2336
+ _t as $,
2337
+ pe as A,
2338
+ os as B,
2339
+ is as C,
2340
+ ls as D,
2341
+ Ve as E,
2342
+ Na as F,
2343
+ Bt as G,
2344
+ rt as H,
2345
+ ot as I,
2346
+ Ct as J,
2347
+ zt as K,
2348
+ nt as L,
2349
+ fa as M,
2350
+ Yt as N,
2351
+ M as O,
2352
+ D as P,
2353
+ Zt as Q,
2354
+ pt as R,
2355
+ dt as S,
2356
+ es as T,
2357
+ Xe as U,
2358
+ as as V,
2359
+ ta as W,
2360
+ Vt as X,
2361
+ sa as Y,
2362
+ Ft as Z,
2363
+ ns as _,
2364
+ ss as a,
2365
+ Ke as a0,
2366
+ Mt as a1,
2367
+ Jt as a2,
2368
+ et as a3,
2369
+ ua as a4,
2370
+ Gt as a5,
2371
+ $t as a6,
2372
+ aa as a7,
2373
+ Da as a8,
2374
+ Ne as a9,
2375
+ q as aa,
2376
+ se as ab,
2377
+ ge as ac,
2378
+ H as ad,
2379
+ ts as ae,
2380
+ Je as af,
2381
+ re as ag,
2382
+ Ut as b,
2383
+ Xt as c,
2384
+ Ht as d,
2385
+ Nt as e,
2386
+ Wt as f,
2387
+ qt as g,
2388
+ Qt as h,
2389
+ F as i,
2390
+ Kt as j,
2391
+ la as k,
2392
+ Za as l,
2393
+ jt as m,
2394
+ rs as n,
2395
+ Dt as o,
2396
+ fe as p,
2397
+ Ua as q,
2398
+ oe as r,
2399
+ Y as s,
2400
+ he as t,
2401
+ j as u,
2402
+ Z as v,
2403
+ de as w,
2404
+ De as x,
2405
+ Pe as y,
2406
+ we as z
2407
+ };