@skyfox2000/webui 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/stores/userInfo.ts +28 -2
- package/lib/AceEditor.d.ts +0 -1
- package/lib/BasicLayout.d.ts +0 -1
- package/lib/Error403.d.ts +0 -1
- package/lib/Error404.d.ts +0 -1
- package/lib/ExcelForm.d.ts +0 -1
- package/lib/UploadForm.d.ts +0 -1
- package/lib/assets/modules/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/lib/assets/modules/file-upload-BYIvmkmy.js +0 -204
- package/lib/assets/modules/form-excel-BUX2QW11.js +0 -235
- package/lib/assets/modules/index-DcRkhkn2.js +0 -109
- package/lib/assets/modules/index-jl5Ie2tZ.js +0 -112
- package/lib/assets/modules/menuTabs-DY1XBq16.js +0 -671
- package/lib/assets/modules/toolIcon-BDIOj_3l.js +0 -50
- package/lib/assets/modules/uploadList-BPG5whz7.js +0 -369
- package/lib/assets/modules/uploadList-D2Ux4h1N.js +0 -2253
- package/lib/components/common/button/index.vue.d.ts +0 -41
- package/lib/components/common/icon/appicon.vue.d.ts +0 -11
- package/lib/components/common/icon/fullscreen.vue.d.ts +0 -3
- package/lib/components/common/icon/helper.vue.d.ts +0 -22
- package/lib/components/common/icon/index.vue.d.ts +0 -243
- package/lib/components/common/icon/layoutIcon.vue.d.ts +0 -43
- package/lib/components/common/icon/projectIcon.vue.d.ts +0 -59
- package/lib/components/common/icon/toolIcon.vue.d.ts +0 -43
- package/lib/components/common/index.d.ts +0 -20
- package/lib/components/common/loading/index.vue.d.ts +0 -3
- package/lib/components/common/tooltip/index.vue.d.ts +0 -21
- package/lib/components/content/dialog/index.vue.d.ts +0 -35
- package/lib/components/content/drawer/index.vue.d.ts +0 -28
- package/lib/components/content/form/formItem.vue.d.ts +0 -27
- package/lib/components/content/form/index.vue.d.ts +0 -25
- package/lib/components/content/index.d.ts +0 -22
- package/lib/components/content/search/index.vue.d.ts +0 -30
- package/lib/components/content/search/searchItem.vue.d.ts +0 -23
- package/lib/components/content/table/index.vue.d.ts +0 -36
- package/lib/components/content/table/tableOperate.vue.d.ts +0 -18
- package/lib/components/content/toolbar/icontool.vue.d.ts +0 -7
- package/lib/components/content/toolbar/index.vue.d.ts +0 -18
- package/lib/components/content/tree/index.vue.d.ts +0 -46
- package/lib/components/form/aceEditor/aceConfig.d.ts +0 -8
- package/lib/components/form/autoComplete/index.vue.d.ts +0 -176
- package/lib/components/form/cascader/index.vue.d.ts +0 -120
- package/lib/components/form/checkbox/index.vue.d.ts +0 -139
- package/lib/components/form/datePicker/index.vue.d.ts +0 -6
- package/lib/components/form/index.d.ts +0 -39
- package/lib/components/form/input/index.vue.d.ts +0 -26
- package/lib/components/form/input/inputIcon.vue.d.ts +0 -10
- package/lib/components/form/input/inputNumber.vue.d.ts +0 -3
- package/lib/components/form/input/inputPassword.vue.d.ts +0 -3
- package/lib/components/form/propEditor/index.vue.d.ts +0 -21
- package/lib/components/form/radio/index.vue.d.ts +0 -144
- package/lib/components/form/radio/radioStatus.vue.d.ts +0 -31
- package/lib/components/form/rangePicker/index.vue.d.ts +0 -16
- package/lib/components/form/select/index.vue.d.ts +0 -153
- package/lib/components/form/switch/index.vue.d.ts +0 -43
- package/lib/components/form/textarea/index.vue.d.ts +0 -3
- package/lib/components/form/transfer/index.vue.d.ts +0 -38
- package/lib/components/form/transfer/transferTable.vue.d.ts +0 -38
- package/lib/components/form/treeSelect/index.vue.d.ts +0 -38
- package/lib/components/form/upload/uploadList.vue.d.ts +0 -487
- package/lib/components/index.d.ts +0 -4
- package/lib/components/layout/breadcrumb/index.vue.d.ts +0 -3
- package/lib/components/layout/content/index.vue.d.ts +0 -22
- package/lib/components/layout/datetime/index.vue.d.ts +0 -3
- package/lib/components/layout/header/headerExits.vue.d.ts +0 -3
- package/lib/components/layout/header/index.vue.d.ts +0 -3
- package/lib/components/layout/header/user.vue.d.ts +0 -3
- package/lib/components/layout/index.d.ts +0 -14
- package/lib/components/layout/menu/index.vue.d.ts +0 -6
- package/lib/components/layout/menu/menuTabs.vue.d.ts +0 -3
- package/lib/const/options.d.ts +0 -32
- package/lib/directives/enter-submit.d.ts +0 -4
- package/lib/directives/index.d.ts +0 -2
- package/lib/directives/permission.d.ts +0 -5
- package/lib/es/AceEditor/index.js +0 -167
- package/lib/es/BasicLayout/index.js +0 -101
- package/lib/es/Error403/index.js +0 -39
- package/lib/es/Error404/index.js +0 -39
- package/lib/es/ExcelForm/index.js +0 -321
- package/lib/es/UploadForm/index.js +0 -110
- package/lib/index.d.ts +0 -45
- package/lib/router/index.d.ts +0 -15
- package/lib/stores/appInfo.d.ts +0 -31
- package/lib/stores/hostInfo.d.ts +0 -9
- package/lib/stores/pageInfo.d.ts +0 -18
- package/lib/stores/pinia.d.ts +0 -3
- package/lib/stores/settingInfo.d.ts +0 -8
- package/lib/stores/userInfo.d.ts +0 -24
- package/lib/typings/data.d.ts +0 -80
- package/lib/typings/form.d.ts +0 -187
- package/lib/typings/menu.d.ts +0 -7
- package/lib/typings/option.d.ts +0 -189
- package/lib/typings/page.d.ts +0 -70
- package/lib/typings/table.d.ts +0 -181
- package/lib/typings/tools.d.ts +0 -130
- package/lib/typings/tree.d.ts +0 -72
- package/lib/typings/upload.d.ts +0 -161
- package/lib/typings/urls.d.ts +0 -69
- package/lib/utils/cache.d.ts +0 -23
- package/lib/utils/data.d.ts +0 -6
- package/lib/utils/download.d.ts +0 -4
- package/lib/utils/eventbus.d.ts +0 -16
- package/lib/utils/export-table.d.ts +0 -12
- package/lib/utils/file-upload.d.ts +0 -17
- package/lib/utils/form-excel.d.ts +0 -33
- package/lib/utils/form-validate.d.ts +0 -29
- package/lib/utils/form.d.ts +0 -9
- package/lib/utils/icon-loader.d.ts +0 -125
- package/lib/utils/isEmpty.d.ts +0 -1
- package/lib/utils/main-openapis.d.ts +0 -8
- package/lib/utils/menu.d.ts +0 -6
- package/lib/utils/options.d.ts +0 -10
- package/lib/utils/page.d.ts +0 -25
- package/lib/utils/table.d.ts +0 -21
- package/lib/utils/tools.d.ts +0 -18
- package/lib/utils/tree.d.ts +0 -3
- package/lib/vite-env.d.ts +0 -8
- package/lib/webui.css +0 -1
- package/lib/webui.es.js +0 -2262
|
@@ -1,2253 +0,0 @@
|
|
|
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 k = (e, t, a) => ua(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
-
import { inject as j, ref as c, provide as ye, watch as E, toRaw as je, h as F, nextTick as ca, shallowRef as qe, defineComponent as ee, reactive as fa, useAttrs as oe, onMounted as le, onUnmounted as ie, createElementBlock as O, openBlock as x, createVNode as J, unref as A, mergeProps as ue, withCtx as Q, createCommentVNode as B, Fragment as z, renderList as Pe, createBlock as we, normalizeClass as Je, createTextVNode as Oe, 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 ke, EnvConfig as re, AppAction as Ce, AppSource as _e, isMicroApp as Ke, mainAppApis as D, isBaseMicroApp as Aa } from "@skyfox2000/microbase";
|
|
9
|
-
import { ResStatus as T, httpPost as H, setToken as be, fieldMapping as xa, parseFieldTemplate as Ee, API_HOST as Se, SERVER_HOST as Ea } from "@skyfox2000/fapi";
|
|
10
|
-
import I from "vue-m-message";
|
|
11
|
-
import Le from "async-validator";
|
|
12
|
-
import { createRouter as Ta, createWebHashHistory as Ra } from "vue-router";
|
|
13
|
-
import "dayjs";
|
|
14
|
-
import "vue-draggable-next";
|
|
15
|
-
const Pa = Sa();
|
|
16
|
-
Pa.use(Ia);
|
|
17
|
-
var N = /* @__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))(N || {});
|
|
18
|
-
const R = class R {
|
|
19
|
-
};
|
|
20
|
-
k(R, "dict", {}), k(R, "Keys", {
|
|
21
|
-
EnableDisable: "EnableDisable",
|
|
22
|
-
SuccessResult: "SuccessResult",
|
|
23
|
-
YesNo: "YesNo",
|
|
24
|
-
MaleFemale: "MaleFemale"
|
|
25
|
-
}), /**
|
|
26
|
-
* 静态选择项列表
|
|
27
|
-
* @param key 名称
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
k(R, "getOptions", (t) => R.dict[t]), /**
|
|
31
|
-
* 静态选择项对象
|
|
32
|
-
* @param key 名称
|
|
33
|
-
* @param value 值
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
k(R, "getOptionItem", (t, a) => R.dict[t].find((s) => s.value === a)), /**
|
|
37
|
-
* 设置静态选择项
|
|
38
|
-
* @param key 名称
|
|
39
|
-
* @param list 列表
|
|
40
|
-
*/
|
|
41
|
-
k(R, "setOptions", (t, a) => {
|
|
42
|
-
R.dict[t] = a;
|
|
43
|
-
}), /**
|
|
44
|
-
* 启用/停用选项
|
|
45
|
-
* - 启用 1
|
|
46
|
-
* - 停用 0
|
|
47
|
-
*/
|
|
48
|
-
k(R, "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
|
-
k(R, "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
|
-
k(R, "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
|
-
k(R, "MaleFemale", [
|
|
97
|
-
{
|
|
98
|
-
label: "男",
|
|
99
|
-
text: "男 👨",
|
|
100
|
-
value: "M"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
label: "女",
|
|
104
|
-
text: "女 👩",
|
|
105
|
-
value: "F"
|
|
106
|
-
}
|
|
107
|
-
]);
|
|
108
|
-
let M = R;
|
|
109
|
-
M.setOptions("EnableDisable", M.EnableDisable);
|
|
110
|
-
M.setOptions("SuccessResult", M.SuccessResult);
|
|
111
|
-
M.setOptions("YesNo", M.YesNo);
|
|
112
|
-
M.setOptions("MaleFemale", M.MaleFemale);
|
|
113
|
-
const ce = {
|
|
114
|
-
/**
|
|
115
|
-
* 自动接口加载数据
|
|
116
|
-
* - 默认为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, fe = (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
|
-
}, pe = (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), H(s, r).then((n) => (t.loadingState && (t.loadingState.value = !1), n)).catch((n) => (t.loadingState && (t.loadingState.value = !1), null));
|
|
232
|
-
}, Me = (e, t) => {
|
|
233
|
-
t.params || (t.params = {}), t.params.Query || (t.params.Query = {});
|
|
234
|
-
const a = fe(e, t);
|
|
235
|
-
return t.url = a, pe(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 = fe(e, t), pe(e, t).then((a) => ((a == null ? void 0 : a.status) === T.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 = fe(e, s);
|
|
247
|
-
return s.url = r, pe(e, s).then((n) => ((n == null ? void 0 : n.status) === T.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 = fe(e, r);
|
|
259
|
-
return r.url = n, pe(e, r).then((o) => ((o == null ? void 0 : o.status) === T.SUCCESS && (a.hideErrorToast || I.success("删除成功!")), o));
|
|
260
|
-
}, Oa = (e, t) => Me(e, {
|
|
261
|
-
urlKey: "tree",
|
|
262
|
-
params: {},
|
|
263
|
-
loadingState: e.isTreeLoading,
|
|
264
|
-
loadingText: !1,
|
|
265
|
-
processParams: () => ke(e.treeQuery, t)
|
|
266
|
-
}).then((a) => (a == null ? void 0 : a.status) === T.SUCCESS ? (e.data.value = a.data, e.data.value) : []);
|
|
267
|
-
let Y;
|
|
268
|
-
const Et = (e) => {
|
|
269
|
-
Y = new Le({}), 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
|
-
}, Tt = (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
|
-
}, de = async (e) => {
|
|
350
|
-
const t = e.formData.value, a = e.formRules.value;
|
|
351
|
-
P(a) || ($e(e), e.ruleValidator || (e.ruleValidator = new Le({}), e.ruleValidator.messages(Y.messages()), e.ruleValidator.define(a)), e.ruleResults.value = await e.ruleValidator.validate(t).then(() => {
|
|
352
|
-
}).catch(({ fields: s }) => s));
|
|
353
|
-
}, Rt = async (e, t, a) => (a || (a = new Le({}), a.messages(Y.messages()), a.define(t)), a.validate(e).then(() => {
|
|
354
|
-
}).catch(({ fields: s }) => s)), $e = (e) => {
|
|
355
|
-
e.ruleResults.value = void 0;
|
|
356
|
-
}, he = () => {
|
|
357
|
-
const e = j(N.EditorControl, void 0), t = c(j(N.LabelText, "")), a = c(j(N.RuleKey, "")), s = j(N.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
|
-
ye(N.LabelText, e.label || ""), ye(N.RuleKey, e.rule || "");
|
|
418
|
-
const a = ka(e, t);
|
|
419
|
-
return ye(N.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
|
-
De(e), e.visible.value = !1;
|
|
427
|
-
}, ze = async (e) => {
|
|
428
|
-
var s;
|
|
429
|
-
const t = e.page;
|
|
430
|
-
if (e.isFormSaving.value = !0, $e(e), e.beforeSave && e.beforeSave() === !1)
|
|
431
|
-
return e.isFormSaving.value = !1, Promise.resolve();
|
|
432
|
-
if (e.formRules.value && await de(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) === T.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 && (De(e), e.visible && (e.visible.value = !1), setTimeout(() => {
|
|
487
|
-
e.visible.value = !0;
|
|
488
|
-
}, 1));
|
|
489
|
-
}, We = (e, t) => {
|
|
490
|
-
De(e);
|
|
491
|
-
const a = { ...e.formData.value, ...t };
|
|
492
|
-
e.formData.value = JSON.parse(JSON.stringify(a));
|
|
493
|
-
}, De = (e) => {
|
|
494
|
-
e.formData.value = e.default ? JSON.parse(JSON.stringify(e.default)) : {}, $e(e);
|
|
495
|
-
}, ne = "/login/", se = [], Ma = (e) => {
|
|
496
|
-
for (const t of e) {
|
|
497
|
-
const a = se.findIndex((s) => s.path === t.path);
|
|
498
|
-
a !== -1 && se.splice(a, 1), se.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 = Ta({
|
|
504
|
-
history: Ra("/"),
|
|
505
|
-
routes: se
|
|
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 = K();
|
|
513
|
-
if (re.VITE_PERMISSION_MODE === "role")
|
|
514
|
-
return a.length === 0 ? !0 : o.hasRole(a);
|
|
515
|
-
if (re.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(ne))
|
|
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 = K();
|
|
548
|
-
if (!i.isLogin)
|
|
549
|
-
a({ path: ne });
|
|
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 Da = (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
|
-
}, Na = (e) => {
|
|
569
|
-
const t = Ne();
|
|
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), Ne = 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
|
-
Na(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
|
-
}, Ie = /* @__PURE__ */ new Map(), Ca = (e) => {
|
|
632
|
-
const t = K(), { roles: a, permission: s } = e.meta || {};
|
|
633
|
-
if (P(a) && P(s))
|
|
634
|
-
return !0;
|
|
635
|
-
if (re.VITE_PERMISSION_MODE === "role")
|
|
636
|
-
return P(a) ? !0 : t.hasRole(a);
|
|
637
|
-
if (re.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: _e.Manual,
|
|
666
|
-
Action: Ce.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 H(Ua.appList, {
|
|
692
|
-
Query: {
|
|
693
|
-
AppCode: this.appInfo.AppCode,
|
|
694
|
-
Enabled: 1
|
|
695
|
-
}
|
|
696
|
-
}).then((e) => {
|
|
697
|
-
(e == null ? void 0 : e.status) === T.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
|
-
}), (!Ke() || !Aa()) && (await K().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
|
-
}), K().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, D.value && D.value.mainAppPush) {
|
|
753
|
-
const s = this.formatRoute(this.appInfo.defaultPage);
|
|
754
|
-
D.value.mainAppPush(s);
|
|
755
|
-
}
|
|
756
|
-
Da(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) && Ne().setTabActive(e), ca(() => {
|
|
775
|
-
if (X.push({ path: e }), D.value && D.value.mainAppPush) {
|
|
776
|
-
const a = this.formatRoute(e);
|
|
777
|
-
D.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 = Ie.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
|
-
}, Ie.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), Ie.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: _e.Manual,
|
|
835
|
-
Action: Ce.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: ne + "#/" }), Ke() && D.value && D.value.mainAppPush && D.value.mainAppPush(ne + "#/");
|
|
846
|
-
}
|
|
847
|
-
},
|
|
848
|
-
persist: !1
|
|
849
|
-
}), ea = "Token解析失败", He = "登录过期,请重新登录", Fe = {
|
|
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 H(Fe.login, t).then((a) => (a == null ? void 0 : a.status) === T.SUCCESS ? a : null);
|
|
875
|
-
}, Ka = (e) => {
|
|
876
|
-
let t = {
|
|
877
|
-
Query: {
|
|
878
|
-
AppId: e
|
|
879
|
-
}
|
|
880
|
-
};
|
|
881
|
-
return H(Fe.auth, t).then((a) => (a == null ? void 0 : a.status) === T.SUCCESS ? a.data : (I.error("获取授权信息失败," + (a == null ? void 0 : a.msg)), null));
|
|
882
|
-
}, Ha = () => {
|
|
883
|
-
let e = {
|
|
884
|
-
Option: {},
|
|
885
|
-
Query: {}
|
|
886
|
-
};
|
|
887
|
-
return H(Fe.logout, e).then((t) => (t == null ? void 0 : t.status) === T.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
|
-
}, Ve = (e, t) => e == "" ? (I.error(He, {
|
|
896
|
-
duration: 3e3,
|
|
897
|
-
onClose: t
|
|
898
|
-
}), !1) : Va(e) ? (I.error(He, {
|
|
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
|
-
}, L = c(""), G = c(null), K = 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
|
-
* @param loginInfo 登录信息
|
|
925
|
-
* @returns
|
|
926
|
-
*/
|
|
927
|
-
async login(e, t) {
|
|
928
|
-
const a = await _a(e);
|
|
929
|
-
if (a) {
|
|
930
|
-
const s = a;
|
|
931
|
-
if (s.errno)
|
|
932
|
-
return s;
|
|
933
|
-
{
|
|
934
|
-
const r = a.data;
|
|
935
|
-
if (this.token = r.token, be(this.token), this.isLogin = !0, Qa(r))
|
|
936
|
-
this.userInfo = {
|
|
937
|
-
...this.userInfo,
|
|
938
|
-
...r.UserInfo
|
|
939
|
-
}, L.value = r.UserInfo.UserLevel;
|
|
940
|
-
else {
|
|
941
|
-
I.error("用户信息解析失败");
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
t && C().toDefaultApp();
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
},
|
|
948
|
-
/**
|
|
949
|
-
* 获取应用授权信息
|
|
950
|
-
* @param appId 应用ID
|
|
951
|
-
* @returns 是否获取成功
|
|
952
|
-
*/
|
|
953
|
-
async getRolePermits(e) {
|
|
954
|
-
if (!this.isLogin || !this.token)
|
|
955
|
-
return !1;
|
|
956
|
-
if (G.value && G.value.appId === e)
|
|
957
|
-
return !0;
|
|
958
|
-
try {
|
|
959
|
-
const t = await Ka(e);
|
|
960
|
-
return t ? (G.value = {
|
|
961
|
-
appId: e,
|
|
962
|
-
permits: t.permits || [],
|
|
963
|
-
lastTime: t.lastTime
|
|
964
|
-
}, !0) : !1;
|
|
965
|
-
} catch (t) {
|
|
966
|
-
return console.error("获取授权信息出错", t), !1;
|
|
967
|
-
}
|
|
968
|
-
},
|
|
969
|
-
/**
|
|
970
|
-
* 检查角色权限
|
|
971
|
-
* @param role 资源角色编码需求
|
|
972
|
-
* @returns 是否有角色权限
|
|
973
|
-
*/
|
|
974
|
-
hasRole(e) {
|
|
975
|
-
return L.value ? Array.isArray(e) ? e.includes(L.value) : L.value === e : !1;
|
|
976
|
-
},
|
|
977
|
-
/**
|
|
978
|
-
* 检查功能权限
|
|
979
|
-
* @param url 所在页面
|
|
980
|
-
* @param permitCode 资源权限编码
|
|
981
|
-
* @returns 是否有功能权限
|
|
982
|
-
*/
|
|
983
|
-
hasPermit(e, t) {
|
|
984
|
-
var s;
|
|
985
|
-
const a = G.value;
|
|
986
|
-
return !a || !a.permits ? !1 : ((s = a.permits[e]) == null ? void 0 : s.includes(t)) ?? !1;
|
|
987
|
-
},
|
|
988
|
-
/**
|
|
989
|
-
* 获取用户信息
|
|
990
|
-
* @returns 用户Token
|
|
991
|
-
*/
|
|
992
|
-
getUserInfo() {
|
|
993
|
-
return this.userInfo;
|
|
994
|
-
},
|
|
995
|
-
/**
|
|
996
|
-
* 设置用户信息
|
|
997
|
-
* 仅允许设置一次,启动时设置,避免通过其它方式设置
|
|
998
|
-
* @param userInfo 用户信息
|
|
999
|
-
* @param token 用户Token
|
|
1000
|
-
*/
|
|
1001
|
-
setUserInfo(e, t) {
|
|
1002
|
-
if (!Ve(t)) {
|
|
1003
|
-
this.clean();
|
|
1004
|
-
return;
|
|
1005
|
-
}
|
|
1006
|
-
L.value || (L.value = e.UserLevel, this.userInfo = {
|
|
1007
|
-
...this.userInfo,
|
|
1008
|
-
...e
|
|
1009
|
-
}, this.token = t, be(this.token), this.isLogin = !0);
|
|
1010
|
-
},
|
|
1011
|
-
/**
|
|
1012
|
-
* 获取用户Token
|
|
1013
|
-
* @returns 用户Token
|
|
1014
|
-
*/
|
|
1015
|
-
getToken() {
|
|
1016
|
-
return Ve(this.token, () => {
|
|
1017
|
-
this.clean(), this.logout();
|
|
1018
|
-
}) ? this.token : "";
|
|
1019
|
-
},
|
|
1020
|
-
/**
|
|
1021
|
-
* 是否超级管理员
|
|
1022
|
-
*/
|
|
1023
|
-
isSuperAdmin() {
|
|
1024
|
-
return L.value === "Super";
|
|
1025
|
-
},
|
|
1026
|
-
/**
|
|
1027
|
-
* 是否管理员
|
|
1028
|
-
*/
|
|
1029
|
-
isAdmin() {
|
|
1030
|
-
return L.value === "Super" || L.value === "Admin";
|
|
1031
|
-
},
|
|
1032
|
-
/**
|
|
1033
|
-
* 获取用户级别
|
|
1034
|
-
* @returns 用户级别
|
|
1035
|
-
*/
|
|
1036
|
-
getUserLevel() {
|
|
1037
|
-
return L.value;
|
|
1038
|
-
},
|
|
1039
|
-
/*
|
|
1040
|
-
* 清理登录信息
|
|
1041
|
-
*/
|
|
1042
|
-
async clean() {
|
|
1043
|
-
return this.userInfo = {
|
|
1044
|
-
Id: "",
|
|
1045
|
-
Name: "",
|
|
1046
|
-
Code: "",
|
|
1047
|
-
TenantId: "",
|
|
1048
|
-
UserLevel: ""
|
|
1049
|
-
}, this.token = "", be(this.token), this.isLogin = !1, G.value = null, L.value = "", C().clean(), Promise.resolve();
|
|
1050
|
-
},
|
|
1051
|
-
/**
|
|
1052
|
-
* 登出操作
|
|
1053
|
-
* @returns
|
|
1054
|
-
*/
|
|
1055
|
-
async logout() {
|
|
1056
|
-
try {
|
|
1057
|
-
await Ha();
|
|
1058
|
-
} catch (e) {
|
|
1059
|
-
console.error("调用登出接口失败", e);
|
|
1060
|
-
} finally {
|
|
1061
|
-
await this.clean(), setTimeout(async () => {
|
|
1062
|
-
I.success("已退出登录");
|
|
1063
|
-
}, 1e3), setTimeout(async () => {
|
|
1064
|
-
C().logout();
|
|
1065
|
-
}, 2e3);
|
|
1066
|
-
}
|
|
1067
|
-
return Promise.resolve();
|
|
1068
|
-
}
|
|
1069
|
-
},
|
|
1070
|
-
persist: !1
|
|
1071
|
-
}), $t = (e, t) => {
|
|
1072
|
-
const a = K();
|
|
1073
|
-
return e.filter((s) => {
|
|
1074
|
-
if (s.role && !a.hasRole(s.role) || s.permit && !a.hasPermit(X.currentRoute.value.path, s.permit))
|
|
1075
|
-
return !1;
|
|
1076
|
-
if (!t) {
|
|
1077
|
-
if (s.visible === !1)
|
|
1078
|
-
return !1;
|
|
1079
|
-
if (typeof s.visible == "function")
|
|
1080
|
-
return s.visible();
|
|
1081
|
-
}
|
|
1082
|
-
return !0;
|
|
1083
|
-
});
|
|
1084
|
-
}, Dt = (e, t) => {
|
|
1085
|
-
const a = t == null ? void 0 : t.filter((s) => {
|
|
1086
|
-
const r = e.find(
|
|
1087
|
-
(n) => n.dataIndex === s.dataIndex || n.key === s.key || n.title === s.title
|
|
1088
|
-
);
|
|
1089
|
-
return r ? { ...s, ...r } : !1;
|
|
1090
|
-
});
|
|
1091
|
-
return [...a || [], ...e.filter((s) => !(a != null && a.includes(s)))];
|
|
1092
|
-
}, Ga = (e) => (e.remotePage = !1, aa(e).then((t) => t.rows)), aa = (e) => {
|
|
1093
|
-
e.gridQuery || (e.gridQuery = {});
|
|
1094
|
-
const t = e.remotePage ? "find" : "list";
|
|
1095
|
-
return Me(e, {
|
|
1096
|
-
urlKey: t,
|
|
1097
|
-
url: e.gridUrl,
|
|
1098
|
-
params: e.gridQuery,
|
|
1099
|
-
loadingState: e.isGridLoading,
|
|
1100
|
-
processParams: (a) => {
|
|
1101
|
-
var r;
|
|
1102
|
-
return e.remotePage && (a.Query.$limit = [(e.pageNo.value - 1) * e.pageSize.value, e.pageSize.value]), ke((r = e.gridUrl) == null ? void 0 : r.params, a, e.gridQuery);
|
|
1103
|
-
}
|
|
1104
|
-
}).then((a) => {
|
|
1105
|
-
if ((a == null ? void 0 : a.status) === T.SUCCESS) {
|
|
1106
|
-
let s = a.data;
|
|
1107
|
-
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 = {
|
|
1108
|
-
total: e.total.value,
|
|
1109
|
-
rows: a.data
|
|
1110
|
-
}, e.afterLoad && e.afterLoad(s)), s;
|
|
1111
|
-
}
|
|
1112
|
-
return e.tableData.value = [], e.total.value = 0, {
|
|
1113
|
-
total: 0,
|
|
1114
|
-
rows: []
|
|
1115
|
-
};
|
|
1116
|
-
});
|
|
1117
|
-
}, ja = (e, t, a = {}) => Be(e, {
|
|
1118
|
-
urlKey: "update",
|
|
1119
|
-
url: e.updateUrl,
|
|
1120
|
-
params: {
|
|
1121
|
-
Query: { [e.primaryKey]: t[e.primaryKey] },
|
|
1122
|
-
Data: t
|
|
1123
|
-
},
|
|
1124
|
-
loadingState: e.isGridSaving,
|
|
1125
|
-
...a
|
|
1126
|
-
}).then((s) => ((s == null ? void 0 : s.status) === T.SUCCESS && setTimeout(() => {
|
|
1127
|
-
e.reload.value = !0, e.afterUpdate && e.afterUpdate(t);
|
|
1128
|
-
}, 50), s)), Nt = (e, t) => {
|
|
1129
|
-
const a = {};
|
|
1130
|
-
return a[e.primaryKey] = t[e.primaryKey], a[e.statusKey] = t[e.statusKey], ja(e, a, {
|
|
1131
|
-
loadingText: !1,
|
|
1132
|
-
hideErrorToast: !0
|
|
1133
|
-
});
|
|
1134
|
-
}, ta = async (e, t, a) => await Me(e, {
|
|
1135
|
-
urlKey: "detail",
|
|
1136
|
-
url: a,
|
|
1137
|
-
params: t,
|
|
1138
|
-
loadingState: e.isGridLoading
|
|
1139
|
-
}), Ft = (e, t) => {
|
|
1140
|
-
const a = t;
|
|
1141
|
-
return ta(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));
|
|
1142
|
-
}, Ut = (e, t) => {
|
|
1143
|
-
let a = e.editor;
|
|
1144
|
-
e.rowData.value = t, a && (We(a, t), a.visible.value = !0);
|
|
1145
|
-
}, Ct = (e, t) => wa(e, t, {
|
|
1146
|
-
url: e.deleteUrl,
|
|
1147
|
-
primaryKey: e.primaryKey
|
|
1148
|
-
}).then((a) => ((a == null ? void 0 : a.status) === T.SUCCESS && setTimeout(() => {
|
|
1149
|
-
e.reload.value = !0, e.afterDelete && !Array.isArray(t) && e.afterDelete(t);
|
|
1150
|
-
}, 50), a)), y = {
|
|
1151
|
-
PageOption: {
|
|
1152
|
-
primaryKey: "Id",
|
|
1153
|
-
statusKey: "Enabled"
|
|
1154
|
-
},
|
|
1155
|
-
GridOption: {
|
|
1156
|
-
autoload: !0,
|
|
1157
|
-
primaryKey: "Id",
|
|
1158
|
-
statusKey: "Enabled",
|
|
1159
|
-
remotePage: !0,
|
|
1160
|
-
tableSize: c("small"),
|
|
1161
|
-
selectable: c(!1),
|
|
1162
|
-
searchBar: c(!0),
|
|
1163
|
-
pageSize: c(10),
|
|
1164
|
-
rowExpand: c(!1),
|
|
1165
|
-
buttons: c(["New"]),
|
|
1166
|
-
tools: ["Reload", "RowHeight", "TableHeadset"],
|
|
1167
|
-
operates: ["Edit", "Delete"]
|
|
1168
|
-
},
|
|
1169
|
-
EditorOption: {
|
|
1170
|
-
primaryKey: "Id",
|
|
1171
|
-
autoClose: !0,
|
|
1172
|
-
autoDetail: !1,
|
|
1173
|
-
saveBtnVisible: !0,
|
|
1174
|
-
saveAsBtnVisible: !0
|
|
1175
|
-
},
|
|
1176
|
-
TreeOption: {
|
|
1177
|
-
autoload: !0
|
|
1178
|
-
}
|
|
1179
|
-
}, _t = (e) => {
|
|
1180
|
-
y.PageOption = {
|
|
1181
|
-
...y.PageOption,
|
|
1182
|
-
...e.pageOption
|
|
1183
|
-
}, y.GridOption = {
|
|
1184
|
-
...y.GridOption,
|
|
1185
|
-
...e.gridOption
|
|
1186
|
-
}, y.EditorOption = {
|
|
1187
|
-
...y.EditorOption,
|
|
1188
|
-
...e.editorOptions
|
|
1189
|
-
}, y.TreeOption = {
|
|
1190
|
-
...y.TreeOption,
|
|
1191
|
-
...e.treeOption
|
|
1192
|
-
};
|
|
1193
|
-
}, qa = (e, t, a, s) => ({
|
|
1194
|
-
editorCtrl: {
|
|
1195
|
-
...y.EditorOption,
|
|
1196
|
-
name: "",
|
|
1197
|
-
default: a ? JSON.parse(JSON.stringify(a)) : void 0,
|
|
1198
|
-
visible: c(!1),
|
|
1199
|
-
page: t,
|
|
1200
|
-
formData: c(a ? JSON.parse(JSON.stringify(a)) : void 0),
|
|
1201
|
-
formRules: c(s),
|
|
1202
|
-
ruleResults: c({}),
|
|
1203
|
-
updateData: c(void 0),
|
|
1204
|
-
saveUrl: e.urls.save,
|
|
1205
|
-
detailUrl: e.urls.detail,
|
|
1206
|
-
isFormSaving: c(!1),
|
|
1207
|
-
isFormLoading: c(!1)
|
|
1208
|
-
}
|
|
1209
|
-
}), Ja = (e, t, a) => {
|
|
1210
|
-
const s = {
|
|
1211
|
-
...y.GridOption,
|
|
1212
|
-
tableSize: c(y.GridOption.tableSize.value),
|
|
1213
|
-
selectable: c(y.GridOption.selectable.value),
|
|
1214
|
-
searchBar: c(y.GridOption.searchBar.value),
|
|
1215
|
-
pageSize: c(y.GridOption.pageSize.value),
|
|
1216
|
-
rowExpand: c(y.GridOption.rowExpand.value),
|
|
1217
|
-
buttons: c([...y.GridOption.buttons.value]),
|
|
1218
|
-
tools: [...y.GridOption.tools],
|
|
1219
|
-
operates: [...y.GridOption.operates],
|
|
1220
|
-
columns: c(a || []),
|
|
1221
|
-
reload: c(!1),
|
|
1222
|
-
pageNo: c(1),
|
|
1223
|
-
total: c(0),
|
|
1224
|
-
page: t,
|
|
1225
|
-
selectKeys: c([]),
|
|
1226
|
-
selectRows: c([]),
|
|
1227
|
-
rowData: c(void 0),
|
|
1228
|
-
gridQuery: {},
|
|
1229
|
-
tableData: qe(void 0),
|
|
1230
|
-
expandRows: c({}),
|
|
1231
|
-
isGridLoading: c(!1),
|
|
1232
|
-
isGridSaving: c(!1),
|
|
1233
|
-
gridUrl: e.urls.list || e.urls.find,
|
|
1234
|
-
updateUrl: e.urls.update,
|
|
1235
|
-
deleteUrl: e.urls.delete
|
|
1236
|
-
};
|
|
1237
|
-
return E(
|
|
1238
|
-
() => s.reload.value,
|
|
1239
|
-
(r) => {
|
|
1240
|
-
r && (setTimeout(() => {
|
|
1241
|
-
s.reload.value = !1;
|
|
1242
|
-
}, 1), s.remotePage ? aa(s) : Ga(s));
|
|
1243
|
-
}
|
|
1244
|
-
), {
|
|
1245
|
-
gridCtrl: s
|
|
1246
|
-
};
|
|
1247
|
-
}, Kt = (e, t) => {
|
|
1248
|
-
const a = {
|
|
1249
|
-
...y.TreeOption,
|
|
1250
|
-
reload: c(!1),
|
|
1251
|
-
page: t,
|
|
1252
|
-
node: c(void 0),
|
|
1253
|
-
url: e.urls.tree,
|
|
1254
|
-
data: qe(void 0),
|
|
1255
|
-
isTreeLoading: c(!1)
|
|
1256
|
-
};
|
|
1257
|
-
return E(
|
|
1258
|
-
() => a.reload.value,
|
|
1259
|
-
(s) => {
|
|
1260
|
-
s && (setTimeout(() => {
|
|
1261
|
-
a.reload.value = !1;
|
|
1262
|
-
}, 1), Oa(a));
|
|
1263
|
-
}
|
|
1264
|
-
), {
|
|
1265
|
-
treeCtrl: a
|
|
1266
|
-
};
|
|
1267
|
-
}, Ht = (e, t, a) => {
|
|
1268
|
-
for (const o in e.urls)
|
|
1269
|
-
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));
|
|
1270
|
-
const s = {
|
|
1271
|
-
...y.PageOption,
|
|
1272
|
-
...e
|
|
1273
|
-
}, { editorCtrl: r } = qa(e, s, t, a), { gridCtrl: n } = Ja(e, s);
|
|
1274
|
-
return s.editor = r, s.grid = n, n.editor = r, n.tools = ["Reload", "RowHeight", "TableHeadset", "Fullscreen"], r.grid = n, {
|
|
1275
|
-
pageCtrl: s,
|
|
1276
|
-
editorCtrl: r,
|
|
1277
|
-
gridCtrl: n
|
|
1278
|
-
};
|
|
1279
|
-
};
|
|
1280
|
-
var Te = /* @__PURE__ */ ((e) => (e.SelectReload = "Select.Reload", e.RadioReload = "Radio.Reload", e.CheckboxReload = "Checkbox.Reload", e.TreeSelectReload = "TreeSelect.Reload", e.TreeCheckReload = "TreeCheck.Reload", e))(Te || {});
|
|
1281
|
-
class Ba {
|
|
1282
|
-
constructor() {
|
|
1283
|
-
k(this, "listeners", {});
|
|
1284
|
-
}
|
|
1285
|
-
// 检查事件名是否符合前缀
|
|
1286
|
-
isValidPrefix(t) {
|
|
1287
|
-
return Object.values(Te).some((a) => t.startsWith(a + "."));
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* 事件订阅
|
|
1291
|
-
* @param event 事件名
|
|
1292
|
-
* @param listener 处理器
|
|
1293
|
-
*/
|
|
1294
|
-
on(t, a) {
|
|
1295
|
-
if (!this.isValidPrefix(t)) {
|
|
1296
|
-
console.error(`事件前缀不正确: ${t}, 事件名必须以 ${Object.values(Te).join(", ")} 开头`);
|
|
1297
|
-
return;
|
|
1298
|
-
}
|
|
1299
|
-
this.listeners[t] || (this.listeners[t] = []), this.listeners[t].push(a);
|
|
1300
|
-
}
|
|
1301
|
-
/**
|
|
1302
|
-
* 取消订阅事件
|
|
1303
|
-
* @param event 事件名
|
|
1304
|
-
* @param listener 处理器
|
|
1305
|
-
*/
|
|
1306
|
-
off(t, a) {
|
|
1307
|
-
if (!this.isValidPrefix(t)) {
|
|
1308
|
-
console.error(`事件前缀不正确: ${t}`);
|
|
1309
|
-
return;
|
|
1310
|
-
}
|
|
1311
|
-
this.listeners[t] && (this.listeners[t] = this.listeners[t].filter((s) => s !== a));
|
|
1312
|
-
}
|
|
1313
|
-
//
|
|
1314
|
-
/**
|
|
1315
|
-
* 触发事件
|
|
1316
|
-
* @param event 事件名
|
|
1317
|
-
* @param args 参数
|
|
1318
|
-
*/
|
|
1319
|
-
emit(t, ...a) {
|
|
1320
|
-
if (!this.isValidPrefix(t)) {
|
|
1321
|
-
console.error(`事件前缀不正确: ${t}`);
|
|
1322
|
-
return;
|
|
1323
|
-
}
|
|
1324
|
-
this.listeners[t] && this.listeners[t].forEach((s) => s(t, ...a));
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
const V = new Ba(), Z = (e, t, a, s, r, n) => {
|
|
1328
|
-
if (s && t.reloadEvent && (s.reloadHandler = (o, l) => {
|
|
1329
|
-
za(r, t, l, a);
|
|
1330
|
-
}, V.on(t.reloadEvent, s.reloadHandler)), t.data)
|
|
1331
|
-
E(
|
|
1332
|
-
() => t.data,
|
|
1333
|
-
() => {
|
|
1334
|
-
Ue(t, t.data, a, !0);
|
|
1335
|
-
},
|
|
1336
|
-
{ deep: !0, immediate: !0 }
|
|
1337
|
-
);
|
|
1338
|
-
else if (r && r.url)
|
|
1339
|
-
e !== !1 && sa(r, t, n ?? {}, a);
|
|
1340
|
-
else {
|
|
1341
|
-
const o = c(j(N.LabelText, ""));
|
|
1342
|
-
I.error("`" + o.value + "` 未配置选项数据!", {
|
|
1343
|
-
duration: 5e3
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
}, Ue = (e, t, a, s) => {
|
|
1347
|
-
if (!t || t.length === 0) {
|
|
1348
|
-
a.value = [];
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
if (s) {
|
|
1352
|
-
const r = {
|
|
1353
|
-
...e.fieldMap
|
|
1354
|
-
};
|
|
1355
|
-
t = xa(r, t);
|
|
1356
|
-
}
|
|
1357
|
-
t = JSON.parse(JSON.stringify(t)), e.all && t.unshift({
|
|
1358
|
-
label: "全部",
|
|
1359
|
-
value: void 0
|
|
1360
|
-
}), a.value = t;
|
|
1361
|
-
}, za = (e, t, a, s) => {
|
|
1362
|
-
Array.isArray(a) ? Ue(t, a, s, !0) : sa(e, t, a, s);
|
|
1363
|
-
}, me = (e, t) => {
|
|
1364
|
-
t && e.reloadEvent && t.reloadHandler && V.off(e.reloadEvent, t.reloadHandler);
|
|
1365
|
-
}, sa = (e, t, a, s) => {
|
|
1366
|
-
const r = ke(e.params, t.params, a);
|
|
1367
|
-
Wa(e, t.fieldMap, r).then((n) => {
|
|
1368
|
-
Ue(t, n, s, !1);
|
|
1369
|
-
});
|
|
1370
|
-
}, Wa = (e, t, a) => {
|
|
1371
|
-
const { fieldMap: s, ...r } = e, o = {
|
|
1372
|
-
...{
|
|
1373
|
-
url: "",
|
|
1374
|
-
cacheTime: 6e4,
|
|
1375
|
-
fieldMap: {
|
|
1376
|
-
...t,
|
|
1377
|
-
...e.fieldMap
|
|
1378
|
-
}
|
|
1379
|
-
},
|
|
1380
|
-
...r
|
|
1381
|
-
};
|
|
1382
|
-
return o.loadingText = !1, a || (a = {}), a.Query || (a.Query = {}), H(o, a).then((l) => (l == null ? void 0 : l.status) === T.SUCCESS && l.data ? l.data : []);
|
|
1383
|
-
}, Ya = (e, t) => {
|
|
1384
|
-
if (e !== void 0)
|
|
1385
|
-
return Array.isArray(e) ? t.filter((a) => e.includes(a.value)) : t.find((a) => a.value === e);
|
|
1386
|
-
}, Ae = (e, t, a) => {
|
|
1387
|
-
const s = t.split(".");
|
|
1388
|
-
let r = e;
|
|
1389
|
-
for (let n = 0; n < s.length - 1; n++) {
|
|
1390
|
-
const o = s[n];
|
|
1391
|
-
r[o] || (r[o] = {}), r = r[o];
|
|
1392
|
-
}
|
|
1393
|
-
r[s[s.length - 1]] = a;
|
|
1394
|
-
}, ra = (e, t, a) => {
|
|
1395
|
-
if (a == null) {
|
|
1396
|
-
Object.entries(t).forEach(([s]) => {
|
|
1397
|
-
Ae(e, s, a);
|
|
1398
|
-
});
|
|
1399
|
-
return;
|
|
1400
|
-
}
|
|
1401
|
-
Array.isArray(a) || Object.entries(t).forEach(([s, r]) => {
|
|
1402
|
-
if (r.includes("${")) {
|
|
1403
|
-
const n = Ee(r, a);
|
|
1404
|
-
Ae(e, s, n);
|
|
1405
|
-
} else
|
|
1406
|
-
Ae(e, s, a[r]);
|
|
1407
|
-
});
|
|
1408
|
-
}, ve = (e, t, a, s) => {
|
|
1409
|
-
var n;
|
|
1410
|
-
s.editorCtrl && ((n = s.errInfo) != null && n.value.errClass) && de(s.editorCtrl);
|
|
1411
|
-
const r = Ya(t, a.value);
|
|
1412
|
-
if (e.formData && e.outFields && ra(e.formData, e.outFields, r), e.changeEvent) {
|
|
1413
|
-
const [o, l] = e.changeEvent;
|
|
1414
|
-
if (l)
|
|
1415
|
-
if (Array.isArray(o))
|
|
1416
|
-
o.every((i) => {
|
|
1417
|
-
const u = Ee(l, { selectedValues: t });
|
|
1418
|
-
try {
|
|
1419
|
-
const f = JSON.parse(u);
|
|
1420
|
-
V.emit(i, f, t, r);
|
|
1421
|
-
} catch (f) {
|
|
1422
|
-
console.error("eventParamsValue: ", u, f);
|
|
1423
|
-
}
|
|
1424
|
-
});
|
|
1425
|
-
else {
|
|
1426
|
-
const i = Ee(l, { selectedValues: t });
|
|
1427
|
-
try {
|
|
1428
|
-
const u = JSON.parse(i);
|
|
1429
|
-
V.emit(o, u, t, r);
|
|
1430
|
-
} catch (u) {
|
|
1431
|
-
console.error("eventParamsValue: ", i, u);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
else
|
|
1435
|
-
Array.isArray(o) ? o.every((i) => {
|
|
1436
|
-
V.emit(i, r, t);
|
|
1437
|
-
}) : V.emit(o, r, t);
|
|
1438
|
-
}
|
|
1439
|
-
return s.inputEmit && s.inputEmit("change", t, r), r;
|
|
1440
|
-
}, ge = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map((t) => t.label) : [e.label], Xa = 7 * 24 * 60 * 60 * 1e3, xe = /* @__PURE__ */ new Map(), Qe = /* @__PURE__ */ new Set(), _ = c({}), Vt = _, Qt = (e) => {
|
|
1441
|
-
var r;
|
|
1442
|
-
if (!e.iconUrl) return Re;
|
|
1443
|
-
const t = c(!0), a = c("");
|
|
1444
|
-
let s = !0;
|
|
1445
|
-
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(() => {
|
|
1446
|
-
tt(e.iconUrl, e.monoColor || !1), t.value = !0;
|
|
1447
|
-
}), ee({
|
|
1448
|
-
props: {
|
|
1449
|
-
icon: {
|
|
1450
|
-
type: String
|
|
1451
|
-
},
|
|
1452
|
-
icons: {
|
|
1453
|
-
type: Array
|
|
1454
|
-
},
|
|
1455
|
-
iconIndex: {
|
|
1456
|
-
type: Number
|
|
1457
|
-
},
|
|
1458
|
-
clickable: {
|
|
1459
|
-
type: Boolean
|
|
1460
|
-
},
|
|
1461
|
-
angle: {
|
|
1462
|
-
type: Number
|
|
1463
|
-
},
|
|
1464
|
-
flip: {
|
|
1465
|
-
type: Boolean
|
|
1466
|
-
},
|
|
1467
|
-
class: {
|
|
1468
|
-
type: [String, Array],
|
|
1469
|
-
default: ""
|
|
1470
|
-
}
|
|
1471
|
-
},
|
|
1472
|
-
emits: ["update:iconIndex"],
|
|
1473
|
-
setup(n, { emit: o }) {
|
|
1474
|
-
const l = c(n.icon), i = c(0), u = () => {
|
|
1475
|
-
n.icons && i.value++;
|
|
1476
|
-
};
|
|
1477
|
-
return E(
|
|
1478
|
-
() => n.iconIndex,
|
|
1479
|
-
(f) => {
|
|
1480
|
-
f !== void 0 && (i.value = f);
|
|
1481
|
-
},
|
|
1482
|
-
{ immediate: !0 }
|
|
1483
|
-
), E(
|
|
1484
|
-
() => i.value,
|
|
1485
|
-
(f) => {
|
|
1486
|
-
n.icons && (f >= n.icons.length && (i.value = 0), l.value = n.icons[i.value], te(a, l, l.value), o("update:iconIndex", i.value));
|
|
1487
|
-
},
|
|
1488
|
-
{ immediate: !0 }
|
|
1489
|
-
), E(
|
|
1490
|
-
() => _.value,
|
|
1491
|
-
() => {
|
|
1492
|
-
te(a, l, l.value);
|
|
1493
|
-
},
|
|
1494
|
-
{ deep: !0 }
|
|
1495
|
-
), E(
|
|
1496
|
-
() => n.icon,
|
|
1497
|
-
(f) => {
|
|
1498
|
-
te(a, l, f);
|
|
1499
|
-
}
|
|
1500
|
-
), te(a, l, l.value), { isLoaded: t, Icon: a, handleClick: u };
|
|
1501
|
-
},
|
|
1502
|
-
render() {
|
|
1503
|
-
if (!t.value)
|
|
1504
|
-
return Re;
|
|
1505
|
-
let n = this.class, o = "";
|
|
1506
|
-
Array.isArray(n) ? o = n.join(" ") : typeof n == "string" && (o = n);
|
|
1507
|
-
let l = [o];
|
|
1508
|
-
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), {
|
|
1509
|
-
onClick: this.$props.clickable ? this.handleClick : void 0,
|
|
1510
|
-
class: `${l.join(" ")}`,
|
|
1511
|
-
style: {
|
|
1512
|
-
fill: "currentColor",
|
|
1513
|
-
cursor: this.$props.clickable ? "pointer" : "default",
|
|
1514
|
-
transform: rt(this.angle, this.flip)
|
|
1515
|
-
}
|
|
1516
|
-
}) : F("div", { class: "w-[14px] h-[14px]" });
|
|
1517
|
-
}
|
|
1518
|
-
});
|
|
1519
|
-
}, Za = (e, t) => {
|
|
1520
|
-
let a = e.iconUrl;
|
|
1521
|
-
if (!a)
|
|
1522
|
-
return console.error("图标库地址不能为空"), Promise.resolve();
|
|
1523
|
-
if (xe.has(a))
|
|
1524
|
-
return Promise.resolve();
|
|
1525
|
-
const s = oa(a);
|
|
1526
|
-
if (s)
|
|
1527
|
-
return new Promise(async (n) => (na(s.scriptContent), n()));
|
|
1528
|
-
t.value = !1;
|
|
1529
|
-
const r = new Promise(async (n) => {
|
|
1530
|
-
await et(a, e.monoColor || !1), n(), xe.delete(a);
|
|
1531
|
-
});
|
|
1532
|
-
return xe.set(a, r), r;
|
|
1533
|
-
}, et = async (e, t) => {
|
|
1534
|
-
try {
|
|
1535
|
-
const a = await fetch(e);
|
|
1536
|
-
if (!a.ok) {
|
|
1537
|
-
I.error("网络异常,无法加载图标库!");
|
|
1538
|
-
return;
|
|
1539
|
-
}
|
|
1540
|
-
let s = await a.text();
|
|
1541
|
-
s = t ? s.replace(/fill=\"[^\"]*\"/gi, "") : s;
|
|
1542
|
-
let r = /^window\.(\w+)\s*=/;
|
|
1543
|
-
const n = s.match(r);
|
|
1544
|
-
if (n && n.length > 1) {
|
|
1545
|
-
let o = n[1];
|
|
1546
|
-
at(e, o, t, s);
|
|
1547
|
-
}
|
|
1548
|
-
na(s);
|
|
1549
|
-
return;
|
|
1550
|
-
} catch (a) {
|
|
1551
|
-
return console.error("网络异常,无法加载图标库:", a), null;
|
|
1552
|
-
}
|
|
1553
|
-
}, na = (e) => {
|
|
1554
|
-
const t = document.createElement("script");
|
|
1555
|
-
t.textContent = e, document.head.appendChild(t);
|
|
1556
|
-
}, at = (e, t, a, s) => {
|
|
1557
|
-
let r = `icon_cache:${e}`;
|
|
1558
|
-
const n = {
|
|
1559
|
-
windowKey: t,
|
|
1560
|
-
monoColor: a,
|
|
1561
|
-
scriptContent: s,
|
|
1562
|
-
expireTime: Date.now() + Xa
|
|
1563
|
-
// 缓存时间:7天
|
|
1564
|
-
};
|
|
1565
|
-
localStorage.setItem(r, JSON.stringify(n));
|
|
1566
|
-
}, oa = (e) => {
|
|
1567
|
-
let t = `icon_cache:${e}`;
|
|
1568
|
-
const a = localStorage.getItem(t);
|
|
1569
|
-
if (!a) return null;
|
|
1570
|
-
let s;
|
|
1571
|
-
try {
|
|
1572
|
-
s = JSON.parse(a);
|
|
1573
|
-
} catch (r) {
|
|
1574
|
-
return console.error("解析缓存失败:", r), null;
|
|
1575
|
-
}
|
|
1576
|
-
return s.expireTime < Date.now() ? (localStorage.removeItem(e), null) : s;
|
|
1577
|
-
}, Gt = () => {
|
|
1578
|
-
const e = Date.now();
|
|
1579
|
-
for (const t in localStorage)
|
|
1580
|
-
if (t.startsWith("icon_cache:")) {
|
|
1581
|
-
const a = localStorage.getItem(t);
|
|
1582
|
-
a && JSON.parse(a).expireTime < e && localStorage.removeItem(t);
|
|
1583
|
-
}
|
|
1584
|
-
}, te = (e, t, a) => {
|
|
1585
|
-
setTimeout(() => {
|
|
1586
|
-
t.value = a, t.value && (e.value = _.value[t.value]);
|
|
1587
|
-
}, 1);
|
|
1588
|
-
}, Re = F(
|
|
1589
|
-
"svg",
|
|
1590
|
-
{ class: "w-4 h-4", viewBox: "0 0 50 50", style: { animation: "rotate 2s linear infinite" } },
|
|
1591
|
-
[
|
|
1592
|
-
F("circle", {
|
|
1593
|
-
cx: "25",
|
|
1594
|
-
cy: "25",
|
|
1595
|
-
r: "20",
|
|
1596
|
-
stroke: "currentColor",
|
|
1597
|
-
fill: "none",
|
|
1598
|
-
style: { strokeWidth: "3 !important" }
|
|
1599
|
-
// 强制应用线宽
|
|
1600
|
-
}),
|
|
1601
|
-
F("circle", {
|
|
1602
|
-
cx: "25",
|
|
1603
|
-
cy: "6",
|
|
1604
|
-
r: "6",
|
|
1605
|
-
fill: "currentColor"
|
|
1606
|
-
})
|
|
1607
|
-
]
|
|
1608
|
-
), tt = (e, t) => {
|
|
1609
|
-
const a = oa(e);
|
|
1610
|
-
Object.keys(window).forEach((s) => {
|
|
1611
|
-
s.startsWith("_iconfont_svg_string_") && (a == null ? void 0 : a.windowKey) === s && !Qe.has(s) && (Qe.add(s), st(s, t));
|
|
1612
|
-
});
|
|
1613
|
-
}, st = (e, t) => {
|
|
1614
|
-
const a = window[e], n = new DOMParser().parseFromString(a, "image/svg+xml").getElementsByTagName("symbol"), o = document.querySelectorAll("symbol");
|
|
1615
|
-
for (const l of n) {
|
|
1616
|
-
const i = l.id, u = Array.from(o).find((f) => f.id === i);
|
|
1617
|
-
u && t && (u.innerHTML = l.innerHTML, u.querySelectorAll("*").forEach((f) => {
|
|
1618
|
-
f.hasAttribute("fill") && f.removeAttribute("fill");
|
|
1619
|
-
})), _.value[i] || (_.value[i] = F("svg", { fill: "currentColor" }, [F("use", { "xlink:href": `#${i}` })]));
|
|
1620
|
-
}
|
|
1621
|
-
}, rt = (e, t) => {
|
|
1622
|
-
let a = "";
|
|
1623
|
-
return e && (a += `rotate(${e}deg)`), t && (a += " scaleX(-1)"), a;
|
|
1624
|
-
}, jt = (e, t, a, s) => {
|
|
1625
|
-
la(e, [], a, s).forEach((n) => t.push(n));
|
|
1626
|
-
}, la = (e, t, a, s) => {
|
|
1627
|
-
var o, l, i, u, f;
|
|
1628
|
-
const r = [], n = K();
|
|
1629
|
-
for (const p of e) {
|
|
1630
|
-
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"))
|
|
1631
|
-
continue;
|
|
1632
|
-
const v = p.path.split("/");
|
|
1633
|
-
v.unshift(...t);
|
|
1634
|
-
const h = la(p.children || [], v, a, s), w = {
|
|
1635
|
-
key: v.join("/"),
|
|
1636
|
-
label: ((u = p.name) == null ? void 0 : u.toString()) ?? "",
|
|
1637
|
-
title: ((f = p.name) == null ? void 0 : f.toString()) ?? "",
|
|
1638
|
-
icon: p.icon ? F(a, { ...s, icon: p.icon }) : void 0,
|
|
1639
|
-
children: h.length > 0 ? h : void 0
|
|
1640
|
-
};
|
|
1641
|
-
(h.length > 0 || !p.children) && r.push(w);
|
|
1642
|
-
}
|
|
1643
|
-
return r;
|
|
1644
|
-
}, Ge = fa([]), qt = () => {
|
|
1645
|
-
Ge.length = 0;
|
|
1646
|
-
const e = C();
|
|
1647
|
-
let a = Ne().TabActive;
|
|
1648
|
-
e.matchedRoutes(a).forEach((r, n) => {
|
|
1649
|
-
var l;
|
|
1650
|
-
const o = {
|
|
1651
|
-
index: n,
|
|
1652
|
-
path: r.path,
|
|
1653
|
-
breadcrumbName: ((l = r.name) == null ? void 0 : l.toString()) ?? ""
|
|
1654
|
-
};
|
|
1655
|
-
Ge.push(o);
|
|
1656
|
-
});
|
|
1657
|
-
}, nt = {
|
|
1658
|
-
host: {
|
|
1659
|
-
api: "SITEHOST_API",
|
|
1660
|
-
url: "/openapi/RCSiteHostSrv/get",
|
|
1661
|
-
fieldMap: {
|
|
1662
|
-
hostId: "Id",
|
|
1663
|
-
hostName: "Title"
|
|
1664
|
-
},
|
|
1665
|
-
loadingText: "站点配置加载中……",
|
|
1666
|
-
// 不显示错误
|
|
1667
|
-
hideErrorToast: !0
|
|
1668
|
-
}
|
|
1669
|
-
}, Jt = ae("hostInfo", {
|
|
1670
|
-
state: () => ({
|
|
1671
|
-
hostInfo: {
|
|
1672
|
-
Host: "",
|
|
1673
|
-
Title: "",
|
|
1674
|
-
API_HOST: {},
|
|
1675
|
-
SERVER_HOST: {},
|
|
1676
|
-
ExtraProps: {},
|
|
1677
|
-
ExtraPropLines: []
|
|
1678
|
-
}
|
|
1679
|
-
}),
|
|
1680
|
-
actions: {
|
|
1681
|
-
/**
|
|
1682
|
-
* 加载站点信息,如加载失败,则使用本地缓存或默认参数
|
|
1683
|
-
* @param hostApi 启动配置主机地址
|
|
1684
|
-
* @param hostKey 站点信息,默认为当前主域名
|
|
1685
|
-
* @param mainOpenApis 宿主机开放接口
|
|
1686
|
-
*/
|
|
1687
|
-
async loadHostInfo(e, t, a) {
|
|
1688
|
-
if (a) {
|
|
1689
|
-
this._setHostInfo(a.getHostInfo());
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
return new Promise((s) => {
|
|
1693
|
-
Se.SITEHOST_API || (Se.SITEHOST_API = e);
|
|
1694
|
-
const r = t || window.location.origin;
|
|
1695
|
-
H(nt.host, {
|
|
1696
|
-
Query: {
|
|
1697
|
-
Host: r
|
|
1698
|
-
}
|
|
1699
|
-
}).then((n) => {
|
|
1700
|
-
if ((n == null ? void 0 : n.status) === T.SUCCESS && n.data) {
|
|
1701
|
-
const o = n.data;
|
|
1702
|
-
this._setHostInfo(o);
|
|
1703
|
-
}
|
|
1704
|
-
s();
|
|
1705
|
-
});
|
|
1706
|
-
});
|
|
1707
|
-
},
|
|
1708
|
-
/**
|
|
1709
|
-
* 设置主机信息(私有方法)
|
|
1710
|
-
*/
|
|
1711
|
-
_setHostInfo(e) {
|
|
1712
|
-
if (this.hostInfo = {
|
|
1713
|
-
...this.hostInfo,
|
|
1714
|
-
...e
|
|
1715
|
-
}, this.hostInfo.API_HOST)
|
|
1716
|
-
for (const t in this.hostInfo.API_HOST) Se[t] = this.hostInfo.API_HOST[t];
|
|
1717
|
-
if (this.hostInfo.SERVER_HOST)
|
|
1718
|
-
for (const t in this.hostInfo.SERVER_HOST) Ea[t] = this.hostInfo.SERVER_HOST[t];
|
|
1719
|
-
},
|
|
1720
|
-
getHostInfo() {
|
|
1721
|
-
return this.hostInfo;
|
|
1722
|
-
}
|
|
1723
|
-
},
|
|
1724
|
-
// 使用自定义数据缓存
|
|
1725
|
-
persist: !1
|
|
1726
|
-
// persist: {
|
|
1727
|
-
// key: HOSTINFO_STORE_KEY,
|
|
1728
|
-
// storage: localStorage,
|
|
1729
|
-
// pick: ['hostInfo'],
|
|
1730
|
-
// },
|
|
1731
|
-
}), Bt = ae("settingInfo", {
|
|
1732
|
-
state: () => ({
|
|
1733
|
-
fullscreen: !1,
|
|
1734
|
-
menuCollapse: !1,
|
|
1735
|
-
tableColumns: {}
|
|
1736
|
-
}),
|
|
1737
|
-
actions: {
|
|
1738
|
-
/**
|
|
1739
|
-
* 设置全屏
|
|
1740
|
-
*/
|
|
1741
|
-
setFullscreen(e) {
|
|
1742
|
-
this.$patch({
|
|
1743
|
-
fullscreen: e
|
|
1744
|
-
});
|
|
1745
|
-
},
|
|
1746
|
-
/**
|
|
1747
|
-
* 设置主菜单区折叠
|
|
1748
|
-
*/
|
|
1749
|
-
setMenuCollapse(e) {
|
|
1750
|
-
this.$patch({
|
|
1751
|
-
menuCollapse: e
|
|
1752
|
-
});
|
|
1753
|
-
},
|
|
1754
|
-
/**
|
|
1755
|
-
* 获取表格头配置
|
|
1756
|
-
*/
|
|
1757
|
-
getTableColumns(e) {
|
|
1758
|
-
return this.tableColumns[e];
|
|
1759
|
-
},
|
|
1760
|
-
/**
|
|
1761
|
-
* 设置表格头配置
|
|
1762
|
-
*/
|
|
1763
|
-
setTableColumns(e, t) {
|
|
1764
|
-
this.$patch({
|
|
1765
|
-
tableColumns: {
|
|
1766
|
-
...this.tableColumns,
|
|
1767
|
-
[e]: t
|
|
1768
|
-
}
|
|
1769
|
-
});
|
|
1770
|
-
}
|
|
1771
|
-
},
|
|
1772
|
-
persist: !1
|
|
1773
|
-
}), zt = /* @__PURE__ */ ee({
|
|
1774
|
-
inheritAttrs: !1,
|
|
1775
|
-
__name: "index",
|
|
1776
|
-
props: {
|
|
1777
|
-
...ce,
|
|
1778
|
-
autoload: {
|
|
1779
|
-
type: Boolean,
|
|
1780
|
-
default: !1
|
|
1781
|
-
},
|
|
1782
|
-
value: {
|
|
1783
|
-
type: [String, Number, null, Array],
|
|
1784
|
-
default: void 0
|
|
1785
|
-
},
|
|
1786
|
-
/**
|
|
1787
|
-
* 查询字段
|
|
1788
|
-
* - 模糊查询
|
|
1789
|
-
*/
|
|
1790
|
-
searchField: {
|
|
1791
|
-
type: [String, Array]
|
|
1792
|
-
},
|
|
1793
|
-
/**
|
|
1794
|
-
* 自定义查询参数
|
|
1795
|
-
* - 查询参数
|
|
1796
|
-
* - query参数
|
|
1797
|
-
*/
|
|
1798
|
-
onsearch: {
|
|
1799
|
-
type: Function
|
|
1800
|
-
},
|
|
1801
|
-
/**
|
|
1802
|
-
* 修改输入数据则自动清空关联数据
|
|
1803
|
-
*/
|
|
1804
|
-
autoClean: {
|
|
1805
|
-
type: Boolean,
|
|
1806
|
-
default: !0
|
|
1807
|
-
}
|
|
1808
|
-
},
|
|
1809
|
-
emits: ["update:value", "select", "change", "update:labels"],
|
|
1810
|
-
setup(e, { emit: t }) {
|
|
1811
|
-
var w, m, b;
|
|
1812
|
-
const a = e, s = oe(), r = c({
|
|
1813
|
-
...a.url,
|
|
1814
|
-
url: ((w = a.url) == null ? void 0 : w.url) || "",
|
|
1815
|
-
fieldMap: a.fieldMap || ((m = a.url) == null ? void 0 : m.fieldMap),
|
|
1816
|
-
params: a.params || ((b = a.url) == null ? void 0 : b.params),
|
|
1817
|
-
loadingText: !1
|
|
1818
|
-
}), n = c(void 0);
|
|
1819
|
-
E(
|
|
1820
|
-
() => a.value,
|
|
1821
|
-
() => {
|
|
1822
|
-
n.value = a.value;
|
|
1823
|
-
},
|
|
1824
|
-
{ immediate: !0 }
|
|
1825
|
-
), E(
|
|
1826
|
-
() => n.value,
|
|
1827
|
-
(g) => {
|
|
1828
|
-
a.autoClean && a.formData && a.outFields && g !== a.value && ra(a.formData, a.outFields, null);
|
|
1829
|
-
}
|
|
1830
|
-
);
|
|
1831
|
-
const o = he(), { editorCtrl: l, errInfo: i, labelText: u } = o, f = t;
|
|
1832
|
-
o.inputEmit = f;
|
|
1833
|
-
const p = c([]), v = (g) => {
|
|
1834
|
-
var $;
|
|
1835
|
-
if (p.value = [], g === "") return;
|
|
1836
|
-
let d = g.trim(), S = {
|
|
1837
|
-
...r.value.params,
|
|
1838
|
-
Query: {
|
|
1839
|
-
...($ = r.value.params) == null ? void 0 : $.Query
|
|
1840
|
-
}
|
|
1841
|
-
};
|
|
1842
|
-
a.searchField && (Array.isArray(a.searchField) ? a.searchField.forEach((U) => {
|
|
1843
|
-
S.Query[U] = {
|
|
1844
|
-
$like: "%" + d + "%"
|
|
1845
|
-
};
|
|
1846
|
-
}) : S.Query[a.searchField] = {
|
|
1847
|
-
$like: "%" + d + "%"
|
|
1848
|
-
}), a.onsearch && a.onsearch(d, S), Z(!0, a, p, o, r.value, S);
|
|
1849
|
-
}, h = (g) => {
|
|
1850
|
-
const d = ve(a, g, p, o);
|
|
1851
|
-
f("update:value", g), f("select", g);
|
|
1852
|
-
const S = ge(d);
|
|
1853
|
-
f("update:labels", S), i != null && i.value.errClass && l && de(l);
|
|
1854
|
-
};
|
|
1855
|
-
return le(() => {
|
|
1856
|
-
r.value && !r.value.fieldMap && (r.value.fieldMap = {
|
|
1857
|
-
title: "Name",
|
|
1858
|
-
label: "Name",
|
|
1859
|
-
value: "Name",
|
|
1860
|
-
key: "Id"
|
|
1861
|
-
});
|
|
1862
|
-
}), ie(() => {
|
|
1863
|
-
me(a, o);
|
|
1864
|
-
}), (g, d) => {
|
|
1865
|
-
var S;
|
|
1866
|
-
return x(), O("div", null, [
|
|
1867
|
-
J(A(da), ue({
|
|
1868
|
-
value: n.value,
|
|
1869
|
-
"onUpdate:value": d[0] || (d[0] = ($) => n.value = $),
|
|
1870
|
-
class: [(S = A(i)) == null ? void 0 : S.errClass, "error w-full"],
|
|
1871
|
-
options: p.value,
|
|
1872
|
-
onSearch: v,
|
|
1873
|
-
onSelect: h,
|
|
1874
|
-
placeholder: a.url && !a.url.loading ? "请输入并选择" + A(u) : ""
|
|
1875
|
-
}, A(s)), null, 16, ["value", "class", "options", "placeholder"])
|
|
1876
|
-
]);
|
|
1877
|
-
};
|
|
1878
|
-
}
|
|
1879
|
-
}), ot = { class: "min-h-[32px] pt-[5px]" }, lt = {
|
|
1880
|
-
key: 1,
|
|
1881
|
-
class: "text-center text-gray-500"
|
|
1882
|
-
}, Wt = /* @__PURE__ */ ee({
|
|
1883
|
-
inheritAttrs: !1,
|
|
1884
|
-
__name: "index",
|
|
1885
|
-
props: {
|
|
1886
|
-
...ce,
|
|
1887
|
-
nodata: {
|
|
1888
|
-
type: String,
|
|
1889
|
-
default: ""
|
|
1890
|
-
},
|
|
1891
|
-
/**
|
|
1892
|
-
* 换行数量
|
|
1893
|
-
*/
|
|
1894
|
-
wrap: {
|
|
1895
|
-
type: Number
|
|
1896
|
-
},
|
|
1897
|
-
disabledItems: {
|
|
1898
|
-
type: Array
|
|
1899
|
-
}
|
|
1900
|
-
},
|
|
1901
|
-
emits: ["change", "update:labels"],
|
|
1902
|
-
setup(e, { emit: t }) {
|
|
1903
|
-
var f, p, v;
|
|
1904
|
-
const a = e, s = oe(), r = c({
|
|
1905
|
-
...a.url,
|
|
1906
|
-
url: ((f = a.url) == null ? void 0 : f.url) || "",
|
|
1907
|
-
fieldMap: a.fieldMap || ((p = a.url) == null ? void 0 : p.fieldMap),
|
|
1908
|
-
params: a.params || ((v = a.url) == null ? void 0 : v.params),
|
|
1909
|
-
loadingText: !1
|
|
1910
|
-
}), n = he(), { errInfo: o } = n, l = t;
|
|
1911
|
-
n.inputEmit = l;
|
|
1912
|
-
const i = c([]), u = (h) => {
|
|
1913
|
-
const m = ve(a, h, i, n), b = ge(m);
|
|
1914
|
-
l("update:labels", b);
|
|
1915
|
-
};
|
|
1916
|
-
return le(() => {
|
|
1917
|
-
r.value && !r.value.fieldMap && (r.value.fieldMap = {
|
|
1918
|
-
title: "Name",
|
|
1919
|
-
label: "Name",
|
|
1920
|
-
value: "Id",
|
|
1921
|
-
key: "Id"
|
|
1922
|
-
}), Z(a.autoload, a, i, n, r.value, r.value.params);
|
|
1923
|
-
}), ie(() => {
|
|
1924
|
-
me(a, n);
|
|
1925
|
-
}), (h, w) => (x(), O("div", ot, [
|
|
1926
|
-
J(A(ha), ue({
|
|
1927
|
-
onChange: u,
|
|
1928
|
-
class: "w-full mb-[-3px]"
|
|
1929
|
-
}, A(s)), {
|
|
1930
|
-
default: Q(() => [
|
|
1931
|
-
i.value.length > 0 ? (x(!0), O(z, { key: 0 }, Pe(i.value, (m) => {
|
|
1932
|
-
var b;
|
|
1933
|
-
return x(), we(A(ma), {
|
|
1934
|
-
key: m.value,
|
|
1935
|
-
value: m.value,
|
|
1936
|
-
disabled: m.disabled || m.value && e.disabledItems && e.disabledItems.indexOf(m.value.toString()) > -1,
|
|
1937
|
-
class: Je([
|
|
1938
|
-
((b = A(o)) == null ? void 0 : b.errClass) === "error" ? "error !text-red-400" : "",
|
|
1939
|
-
"text-nowrap",
|
|
1940
|
-
"pb-1",
|
|
1941
|
-
e.wrap ? `w-1/${a.wrap}` : ""
|
|
1942
|
-
])
|
|
1943
|
-
}, {
|
|
1944
|
-
default: Q(() => [
|
|
1945
|
-
Oe(W(m.label), 1)
|
|
1946
|
-
]),
|
|
1947
|
-
_: 2
|
|
1948
|
-
}, 1032, ["value", "disabled", "class"]);
|
|
1949
|
-
}), 128)) : e.nodata ? (x(), O("div", lt, W(e.nodata), 1)) : B("", !0)
|
|
1950
|
-
]),
|
|
1951
|
-
_: 1
|
|
1952
|
-
}, 16)
|
|
1953
|
-
]));
|
|
1954
|
-
}
|
|
1955
|
-
}), it = { class: "min-h-[32px] pt-1" }, ut = {
|
|
1956
|
-
key: 1,
|
|
1957
|
-
class: "text-center text-gray-500"
|
|
1958
|
-
}, Yt = /* @__PURE__ */ ee({
|
|
1959
|
-
inheritAttrs: !1,
|
|
1960
|
-
__name: "index",
|
|
1961
|
-
props: {
|
|
1962
|
-
...ce,
|
|
1963
|
-
value: {
|
|
1964
|
-
type: [String, Number, null, Array],
|
|
1965
|
-
default: void 0
|
|
1966
|
-
},
|
|
1967
|
-
nodata: {
|
|
1968
|
-
type: String,
|
|
1969
|
-
default: "无数据"
|
|
1970
|
-
},
|
|
1971
|
-
/**
|
|
1972
|
-
* 换行数量
|
|
1973
|
-
*/
|
|
1974
|
-
wrap: {
|
|
1975
|
-
type: Number
|
|
1976
|
-
}
|
|
1977
|
-
},
|
|
1978
|
-
emits: ["change", "update:value", "update:labels"],
|
|
1979
|
-
setup(e, { emit: t }) {
|
|
1980
|
-
var v, h, w;
|
|
1981
|
-
const a = e, s = oe(), r = c({
|
|
1982
|
-
...a.url,
|
|
1983
|
-
url: ((v = a.url) == null ? void 0 : v.url) || "",
|
|
1984
|
-
fieldMap: a.fieldMap || ((h = a.url) == null ? void 0 : h.fieldMap),
|
|
1985
|
-
params: a.params || ((w = a.url) == null ? void 0 : w.params),
|
|
1986
|
-
loadingText: !1
|
|
1987
|
-
}), n = c(a.value), o = he(), { errInfo: l } = o, i = c([]), u = t;
|
|
1988
|
-
o.inputEmit = u, E(
|
|
1989
|
-
() => n.value,
|
|
1990
|
-
(m) => {
|
|
1991
|
-
u("update:value", m);
|
|
1992
|
-
}
|
|
1993
|
-
);
|
|
1994
|
-
const f = (m, b) => {
|
|
1995
|
-
if (typeof m == "object" && typeof b == "object") {
|
|
1996
|
-
const g = JSON.stringify(m) === JSON.stringify(b);
|
|
1997
|
-
return g && (n.value = m), g;
|
|
1998
|
-
}
|
|
1999
|
-
return m === b;
|
|
2000
|
-
}, p = (m) => {
|
|
2001
|
-
const b = m.target.value, g = ve(a, b, i, o), d = ge(g);
|
|
2002
|
-
u("update:labels", d);
|
|
2003
|
-
};
|
|
2004
|
-
return le(() => {
|
|
2005
|
-
var m;
|
|
2006
|
-
r.value && !r.value.fieldMap && (r.value.fieldMap = {
|
|
2007
|
-
label: "Name",
|
|
2008
|
-
value: "Id",
|
|
2009
|
-
key: "Id"
|
|
2010
|
-
}), Z(a.autoload, a, i, o, r.value, (m = r.value) == null ? void 0 : m.params);
|
|
2011
|
-
}), ie(() => {
|
|
2012
|
-
me(a, o);
|
|
2013
|
-
}), (m, b) => (x(), O("div", it, [
|
|
2014
|
-
J(A(va), ue({
|
|
2015
|
-
value: n.value,
|
|
2016
|
-
"onUpdate:value": b[0] || (b[0] = (g) => n.value = g),
|
|
2017
|
-
autocheck: !1,
|
|
2018
|
-
onChange: p,
|
|
2019
|
-
class: "w-full flex align-items flex-wrap mb-[-3px]"
|
|
2020
|
-
}, A(s)), {
|
|
2021
|
-
default: Q(() => [
|
|
2022
|
-
i.value.length > 0 ? (x(!0), O(z, { key: 0 }, Pe(i.value, (g) => {
|
|
2023
|
-
var d;
|
|
2024
|
-
return x(), O(z, {
|
|
2025
|
-
key: g.value
|
|
2026
|
-
}, [
|
|
2027
|
-
g.visible !== !1 ? (x(), we(A(ga), {
|
|
2028
|
-
key: 0,
|
|
2029
|
-
checked: f(g.value, a.value),
|
|
2030
|
-
value: g.value,
|
|
2031
|
-
class: Je([
|
|
2032
|
-
((d = A(l)) == null ? void 0 : d.errClass) === "error" ? "error !text-red-400" : "",
|
|
2033
|
-
"text-nowrap",
|
|
2034
|
-
"pb-1",
|
|
2035
|
-
e.wrap ? `w-1/${a.wrap}` : ""
|
|
2036
|
-
])
|
|
2037
|
-
}, {
|
|
2038
|
-
default: Q(() => [
|
|
2039
|
-
Oe(W(g.label), 1)
|
|
2040
|
-
]),
|
|
2041
|
-
_: 2
|
|
2042
|
-
}, 1032, ["checked", "value", "class"])) : B("", !0)
|
|
2043
|
-
], 64);
|
|
2044
|
-
}), 128)) : e.nodata ? (x(), O("div", ut, W(e.nodata), 1)) : B("", !0)
|
|
2045
|
-
]),
|
|
2046
|
-
_: 1
|
|
2047
|
-
}, 16, ["value"])
|
|
2048
|
-
]));
|
|
2049
|
-
}
|
|
2050
|
-
}), ct = {
|
|
2051
|
-
key: 0,
|
|
2052
|
-
class: "absolute z-10 mt-[5px] mr-[10px] text-[#999] flex items-center"
|
|
2053
|
-
}, Xt = /* @__PURE__ */ ee({
|
|
2054
|
-
inheritAttrs: !1,
|
|
2055
|
-
__name: "index",
|
|
2056
|
-
props: {
|
|
2057
|
-
...ce,
|
|
2058
|
-
value: {
|
|
2059
|
-
type: [String, Number, Array, null],
|
|
2060
|
-
default: void 0
|
|
2061
|
-
},
|
|
2062
|
-
/**
|
|
2063
|
-
* 自动选择第一个选项
|
|
2064
|
-
*/
|
|
2065
|
-
selectFirst: {
|
|
2066
|
-
type: Boolean,
|
|
2067
|
-
default: !1
|
|
2068
|
-
},
|
|
2069
|
-
/**
|
|
2070
|
-
* 数据源OPTIONS的key
|
|
2071
|
-
*/
|
|
2072
|
-
dataKey: {
|
|
2073
|
-
type: String,
|
|
2074
|
-
required: !1
|
|
2075
|
-
},
|
|
2076
|
-
/**
|
|
2077
|
-
* 是否显示全部选项
|
|
2078
|
-
*/
|
|
2079
|
-
all: {
|
|
2080
|
-
type: Boolean,
|
|
2081
|
-
default: !1
|
|
2082
|
-
},
|
|
2083
|
-
/**
|
|
2084
|
-
* 自定义全部选项的值
|
|
2085
|
-
* 如果all为true,则显示全部选项
|
|
2086
|
-
* 未设置allValue,则默认[0, 1]
|
|
2087
|
-
*/
|
|
2088
|
-
allValue: {
|
|
2089
|
-
type: [String, Number, Array],
|
|
2090
|
-
required: !1
|
|
2091
|
-
}
|
|
2092
|
-
},
|
|
2093
|
-
emits: ["change", "update:value", "update:labels"],
|
|
2094
|
-
setup(e, { emit: t }) {
|
|
2095
|
-
var m, b, g;
|
|
2096
|
-
const a = e, s = oe(), r = c({
|
|
2097
|
-
...a.url,
|
|
2098
|
-
url: ((m = a.url) == null ? void 0 : m.url) || "",
|
|
2099
|
-
fieldMap: a.fieldMap || ((b = a.url) == null ? void 0 : b.fieldMap),
|
|
2100
|
-
params: a.params || ((g = a.url) == null ? void 0 : g.params),
|
|
2101
|
-
loadingText: !1
|
|
2102
|
-
}), n = he(), { editorCtrl: o, errInfo: l, labelText: i } = n, u = c(a.value), f = c(s.placeholder), p = c(void 0), v = t;
|
|
2103
|
-
n.inputEmit = v;
|
|
2104
|
-
const h = c([]), w = (d) => {
|
|
2105
|
-
const S = ve(a, d, h, n), $ = ge(S);
|
|
2106
|
-
p.value = d, v("update:labels", $), v("change", d), l != null && l.value.errClass && o && de(o);
|
|
2107
|
-
};
|
|
2108
|
-
return E(
|
|
2109
|
-
() => h.value,
|
|
2110
|
-
(d) => {
|
|
2111
|
-
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);
|
|
2112
|
-
}
|
|
2113
|
-
), E(
|
|
2114
|
-
() => r.value.loading,
|
|
2115
|
-
(d) => {
|
|
2116
|
-
d ? f.value = "" : f.value || (f.value = "请选择" + i.value);
|
|
2117
|
-
},
|
|
2118
|
-
{ immediate: !0 }
|
|
2119
|
-
), E(
|
|
2120
|
-
() => p.value,
|
|
2121
|
-
(d) => {
|
|
2122
|
-
if (s.mode === "multiple" && P(d) && P(u.value)) {
|
|
2123
|
-
v("update:value", u.value);
|
|
2124
|
-
return;
|
|
2125
|
-
}
|
|
2126
|
-
v("update:value", d);
|
|
2127
|
-
}
|
|
2128
|
-
), E(
|
|
2129
|
-
() => a.params,
|
|
2130
|
-
(d) => {
|
|
2131
|
-
Z(!0, a, h, n, r.value, d);
|
|
2132
|
-
},
|
|
2133
|
-
{ deep: !0 }
|
|
2134
|
-
), le(() => {
|
|
2135
|
-
var d;
|
|
2136
|
-
if (r.value && !r.value.fieldMap && (r.value.fieldMap = {
|
|
2137
|
-
label: "Name",
|
|
2138
|
-
value: "Id",
|
|
2139
|
-
key: "Id"
|
|
2140
|
-
}), a.dataKey) {
|
|
2141
|
-
const S = JSON.parse(JSON.stringify(M.getOptions(a.dataKey)));
|
|
2142
|
-
h.value = S;
|
|
2143
|
-
} else Z(a.autoload, a, h, n, r.value, (d = r.value) == null ? void 0 : d.params);
|
|
2144
|
-
}), ie(() => {
|
|
2145
|
-
me(a, n);
|
|
2146
|
-
}), (d, S) => {
|
|
2147
|
-
var $;
|
|
2148
|
-
return x(), O("div", null, [
|
|
2149
|
-
a.url && a.url.loading === !0 ? (x(), O("div", ct, [
|
|
2150
|
-
J(A(Re), { class: "text-[#555] mx-[5px] !ml-[10px] !w-4 !h-4" }),
|
|
2151
|
-
S[1] || (S[1] = pa("span", null, "数据加载中...", -1))
|
|
2152
|
-
])) : B("", !0),
|
|
2153
|
-
J(A(ya), ue({
|
|
2154
|
-
class: [($ = A(l)) == null ? void 0 : $.errClass, "w-full"],
|
|
2155
|
-
value: p.value,
|
|
2156
|
-
"onUpdate:value": S[0] || (S[0] = (U) => p.value = U),
|
|
2157
|
-
"allow-clear": !0,
|
|
2158
|
-
onChange: w,
|
|
2159
|
-
placeholder: f.value,
|
|
2160
|
-
"label-in-value": !1
|
|
2161
|
-
}, A(s)), {
|
|
2162
|
-
default: Q(() => [
|
|
2163
|
-
(x(!0), O(z, null, Pe(h.value, (U) => (x(), O(z, {
|
|
2164
|
-
key: U.value
|
|
2165
|
-
}, [
|
|
2166
|
-
U.visible !== !1 ? (x(), we(A(ba), {
|
|
2167
|
-
key: 0,
|
|
2168
|
-
value: U.value
|
|
2169
|
-
}, {
|
|
2170
|
-
default: Q(() => [
|
|
2171
|
-
Oe(W(U.label), 1)
|
|
2172
|
-
]),
|
|
2173
|
-
_: 2
|
|
2174
|
-
}, 1032, ["value"])) : B("", !0)
|
|
2175
|
-
], 64))), 128))
|
|
2176
|
-
]),
|
|
2177
|
-
_: 1
|
|
2178
|
-
}, 16, ["class", "value", "placeholder"])
|
|
2179
|
-
]);
|
|
2180
|
-
};
|
|
2181
|
-
}
|
|
2182
|
-
});
|
|
2183
|
-
export {
|
|
2184
|
-
Tt as $,
|
|
2185
|
-
Me as A,
|
|
2186
|
-
Pa as B,
|
|
2187
|
-
_t as C,
|
|
2188
|
-
qa as D,
|
|
2189
|
-
Ja as E,
|
|
2190
|
-
Kt as F,
|
|
2191
|
-
Ht as G,
|
|
2192
|
-
Ya as H,
|
|
2193
|
-
ra as I,
|
|
2194
|
-
ve as J,
|
|
2195
|
-
ge as K,
|
|
2196
|
-
Vt as L,
|
|
2197
|
-
Gt as M,
|
|
2198
|
-
st as N,
|
|
2199
|
-
M as O,
|
|
2200
|
-
N as P,
|
|
2201
|
-
rt as Q,
|
|
2202
|
-
jt as R,
|
|
2203
|
-
Ge as S,
|
|
2204
|
-
qt as T,
|
|
2205
|
-
ze as U,
|
|
2206
|
-
Lt as V,
|
|
2207
|
-
We as W,
|
|
2208
|
-
Et as X,
|
|
2209
|
-
Rt as Y,
|
|
2210
|
-
$e as Z,
|
|
2211
|
-
zt as _,
|
|
2212
|
-
Bt as a,
|
|
2213
|
-
Dt as a0,
|
|
2214
|
-
ja as a1,
|
|
2215
|
-
ta as a2,
|
|
2216
|
-
Ft as a3,
|
|
2217
|
-
xt as a4,
|
|
2218
|
-
Be as a5,
|
|
2219
|
-
wa as a6,
|
|
2220
|
-
Te as a7,
|
|
2221
|
-
V as a8,
|
|
2222
|
-
q as a9,
|
|
2223
|
-
se as aa,
|
|
2224
|
-
C as ab,
|
|
2225
|
-
Jt as ac,
|
|
2226
|
-
Ne as ad,
|
|
2227
|
-
Y as ae,
|
|
2228
|
-
Ot as b,
|
|
2229
|
-
Qt as c,
|
|
2230
|
-
kt as d,
|
|
2231
|
-
Pt as e,
|
|
2232
|
-
Ut as f,
|
|
2233
|
-
Ct as g,
|
|
2234
|
-
$t as h,
|
|
2235
|
-
P as i,
|
|
2236
|
-
Mt as j,
|
|
2237
|
-
aa as k,
|
|
2238
|
-
Ga as l,
|
|
2239
|
-
Nt as m,
|
|
2240
|
-
ce as n,
|
|
2241
|
-
wt as o,
|
|
2242
|
-
he as p,
|
|
2243
|
-
Oa as q,
|
|
2244
|
-
X as r,
|
|
2245
|
-
Z as s,
|
|
2246
|
-
me as t,
|
|
2247
|
-
K as u,
|
|
2248
|
-
Re as v,
|
|
2249
|
-
de as w,
|
|
2250
|
-
Wt as x,
|
|
2251
|
-
Yt as y,
|
|
2252
|
-
Xt as z
|
|
2253
|
-
};
|