@newview/base-vue 1.1.6 → 1.1.8
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 +157 -25
- package/dist/base-vue.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/readme.md +4 -0
- package/types/BaseInstance.d.ts +6 -0
- package/types/FreeLoginCenter.d.ts +4 -0
- package/types/OtherCommon.ts +7 -0
package/dist/base-vue.js
CHANGED
|
@@ -4,10 +4,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { defineComponent, openBlock, createElementBlock, ref, onMounted, resolveComponent, withDirectives, createElementVNode, vShow, createVNode, onUnmounted, shallowRef, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, nextTick } from "vue";
|
|
7
|
+
import { defineComponent, openBlock, createElementBlock, ref, onMounted, resolveComponent, withDirectives, createElementVNode, vShow, createVNode, onUnmounted, shallowRef, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString, pushScopeId, popScopeId, nextTick } from "vue";
|
|
8
8
|
import ViewUIPlus, { Message, Modal } from "view-ui-plus";
|
|
9
9
|
import { Utilities, utilities } from "@newview/tools";
|
|
10
|
-
import { storageInfo, openObserve } from "@newview/infrastructure";
|
|
10
|
+
import { storageInfo, openObserve, request } from "@newview/infrastructure";
|
|
11
11
|
import mitt from "mitt";
|
|
12
12
|
import { useRouter } from "vue-router";
|
|
13
13
|
import VxeTable from "vxe-table";
|
|
@@ -92,6 +92,23 @@ class ModalInstance {
|
|
|
92
92
|
}
|
|
93
93
|
const modal = new ModalInstance();
|
|
94
94
|
const bus = mitt();
|
|
95
|
+
class OtherCommon {
|
|
96
|
+
constructor() {
|
|
97
|
+
__publicField(this, "utilities", new Utilities());
|
|
98
|
+
__publicField(this, "storageInfo", storageInfo);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 获取进入BIM中心传递参数
|
|
102
|
+
*/
|
|
103
|
+
getEnterBIMParam(BIMViewUrl) {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
return BIMViewUrl + this.utilities.stringHelper.encryptAES(JSON.stringify({
|
|
106
|
+
token: this.storageInfo.getToken(),
|
|
107
|
+
userId: (_a = this.storageInfo.getUser()) == null ? void 0 : _a.Id,
|
|
108
|
+
projectId: (_b = this.storageInfo.getCurrentPlatform()) == null ? void 0 : _b.Id
|
|
109
|
+
}), "d2140707ca3a469c8527e546fe961276");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
95
112
|
class BaseInstance {
|
|
96
113
|
constructor() {
|
|
97
114
|
/**
|
|
@@ -118,6 +135,10 @@ class BaseInstance {
|
|
|
118
135
|
* 事件总线
|
|
119
136
|
*/
|
|
120
137
|
__publicField(this, "bus", bus);
|
|
138
|
+
/**
|
|
139
|
+
* 其他公共方法(业务相关)
|
|
140
|
+
*/
|
|
141
|
+
__publicField(this, "OtherCommon", new OtherCommon());
|
|
121
142
|
/**
|
|
122
143
|
*
|
|
123
144
|
* @param e
|
|
@@ -131,18 +152,18 @@ class BaseInstance {
|
|
|
131
152
|
});
|
|
132
153
|
}
|
|
133
154
|
}
|
|
134
|
-
const propDefine$
|
|
155
|
+
const propDefine$7 = {
|
|
135
156
|
count: {
|
|
136
157
|
type: Number,
|
|
137
158
|
default: 0
|
|
138
159
|
}
|
|
139
160
|
};
|
|
140
|
-
const _sfc_main$
|
|
161
|
+
const _sfc_main$6 = defineComponent({
|
|
141
162
|
name: "Root",
|
|
142
163
|
components: {},
|
|
143
164
|
emits: [""],
|
|
144
165
|
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
145
|
-
props: propDefine$
|
|
166
|
+
props: propDefine$7,
|
|
146
167
|
setup(props, ctx) {
|
|
147
168
|
return new RootInstance(props, ctx);
|
|
148
169
|
}
|
|
@@ -215,24 +236,24 @@ const _export_sfc = (sfc, props) => {
|
|
|
215
236
|
}
|
|
216
237
|
return target;
|
|
217
238
|
};
|
|
218
|
-
const _hoisted_1$
|
|
219
|
-
function _sfc_render$
|
|
220
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
239
|
+
const _hoisted_1$6 = { class: "root" };
|
|
240
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
241
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6);
|
|
221
242
|
}
|
|
222
|
-
const Root = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
223
|
-
const propDefine$
|
|
243
|
+
const Root = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-b392b4ac"]]);
|
|
244
|
+
const propDefine$6 = {
|
|
224
245
|
tabPage: {
|
|
225
246
|
// 要打开的页面信息
|
|
226
247
|
type: Object,
|
|
227
248
|
default: () => ({})
|
|
228
249
|
}
|
|
229
250
|
};
|
|
230
|
-
const _sfc_main$
|
|
251
|
+
const _sfc_main$5 = defineComponent({
|
|
231
252
|
name: "LinkPanel",
|
|
232
253
|
components: {},
|
|
233
254
|
emits: [""],
|
|
234
255
|
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
235
|
-
props: propDefine$
|
|
256
|
+
props: propDefine$6,
|
|
236
257
|
setup(props, ctx) {
|
|
237
258
|
return new LinkPanelInstance(props, ctx);
|
|
238
259
|
}
|
|
@@ -302,17 +323,17 @@ class LinkPanelInstance extends BaseInstance {
|
|
|
302
323
|
//#endregion 业务逻辑二 END
|
|
303
324
|
}
|
|
304
325
|
const LinkPanel_vue_vue_type_style_index_0_scoped_37023fbf_lang = "";
|
|
305
|
-
const _hoisted_1$
|
|
306
|
-
const _hoisted_2$
|
|
307
|
-
function _sfc_render$
|
|
326
|
+
const _hoisted_1$5 = { class: "link-panel" };
|
|
327
|
+
const _hoisted_2$2 = ["src", "title"];
|
|
328
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
308
329
|
const _component_Spin = resolveComponent("Spin");
|
|
309
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
330
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
310
331
|
withDirectives(createElementVNode("iframe", {
|
|
311
332
|
src: _ctx.tabPage.path,
|
|
312
333
|
class: "link-ifr",
|
|
313
334
|
title: _ctx.tabPage.path,
|
|
314
335
|
ref: "ifrPanel"
|
|
315
|
-
}, null, 8, _hoisted_2$
|
|
336
|
+
}, null, 8, _hoisted_2$2), [
|
|
316
337
|
[vShow, !_ctx.loading]
|
|
317
338
|
]),
|
|
318
339
|
createVNode(_component_Spin, {
|
|
@@ -322,14 +343,14 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
322
343
|
}, null, 8, ["show"])
|
|
323
344
|
]);
|
|
324
345
|
}
|
|
325
|
-
const LinkPanel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
326
|
-
const propDefine$
|
|
327
|
-
const _sfc_main$
|
|
346
|
+
const LinkPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-37023fbf"]]);
|
|
347
|
+
const propDefine$5 = {};
|
|
348
|
+
const _sfc_main$4 = defineComponent({
|
|
328
349
|
name: "LinkMain",
|
|
329
350
|
components: { LinkPanel },
|
|
330
351
|
emits: [""],
|
|
331
352
|
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
332
|
-
props: propDefine$
|
|
353
|
+
props: propDefine$5,
|
|
333
354
|
setup(props, ctx) {
|
|
334
355
|
return new LinkMainInstance(props, ctx);
|
|
335
356
|
}
|
|
@@ -493,10 +514,10 @@ class LinkMainInstance extends BaseInstance {
|
|
|
493
514
|
//#endregion 业务逻辑二 END
|
|
494
515
|
}
|
|
495
516
|
const LinkMain_vue_vue_type_style_index_0_scoped_026a2cc9_lang = "";
|
|
496
|
-
const _hoisted_1$
|
|
497
|
-
function _sfc_render$
|
|
517
|
+
const _hoisted_1$4 = { class: "line-main" };
|
|
518
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
498
519
|
const _component_LinkPanel = resolveComponent("LinkPanel");
|
|
499
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
520
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
500
521
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.pages, (item) => {
|
|
501
522
|
return openBlock(), createElementBlock(Fragment, {
|
|
502
523
|
key: item.path
|
|
@@ -518,7 +539,117 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
518
539
|
}), 128))
|
|
519
540
|
]);
|
|
520
541
|
}
|
|
521
|
-
const LinkMain = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
542
|
+
const LinkMain = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-026a2cc9"]]);
|
|
543
|
+
const propDefine$4 = {};
|
|
544
|
+
const _sfc_main$3 = defineComponent({
|
|
545
|
+
name: "FreeLoginCenter",
|
|
546
|
+
components: {},
|
|
547
|
+
emits: [""],
|
|
548
|
+
// 例如: ['clearRadioRow', 'change', 'delete', 'addchild']
|
|
549
|
+
props: propDefine$4,
|
|
550
|
+
setup(props, ctx) {
|
|
551
|
+
return new FreeLoginCenterInstance(props, ctx);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
class FreeLoginCenterInstance extends BaseInstance {
|
|
555
|
+
constructor(props, ctx) {
|
|
556
|
+
super();
|
|
557
|
+
__publicField(this, "props");
|
|
558
|
+
__publicField(this, "ctx");
|
|
559
|
+
// API实例化
|
|
560
|
+
// private platformApi: PlatformApi = new PlatformApi();
|
|
561
|
+
// 全局属性
|
|
562
|
+
__publicField(this, "router");
|
|
563
|
+
__publicField(this, "errTip", ref(""));
|
|
564
|
+
this.props = props;
|
|
565
|
+
this.ctx = ctx;
|
|
566
|
+
this.router = useRouter();
|
|
567
|
+
this.init();
|
|
568
|
+
}
|
|
569
|
+
//#region 页面调整
|
|
570
|
+
// 私有方法 | private 方法名() {}
|
|
571
|
+
/**
|
|
572
|
+
* 初始化业务
|
|
573
|
+
*/
|
|
574
|
+
async init() {
|
|
575
|
+
let linkParam = this.getRequestParam();
|
|
576
|
+
if (linkParam && linkParam.u && linkParam.t) {
|
|
577
|
+
let result = this.utilities.parseApiResult(await request(`/PermissionApi/OAuth/OAuthByToken?account=${decodeURIComponent(linkParam.u)}&token=${decodeURIComponent(linkParam.t)}`, {
|
|
578
|
+
method: "post",
|
|
579
|
+
data: {}
|
|
580
|
+
}));
|
|
581
|
+
if (result && result.Token) {
|
|
582
|
+
this.storageInfo.setToken(result.Token);
|
|
583
|
+
this.storageInfo.setUser(result.User);
|
|
584
|
+
this.storageInfo.setPlatforms(result.Platforms);
|
|
585
|
+
localStorage.setItem("needChangePsw", result.NeedChangePsw);
|
|
586
|
+
const platforms = this.storageInfo.getPlatforms();
|
|
587
|
+
if (!this.utilities.isNull(platforms) && platforms.length > 0) {
|
|
588
|
+
const platform = platforms.find((item) => item.PlatformNo == this.storageInfo.getPlatformNo());
|
|
589
|
+
this.storageInfo.setCurrentPlatform(this.utilities.isNull(platform) ? platforms[0] : platform);
|
|
590
|
+
}
|
|
591
|
+
const currentPlatform = this.storageInfo.getCurrentPlatform();
|
|
592
|
+
if (!this.utilities.isNull(currentPlatform) && currentPlatform.Modules.length > 0) {
|
|
593
|
+
this.storageInfo.setCurrentBusiness(currentPlatform.Modules[0]);
|
|
594
|
+
}
|
|
595
|
+
this.router.replace("/");
|
|
596
|
+
} else {
|
|
597
|
+
this.errLogin();
|
|
598
|
+
}
|
|
599
|
+
} else {
|
|
600
|
+
this.errLogin();
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
errLogin() {
|
|
604
|
+
this.router.replace("/Login");
|
|
605
|
+
}
|
|
606
|
+
getRequestParam() {
|
|
607
|
+
let href = window.location.href;
|
|
608
|
+
let paramString = href.split("?")[1];
|
|
609
|
+
if (!paramString) {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
let returnData = {};
|
|
613
|
+
paramString.split("&").forEach((element) => {
|
|
614
|
+
if (element.indexOf("u=") == 0) {
|
|
615
|
+
returnData.u = element.replace("u=", "");
|
|
616
|
+
} else if (element.indexOf("t=") == 0) {
|
|
617
|
+
returnData.t = element.replace("t=", "");
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
return returnData;
|
|
621
|
+
}
|
|
622
|
+
//#endregion 页面调整 END
|
|
623
|
+
}
|
|
624
|
+
const FreeLoginCenter_vue_vue_type_style_index_0_scoped_08b85823_lang = "";
|
|
625
|
+
const _withScopeId = (n) => (pushScopeId("data-v-08b85823"), n = n(), popScopeId(), n);
|
|
626
|
+
const _hoisted_1$3 = { class: "nv-full nv-pos-a" };
|
|
627
|
+
const _hoisted_2$1 = {
|
|
628
|
+
key: 0,
|
|
629
|
+
style: { "text-align": "center", "padding-top": "20%", "font-size": "25px" }
|
|
630
|
+
};
|
|
631
|
+
const _hoisted_3 = {
|
|
632
|
+
key: 1,
|
|
633
|
+
class: "loader"
|
|
634
|
+
};
|
|
635
|
+
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "loader-inner line-scale" }, [
|
|
636
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
637
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
638
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
639
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
640
|
+
/* @__PURE__ */ createElementVNode("div")
|
|
641
|
+
], -1));
|
|
642
|
+
const _hoisted_5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", null, "正在初始化数据,请稍候...", -1));
|
|
643
|
+
const _hoisted_6 = [
|
|
644
|
+
_hoisted_4,
|
|
645
|
+
_hoisted_5
|
|
646
|
+
];
|
|
647
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
648
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
649
|
+
_ctx.errTip ? (openBlock(), createElementBlock("div", _hoisted_2$1, toDisplayString(_ctx.errTip), 1)) : (openBlock(), createElementBlock("div", _hoisted_3, _hoisted_6))
|
|
650
|
+
]);
|
|
651
|
+
}
|
|
652
|
+
const FreeLoginCenter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-08b85823"]]);
|
|
522
653
|
const vFocus = (app) => {
|
|
523
654
|
app.directive("focus", {
|
|
524
655
|
// 当被绑定的元素挂载到 DOM 中时被调用
|
|
@@ -1339,6 +1470,7 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
1339
1470
|
}
|
|
1340
1471
|
export {
|
|
1341
1472
|
BaseInstance,
|
|
1473
|
+
FreeLoginCenter,
|
|
1342
1474
|
LinkMain,
|
|
1343
1475
|
LoaderManage,
|
|
1344
1476
|
LoaderManageInstance2 as LoaderManageInstance,
|
package/dist/base-vue.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__publicField=(e,t,o)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,o),o);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("view-ui-plus"),require("@newview/tools"),require("@newview/infrastructure"),require("mitt"),require("vue-router"),require("vxe-table"),require("axios")):"function"==typeof define&&define.amd?define(["exports","vue","view-ui-plus","@newview/tools","@newview/infrastructure","mitt","vue-router","vxe-table","axios"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BaseVue={},e.Vue,e.viewUiPlus,e.tools$1,e.infrastructure,e.mitt,e.VueRouter,e.VxeTable,e.axios)}(this,(function(e,t,o,s,a,i,n,r,l){"use strict";class c{constructor(){__publicField(this,"info",(e=>{o.Message.info(e)})),__publicField(this,"success",(e=>{o.Message.success(e)})),__publicField(this,"warning",(e=>{o.Message.warning(e)})),__publicField(this,"error",(e=>{o.Message.error(e)}))}}const d=new c;class u{constructor(){__publicField(this,"zIndex",1e4),__publicField(this,"confirm",(e=>{e["z-index"]=this.zIndex,o.Modal.confirm(e)})),__publicField(this,"info",(e=>{e["z-index"]=this.zIndex,o.Modal.info(e)})),__publicField(this,"success",(e=>{e["z-index"]=this.zIndex,o.Modal.success(e)})),__publicField(this,"warning",(e=>{e["z-index"]=this.zIndex,o.Modal.warning(e)})),__publicField(this,"error",(e=>{e["z-index"]=this.zIndex,o.Modal.error(e)}))}}const p=new u,h=i();class f{constructor(){__publicField(this,"message",new c),__publicField(this,"modal",new u),__publicField(this,"utilities",new s.Utilities),__publicField(this,"storageInfo",a.storageInfo),__publicField(this,"openObserve",a.openObserve),__publicField(this,"bus",h),__publicField(this,"doInputControl",(e=>{this.utilities.isNull(e)||(e.target.readOnly=!1)}))}}const m={count:{type:Number,default:0}},g=t.defineComponent({name:"Root",components:{},emits:[""],props:m,setup:(e,t)=>new v(e,t)});class v extends f{constructor(e,t){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"router"),this.props=e,this.ctx=t,this.useRoot()}useRoot(){this.router=n.useRouter(),this.goPage()}goPage(){const e=this.getQueryString("linkMain");if(!this.utilities.isNull(e))return void this.router.replace("/LinkMain");const t=this.storageInfo.getToken();this.utilities.isNull(t)?this.router.replace("/Login"):this.router.replace(this.storageInfo.getCurrentDefaultPath())}getQueryString(e){let t=window.location.href.indexOf("?"),o=window.location.href.substring(t+1,window.location.href.length).split("&");for(const s of o){let t=s.split("=");if(t[0]==e)return t[1]}return""}}const P=(e,t)=>{const o=e.__vccOpts||e;for(const[s,a]of t)o[s]=a;return o},_={class:"root"};const b=P(g,[["render",function(e,o,s,a,i,n){return t.openBlock(),t.createElementBlock("div",_)}],["__scopeId","data-v-b392b4ac"]]),N={tabPage:{type:Object,default:()=>({})}},k=t.defineComponent({name:"LinkPanel",components:{},emits:[""],props:N,setup:(e,t)=>new I(e,t)});class I extends f{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"loading",t.ref(!0)),__publicField(this,"ifrPanel",t.ref()),this.props=e,this.ctx=o,this.useLinkPanel()}useLinkPanel(){t.onMounted((()=>{this.bindLoadEvent()}))}bindLoadEvent(){const e=this.ifrPanel.value;e.attachEvent?e.attachEvent("onload",(()=>{this.doLoaded(e)})):e.onload=()=>{this.doLoaded(e)}}doLoaded(e){this.loading.value=!1,setTimeout((()=>{const t={token:this.storageInfo.getToken(),user:JSON.stringify(this.storageInfo.getUser()),currentPlatform:JSON.stringify(this.storageInfo.getCurrentPlatform()),currentBusiness:JSON.stringify(this.storageInfo.getCurrentBusiness()),currentModule:JSON.stringify(this.storageInfo.getCurrentModule())};e.contentWindow.postMessage(t,"*")}),20)}}const w={class:"link-panel"},F=["src","title"];const B=P(k,[["render",function(e,o,s,a,i,n){const r=t.resolveComponent("Spin");return t.openBlock(),t.createElementBlock("div",w,[t.withDirectives(t.createElementVNode("iframe",{src:e.tabPage.path,class:"link-ifr",title:e.tabPage.path,ref:"ifrPanel"},null,8,F),[[t.vShow,!e.loading]]),t.createVNode(r,{size:"large",fix:"",show:e.loading},null,8,["show"])])}],["__scopeId","data-v-37023fbf"]]),M=t.defineComponent({name:"LinkMain",components:{LinkPanel:B},emits:[""],props:{},setup:(e,t)=>new L(e,t)});class L extends f{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",t.ref([])),__publicField(this,"activePath",t.ref("")),this.props=e,this.ctx=o,this.useLinkMain()}useLinkMain(){const e=e=>{this.receiveMessage(e)};window.addEventListener("message",e),t.onUnmounted((()=>{window.removeEventListener("message",e)}))}receiveMessage(e){if(e.source!=window.parent.window.parent)return;const t=e.data;switch(t.command){case"initStorageInfo":this.initStorageInfo(t.data);break;case"pushPage":this.pushPage(t.data);break;case"clearAllPage":this.clearAllPage(t.data);break;case"closePage":this.closePage(t.data);break;case"activePage":this.activePage(t.data);break;case"closePageByCommand":this.closePageByCommand(t.data)}}initStorageInfo(e){const t=e.token,o=this.utilities.isNull(e.user)?void 0:JSON.parse(e.user),s=this.utilities.isNull(e.currentPlatform)?void 0:JSON.parse(e.currentPlatform),a=this.utilities.isNull(e.currentBusiness)?void 0:JSON.parse(e.currentBusiness),i=this.utilities.isNull(e.currentModule)?void 0:JSON.parse(e.currentModule);this.storageInfo.setToken(t),this.storageInfo.setUser(o),this.storageInfo.setCurrentPlatform(s),this.storageInfo.setCurrentBusiness(a),this.storageInfo.setCurrentModule(i)}pushPage(e){let o;if(0==e.loadMode){const s=this.storageInfo.getMenuComponts().find((t=>t.path==e.path));o="function"==typeof s.component?t.shallowRef(s.component()):t.shallowRef(s.component)}this.pages.value.push({path:e.path,loadMode:e.loadMode,param:e.param,operates:e.operates,component:o})}clearAllPage(e){this.pages.value=[]}closePage(e){const t=this.pages.value.findIndex((t=>t.path==e.path));this.pages.value.splice(t,1)}activePage(e){this.activePath.value=e.path}closePageByCommand(e){const t=this.pages.value.findIndex((e=>e.path==this.activePath.value));switch(e.command){case"left":if(0==t||1==t)return;this.pages.value.splice(1,t-1);break;case"right":if(t==this.pages.value.length-1)return;this.pages.value.splice(t+1);break;case"other":const e=this.pages.value.findIndex((e=>e.path==this.activePath.value)),o=this.pages.value[0];if(0==e)this.pages.value=[o];else{const t=this.pages.value[e];this.pages.value=[o,t]}break;case"all":this.pages.value.splice(1)}}}const x={class:"line-main"};const y=P(M,[["render",function(e,o,s,a,i,n){const r=t.resolveComponent("LinkPanel");return t.openBlock(),t.createElementBlock("div",x,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.pages,(o=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:o.path},[0==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.component),{key:0,linkParam:o.param,operates:o.operates},null,8,["linkParam","operates"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0),1==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(r,{key:1,tabPage:o},null,8,["tabPage"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0)],64)))),128))])}],["__scopeId","data-v-026a2cc9"]]);let C;const S={loaderInfor:{type:Object,default:()=>({})}},O=t.defineComponent({name:"LocalLoader",components:{LinkPanel:B},emits:[""],props:S,setup:(e,t)=>new U(e,t)});class U extends f{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",t.ref([])),__publicField(this,"activePath",t.ref("")),this.props=e,this.ctx=o,this.useBusiness()}useBusiness(){t.onMounted((()=>{})),t.onUnmounted((()=>{h.off("pushPage"),h.off("clearAllPage"),h.off("closePage"),h.off("activePage"),h.off("closePageByCommand")})),h.on("pushPage",(e=>{this.pushPage(e)})),h.on("clearAllPage",(e=>{this.clearAllPage(e)})),h.on("closePage",(e=>{this.closePage(e)})),h.on("activePage",(e=>{this.activePage(e)})),h.on("closePageByCommand",(e=>{this.closePageByCommand(e)}))}pushPage(e){if(e.platformNo!=this.props.loaderInfor.platformNo)return;let o;if(0==e.loadMode){const s=this.storageInfo.getMenuComponts().find((t=>t.path==e.path));o="function"==typeof s.component?t.shallowRef(s.component()):t.shallowRef(s.component)}this.pages.value.push({path:e.path,loadMode:e.loadMode,param:e.param,operates:e.operates,component:o})}clearAllPage(e){e.platformNo==this.props.loaderInfor.platformNo&&(this.pages.value=[])}closePage(e){if(e.platformNo!=this.props.loaderInfor.platformNo)return;const t=this.pages.value.findIndex((t=>t.path==e.path));this.pages.value.splice(t,1)}activePage(e){e.platformNo==this.props.loaderInfor.platformNo&&(this.activePath.value=e.path)}closePageByCommand(e){if(e.platformNo!=this.props.loaderInfor.platformNo)return;const t=this.pages.value.findIndex((e=>e.path==this.activePath.value));switch(e.command){case"left":if(0==t||1==t)return;this.pages.value.splice(1,t-1);break;case"right":if(t==this.pages.value.length-1)return;this.pages.value.splice(t+1);break;case"other":const e=this.pages.value.findIndex((e=>e.path==this.activePath.value)),o=this.pages.value[0];if(0==e)this.pages.value=[o];else{const t=this.pages.value[e];this.pages.value=[o,t]}break;case"all":this.pages.value.splice(1)}}}const E={class:"local-loader"};const A=P(O,[["render",function(e,o,s,a,i,n){const r=t.resolveComponent("LinkPanel");return t.openBlock(),t.createElementBlock("div",E,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.pages,(o=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:o.path},[0==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.component),{key:0,linkParam:o.param,operates:o.operates},null,8,["linkParam","operates"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0),1==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(r,{key:1,tabPage:o},null,8,["tabPage"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0)],64)))),128))])}],["__scopeId","data-v-1ff2be67"]]),R={loaderInfor:{type:Object,default:()=>({})}},z=t.defineComponent({name:"WebLoader",components:{},emits:["loaded"],props:R,setup:(e,t)=>new J(e,t)});class J extends f{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"commandStack",[]),__publicField(this,"loading",t.ref(!0)),__publicField(this,"ifrWeb",t.ref()),__publicField(this,"ifrId",t.ref("")),__publicField(this,"doLoaded",(()=>{t.nextTick((()=>{this.ctx.emit("loaded",this.props.loaderInfor.platformNo),this.loading.value=!1,this.sendMessage("initStorageInfo",{token:this.storageInfo.getToken(),user:JSON.stringify(this.storageInfo.getUser()),currentPlatform:JSON.stringify(this.storageInfo.getCurrentPlatform()),currentBusiness:JSON.stringify(this.storageInfo.getCurrentBusiness()),currentModule:JSON.stringify(this.storageInfo.getCurrentModule())}),this.sendStackCommand()}))})),__publicField(this,"getIfrUrl",(()=>this.props.loaderInfor.url+(-1!=this.props.loaderInfor.url.indexOf("?")?"&":"?")+"linkMain=true")),this.props=e,this.ctx=o,this.useWebLoader()}useWebLoader(){this.ifrId.value=this.utilities.getUniqueCode(),t.onUnmounted((()=>{h.off("pushPage"),h.off("clearAllPage"),h.off("closePage"),h.off("activePage"),h.off("closePageByCommand")})),h.on("pushPage",(e=>{this.pushPage(e)})),h.on("clearAllPage",(e=>{this.clearAllPage(e)})),h.on("closePage",(e=>{this.closePage(e)})),h.on("activePage",(e=>{this.activePage(e)})),h.on("closePageByCommand",(e=>{this.closePageByCommand(e)}))}sendMessage(e,t){if(this.loading.value)return void this.commandStack.push({command:e,data:t});const o={command:e,data:t};document.getElementById(this.ifrId.value).contentWindow.postMessage(o,"*")}sendStackCommand(){for(const e of this.commandStack)this.sendMessage(e.command,e.data);this.commandStack=[]}pushPage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("pushPage",e)}clearAllPage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("clearAllPage",e)}closePage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("closePage",e)}activePage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("activePage",e)}closePageByCommand(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("closePageByCommand",e)}}const V={class:"web-loader"},T=["id","src","title"];const q=P(z,[["render",function(e,o,s,a,i,n){const r=t.resolveComponent("Spin");return t.openBlock(),t.createElementBlock("div",V,[t.createElementVNode("iframe",{id:e.ifrId,src:e.getIfrUrl(),class:"web-ifr",title:e.loaderInfor.platformNo,onLoad:o[0]||(o[0]=(...t)=>e.doLoaded&&e.doLoaded(...t))},null,40,T),t.createVNode(r,{size:"large",fix:"",show:e.loading},null,8,["show"])])}],["__scopeId","data-v-12870e01"]]),W=t.defineComponent({name:"LoaderManage",components:{LocalLoader:A,WebLoader:q},emits:["loaded"],props:{},setup:(e,t)=>new D(e,t)});let D=class extends f{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",[]),__publicField(this,"loaderStack",t.ref([])),__publicField(this,"currentPlatformNo",t.ref("")),__publicField(this,"doLoaded",(e=>{const t=this.loaderStack.value.find((t=>t.platformNo==e));this.utilities.isNull(t)||(t.isloaded=!0,this.ctx.emit("loaded",t))})),__publicField(this,"loadPlatform",((e,t)=>{if(this.currentPlatformNo.value=t,-1!=this.loaderStack.value.findIndex((e=>e.platformNo==t)))return;if(!e)return;const o=this.isLocal(e,t);this.loaderStack.value.push({url:e,platformNo:t,isloaded:!!o,isLocal:o})})),__publicField(this,"pushPage",((e,t,o,s)=>{this.pages.push({path:e,loadMode:t,param:o,operates:s,component:void 0});const a={platformNo:this.currentPlatformNo.value,path:e,loadMode:t,param:o,operates:s};h.emit("pushPage",a)})),__publicField(this,"clearAllPage",(()=>{this.pages=[];const e={platformNo:this.currentPlatformNo.value};h.emit("clearAllPage",e)})),__publicField(this,"closePage",(e=>{const t=this.pages.findIndex((t=>t.path==e));this.pages.splice(t,1);const o={platformNo:this.currentPlatformNo.value,path:e};h.emit("closePage",o)})),__publicField(this,"activePage",(e=>{const t={platformNo:this.currentPlatformNo.value,path:e};h.emit("activePage",t)})),__publicField(this,"closePageByCommand",(e=>{const t={platformNo:this.currentPlatformNo.value,command:e};h.emit("closePageByCommand",t)})),this.props=e,this.ctx=o,this.useBusinessLoader()}useBusinessLoader(){t.onMounted((()=>{})),t.onUnmounted((()=>{}))}isLocal(e,t){if(!e)return!0;if(t==this.storageInfo.getPlatformNo())return!0;const o=new URL(e),s=new URL(location.href);return o.host==s.host&&o.port==s.host}};const j={class:"loader-manage"};const $=P(W,[["render",function(e,o,s,a,i,n){const r=t.resolveComponent("LocalLoader"),l=t.resolveComponent("WebLoader");return t.openBlock(),t.createElementBlock("div",j,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.loaderStack,(o=>t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:o.platformNo,class:"loader-manage_content"},[o.isLocal?(t.openBlock(),t.createBlock(r,{key:0,loaderInfor:o},null,8,["loaderInfor"])):(t.openBlock(),t.createBlock(l,{key:1,loaderInfor:o,onLoaded:e.doLoaded},null,8,["loaderInfor","onLoaded"]))],512)),[[t.vShow,o.platformNo==e.currentPlatformNo]]))),128))])}],["__scopeId","data-v-ee346895"]]);t.defineComponent({name:"LoaderManage",components:{LocalLoader:A,WebLoader:q},emits:["loaded"],props:{},setup:(e,t)=>new Q(e,t)});class Q extends f{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",[]),__publicField(this,"loaderStack",t.ref([])),__publicField(this,"currentPlatformNo",t.ref("")),__publicField(this,"doLoaded",(e=>{const t=this.loaderStack.value.find((t=>t.platformNo==e));this.utilities.isNull(t)||(t.isloaded=!0,this.ctx.emit("loaded",t))})),__publicField(this,"loadPlatform",((e,t)=>{if(this.currentPlatformNo.value=t,-1!=this.loaderStack.value.findIndex((e=>e.platformNo==t)))return;if(!e)return;const o=this.isLocal(e,t);this.loaderStack.value.push({url:e,platformNo:t,isloaded:!!o,isLocal:o})})),__publicField(this,"pushPage",((e,t,o,s)=>{this.pages.push({path:e,loadMode:t,param:o,operates:s,component:void 0});const a={platformNo:this.currentPlatformNo.value,path:e,loadMode:t,param:o,operates:s};h.emit("pushPage",a)})),__publicField(this,"clearAllPage",(()=>{this.pages=[];const e={platformNo:this.currentPlatformNo.value};h.emit("clearAllPage",e)})),__publicField(this,"closePage",(e=>{const t=this.pages.findIndex((t=>t.path==e));this.pages.splice(t,1);const o={platformNo:this.currentPlatformNo.value,path:e};h.emit("closePage",o)})),__publicField(this,"activePage",(e=>{const t={platformNo:this.currentPlatformNo.value,path:e};h.emit("activePage",t)})),__publicField(this,"closePageByCommand",(e=>{const t={platformNo:this.currentPlatformNo.value,command:e};h.emit("closePageByCommand",t)})),this.props=e,this.ctx=o,this.useBusinessLoader()}useBusinessLoader(){t.onMounted((()=>{})),t.onUnmounted((()=>{}))}isLocal(e,t){if(!e)return!0;if(t==this.storageInfo.getPlatformNo())return!0;const o=new URL(e),s=new URL(location.href);return o.host==s.host&&o.port==s.host}}e.BaseInstance=f,e.LinkMain=y,e.LoaderManage=$,e.LoaderManageInstance=Q,e.MessageInstance=c,e.ModalInstance=u,e.Root=b,e.initWeb=function(e,t,i,n){C=n,e.use(o),e.use(r),(e=>{e.directive("focus",{mounted(e){e.focus(),e.select()}})})(e),a.storageInfo.setPlatformNo(t),a.storageInfo.setMenuComponts(i),l.interceptors.request.use((function(e){const t=a.storageInfo.getToken();!s.utilities.isNull(t)&&s.utilities.isNull(e.headers.Authorization)&&(e.headers.Authorization="Bearer "+t);const o=a.storageInfo.getPlatformNo();s.utilities.isNull(o)||(e.headers.PlatformNo=o);const i=a.storageInfo.getCurrentPlatform();s.utilities.isNull(i)||(e.headers.PlatformId=i.Id,e.headers.PlatformName=encodeURI(i.PlatformName));const n=a.storageInfo.getUser();s.utilities.isNull(n)||(e.headers.UserId=n.Id,e.headers.UserName=encodeURI(`${n.UserName}(${n.Account})`));const r=a.storageInfo.getCurrentModule();return s.utilities.isNull(r)||(e.headers.MenuId=r.Id,e.headers.MenuName=encodeURI(r.ModuleName),e.headers.MenuPath=encodeURI(r.ModuleUrl)),e}),(function(e){return Promise.reject(e)})),l.interceptors.response.use((function(e){return e}),(function(e){return e.response&&e.response.data&&"401"==e.response.data.code?(a.storageInfo.removeAll(),C.push("/Login")):a.openObserve.error("请求异常",e),Promise.reject(e)})),function(){const e=window;if(s.utilities.isNull(e.openObserveOption))return;const t=e.openObserveOption;a.openObserve.init(t)}(),a.openObserve.info(`${t} 初始化完成`,{platformNo:t})},e.message=d,e.modal=p,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
var __defProp=Object.defineProperty,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__publicField=(e,t,o)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,o),o);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("view-ui-plus"),require("@newview/tools"),require("@newview/infrastructure"),require("mitt"),require("vue-router"),require("vxe-table"),require("axios")):"function"==typeof define&&define.amd?define(["exports","vue","view-ui-plus","@newview/tools","@newview/infrastructure","mitt","vue-router","vxe-table","axios"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BaseVue={},e.Vue,e.viewUiPlus,e.tools$1,e.infrastructure,e.mitt,e.VueRouter,e.VxeTable,e.axios)}(this,(function(e,t,o,s,i,a,n,r,l){"use strict";class c{constructor(){__publicField(this,"info",(e=>{o.Message.info(e)})),__publicField(this,"success",(e=>{o.Message.success(e)})),__publicField(this,"warning",(e=>{o.Message.warning(e)})),__publicField(this,"error",(e=>{o.Message.error(e)}))}}const d=new c;class u{constructor(){__publicField(this,"zIndex",1e4),__publicField(this,"confirm",(e=>{e["z-index"]=this.zIndex,o.Modal.confirm(e)})),__publicField(this,"info",(e=>{e["z-index"]=this.zIndex,o.Modal.info(e)})),__publicField(this,"success",(e=>{e["z-index"]=this.zIndex,o.Modal.success(e)})),__publicField(this,"warning",(e=>{e["z-index"]=this.zIndex,o.Modal.warning(e)})),__publicField(this,"error",(e=>{e["z-index"]=this.zIndex,o.Modal.error(e)}))}}const p=new u,h=a();class f{constructor(){__publicField(this,"utilities",new s.Utilities),__publicField(this,"storageInfo",i.storageInfo)}getEnterBIMParam(e){var t,o;return e+this.utilities.stringHelper.encryptAES(JSON.stringify({token:this.storageInfo.getToken(),userId:null==(t=this.storageInfo.getUser())?void 0:t.Id,projectId:null==(o=this.storageInfo.getCurrentPlatform())?void 0:o.Id}),"d2140707ca3a469c8527e546fe961276")}}class m{constructor(){__publicField(this,"message",new c),__publicField(this,"modal",new u),__publicField(this,"utilities",new s.Utilities),__publicField(this,"storageInfo",i.storageInfo),__publicField(this,"openObserve",i.openObserve),__publicField(this,"bus",h),__publicField(this,"OtherCommon",new f),__publicField(this,"doInputControl",(e=>{this.utilities.isNull(e)||(e.target.readOnly=!1)}))}}const g={count:{type:Number,default:0}},v=t.defineComponent({name:"Root",components:{},emits:[""],props:g,setup:(e,t)=>new P(e,t)});class P extends m{constructor(e,t){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"router"),this.props=e,this.ctx=t,this.useRoot()}useRoot(){this.router=n.useRouter(),this.goPage()}goPage(){const e=this.getQueryString("linkMain");if(!this.utilities.isNull(e))return void this.router.replace("/LinkMain");const t=this.storageInfo.getToken();this.utilities.isNull(t)?this.router.replace("/Login"):this.router.replace(this.storageInfo.getCurrentDefaultPath())}getQueryString(e){let t=window.location.href.indexOf("?"),o=window.location.href.substring(t+1,window.location.href.length).split("&");for(const s of o){let t=s.split("=");if(t[0]==e)return t[1]}return""}}const _=(e,t)=>{const o=e.__vccOpts||e;for(const[s,i]of t)o[s]=i;return o},b={class:"root"};const I=_(v,[["render",function(e,o,s,i,a,n){return t.openBlock(),t.createElementBlock("div",b)}],["__scopeId","data-v-b392b4ac"]]),N={tabPage:{type:Object,default:()=>({})}},k=t.defineComponent({name:"LinkPanel",components:{},emits:[""],props:N,setup:(e,t)=>new w(e,t)});class w extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"loading",t.ref(!0)),__publicField(this,"ifrPanel",t.ref()),this.props=e,this.ctx=o,this.useLinkPanel()}useLinkPanel(){t.onMounted((()=>{this.bindLoadEvent()}))}bindLoadEvent(){const e=this.ifrPanel.value;e.attachEvent?e.attachEvent("onload",(()=>{this.doLoaded(e)})):e.onload=()=>{this.doLoaded(e)}}doLoaded(e){this.loading.value=!1,setTimeout((()=>{const t={token:this.storageInfo.getToken(),user:JSON.stringify(this.storageInfo.getUser()),currentPlatform:JSON.stringify(this.storageInfo.getCurrentPlatform()),currentBusiness:JSON.stringify(this.storageInfo.getCurrentBusiness()),currentModule:JSON.stringify(this.storageInfo.getCurrentModule())};e.contentWindow.postMessage(t,"*")}),20)}}const F={class:"link-panel"},B=["src","title"];const L=_(k,[["render",function(e,o,s,i,a,n){const r=t.resolveComponent("Spin");return t.openBlock(),t.createElementBlock("div",F,[t.withDirectives(t.createElementVNode("iframe",{src:e.tabPage.path,class:"link-ifr",title:e.tabPage.path,ref:"ifrPanel"},null,8,B),[[t.vShow,!e.loading]]),t.createVNode(r,{size:"large",fix:"",show:e.loading},null,8,["show"])])}],["__scopeId","data-v-37023fbf"]]),M=t.defineComponent({name:"LinkMain",components:{LinkPanel:L},emits:[""],props:{},setup:(e,t)=>new x(e,t)});class x extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",t.ref([])),__publicField(this,"activePath",t.ref("")),this.props=e,this.ctx=o,this.useLinkMain()}useLinkMain(){const e=e=>{this.receiveMessage(e)};window.addEventListener("message",e),t.onUnmounted((()=>{window.removeEventListener("message",e)}))}receiveMessage(e){if(e.source!=window.parent.window.parent)return;const t=e.data;switch(t.command){case"initStorageInfo":this.initStorageInfo(t.data);break;case"pushPage":this.pushPage(t.data);break;case"clearAllPage":this.clearAllPage(t.data);break;case"closePage":this.closePage(t.data);break;case"activePage":this.activePage(t.data);break;case"closePageByCommand":this.closePageByCommand(t.data)}}initStorageInfo(e){const t=e.token,o=this.utilities.isNull(e.user)?void 0:JSON.parse(e.user),s=this.utilities.isNull(e.currentPlatform)?void 0:JSON.parse(e.currentPlatform),i=this.utilities.isNull(e.currentBusiness)?void 0:JSON.parse(e.currentBusiness),a=this.utilities.isNull(e.currentModule)?void 0:JSON.parse(e.currentModule);this.storageInfo.setToken(t),this.storageInfo.setUser(o),this.storageInfo.setCurrentPlatform(s),this.storageInfo.setCurrentBusiness(i),this.storageInfo.setCurrentModule(a)}pushPage(e){let o;if(0==e.loadMode){const s=this.storageInfo.getMenuComponts().find((t=>t.path==e.path));o="function"==typeof s.component?t.shallowRef(s.component()):t.shallowRef(s.component)}this.pages.value.push({path:e.path,loadMode:e.loadMode,param:e.param,operates:e.operates,component:o})}clearAllPage(e){this.pages.value=[]}closePage(e){const t=this.pages.value.findIndex((t=>t.path==e.path));this.pages.value.splice(t,1)}activePage(e){this.activePath.value=e.path}closePageByCommand(e){const t=this.pages.value.findIndex((e=>e.path==this.activePath.value));switch(e.command){case"left":if(0==t||1==t)return;this.pages.value.splice(1,t-1);break;case"right":if(t==this.pages.value.length-1)return;this.pages.value.splice(t+1);break;case"other":const e=this.pages.value.findIndex((e=>e.path==this.activePath.value)),o=this.pages.value[0];if(0==e)this.pages.value=[o];else{const t=this.pages.value[e];this.pages.value=[o,t]}break;case"all":this.pages.value.splice(1)}}}const C={class:"line-main"};const y=_(M,[["render",function(e,o,s,i,a,n){const r=t.resolveComponent("LinkPanel");return t.openBlock(),t.createElementBlock("div",C,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.pages,(o=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:o.path},[0==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.component),{key:0,linkParam:o.param,operates:o.operates},null,8,["linkParam","operates"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0),1==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(r,{key:1,tabPage:o},null,8,["tabPage"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0)],64)))),128))])}],["__scopeId","data-v-026a2cc9"]]),S=t.defineComponent({name:"FreeLoginCenter",components:{},emits:[""],props:{},setup:(e,t)=>new O(e,t)});class O extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"router"),__publicField(this,"errTip",t.ref("")),this.props=e,this.ctx=o,this.router=n.useRouter(),this.init()}async init(){let e=this.getRequestParam();if(e&&e.u&&e.t){let t=this.utilities.parseApiResult(await i.request(`/PermissionApi/OAuth/OAuthByToken?account=${decodeURIComponent(e.u)}&token=${decodeURIComponent(e.t)}`,{method:"post",data:{}}));if(t&&t.Token){this.storageInfo.setToken(t.Token),this.storageInfo.setUser(t.User),this.storageInfo.setPlatforms(t.Platforms),localStorage.setItem("needChangePsw",t.NeedChangePsw);const e=this.storageInfo.getPlatforms();if(!this.utilities.isNull(e)&&e.length>0){const t=e.find((e=>e.PlatformNo==this.storageInfo.getPlatformNo()));this.storageInfo.setCurrentPlatform(this.utilities.isNull(t)?e[0]:t)}const o=this.storageInfo.getCurrentPlatform();!this.utilities.isNull(o)&&o.Modules.length>0&&this.storageInfo.setCurrentBusiness(o.Modules[0]),this.router.replace("/")}else this.errLogin()}else this.errLogin()}errLogin(){this.router.replace("/Login")}getRequestParam(){let e=window.location.href.split("?")[1];if(!e)return!1;let t={};return e.split("&").forEach((e=>{0==e.indexOf("u=")?t.u=e.replace("u=",""):0==e.indexOf("t=")&&(t.t=e.replace("t=",""))})),t}}const E=e=>(t.pushScopeId("data-v-08b85823"),e=e(),t.popScopeId(),e),U={class:"nv-full nv-pos-a"},A={key:0,style:{"text-align":"center","padding-top":"20%","font-size":"25px"}},R={key:1,class:"loader"},T=[E((()=>t.createElementVNode("div",{class:"loader-inner line-scale"},[t.createElementVNode("div"),t.createElementVNode("div"),t.createElementVNode("div"),t.createElementVNode("div"),t.createElementVNode("div")],-1))),E((()=>t.createElementVNode("div",null,"正在初始化数据,请稍候...",-1)))];const V=_(S,[["render",function(e,o,s,i,a,n){return t.openBlock(),t.createElementBlock("div",U,[e.errTip?(t.openBlock(),t.createElementBlock("div",A,t.toDisplayString(e.errTip),1)):(t.openBlock(),t.createElementBlock("div",R,T))])}],["__scopeId","data-v-08b85823"]]);let z;const q={loaderInfor:{type:Object,default:()=>({})}},J=t.defineComponent({name:"LocalLoader",components:{LinkPanel:L},emits:[""],props:q,setup:(e,t)=>new D(e,t)});class D extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",t.ref([])),__publicField(this,"activePath",t.ref("")),this.props=e,this.ctx=o,this.useBusiness()}useBusiness(){t.onMounted((()=>{})),t.onUnmounted((()=>{h.off("pushPage"),h.off("clearAllPage"),h.off("closePage"),h.off("activePage"),h.off("closePageByCommand")})),h.on("pushPage",(e=>{this.pushPage(e)})),h.on("clearAllPage",(e=>{this.clearAllPage(e)})),h.on("closePage",(e=>{this.closePage(e)})),h.on("activePage",(e=>{this.activePage(e)})),h.on("closePageByCommand",(e=>{this.closePageByCommand(e)}))}pushPage(e){if(e.platformNo!=this.props.loaderInfor.platformNo)return;let o;if(0==e.loadMode){const s=this.storageInfo.getMenuComponts().find((t=>t.path==e.path));o="function"==typeof s.component?t.shallowRef(s.component()):t.shallowRef(s.component)}this.pages.value.push({path:e.path,loadMode:e.loadMode,param:e.param,operates:e.operates,component:o})}clearAllPage(e){e.platformNo==this.props.loaderInfor.platformNo&&(this.pages.value=[])}closePage(e){if(e.platformNo!=this.props.loaderInfor.platformNo)return;const t=this.pages.value.findIndex((t=>t.path==e.path));this.pages.value.splice(t,1)}activePage(e){e.platformNo==this.props.loaderInfor.platformNo&&(this.activePath.value=e.path)}closePageByCommand(e){if(e.platformNo!=this.props.loaderInfor.platformNo)return;const t=this.pages.value.findIndex((e=>e.path==this.activePath.value));switch(e.command){case"left":if(0==t||1==t)return;this.pages.value.splice(1,t-1);break;case"right":if(t==this.pages.value.length-1)return;this.pages.value.splice(t+1);break;case"other":const e=this.pages.value.findIndex((e=>e.path==this.activePath.value)),o=this.pages.value[0];if(0==e)this.pages.value=[o];else{const t=this.pages.value[e];this.pages.value=[o,t]}break;case"all":this.pages.value.splice(1)}}}const W={class:"local-loader"};const j=_(J,[["render",function(e,o,s,i,a,n){const r=t.resolveComponent("LinkPanel");return t.openBlock(),t.createElementBlock("div",W,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.pages,(o=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:o.path},[0==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.component),{key:0,linkParam:o.param,operates:o.operates},null,8,["linkParam","operates"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0),1==o.loadMode?t.withDirectives((t.openBlock(),t.createBlock(r,{key:1,tabPage:o},null,8,["tabPage"])),[[t.vShow,o.path==e.activePath]]):t.createCommentVNode("",!0)],64)))),128))])}],["__scopeId","data-v-1ff2be67"]]),$={loaderInfor:{type:Object,default:()=>({})}},Q=t.defineComponent({name:"WebLoader",components:{},emits:["loaded"],props:$,setup:(e,t)=>new H(e,t)});class H extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"commandStack",[]),__publicField(this,"loading",t.ref(!0)),__publicField(this,"ifrWeb",t.ref()),__publicField(this,"ifrId",t.ref("")),__publicField(this,"doLoaded",(()=>{t.nextTick((()=>{this.ctx.emit("loaded",this.props.loaderInfor.platformNo),this.loading.value=!1,this.sendMessage("initStorageInfo",{token:this.storageInfo.getToken(),user:JSON.stringify(this.storageInfo.getUser()),currentPlatform:JSON.stringify(this.storageInfo.getCurrentPlatform()),currentBusiness:JSON.stringify(this.storageInfo.getCurrentBusiness()),currentModule:JSON.stringify(this.storageInfo.getCurrentModule())}),this.sendStackCommand()}))})),__publicField(this,"getIfrUrl",(()=>this.props.loaderInfor.url+(-1!=this.props.loaderInfor.url.indexOf("?")?"&":"?")+"linkMain=true")),this.props=e,this.ctx=o,this.useWebLoader()}useWebLoader(){this.ifrId.value=this.utilities.getUniqueCode(),t.onUnmounted((()=>{h.off("pushPage"),h.off("clearAllPage"),h.off("closePage"),h.off("activePage"),h.off("closePageByCommand")})),h.on("pushPage",(e=>{this.pushPage(e)})),h.on("clearAllPage",(e=>{this.clearAllPage(e)})),h.on("closePage",(e=>{this.closePage(e)})),h.on("activePage",(e=>{this.activePage(e)})),h.on("closePageByCommand",(e=>{this.closePageByCommand(e)}))}sendMessage(e,t){if(this.loading.value)return void this.commandStack.push({command:e,data:t});const o={command:e,data:t};document.getElementById(this.ifrId.value).contentWindow.postMessage(o,"*")}sendStackCommand(){for(const e of this.commandStack)this.sendMessage(e.command,e.data);this.commandStack=[]}pushPage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("pushPage",e)}clearAllPage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("clearAllPage",e)}closePage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("closePage",e)}activePage(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("activePage",e)}closePageByCommand(e){e.platformNo==this.props.loaderInfor.platformNo&&this.sendMessage("closePageByCommand",e)}}const G={class:"web-loader"},K=["id","src","title"];const X=_(Q,[["render",function(e,o,s,i,a,n){const r=t.resolveComponent("Spin");return t.openBlock(),t.createElementBlock("div",G,[t.createElementVNode("iframe",{id:e.ifrId,src:e.getIfrUrl(),class:"web-ifr",title:e.loaderInfor.platformNo,onLoad:o[0]||(o[0]=(...t)=>e.doLoaded&&e.doLoaded(...t))},null,40,K),t.createVNode(r,{size:"large",fix:"",show:e.loading},null,8,["show"])])}],["__scopeId","data-v-12870e01"]]),Y=t.defineComponent({name:"LoaderManage",components:{LocalLoader:j,WebLoader:X},emits:["loaded"],props:{},setup:(e,t)=>new Z(e,t)});let Z=class extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",[]),__publicField(this,"loaderStack",t.ref([])),__publicField(this,"currentPlatformNo",t.ref("")),__publicField(this,"doLoaded",(e=>{const t=this.loaderStack.value.find((t=>t.platformNo==e));this.utilities.isNull(t)||(t.isloaded=!0,this.ctx.emit("loaded",t))})),__publicField(this,"loadPlatform",((e,t)=>{if(this.currentPlatformNo.value=t,-1!=this.loaderStack.value.findIndex((e=>e.platformNo==t)))return;if(!e)return;const o=this.isLocal(e,t);this.loaderStack.value.push({url:e,platformNo:t,isloaded:!!o,isLocal:o})})),__publicField(this,"pushPage",((e,t,o,s)=>{this.pages.push({path:e,loadMode:t,param:o,operates:s,component:void 0});const i={platformNo:this.currentPlatformNo.value,path:e,loadMode:t,param:o,operates:s};h.emit("pushPage",i)})),__publicField(this,"clearAllPage",(()=>{this.pages=[];const e={platformNo:this.currentPlatformNo.value};h.emit("clearAllPage",e)})),__publicField(this,"closePage",(e=>{const t=this.pages.findIndex((t=>t.path==e));this.pages.splice(t,1);const o={platformNo:this.currentPlatformNo.value,path:e};h.emit("closePage",o)})),__publicField(this,"activePage",(e=>{const t={platformNo:this.currentPlatformNo.value,path:e};h.emit("activePage",t)})),__publicField(this,"closePageByCommand",(e=>{const t={platformNo:this.currentPlatformNo.value,command:e};h.emit("closePageByCommand",t)})),this.props=e,this.ctx=o,this.useBusinessLoader()}useBusinessLoader(){t.onMounted((()=>{})),t.onUnmounted((()=>{}))}isLocal(e,t){if(!e)return!0;if(t==this.storageInfo.getPlatformNo())return!0;const o=new URL(e),s=new URL(location.href);return o.host==s.host&&o.port==s.host}};const ee={class:"loader-manage"};const te=_(Y,[["render",function(e,o,s,i,a,n){const r=t.resolveComponent("LocalLoader"),l=t.resolveComponent("WebLoader");return t.openBlock(),t.createElementBlock("div",ee,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.loaderStack,(o=>t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:o.platformNo,class:"loader-manage_content"},[o.isLocal?(t.openBlock(),t.createBlock(r,{key:0,loaderInfor:o},null,8,["loaderInfor"])):(t.openBlock(),t.createBlock(l,{key:1,loaderInfor:o,onLoaded:e.doLoaded},null,8,["loaderInfor","onLoaded"]))],512)),[[t.vShow,o.platformNo==e.currentPlatformNo]]))),128))])}],["__scopeId","data-v-ee346895"]]);t.defineComponent({name:"LoaderManage",components:{LocalLoader:j,WebLoader:X},emits:["loaded"],props:{},setup:(e,t)=>new oe(e,t)});class oe extends m{constructor(e,o){super(),__publicField(this,"props"),__publicField(this,"ctx"),__publicField(this,"pages",[]),__publicField(this,"loaderStack",t.ref([])),__publicField(this,"currentPlatformNo",t.ref("")),__publicField(this,"doLoaded",(e=>{const t=this.loaderStack.value.find((t=>t.platformNo==e));this.utilities.isNull(t)||(t.isloaded=!0,this.ctx.emit("loaded",t))})),__publicField(this,"loadPlatform",((e,t)=>{if(this.currentPlatformNo.value=t,-1!=this.loaderStack.value.findIndex((e=>e.platformNo==t)))return;if(!e)return;const o=this.isLocal(e,t);this.loaderStack.value.push({url:e,platformNo:t,isloaded:!!o,isLocal:o})})),__publicField(this,"pushPage",((e,t,o,s)=>{this.pages.push({path:e,loadMode:t,param:o,operates:s,component:void 0});const i={platformNo:this.currentPlatformNo.value,path:e,loadMode:t,param:o,operates:s};h.emit("pushPage",i)})),__publicField(this,"clearAllPage",(()=>{this.pages=[];const e={platformNo:this.currentPlatformNo.value};h.emit("clearAllPage",e)})),__publicField(this,"closePage",(e=>{const t=this.pages.findIndex((t=>t.path==e));this.pages.splice(t,1);const o={platformNo:this.currentPlatformNo.value,path:e};h.emit("closePage",o)})),__publicField(this,"activePage",(e=>{const t={platformNo:this.currentPlatformNo.value,path:e};h.emit("activePage",t)})),__publicField(this,"closePageByCommand",(e=>{const t={platformNo:this.currentPlatformNo.value,command:e};h.emit("closePageByCommand",t)})),this.props=e,this.ctx=o,this.useBusinessLoader()}useBusinessLoader(){t.onMounted((()=>{})),t.onUnmounted((()=>{}))}isLocal(e,t){if(!e)return!0;if(t==this.storageInfo.getPlatformNo())return!0;const o=new URL(e),s=new URL(location.href);return o.host==s.host&&o.port==s.host}}e.BaseInstance=m,e.FreeLoginCenter=V,e.LinkMain=y,e.LoaderManage=te,e.LoaderManageInstance=oe,e.MessageInstance=c,e.ModalInstance=u,e.Root=I,e.initWeb=function(e,t,a,n){z=n,e.use(o),e.use(r),(e=>{e.directive("focus",{mounted(e){e.focus(),e.select()}})})(e),i.storageInfo.setPlatformNo(t),i.storageInfo.setMenuComponts(a),l.interceptors.request.use((function(e){const t=i.storageInfo.getToken();!s.utilities.isNull(t)&&s.utilities.isNull(e.headers.Authorization)&&(e.headers.Authorization="Bearer "+t);const o=i.storageInfo.getPlatformNo();s.utilities.isNull(o)||(e.headers.PlatformNo=o);const a=i.storageInfo.getCurrentPlatform();s.utilities.isNull(a)||(e.headers.PlatformId=a.Id,e.headers.PlatformName=encodeURI(a.PlatformName));const n=i.storageInfo.getUser();s.utilities.isNull(n)||(e.headers.UserId=n.Id,e.headers.UserName=encodeURI(`${n.UserName}(${n.Account})`));const r=i.storageInfo.getCurrentModule();return s.utilities.isNull(r)||(e.headers.MenuId=r.Id,e.headers.MenuName=encodeURI(r.ModuleName),e.headers.MenuPath=encodeURI(r.ModuleUrl)),e}),(function(e){return Promise.reject(e)})),l.interceptors.response.use((function(e){return e}),(function(e){return e.response&&e.response.data&&"401"==e.response.data.code?(i.storageInfo.removeAll(),z.push("/Login")):i.openObserve.error("请求异常",e),Promise.reject(e)})),function(){const e=window;if(s.utilities.isNull(e.openObserveOption))return;const t=e.openObserveOption;i.openObserve.init(t)}(),i.openObserve.info(`${t} 初始化完成`,{platformNo:t})},e.message=d,e.modal=p,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|