@newview/base-vue 1.1.4 → 1.1.6
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 +12 -0
- package/dist/base-vue.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/readme.md +3 -0
package/dist/base-vue.js
CHANGED
|
@@ -1031,6 +1031,9 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
1031
1031
|
if (this.loaderStack.value.findIndex((item) => item.platformNo == platformNo) != -1) {
|
|
1032
1032
|
return;
|
|
1033
1033
|
}
|
|
1034
|
+
if (!url) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1034
1037
|
const isLocal = this.isLocal(url, platformNo);
|
|
1035
1038
|
this.loaderStack.value.push({
|
|
1036
1039
|
url,
|
|
@@ -1132,6 +1135,9 @@ let LoaderManageInstance$1 = class LoaderManageInstance extends BaseInstance {
|
|
|
1132
1135
|
* @returns
|
|
1133
1136
|
*/
|
|
1134
1137
|
isLocal(urlStr, platformNo) {
|
|
1138
|
+
if (!urlStr) {
|
|
1139
|
+
return true;
|
|
1140
|
+
}
|
|
1135
1141
|
if (platformNo == this.storageInfo.getPlatformNo()) {
|
|
1136
1142
|
return true;
|
|
1137
1143
|
}
|
|
@@ -1215,6 +1221,9 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
1215
1221
|
if (this.loaderStack.value.findIndex((item) => item.platformNo == platformNo) != -1) {
|
|
1216
1222
|
return;
|
|
1217
1223
|
}
|
|
1224
|
+
if (!url) {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1218
1227
|
const isLocal = this.isLocal(url, platformNo);
|
|
1219
1228
|
this.loaderStack.value.push({
|
|
1220
1229
|
url,
|
|
@@ -1316,6 +1325,9 @@ class LoaderManageInstance2 extends BaseInstance {
|
|
|
1316
1325
|
* @returns
|
|
1317
1326
|
*/
|
|
1318
1327
|
isLocal(urlStr, platformNo) {
|
|
1328
|
+
if (!urlStr) {
|
|
1329
|
+
return true;
|
|
1330
|
+
}
|
|
1319
1331
|
if (platformNo == this.storageInfo.getPlatformNo()) {
|
|
1320
1332
|
return true;
|
|
1321
1333
|
}
|
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 p{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 u=new p,h=i();class f{constructor(){__publicField(this,"message",new c),__publicField(this,"modal",new p),__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;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(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;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(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=p,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=u,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,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"})}));
|