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