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