@newview/base-vue 1.1.1 → 1.1.3
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/dist/base-vue.js +351 -1
- package/dist/base-vue.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -4
package/dist/base-vue.js
CHANGED
|
@@ -7,22 +7,38 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
import { defineComponent, openBlock, createElementBlock, ref, onMounted, resolveComponent, withDirectives, createElementVNode, vShow, createVNode, onUnmounted, shallowRef, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, nextTick } from "vue";
|
|
8
8
|
import ViewUIPlus, { Message, Modal } from "view-ui-plus";
|
|
9
9
|
import { Utilities, utilities } from "@newview/tools";
|
|
10
|
-
import { storageInfo } from "@newview/infrastructure";
|
|
10
|
+
import { storageInfo, openObserve } from "@newview/infrastructure";
|
|
11
11
|
import mitt from "mitt";
|
|
12
12
|
import { useRouter } from "vue-router";
|
|
13
13
|
import VxeTable from "vxe-table";
|
|
14
14
|
import axios from "axios";
|
|
15
15
|
class MessageInstance {
|
|
16
16
|
constructor() {
|
|
17
|
+
/**
|
|
18
|
+
* 提示 info
|
|
19
|
+
* @param prop
|
|
20
|
+
*/
|
|
17
21
|
__publicField(this, "info", (prop) => {
|
|
18
22
|
Message.info(prop);
|
|
19
23
|
});
|
|
24
|
+
/**
|
|
25
|
+
* 提示 success
|
|
26
|
+
* @param prop
|
|
27
|
+
*/
|
|
20
28
|
__publicField(this, "success", (prop) => {
|
|
21
29
|
Message.success(prop);
|
|
22
30
|
});
|
|
31
|
+
/**
|
|
32
|
+
* 提示 warning
|
|
33
|
+
* @param prop
|
|
34
|
+
*/
|
|
23
35
|
__publicField(this, "warning", (prop) => {
|
|
24
36
|
Message.warning(prop);
|
|
25
37
|
});
|
|
38
|
+
/**
|
|
39
|
+
* 提示 error
|
|
40
|
+
* @param prop
|
|
41
|
+
*/
|
|
26
42
|
__publicField(this, "error", (prop) => {
|
|
27
43
|
Message.error(prop);
|
|
28
44
|
});
|
|
@@ -32,22 +48,42 @@ const message = new MessageInstance();
|
|
|
32
48
|
class ModalInstance {
|
|
33
49
|
constructor() {
|
|
34
50
|
__publicField(this, "zIndex", 1e4);
|
|
51
|
+
/**
|
|
52
|
+
* 确认对话框
|
|
53
|
+
* @param prop
|
|
54
|
+
*/
|
|
35
55
|
__publicField(this, "confirm", (prop) => {
|
|
36
56
|
prop["z-index"] = this.zIndex;
|
|
37
57
|
Modal.confirm(prop);
|
|
38
58
|
});
|
|
59
|
+
/**
|
|
60
|
+
* 基础对话框 info
|
|
61
|
+
* @param prop
|
|
62
|
+
*/
|
|
39
63
|
__publicField(this, "info", (prop) => {
|
|
40
64
|
prop["z-index"] = this.zIndex;
|
|
41
65
|
Modal.info(prop);
|
|
42
66
|
});
|
|
67
|
+
/**
|
|
68
|
+
* 基础对话框 success
|
|
69
|
+
* @param prop
|
|
70
|
+
*/
|
|
43
71
|
__publicField(this, "success", (prop) => {
|
|
44
72
|
prop["z-index"] = this.zIndex;
|
|
45
73
|
Modal.success(prop);
|
|
46
74
|
});
|
|
75
|
+
/**
|
|
76
|
+
* 基础对话框 warning
|
|
77
|
+
* @param prop
|
|
78
|
+
*/
|
|
47
79
|
__publicField(this, "warning", (prop) => {
|
|
48
80
|
prop["z-index"] = this.zIndex;
|
|
49
81
|
Modal.warning(prop);
|
|
50
82
|
});
|
|
83
|
+
/**
|
|
84
|
+
* 基础对话框 error
|
|
85
|
+
* @param prop
|
|
86
|
+
*/
|
|
51
87
|
__publicField(this, "error", (prop) => {
|
|
52
88
|
prop["z-index"] = this.zIndex;
|
|
53
89
|
Modal.error(prop);
|
|
@@ -58,11 +94,35 @@ const modal = new ModalInstance();
|
|
|
58
94
|
const bus = mitt();
|
|
59
95
|
class BaseInstance {
|
|
60
96
|
constructor() {
|
|
97
|
+
/**
|
|
98
|
+
* IView 消息提示
|
|
99
|
+
*/
|
|
61
100
|
__publicField(this, "message", new MessageInstance());
|
|
101
|
+
/**
|
|
102
|
+
* IView Modal
|
|
103
|
+
*/
|
|
62
104
|
__publicField(this, "modal", new ModalInstance());
|
|
105
|
+
/**
|
|
106
|
+
* 工具类
|
|
107
|
+
*/
|
|
63
108
|
__publicField(this, "utilities", new Utilities());
|
|
109
|
+
/**
|
|
110
|
+
* 存储信息
|
|
111
|
+
*/
|
|
64
112
|
__publicField(this, "storageInfo", storageInfo);
|
|
113
|
+
/**
|
|
114
|
+
* 系统监视
|
|
115
|
+
*/
|
|
116
|
+
__publicField(this, "openObserve", openObserve);
|
|
117
|
+
/**
|
|
118
|
+
* 事件总线
|
|
119
|
+
*/
|
|
65
120
|
__publicField(this, "bus", bus);
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @param e
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
66
126
|
__publicField(this, "doInputControl", (e) => {
|
|
67
127
|
if (this.utilities.isNull(e)) {
|
|
68
128
|
return;
|
|
@@ -81,6 +141,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
81
141
|
name: "Root",
|
|
82
142
|
components: {},
|
|
83
143
|
emits: [""],
|
|
144
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
84
145
|
props: propDefine$6,
|
|
85
146
|
setup(props, ctx) {
|
|
86
147
|
return new RootInstance(props, ctx);
|
|
@@ -91,15 +152,26 @@ class RootInstance extends BaseInstance {
|
|
|
91
152
|
super();
|
|
92
153
|
__publicField(this, "props");
|
|
93
154
|
__publicField(this, "ctx");
|
|
155
|
+
// API实例化
|
|
156
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
157
|
+
// 全局属性
|
|
94
158
|
__publicField(this, "router");
|
|
95
159
|
this.props = props;
|
|
96
160
|
this.ctx = ctx;
|
|
97
161
|
this.useRoot();
|
|
98
162
|
}
|
|
163
|
+
//#region 页面调整
|
|
164
|
+
// 私有方法 | private 方法名() {}
|
|
165
|
+
/**
|
|
166
|
+
* 初始化业务
|
|
167
|
+
*/
|
|
99
168
|
useRoot() {
|
|
100
169
|
this.router = useRouter();
|
|
101
170
|
this.goPage();
|
|
102
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* 调整页面
|
|
174
|
+
*/
|
|
103
175
|
goPage() {
|
|
104
176
|
const linkMain = this.getQueryString("linkMain");
|
|
105
177
|
if (!this.utilities.isNull(linkMain)) {
|
|
@@ -113,6 +185,11 @@ class RootInstance extends BaseInstance {
|
|
|
113
185
|
this.router.replace(this.storageInfo.getCurrentDefaultPath());
|
|
114
186
|
}
|
|
115
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* 获取地址栏参数
|
|
190
|
+
* @param variable
|
|
191
|
+
* @returns
|
|
192
|
+
*/
|
|
116
193
|
getQueryString(variable) {
|
|
117
194
|
let index = window.location.href.indexOf("?");
|
|
118
195
|
let query = window.location.href.substring(
|
|
@@ -128,6 +205,7 @@ class RootInstance extends BaseInstance {
|
|
|
128
205
|
}
|
|
129
206
|
return "";
|
|
130
207
|
}
|
|
208
|
+
//#endregion 页面调整 END
|
|
131
209
|
}
|
|
132
210
|
const Root_vue_vue_type_style_index_0_scoped_b392b4ac_lang = "";
|
|
133
211
|
const _export_sfc = (sfc, props) => {
|
|
@@ -144,6 +222,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
144
222
|
const Root = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-b392b4ac"]]);
|
|
145
223
|
const propDefine$5 = {
|
|
146
224
|
tabPage: {
|
|
225
|
+
// 要打开的页面信息
|
|
147
226
|
type: Object,
|
|
148
227
|
default: () => ({})
|
|
149
228
|
}
|
|
@@ -152,27 +231,41 @@ const _sfc_main$4 = defineComponent({
|
|
|
152
231
|
name: "LinkPanel",
|
|
153
232
|
components: {},
|
|
154
233
|
emits: [""],
|
|
234
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
155
235
|
props: propDefine$5,
|
|
156
236
|
setup(props, ctx) {
|
|
157
237
|
return new LinkPanelInstance(props, ctx);
|
|
158
238
|
}
|
|
159
239
|
});
|
|
160
240
|
class LinkPanelInstance extends BaseInstance {
|
|
241
|
+
// API实例化
|
|
242
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
243
|
+
// 全局属性
|
|
161
244
|
constructor(props, ctx) {
|
|
162
245
|
super();
|
|
163
246
|
__publicField(this, "props");
|
|
164
247
|
__publicField(this, "ctx");
|
|
248
|
+
//#region 外链接
|
|
249
|
+
// 私有属性 | private
|
|
250
|
+
// 响应属性 | ref、reactive、computed、watch
|
|
165
251
|
__publicField(this, "loading", ref(true));
|
|
166
252
|
__publicField(this, "ifrPanel", ref());
|
|
167
253
|
this.props = props;
|
|
168
254
|
this.ctx = ctx;
|
|
169
255
|
this.useLinkPanel();
|
|
170
256
|
}
|
|
257
|
+
// 私有方法 | private 方法名() {}
|
|
258
|
+
/**
|
|
259
|
+
* 初始化业务
|
|
260
|
+
*/
|
|
171
261
|
useLinkPanel() {
|
|
172
262
|
onMounted(() => {
|
|
173
263
|
this.bindLoadEvent();
|
|
174
264
|
});
|
|
175
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* 绑定事件
|
|
268
|
+
*/
|
|
176
269
|
bindLoadEvent() {
|
|
177
270
|
const iframe = this.ifrPanel.value;
|
|
178
271
|
if (iframe.attachEvent) {
|
|
@@ -185,6 +278,10 @@ class LinkPanelInstance extends BaseInstance {
|
|
|
185
278
|
};
|
|
186
279
|
}
|
|
187
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* 加载完成
|
|
283
|
+
* @param iframe
|
|
284
|
+
*/
|
|
188
285
|
doLoaded(iframe) {
|
|
189
286
|
this.loading.value = false;
|
|
190
287
|
setTimeout(() => {
|
|
@@ -201,6 +298,8 @@ class LinkPanelInstance extends BaseInstance {
|
|
|
201
298
|
);
|
|
202
299
|
}, 20);
|
|
203
300
|
}
|
|
301
|
+
// 响应式方法 | xxx = () => {}
|
|
302
|
+
//#endregion 业务逻辑二 END
|
|
204
303
|
}
|
|
205
304
|
const LinkPanel_vue_vue_type_style_index_0_scoped_37023fbf_lang = "";
|
|
206
305
|
const _hoisted_1$4 = { class: "link-panel" };
|
|
@@ -229,22 +328,33 @@ const _sfc_main$3 = defineComponent({
|
|
|
229
328
|
name: "LinkMain",
|
|
230
329
|
components: { LinkPanel },
|
|
231
330
|
emits: [""],
|
|
331
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
232
332
|
props: propDefine$4,
|
|
233
333
|
setup(props, ctx) {
|
|
234
334
|
return new LinkMainInstance(props, ctx);
|
|
235
335
|
}
|
|
236
336
|
});
|
|
237
337
|
class LinkMainInstance extends BaseInstance {
|
|
338
|
+
// API实例化
|
|
339
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
340
|
+
// 全局属性
|
|
238
341
|
constructor(props, ctx) {
|
|
239
342
|
super();
|
|
240
343
|
__publicField(this, "props");
|
|
241
344
|
__publicField(this, "ctx");
|
|
345
|
+
//#region 业务逻辑二
|
|
346
|
+
// 私有属性 | private
|
|
347
|
+
// 响应属性 | ref、reactive、computed、watch
|
|
242
348
|
__publicField(this, "pages", ref([]));
|
|
243
349
|
__publicField(this, "activePath", ref(""));
|
|
244
350
|
this.props = props;
|
|
245
351
|
this.ctx = ctx;
|
|
246
352
|
this.useLinkMain();
|
|
247
353
|
}
|
|
354
|
+
// 私有方法 | private 方法名() {}
|
|
355
|
+
/**
|
|
356
|
+
* 初始化
|
|
357
|
+
*/
|
|
248
358
|
useLinkMain() {
|
|
249
359
|
const event = (data) => {
|
|
250
360
|
this.receiveMessage(data);
|
|
@@ -254,6 +364,11 @@ class LinkMainInstance extends BaseInstance {
|
|
|
254
364
|
window.removeEventListener("message", event);
|
|
255
365
|
});
|
|
256
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* 接收消息
|
|
369
|
+
* @param messageEvent
|
|
370
|
+
* @returns
|
|
371
|
+
*/
|
|
257
372
|
receiveMessage(messageEvent) {
|
|
258
373
|
if (messageEvent.source != window.parent.window.parent)
|
|
259
374
|
return;
|
|
@@ -280,6 +395,10 @@ class LinkMainInstance extends BaseInstance {
|
|
|
280
395
|
break;
|
|
281
396
|
}
|
|
282
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* 初始化存储信息
|
|
400
|
+
* @param data
|
|
401
|
+
*/
|
|
283
402
|
initStorageInfo(data) {
|
|
284
403
|
const token = data.token;
|
|
285
404
|
const user = this.utilities.isNull(data.user) ? void 0 : JSON.parse(data.user);
|
|
@@ -292,6 +411,10 @@ class LinkMainInstance extends BaseInstance {
|
|
|
292
411
|
this.storageInfo.setCurrentBusiness(currentBusiness);
|
|
293
412
|
this.storageInfo.setCurrentModule(currentModule);
|
|
294
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* 插入页面
|
|
416
|
+
* @param data { platformNo: string, path: string, loadMode: number, param: string, operates: string}
|
|
417
|
+
*/
|
|
295
418
|
pushPage(data) {
|
|
296
419
|
let component;
|
|
297
420
|
if (data.loadMode == 0) {
|
|
@@ -310,16 +433,32 @@ class LinkMainInstance extends BaseInstance {
|
|
|
310
433
|
component
|
|
311
434
|
});
|
|
312
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* 清除所有页面
|
|
438
|
+
* @param data { platformNo: string }
|
|
439
|
+
*/
|
|
313
440
|
clearAllPage(data) {
|
|
314
441
|
this.pages.value = [];
|
|
315
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* 关闭当前页面
|
|
445
|
+
* @param data { platformNo: string, path: string }
|
|
446
|
+
*/
|
|
316
447
|
closePage(data) {
|
|
317
448
|
const index = this.pages.value.findIndex((item) => item.path == data.path);
|
|
318
449
|
this.pages.value.splice(index, 1);
|
|
319
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* 激活页面
|
|
453
|
+
* @param data { platformNo: string, path: string }
|
|
454
|
+
*/
|
|
320
455
|
activePage(data) {
|
|
321
456
|
this.activePath.value = data.path;
|
|
322
457
|
}
|
|
458
|
+
/**
|
|
459
|
+
* 根据命令关闭页面
|
|
460
|
+
* @param data { platformNo: string, command: string }
|
|
461
|
+
*/
|
|
323
462
|
closePageByCommand(data) {
|
|
324
463
|
const currentIndex = this.pages.value.findIndex((item) => item.path == this.activePath.value);
|
|
325
464
|
switch (data.command) {
|
|
@@ -350,6 +489,8 @@ class LinkMainInstance extends BaseInstance {
|
|
|
350
489
|
break;
|
|
351
490
|
}
|
|
352
491
|
}
|
|
492
|
+
// 响应式方法 | xxx = () => {}
|
|
493
|
+
//#endregion 业务逻辑二 END
|
|
353
494
|
}
|
|
354
495
|
const LinkMain_vue_vue_type_style_index_0_scoped_026a2cc9_lang = "";
|
|
355
496
|
const _hoisted_1$3 = { class: "line-main" };
|
|
@@ -380,6 +521,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
380
521
|
const LinkMain = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-026a2cc9"]]);
|
|
381
522
|
const vFocus = (app) => {
|
|
382
523
|
app.directive("focus", {
|
|
524
|
+
// 当被绑定的元素挂载到 DOM 中时被调用
|
|
383
525
|
mounted(el) {
|
|
384
526
|
el.focus();
|
|
385
527
|
el.select();
|
|
@@ -431,11 +573,21 @@ function useAxios() {
|
|
|
431
573
|
if (error.response && error.response.data && error.response.data.code == "401") {
|
|
432
574
|
storageInfo.removeAll();
|
|
433
575
|
$router.push("/Login");
|
|
576
|
+
} else {
|
|
577
|
+
openObserve.error("请求异常", error);
|
|
434
578
|
}
|
|
435
579
|
return Promise.reject(error);
|
|
436
580
|
}
|
|
437
581
|
);
|
|
438
582
|
}
|
|
583
|
+
function useOpenObserve() {
|
|
584
|
+
const windowAny = window;
|
|
585
|
+
if (utilities.isNull(windowAny.openObserveOption)) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const option = windowAny.openObserveOption;
|
|
589
|
+
openObserve.init(option);
|
|
590
|
+
}
|
|
439
591
|
function initWeb(app, platformNo, menus, router) {
|
|
440
592
|
$router = router;
|
|
441
593
|
app.use(ViewUIPlus);
|
|
@@ -444,9 +596,12 @@ function initWeb(app, platformNo, menus, router) {
|
|
|
444
596
|
storageInfo.setPlatformNo(platformNo);
|
|
445
597
|
storageInfo.setMenuComponts(menus);
|
|
446
598
|
useAxios();
|
|
599
|
+
useOpenObserve();
|
|
600
|
+
openObserve.info(`${platformNo} 初始化完成`, { platformNo });
|
|
447
601
|
}
|
|
448
602
|
const propDefine$3 = {
|
|
449
603
|
loaderInfor: {
|
|
604
|
+
// 加载信息
|
|
450
605
|
type: Object,
|
|
451
606
|
default: () => ({})
|
|
452
607
|
}
|
|
@@ -455,22 +610,34 @@ const _sfc_main$2 = defineComponent({
|
|
|
455
610
|
name: "LocalLoader",
|
|
456
611
|
components: { LinkPanel },
|
|
457
612
|
emits: [""],
|
|
613
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
458
614
|
props: propDefine$3,
|
|
459
615
|
setup(props, ctx) {
|
|
460
616
|
return new LocalLoaderInstance(props, ctx);
|
|
461
617
|
}
|
|
462
618
|
});
|
|
463
619
|
class LocalLoaderInstance extends BaseInstance {
|
|
620
|
+
// API实例化
|
|
621
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
622
|
+
// 全局属性
|
|
464
623
|
constructor(props, ctx) {
|
|
465
624
|
super();
|
|
466
625
|
__publicField(this, "props");
|
|
467
626
|
__publicField(this, "ctx");
|
|
627
|
+
//#region 业务逻辑
|
|
628
|
+
// 私有属性 | private
|
|
629
|
+
// private business2Test1: number = 0;
|
|
630
|
+
// 响应属性 | ref、reactive、computed、watch
|
|
468
631
|
__publicField(this, "pages", ref([]));
|
|
469
632
|
__publicField(this, "activePath", ref(""));
|
|
470
633
|
this.props = props;
|
|
471
634
|
this.ctx = ctx;
|
|
472
635
|
this.useBusiness();
|
|
473
636
|
}
|
|
637
|
+
// 私有方法 | private 方法名() {}
|
|
638
|
+
/**
|
|
639
|
+
* 初始化业务
|
|
640
|
+
*/
|
|
474
641
|
useBusiness() {
|
|
475
642
|
onMounted(() => {
|
|
476
643
|
});
|
|
@@ -497,6 +664,10 @@ class LocalLoaderInstance extends BaseInstance {
|
|
|
497
664
|
this.closePageByCommand(data);
|
|
498
665
|
});
|
|
499
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* 插入页面
|
|
669
|
+
* @param data { platformNo: string, path: string, loadMode: number, param: string, operates: string}
|
|
670
|
+
*/
|
|
500
671
|
pushPage(data) {
|
|
501
672
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
502
673
|
return;
|
|
@@ -518,12 +689,20 @@ class LocalLoaderInstance extends BaseInstance {
|
|
|
518
689
|
component
|
|
519
690
|
});
|
|
520
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* 清除所有页面
|
|
694
|
+
* @param data { platformNo: string }
|
|
695
|
+
*/
|
|
521
696
|
clearAllPage(data) {
|
|
522
697
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
523
698
|
return;
|
|
524
699
|
}
|
|
525
700
|
this.pages.value = [];
|
|
526
701
|
}
|
|
702
|
+
/**
|
|
703
|
+
* 关闭当前页面
|
|
704
|
+
* @param data { platformNo: string, path: string }
|
|
705
|
+
*/
|
|
527
706
|
closePage(data) {
|
|
528
707
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
529
708
|
return;
|
|
@@ -531,12 +710,20 @@ class LocalLoaderInstance extends BaseInstance {
|
|
|
531
710
|
const index = this.pages.value.findIndex((item) => item.path == data.path);
|
|
532
711
|
this.pages.value.splice(index, 1);
|
|
533
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* 激活页面
|
|
715
|
+
* @param data { platformNo: string, path: string }
|
|
716
|
+
*/
|
|
534
717
|
activePage(data) {
|
|
535
718
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
536
719
|
return;
|
|
537
720
|
}
|
|
538
721
|
this.activePath.value = data.path;
|
|
539
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* 根据命令关闭页面
|
|
725
|
+
* @param data { platformNo: string, command: string }
|
|
726
|
+
*/
|
|
540
727
|
closePageByCommand(data) {
|
|
541
728
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
542
729
|
return;
|
|
@@ -570,6 +757,9 @@ class LocalLoaderInstance extends BaseInstance {
|
|
|
570
757
|
break;
|
|
571
758
|
}
|
|
572
759
|
}
|
|
760
|
+
// 响应式方法 | xxx = () => {}
|
|
761
|
+
// doBtnClick2 = () = {}
|
|
762
|
+
//#endregion 业务逻辑 END
|
|
573
763
|
}
|
|
574
764
|
const LocalLoader_vue_vue_type_style_index_0_scoped_1ff2be67_lang = "";
|
|
575
765
|
const _hoisted_1$2 = { class: "local-loader" };
|
|
@@ -600,6 +790,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
600
790
|
const LocalLoader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-1ff2be67"]]);
|
|
601
791
|
const propDefine$2 = {
|
|
602
792
|
loaderInfor: {
|
|
793
|
+
// 加载项信息
|
|
603
794
|
type: Object,
|
|
604
795
|
default: () => ({})
|
|
605
796
|
}
|
|
@@ -608,20 +799,30 @@ const _sfc_main$1 = defineComponent({
|
|
|
608
799
|
name: "WebLoader",
|
|
609
800
|
components: {},
|
|
610
801
|
emits: ["loaded"],
|
|
802
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
611
803
|
props: propDefine$2,
|
|
612
804
|
setup(props, ctx) {
|
|
613
805
|
return new WebLoaderInstance(props, ctx);
|
|
614
806
|
}
|
|
615
807
|
});
|
|
616
808
|
class WebLoaderInstance extends BaseInstance {
|
|
809
|
+
// API实例化
|
|
810
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
811
|
+
// 全局属性
|
|
617
812
|
constructor(props, ctx) {
|
|
618
813
|
super();
|
|
619
814
|
__publicField(this, "props");
|
|
620
815
|
__publicField(this, "ctx");
|
|
816
|
+
//#region 业务逻辑
|
|
817
|
+
// 私有属性 | private
|
|
621
818
|
__publicField(this, "commandStack", []);
|
|
819
|
+
// 响应属性 | ref、reactive、computed、watch
|
|
622
820
|
__publicField(this, "loading", ref(true));
|
|
623
821
|
__publicField(this, "ifrWeb", ref());
|
|
624
822
|
__publicField(this, "ifrId", ref(""));
|
|
823
|
+
/**
|
|
824
|
+
* 加载完成
|
|
825
|
+
*/
|
|
625
826
|
__publicField(this, "doLoaded", () => {
|
|
626
827
|
nextTick(() => {
|
|
627
828
|
this.ctx.emit("loaded", this.props.loaderInfor.platformNo);
|
|
@@ -636,6 +837,11 @@ class WebLoaderInstance extends BaseInstance {
|
|
|
636
837
|
this.sendStackCommand();
|
|
637
838
|
});
|
|
638
839
|
});
|
|
840
|
+
// 响应式方法 | xxx = () => {}
|
|
841
|
+
/**
|
|
842
|
+
* 获取URL
|
|
843
|
+
* @returns
|
|
844
|
+
*/
|
|
639
845
|
__publicField(this, "getIfrUrl", () => {
|
|
640
846
|
const url = this.props.loaderInfor.url;
|
|
641
847
|
const isHasQuery = this.props.loaderInfor.url.indexOf("?") != -1;
|
|
@@ -645,6 +851,10 @@ class WebLoaderInstance extends BaseInstance {
|
|
|
645
851
|
this.ctx = ctx;
|
|
646
852
|
this.useWebLoader();
|
|
647
853
|
}
|
|
854
|
+
// 私有方法 | private 方法名() {}
|
|
855
|
+
/**
|
|
856
|
+
* 初始化业务
|
|
857
|
+
*/
|
|
648
858
|
useWebLoader() {
|
|
649
859
|
this.ifrId.value = this.utilities.getUniqueCode();
|
|
650
860
|
onUnmounted(() => {
|
|
@@ -670,6 +880,12 @@ class WebLoaderInstance extends BaseInstance {
|
|
|
670
880
|
this.closePageByCommand(data);
|
|
671
881
|
});
|
|
672
882
|
}
|
|
883
|
+
/**
|
|
884
|
+
* 发送消息
|
|
885
|
+
* @param iframe
|
|
886
|
+
* @param command
|
|
887
|
+
* @param data
|
|
888
|
+
*/
|
|
673
889
|
sendMessage(command, data) {
|
|
674
890
|
if (this.loading.value) {
|
|
675
891
|
this.commandStack.push({ command, data });
|
|
@@ -685,42 +901,66 @@ class WebLoaderInstance extends BaseInstance {
|
|
|
685
901
|
"*"
|
|
686
902
|
);
|
|
687
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* 发送栈中命令
|
|
906
|
+
*/
|
|
688
907
|
sendStackCommand() {
|
|
689
908
|
for (const item of this.commandStack) {
|
|
690
909
|
this.sendMessage(item.command, item.data);
|
|
691
910
|
}
|
|
692
911
|
this.commandStack = [];
|
|
693
912
|
}
|
|
913
|
+
/**
|
|
914
|
+
* 插入页面
|
|
915
|
+
* @param data { platformNo: string, path: string, loadMode: number, param: string, operates: string}
|
|
916
|
+
*/
|
|
694
917
|
pushPage(data) {
|
|
695
918
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
696
919
|
return;
|
|
697
920
|
}
|
|
698
921
|
this.sendMessage("pushPage", data);
|
|
699
922
|
}
|
|
923
|
+
/**
|
|
924
|
+
* 清除所有页面
|
|
925
|
+
* @param data { platformNo: string }
|
|
926
|
+
*/
|
|
700
927
|
clearAllPage(data) {
|
|
701
928
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
702
929
|
return;
|
|
703
930
|
}
|
|
704
931
|
this.sendMessage("clearAllPage", data);
|
|
705
932
|
}
|
|
933
|
+
/**
|
|
934
|
+
* 关闭当前页面
|
|
935
|
+
* @param data { platformNo: string, path: string }
|
|
936
|
+
*/
|
|
706
937
|
closePage(data) {
|
|
707
938
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
708
939
|
return;
|
|
709
940
|
}
|
|
710
941
|
this.sendMessage("closePage", data);
|
|
711
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* 激活页面
|
|
945
|
+
* @param data { platformNo: string, path: string }
|
|
946
|
+
*/
|
|
712
947
|
activePage(data) {
|
|
713
948
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
714
949
|
return;
|
|
715
950
|
}
|
|
716
951
|
this.sendMessage("activePage", data);
|
|
717
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* 根据命令关闭页面
|
|
955
|
+
* @param data { platformNo: string, command: string }
|
|
956
|
+
*/
|
|
718
957
|
closePageByCommand(data) {
|
|
719
958
|
if (data.platformNo != this.props.loaderInfor.platformNo) {
|
|
720
959
|
return;
|
|
721
960
|
}
|
|
722
961
|
this.sendMessage("closePageByCommand", data);
|
|
723
962
|
}
|
|
963
|
+
//#endregion 业务逻辑二 END
|
|
724
964
|
}
|
|
725
965
|
const WebLoader_vue_vue_type_style_index_0_scoped_12870e01_lang = "";
|
|
726
966
|
const _hoisted_1$1 = { class: "web-loader" };
|
|
@@ -748,19 +988,32 @@ const _sfc_main = defineComponent({
|
|
|
748
988
|
name: "LoaderManage",
|
|
749
989
|
components: { LocalLoader, WebLoader },
|
|
750
990
|
emits: ["loaded"],
|
|
991
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
751
992
|
props: propDefine$1,
|
|
752
993
|
setup(props, ctx) {
|
|
753
994
|
return new LoaderManageInstance$1(props, ctx);
|
|
754
995
|
}
|
|
755
996
|
});
|
|
756
997
|
let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
998
|
+
// API实例化
|
|
999
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
1000
|
+
// 全局属性
|
|
757
1001
|
constructor(props, ctx) {
|
|
758
1002
|
super();
|
|
759
1003
|
__publicField(this, "props");
|
|
760
1004
|
__publicField(this, "ctx");
|
|
1005
|
+
//#region 加载器
|
|
1006
|
+
// 私有属性 | private
|
|
761
1007
|
__publicField(this, "pages", []);
|
|
1008
|
+
// 响应属性 | ref、reactive、computed、watch
|
|
762
1009
|
__publicField(this, "loaderStack", ref([]));
|
|
1010
|
+
// 加载器堆栈
|
|
763
1011
|
__publicField(this, "currentPlatformNo", ref(""));
|
|
1012
|
+
// 响应式方法 | xxx = () => {}
|
|
1013
|
+
/**
|
|
1014
|
+
* Web加载器加载完成
|
|
1015
|
+
* @param item
|
|
1016
|
+
*/
|
|
764
1017
|
__publicField(this, "doLoaded", (platformNo) => {
|
|
765
1018
|
const item = this.loaderStack.value.find((item2) => item2.platformNo == platformNo);
|
|
766
1019
|
if (this.utilities.isNull(item)) {
|
|
@@ -769,6 +1022,10 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
769
1022
|
item.isloaded = true;
|
|
770
1023
|
this.ctx.emit("loaded", item);
|
|
771
1024
|
});
|
|
1025
|
+
/**
|
|
1026
|
+
* 加载平台
|
|
1027
|
+
* @param platform
|
|
1028
|
+
*/
|
|
772
1029
|
__publicField(this, "loadPlatform", (url, platformNo) => {
|
|
773
1030
|
this.currentPlatformNo.value = platformNo;
|
|
774
1031
|
if (this.loaderStack.value.findIndex((item) => item.platformNo == platformNo) != -1) {
|
|
@@ -777,11 +1034,22 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
777
1034
|
const isLocal = this.isLocal(url, platformNo);
|
|
778
1035
|
this.loaderStack.value.push({
|
|
779
1036
|
url,
|
|
1037
|
+
// 站点URL
|
|
780
1038
|
platformNo,
|
|
1039
|
+
// 平台编码
|
|
781
1040
|
isloaded: isLocal ? true : false,
|
|
1041
|
+
// 是否加载
|
|
782
1042
|
isLocal
|
|
1043
|
+
// 是否本地站点
|
|
783
1044
|
});
|
|
784
1045
|
});
|
|
1046
|
+
/**
|
|
1047
|
+
* 插入页面
|
|
1048
|
+
* @param path
|
|
1049
|
+
* @param loadMode 0:路由 1:Url 2:低代码
|
|
1050
|
+
* @param param
|
|
1051
|
+
* @param operates
|
|
1052
|
+
*/
|
|
785
1053
|
__publicField(this, "pushPage", (path, loadMode, param, operates) => {
|
|
786
1054
|
this.pages.push({
|
|
787
1055
|
path,
|
|
@@ -799,11 +1067,18 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
799
1067
|
};
|
|
800
1068
|
bus.emit("pushPage", data);
|
|
801
1069
|
});
|
|
1070
|
+
/**
|
|
1071
|
+
* 清除所有页面
|
|
1072
|
+
*/
|
|
802
1073
|
__publicField(this, "clearAllPage", () => {
|
|
803
1074
|
this.pages = [];
|
|
804
1075
|
const data = { platformNo: this.currentPlatformNo.value };
|
|
805
1076
|
bus.emit("clearAllPage", data);
|
|
806
1077
|
});
|
|
1078
|
+
/**
|
|
1079
|
+
* 关闭页面
|
|
1080
|
+
* @param path
|
|
1081
|
+
*/
|
|
807
1082
|
__publicField(this, "closePage", (path) => {
|
|
808
1083
|
const index = this.pages.findIndex((item) => item.path == path);
|
|
809
1084
|
this.pages.splice(index, 1);
|
|
@@ -813,6 +1088,10 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
813
1088
|
};
|
|
814
1089
|
bus.emit("closePage", data);
|
|
815
1090
|
});
|
|
1091
|
+
/**
|
|
1092
|
+
* 激活页面
|
|
1093
|
+
* @param path
|
|
1094
|
+
*/
|
|
816
1095
|
__publicField(this, "activePage", (path) => {
|
|
817
1096
|
const data = {
|
|
818
1097
|
platformNo: this.currentPlatformNo.value,
|
|
@@ -820,6 +1099,10 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
820
1099
|
};
|
|
821
1100
|
bus.emit("activePage", data);
|
|
822
1101
|
});
|
|
1102
|
+
/**
|
|
1103
|
+
* 根据命令关闭页面
|
|
1104
|
+
* @param command
|
|
1105
|
+
*/
|
|
823
1106
|
__publicField(this, "closePageByCommand", (command) => {
|
|
824
1107
|
const data = {
|
|
825
1108
|
platformNo: this.currentPlatformNo.value,
|
|
@@ -831,12 +1114,23 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
831
1114
|
this.ctx = ctx;
|
|
832
1115
|
this.useBusinessLoader();
|
|
833
1116
|
}
|
|
1117
|
+
// 当前平台
|
|
1118
|
+
// 私有方法 | private 方法名() {}
|
|
1119
|
+
/**
|
|
1120
|
+
* 初始化加载器
|
|
1121
|
+
*/
|
|
834
1122
|
useBusinessLoader() {
|
|
835
1123
|
onMounted(() => {
|
|
836
1124
|
});
|
|
837
1125
|
onUnmounted(() => {
|
|
838
1126
|
});
|
|
839
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* 判断是否为本地站点
|
|
1130
|
+
* @param urlStr URL 地址
|
|
1131
|
+
* @param platformNo 系统代号
|
|
1132
|
+
* @returns
|
|
1133
|
+
*/
|
|
840
1134
|
isLocal(urlStr, platformNo) {
|
|
841
1135
|
if (platformNo == this.storageInfo.getPlatformNo()) {
|
|
842
1136
|
return true;
|
|
@@ -845,6 +1139,7 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
845
1139
|
const currentUrl = new URL(location.href);
|
|
846
1140
|
return url.host == currentUrl.host && url.port == currentUrl.host;
|
|
847
1141
|
}
|
|
1142
|
+
//#endregion 加载器 END
|
|
848
1143
|
};
|
|
849
1144
|
const LoaderManage_vue_vue_type_style_index_0_scoped_ee346895_lang = "";
|
|
850
1145
|
const _hoisted_1 = { class: "loader-manage" };
|
|
@@ -877,19 +1172,32 @@ defineComponent({
|
|
|
877
1172
|
name: "LoaderManage",
|
|
878
1173
|
components: { LocalLoader, WebLoader },
|
|
879
1174
|
emits: ["loaded"],
|
|
1175
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
880
1176
|
props: propDefine,
|
|
881
1177
|
setup(props, ctx) {
|
|
882
1178
|
return new LoaderManageInstance2(props, ctx);
|
|
883
1179
|
}
|
|
884
1180
|
});
|
|
885
1181
|
class LoaderManageInstance2 extends BaseInstance {
|
|
1182
|
+
// API实例化
|
|
1183
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
1184
|
+
// 全局属性
|
|
886
1185
|
constructor(props, ctx) {
|
|
887
1186
|
super();
|
|
888
1187
|
__publicField(this, "props");
|
|
889
1188
|
__publicField(this, "ctx");
|
|
1189
|
+
//#region 加载器
|
|
1190
|
+
// 私有属性 | private
|
|
890
1191
|
__publicField(this, "pages", []);
|
|
1192
|
+
// 响应属性 | ref、reactive、computed、watch
|
|
891
1193
|
__publicField(this, "loaderStack", ref([]));
|
|
1194
|
+
// 加载器堆栈
|
|
892
1195
|
__publicField(this, "currentPlatformNo", ref(""));
|
|
1196
|
+
// 响应式方法 | xxx = () => {}
|
|
1197
|
+
/**
|
|
1198
|
+
* Web加载器加载完成
|
|
1199
|
+
* @param item
|
|
1200
|
+
*/
|
|
893
1201
|
__publicField(this, "doLoaded", (platformNo) => {
|
|
894
1202
|
const item = this.loaderStack.value.find((item2) => item2.platformNo == platformNo);
|
|
895
1203
|
if (this.utilities.isNull(item)) {
|
|
@@ -898,6 +1206,10 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
898
1206
|
item.isloaded = true;
|
|
899
1207
|
this.ctx.emit("loaded", item);
|
|
900
1208
|
});
|
|
1209
|
+
/**
|
|
1210
|
+
* 加载平台
|
|
1211
|
+
* @param platform
|
|
1212
|
+
*/
|
|
901
1213
|
__publicField(this, "loadPlatform", (url, platformNo) => {
|
|
902
1214
|
this.currentPlatformNo.value = platformNo;
|
|
903
1215
|
if (this.loaderStack.value.findIndex((item) => item.platformNo == platformNo) != -1) {
|
|
@@ -906,11 +1218,22 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
906
1218
|
const isLocal = this.isLocal(url, platformNo);
|
|
907
1219
|
this.loaderStack.value.push({
|
|
908
1220
|
url,
|
|
1221
|
+
// 站点URL
|
|
909
1222
|
platformNo,
|
|
1223
|
+
// 平台编码
|
|
910
1224
|
isloaded: isLocal ? true : false,
|
|
1225
|
+
// 是否加载
|
|
911
1226
|
isLocal
|
|
1227
|
+
// 是否本地站点
|
|
912
1228
|
});
|
|
913
1229
|
});
|
|
1230
|
+
/**
|
|
1231
|
+
* 插入页面
|
|
1232
|
+
* @param path
|
|
1233
|
+
* @param loadMode 0:路由 1:Url 2:低代码
|
|
1234
|
+
* @param param
|
|
1235
|
+
* @param operates
|
|
1236
|
+
*/
|
|
914
1237
|
__publicField(this, "pushPage", (path, loadMode, param, operates) => {
|
|
915
1238
|
this.pages.push({
|
|
916
1239
|
path,
|
|
@@ -928,11 +1251,18 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
928
1251
|
};
|
|
929
1252
|
bus.emit("pushPage", data);
|
|
930
1253
|
});
|
|
1254
|
+
/**
|
|
1255
|
+
* 清除所有页面
|
|
1256
|
+
*/
|
|
931
1257
|
__publicField(this, "clearAllPage", () => {
|
|
932
1258
|
this.pages = [];
|
|
933
1259
|
const data = { platformNo: this.currentPlatformNo.value };
|
|
934
1260
|
bus.emit("clearAllPage", data);
|
|
935
1261
|
});
|
|
1262
|
+
/**
|
|
1263
|
+
* 关闭页面
|
|
1264
|
+
* @param path
|
|
1265
|
+
*/
|
|
936
1266
|
__publicField(this, "closePage", (path) => {
|
|
937
1267
|
const index = this.pages.findIndex((item) => item.path == path);
|
|
938
1268
|
this.pages.splice(index, 1);
|
|
@@ -942,6 +1272,10 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
942
1272
|
};
|
|
943
1273
|
bus.emit("closePage", data);
|
|
944
1274
|
});
|
|
1275
|
+
/**
|
|
1276
|
+
* 激活页面
|
|
1277
|
+
* @param path
|
|
1278
|
+
*/
|
|
945
1279
|
__publicField(this, "activePage", (path) => {
|
|
946
1280
|
const data = {
|
|
947
1281
|
platformNo: this.currentPlatformNo.value,
|
|
@@ -949,6 +1283,10 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
949
1283
|
};
|
|
950
1284
|
bus.emit("activePage", data);
|
|
951
1285
|
});
|
|
1286
|
+
/**
|
|
1287
|
+
* 根据命令关闭页面
|
|
1288
|
+
* @param command
|
|
1289
|
+
*/
|
|
952
1290
|
__publicField(this, "closePageByCommand", (command) => {
|
|
953
1291
|
const data = {
|
|
954
1292
|
platformNo: this.currentPlatformNo.value,
|
|
@@ -960,12 +1298,23 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
960
1298
|
this.ctx = ctx;
|
|
961
1299
|
this.useBusinessLoader();
|
|
962
1300
|
}
|
|
1301
|
+
// 当前平台
|
|
1302
|
+
// 私有方法 | private 方法名() {}
|
|
1303
|
+
/**
|
|
1304
|
+
* 初始化加载器
|
|
1305
|
+
*/
|
|
963
1306
|
useBusinessLoader() {
|
|
964
1307
|
onMounted(() => {
|
|
965
1308
|
});
|
|
966
1309
|
onUnmounted(() => {
|
|
967
1310
|
});
|
|
968
1311
|
}
|
|
1312
|
+
/**
|
|
1313
|
+
* 判断是否为本地站点
|
|
1314
|
+
* @param urlStr URL 地址
|
|
1315
|
+
* @param platformNo 系统代号
|
|
1316
|
+
* @returns
|
|
1317
|
+
*/
|
|
969
1318
|
isLocal(urlStr, platformNo) {
|
|
970
1319
|
if (platformNo == this.storageInfo.getPlatformNo()) {
|
|
971
1320
|
return true;
|
|
@@ -974,6 +1323,7 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
974
1323
|
const currentUrl = new URL(location.href);
|
|
975
1324
|
return url.host == currentUrl.host && url.port == currentUrl.host;
|
|
976
1325
|
}
|
|
1326
|
+
//#endregion 加载器 END
|
|
977
1327
|
}
|
|
978
1328
|
export {
|
|
979
1329
|
BaseInstance,
|