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