import{g as t,Z as e,$ as s,L as o,n as a,s as l,o as i,X as r,p as n,w as p,q as c,t as h,v as m,B as u,x as d,y as f,D as y,E as g,F as w,O as k,I,H as x}from"./index-P0fyQ2Em.js";import{_ as P}from"./uni-icons.RJ8Vh9KU.js";import{r as _}from"./uni-app.es.DOtS5Ldl.js";import{_ as b}from"./uni-nav-bar.CsxVGSV_.js";import{_ as j}from"./index.BuZ8YmVY.js";import{_ as v}from"./u-image.RNxpLaRU.js";import{_ as D}from"./mescroll-body.CszwJbBy.js";import{_ as S}from"./u-search.CSVnMmHg.js";import{_ as L}from"./u-icon.wXcRZHbn.js";import{_ as C}from"./u-popup.CXrq2y3n.js";import{a as N,P as O,S as T}from"./portal.BblJR1cW.js";import{M as $}from"./mescroll-mixins.C2YUWJKd.js";import{I as J}from"./mixin.MtVXWP3_.js";import{p as R}from"./index.BKbDh3D5.js";import{d as U,e as V}from"./defPortal.BG2OqSQl.js";import{_ as F}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./resources.DEPsJg7u.js";import"./renderjs.BXp1P0Wg.js";import"./u-tabs.DEel8MQB.js";import"./u-badge.CWPuZ-w1.js";import"./u-line.D-FzmOwL.js";import"./mp-html.DI6DI7Ml.js";import"./flowEngine.Ke7vpfzj.js";import"./u-time-line.q7UXLQNV.js";const A=F({mixins:[$,J],components:{portalItem:R,defaultPortal:U},data(){return{keyword:"",showWebView:!0,emptyImg:V,rightIcon:"",key:+new Date,formData:[],portalTitle:"门户",showSelect:!1,upOption:{page:{num:0,size:50,time:null},empty:{use:!1},textNoMore:this.$t("app.apply.noMoreData")},portalList:[],id:"",userInfo:{},downOption:{use:!0,auto:!0},authConfig:{},token:"",mpPortalUrl:"",timer:null,type:0}},onShow(){this.token=t("token"),this.mpPortalUrl=this.define.baseURL+"/pages/portal/mpPortal/index?token="+this.token,this.userInfo=t("userInfo")||{},this.showSelect=!1,this.userInfo.appPortalId&&(this.getPortalList(),this.$nextTick((()=>{this.mescroll.resetUpScroll(),this.portalList=[]})))},onReady(){},onLoad(e){this.token=t("token")},computed:{isPortalListValid(){return Array.isArray(this.portalList)&&this.portalList.length},columnList(){return this.portalList.filter((t=>t.fullName&&t.fullName.match(this.keyword)))}},methods:{setWebview(){if(1==this.authConfig.linkType){var t=this.$scope.$getAppWebview();let s=0;e({success:t=>{s=t.windowHeight-50},complete:()=>{}}),this.$nextTick((()=>{setTimeout((()=>{t.children()[0].setStyle({top:80,height:s,scalable:!0})}),500)}))}},upCallback(t){N(this.userInfo.appPortalId).then((t=>{this.authConfig=t.data||{};let e=JSON.parse(t.data.formData)||{};this.formData=e.layout?JSON.parse(JSON.stringify(e.layout)):[],this.handelFormData(e),e.refresh.autoRefresh&&(this.timer&&clearInterval(this.timer),this.timer=setInterval((()=>{s("proRefresh")}),6e4*e.refresh.autoRefreshTime)),this.mescroll.endSuccess(this.formData.length),this.key=+new Date})).catch((()=>{this.formData=[],this.mescroll.endSuccess(0),this.mescroll.endErr(),this.key=+new Date}))},handelFormData(t){const e=s=>{s.forEach((s=>{s.allRefresh=t.refresh,s.show=!1,s.visibility&&s.visibility.length&&s.visibility.includes("app")&&(s.show=!0),s.children&&s.children.length&&e(s.children)})),this.key=+new Date};e(this.formData),this.dataList=this.formData.filter((t=>t.show)),this.dataList.length<1&&(this.formData=this.dataList,this.mescroll.endSuccess(this.dataList.length))},isJSON(t){try{var e=JSON.parse(t);return!("object"!=typeof e||!e)}catch(s){return!1}},scan(){this.userInfo.appPortalId&&o({success:e=>{let s="";if(this.isJSON(e.result.trim())){const o=JSON.parse(e.result.trim());if("ADP"===o.t){let t={isPreview:1,moduleId:o.id,previewType:o.previewType};s="/pages/apply/dynamicModel/index?config="+this.jnpf.base64.encode(JSON.stringify(t))}if("DFD"===o.t&&(s="/pages/apply/dynamicModel/scanForm?config="+JSON.stringify(o)),"WFP"===o.t&&(s="/pages/workFlow/scanForm/index?config="+JSON.stringify(o)),"report"===o.t){userInfo=t("userInfo")||{};const e=userInfo.systemCode;let a=`${this.report}/preview.html?id=${o.id}&token=${this.token}&appCode=${e}&page=1&from=menu`;s="/pages/apply/externalLink/index?url="+encodeURIComponent(a)+"&fullName= "+o.fullName}"portal"===o.t&&(s="/pages/portal/scanPortal/index?id="+o.id),"login"===o.t&&(s="/pages/login/scanLogin?id="+o.id)}else s="/pages/my/scanResult/index?result="+e.result;a({url:s,fail:t=>{this.$u.toast("暂无此页面")}})}})},getPortalList(){O().then((t=>{let e=t.data.list||[];this.portalList=e,e.map((t=>{this.portalList.forEach((t=>{t.appPortalId=this.userInfo.appPortalId,t.id===t.appPortalId&&(this.portalTitle=t.fullName)}))}))}))},closePopup(){},showSelectBox(){this.showSelect=!this.showSelect,this.getPortalList()},selectPortal(t,e){T(t.id).then((s=>{this.portalTitle=this.portalList[e].fullName,this.userInfo.appPortalId=t.id,this.mescroll.triggerDownScroll(),this.showSelectBox(!1),l("userInfo",this.userInfo)}))}}},[["render",function(t,e,s,o,a,l){const N=_(i("uni-icons"),P),O=c,T=_(i("uni-nav-bar"),b),$=r("portalItem"),J=_(i("JnpfEmpty"),j),R=k,U=_(i("u-image"),v),V=I,F=_(i("mescroll-body"),D),A=r("defaultPortal"),E=_(i("u-search"),S),B=_(i("u-icon"),L),M=_(i("u-popup"),C);return h(),n(O,{class:"index-v"},{default:p((()=>[m(T,{class:"nav",fixed:!0,statusBar:!0,border:!1,"right-icon":a.rightIcon,onClickRight:l.scan},{left:p((()=>[a.portalList.length>1&&a.userInfo.appPortalId?(h(),n(O,{key:0},{default:p((()=>[m(N,{class:"icon-ym icon-ym-header-role-toggle",color:"#666",size:"20",onClick:l.showSelectBox},null,8,["onClick"])])),_:1})):u("",!0)])),default:p((()=>[m(O,{class:"nav-left"},{default:p((()=>[m(O,{class:"nav-left-text"},{default:p((()=>[d(f(a.portalTitle),1)])),_:1})])),_:1})])),_:1},8,["right-icon","onClickRight"]),a.userInfo.appPortalId?(h(),n(F,{key:0,ref:"mescrollRef",onInit:t.mescrollInit,onDown:t.downCallback,down:a.downOption,onUp:l.upCallback,up:a.upOption,bottombar:!1,top:"10"},{default:p((()=>[0==a.authConfig.type?(h(),n(O,{key:0,class:"portal-v"},{default:p((()=>[a.formData.length?(h(!0),y(w,{key:0},g(a.formData,((t,e)=>(h(),n(O,{class:"portal-box",key:e},{default:p((()=>[t.show?(h(),n($,{item:t,ref_for:!0,ref:"portalItem",key:a.key},null,8,["item"])):u("",!0)])),_:2},1024)))),128)):(h(),n(J,{key:1}))])),_:1})):u("",!0),1==a.authConfig.type?(h(),y(w,{key:1},[1==a.authConfig.linkType&&a.showWebView?(h(),n(O,{key:0},{default:p((()=>[m(R,{src:a.authConfig.customUrl,fullscreen:!1,style:{width:"100%",height:"calc(100vh - 300rpx)"}},null,8,["src"])])),_:1})):(h(),n(O,{key:1,class:"portal-v portal-nodata"},{default:p((()=>[m(O,{class:"u-flex-col",style:{"align-items":"center"}},{default:p((()=>[m(U,{width:"280rpx",height:"280rpx",src:a.emptyImg},null,8,["src"]),m(V,{class:"u-m-t-20",style:{color:"#909399"}},{default:p((()=>[d("当前内容无法在APP上显示,请前往PC门户查看~~")])),_:1})])),_:1})])),_:1}))],64)):u("",!0)])),_:1},8,["onInit","onDown","down","onUp","up"])):(h(),n(O,{key:1,class:"portal-v",style:{"padding-top":"20rpx"}},{default:p((()=>[m(O,{class:"portal-box"},{default:p((()=>[m(A)])),_:1})])),_:1})),m(M,{modelValue:a.showSelect,"onUpdate:modelValue":e[1]||(e[1]=t=>a.showSelect=t),mode:"bottom",class:"select-box",height:"600rpx",onClose:l.closePopup},{default:p((()=>[m(O,{class:"search-box"},{default:p((()=>[m(E,{placeholder:t.$t("app.apply.pleaseKeyword"),modelValue:a.keyword,"onUpdate:modelValue":e[0]||(e[0]=t=>a.keyword=t),height:"72","show-action":!1,"bg-color":"#f0f2f6",shape:"square","search-icon-color":"#909399"},null,8,["placeholder","modelValue"])])),_:1}),(h(!0),y(w,null,g(l.columnList,((t,e)=>(h(),n(O,{key:e,class:"select-item",onClick:s=>l.selectPortal(t,e)},{default:p((()=>[m(V,{class:x(["u-m-r-12 u-font-30",[t.icon,{currentItem:t.isDefault||t.id===t.appPortalId}]])},null,8,["class"]),m(V,{class:x(["item-text sysName",{currentItem:t.isDefault||t.id===t.appPortalId}])},{default:p((()=>[d(f(t.fullName),1)])),_:2},1032,["class"]),t.isDefault||t.id===t.appPortalId?(h(),n(B,{key:0,name:"checkbox-mark ",class:"currentItem"})):u("",!0)])),_:2},1032,["onClick"])))),128))])),_:1},8,["modelValue","onClose"])])),_:1})}],["__scopeId","data-v-49a92f0d"]]);export{A as default};