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