@ibiz-template/runtime 0.5.7-alpha.3 → 0.5.7-alpha.5
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/index.esm.js +661 -309
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts +2 -0
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +2 -0
- package/out/application.js +1 -1
- package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/exp-bar.controller.js +7 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +5 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.js +16 -0
- package/out/controller/control/search-bar/entity-schema.d.ts +1 -2
- package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -1
- package/out/controller/control/search-bar/entity-schema.js +2 -2
- package/out/controller/control/search-bar/index.d.ts +2 -0
- package/out/controller/control/search-bar/index.d.ts.map +1 -1
- package/out/controller/control/search-bar/index.js +2 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +5 -6
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar-filter.controller.js +6 -9
- package/out/controller/control/search-bar/search-bar.controller.d.ts +1 -24
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +11 -88
- package/out/controller/control/search-bar/use-searchcond.d.ts +33 -0
- package/out/controller/control/search-bar/use-searchcond.d.ts.map +1 -0
- package/out/controller/control/search-bar/use-searchcond.js +91 -0
- package/out/controller/notification/async-action.controller.d.ts +64 -0
- package/out/controller/notification/async-action.controller.d.ts.map +1 -0
- package/out/controller/notification/async-action.controller.js +141 -0
- package/out/controller/notification/index.d.ts +2 -0
- package/out/controller/notification/index.d.ts.map +1 -0
- package/out/controller/notification/index.js +1 -0
- package/out/controller/notification/internal-message.controller.d.ts +23 -0
- package/out/controller/notification/internal-message.controller.d.ts.map +1 -0
- package/out/controller/notification/internal-message.controller.js +50 -0
- package/out/controller/notification/notice.controller.d.ts +10 -0
- package/out/controller/notification/notice.controller.d.ts.map +1 -0
- package/out/controller/notification/notice.controller.js +13 -0
- package/out/global/global-util/global-util.d.ts +9 -1
- package/out/global/global-util/global-util.d.ts.map +1 -1
- package/out/global/global-util/global-util.js +9 -1
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +8 -1
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/common/i-popover-options/i-popover-options.d.ts +9 -1
- package/out/interface/common/i-popover-options/i-popover-options.d.ts.map +1 -1
- package/out/interface/controller/controller/index.d.ts +1 -0
- package/out/interface/controller/controller/index.d.ts.map +1 -1
- package/out/interface/controller/controller/index.js +1 -0
- package/out/interface/controller/controller/notice/i-async-action.controller.d.ts +49 -0
- package/out/interface/controller/controller/notice/i-async-action.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/i-async-action.controller.js +1 -0
- package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts +68 -0
- package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/i-internal-message.controller.js +1 -0
- package/out/interface/controller/controller/notice/i-notice.controller.d.ts +33 -0
- package/out/interface/controller/controller/notice/i-notice.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/i-notice.controller.js +1 -0
- package/out/interface/controller/controller/notice/index.d.ts +4 -0
- package/out/interface/controller/controller/notice/index.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/index.js +1 -0
- package/out/interface/provider/i-async-action.provider.d.ts +11 -3
- package/out/interface/provider/i-async-action.provider.d.ts.map +1 -1
- package/out/interface/provider/i-internal-message.provider.d.ts +10 -2
- package/out/interface/provider/i-internal-message.provider.d.ts.map +1 -1
- package/out/interface/util/i-notice-util/i-notice-util.d.ts +34 -0
- package/out/interface/util/i-notice-util/i-notice-util.d.ts.map +1 -0
- package/out/interface/util/i-notice-util/i-notice-util.js +1 -0
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +2 -2
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
- package/out/interface/util/index.d.ts +1 -0
- package/out/interface/util/index.d.ts.map +1 -1
- package/out/register/helper/async-action-register.d.ts +2 -1
- package/out/register/helper/async-action-register.d.ts.map +1 -1
- package/out/register/helper/async-action-register.js +3 -3
- package/out/register/helper/internal-message-register.js +2 -2
- package/out/service/service/auth/v7-auth.service.d.ts +8 -0
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +15 -0
- package/out/service/service/internal-message/internal-message.service.d.ts +1 -1
- package/out/service/service/internal-message/internal-message.service.d.ts.map +1 -1
- package/out/service/service/internal-message/internal-message.service.js +7 -16
- package/out/types.d.ts +8 -1
- package/out/types.d.ts.map +1 -1
- package/out/utils/file-util/file-util.d.ts +57 -0
- package/out/utils/file-util/file-util.d.ts.map +1 -0
- package/out/utils/file-util/file-util.js +113 -0
- package/out/utils/file-util/index.d.ts +2 -0
- package/out/utils/file-util/index.d.ts.map +1 -0
- package/out/utils/file-util/index.js +1 -0
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/package.json +5 -6
- package/src/app-hub.ts +3 -0
- package/src/application.ts +1 -1
- package/src/controller/control/exp-bar/exp-bar.controller.ts +6 -0
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +17 -0
- package/src/controller/control/search-bar/entity-schema.ts +4 -4
- package/src/controller/control/search-bar/index.ts +2 -0
- package/src/controller/control/search-bar/search-bar-filter.controller.ts +15 -10
- package/src/controller/control/search-bar/search-bar.controller.ts +24 -98
- package/src/controller/control/search-bar/use-searchcond.ts +100 -0
- package/src/controller/notification/async-action.controller.ts +163 -0
- package/src/controller/notification/index.ts +1 -0
- package/src/controller/notification/internal-message.controller.ts +64 -0
- package/src/controller/notification/notice.controller.ts +16 -0
- package/src/global/global-util/global-util.ts +10 -0
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +9 -1
- package/src/interface/common/i-popover-options/i-popover-options.ts +10 -1
- package/src/interface/controller/controller/index.ts +1 -0
- package/src/interface/controller/controller/notice/i-async-action.controller.ts +52 -0
- package/src/interface/controller/controller/notice/i-internal-message.controller.ts +74 -0
- package/src/interface/controller/controller/notice/i-notice.controller.ts +36 -0
- package/src/interface/controller/controller/notice/index.ts +9 -0
- package/src/interface/provider/i-async-action.provider.ts +14 -3
- package/src/interface/provider/i-internal-message.provider.ts +10 -2
- package/src/interface/util/i-notice-util/i-notice-util.ts +34 -0
- package/src/interface/util/i-open-view-util/i-open-view-util.ts +2 -1
- package/src/interface/util/index.ts +1 -0
- package/src/register/helper/async-action-register.ts +4 -4
- package/src/register/helper/internal-message-register.ts +2 -2
- package/src/service/service/auth/v7-auth.service.ts +16 -1
- package/src/service/service/internal-message/internal-message.service.ts +12 -18
- package/src/types.ts +9 -0
- package/src/utils/file-util/file-util.ts +141 -0
- package/src/utils/file-util/index.ts +1 -0
- package/src/utils/index.ts +1 -0
package/dist/index.system.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var a,i,s,n,o,r,c,d,l,h,u,p,m,f,g,w,E,v,y,I,D,C,A,b,P,T,x,N,S,L,R,O,M,_,V,F,k,W,B,U,z,G,j,K,X,H,Y,q,Q,$,J,Z,tt,et,at,it,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,ft,gt,wt,Et;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,n=t.NoticeError,o=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.IBizContext,l=t.DataTypes,h=t.clone,u=t.CoreConst,p=t.HttpResponse,m=t.updateKeyDefine,f=t.Net,g=t.getToken,w=t.NOOP,E=t.IBizParams,v=t.isElementSame,y=t.findRecursiveChild,I=t.StringUtil,D=t.debounceAndAsyncMerge,C=t.isOverlap,A=t.BitMask,b=t.mergeInLeft,P=t.awaitTimeout,T=t.mergeDefaultInLeft,x=t.plus,N=t.toNumberOrNil},function(t){S=t.isEmpty,L=t.isString,R=t.isArray,O=t.isObject,M=t.isNil,_=t.debounce,V=t.camelCase,F=t.eq,k=t.gt,W=t.gte,B=t.findIndex,U=t.lt,z=t.lte,G=t.upperFirst,j=t.snakeCase,K=t.kebabCase,X=t.isFunction},function(t){H=t.notNilEmpty,Y=t.isNilOrEmpty,q=t.AsyncSeriesHook,Q=t.createUUID,$=t.QXEvent,J=t.isArray,Z=t.getCookie,tt=t.setCookie,et=t.clearCookie,at=t.ascSort,it=t.descSort,st=t.clearAll,nt=t.isNumber},function(t){ot=t.default},function(t){rt=t.isNil,ct=t.mergeRight,dt=t.isEmpty,lt=t.clone,ht=t.equals,ut=t.where,pt=t.mergeLeft,mt=t.isNotNil,ft=t.mergeDeepRight},function(t){gt=t.default},function(t){wt=t.default},function(t){Et=t.default}],execute:function(){t({asyncImportData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Ho);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const n=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(o=n.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(o!==i)return;const s=a.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED");var o},calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t;let i;if(e||a){switch(i={display:"flex"},e){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(a){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:fe,calcDynaClass:ue,calcDynaSysParams:async function(t,e,a={}){const i=a.appId||e.srfappid,s=a.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,i);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdeanme)n.srfparentkey=s.srfparentkey,n.srfparentdeanme=s.srfparentdeanme;else{const t=Hs(e,o);if(t&&t.keys.length>1){const a=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[a],n.srfparentdeanme=s.srfparentdeanme||a}}return n},calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:l(a,i),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcLayoutHeightWidth:he,calcMainStateOPPrivsStrs:me,calcNavParams:re,calcResPath:Ys,compare:ke,compareNumber:We,contains:Be,convertNavData:ie,convertNavDataByArray:ne,convertObjectToNavParams:ae,execDELogic:Bn,execDELogicAction:zn,execDELogicById:Un,execFieldLogics:jn,execUILogic:Yr,exportData:qo,fieldValueToBoolean:Qs,filterFieldLogics:Ee,filterValueRules:la,findChildFormDetails:be,findDELogic:we,findEditItem:Ae,findFieldById:ve,findModelChild:ce,formatMultiData:oe,generateEditorRules:jo,generateRules:Go,getAllPanelField:Oe,getAppCounterProvider:ji,getAppMenuItemProvider:_s,getAppViewRef:function(t,e){var a,i;let s=t.appViewRefs||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(a=t||"DEFAULT",ibiz.register.get("".concat(ws,"_").concat(a)));var a;if(e)return e;throw new o("找不异步操作类型".concat(t,"对应的适配器"))},getChildNodeRSs:Ce,getControl:function(t,e){var a,i;let s=t.controls||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.controls));return s.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlPanel:le,getControlProvider:Hi,getControlsByView:Te,getDEMethodProvider:Ns,getDERedirectToView:Ve,getDeACMode:async function(t,e,a){var i;const s=await ibiz.hub.getAppDataEntity(e,a);return null==(i=s.appDEACModes)?void 0:i.find((e=>e.id===t))},getDefaultValue:Xo,getEditorProvider:Qi,getEntitySchema:Qo,getFormDetailProvider:Zi,getGridColumnProvider:as,getInternalMessageProvider:function(t){const e=(a=t.message_type||"DEFAULT",ibiz.register.get("".concat(Vs,"_").concat(a)));var a;if(e)return e;throw new o("找不站内信类型".concat(t.message_type,"对应的适配器"))},getMatchResPath:Hs,getOriginData:zo,getPFPlugin:function(t,e){const i=ibiz.hub.getApp(e);if(!i)throw new a(i,"未找到应用");const{model:s}=i;if(!s.appPFPluginRefs)throw new a(s,"应用未配置插件");const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error("未找到插件".concat(t));return n},getPanelItemProvider:ns,getPlatformProvider:bs,getPlatformType:Is,getPortletProvider:cs,getRootNode:Ie,getTreeGridExColumnProvider:Rs,getTreeNode:De,getUIActionById:ye,getUIActionItemsByActionLevel:function(t,e){const a=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const i=t;i.actionLevel===e&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),a},getUIActionProvider:us,getUILogicNodeProvider:ms,getViewEngines:Ne,getViewLogics:xe,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=gs(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=gs("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=gs(a));e||(e=gs("DEFAULT"));return e},getWFContext:Qe,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:s),c=null==o?void 0:o.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:Ea,hasDeCodeName:ge,hasSubRoute:Bo,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Yo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));return(await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}})).data},install:function(){const{ibiz:t}=window;t.util=new md,t.hub=new hd,t.register=new Lt,t.config=new St,t.auth=new pn,t.asyncAction=new mn,t.internalMessage=new $n,t.engine=new ud,t.uiDomainManager=new fa,Io(),ac(),Qn(),Bs(),ibiz.scheduler=new Cd,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Pd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Pd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Pd(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Td(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new bd(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new Nd(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Sd(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new wd(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Ed(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Ed(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new xd(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Ld(t,e))),function(){const t=new vs;Cs("Browser",(()=>t))}(),t.platform=bs()},installCommand:Io,isDataContainer:Se,isFormDataContainer:Pe,isValueChange:Uo,matchMainState:pe,openRedirectView:Me,parseUserParams:de,presetAppCounterProvider:Bs,presetDEMethodProvider:Qn,presetUIActionProvider:ac,registerAppCounterProvider:zi,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Os,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ws,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(Ki,"_").concat(t),e)},registerDEMethodProvider:Ts,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Yi,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat($i,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(ts,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Vs,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(is,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:Cs,registerPortletProvider:function(t,e){ibiz.register.register("".concat(os,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(Ss,"_").concat(t),e)},registerUIActionProvider:ls,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(ps,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(fs,"_").concat(t),e)},strContain:Ue,testCond:Fe,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await _e(t,e,a);await ibiz.commands.execute(Eo.TAG,i.viewId,i.context,i.params,i.opts)},verifyDeRules:Ke,verifyFormGroupLogic:He,verifyPanelGroupLogic:Ye});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function vt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var yt={exports:{}};!function(t,e){t.exports=function(t,e,a){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var a;1===e.length&&e[0].length>0&&(e=e[0]),a=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](a)||(a=e[i]);return a};a.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},a.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}}}(yt);var It=vt(yt.exports),Dt={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Dt);var Ct=vt(Dt.exports),At={exports:{}};!function(t,e){var a,i;t.exports=(a="month",i="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var n=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):n.bind(this)(t,e)};var o=s.startOf;s.startOf=function(t,e){var s=this.$utils(),n=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return n?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return o.bind(this)(t,e)}})}(At);var bt=vt(At.exports),Pt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var n=e.prototype;n.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var n=s(this).startOf(i).add(1,i).date(e),o=s(this).endOf(a);if(n.isBefore(o))return 1}var r=s(this).startOf(i).date(e).startOf(a).subtract(1,"millisecond"),c=this.diff(r,a,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},n.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Pt);var Tt=vt(Pt.exports),xt={exports:{}};!function(t,e){var a;t.exports=(a="day",function(t,e,i){var s=function(t){return t.add(4-t.isoWeekday(),a)},n=e.prototype;n.isoWeekYear=function(){return s(this).year()},n.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,a));return r.diff(c,"week")+1},n.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var o=n.startOf;n.startOf=function(t,e){var a=this.$utils(),i=!!a.u(e)||e;return"isoweek"===a.p(t)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):o.bind(this)(t,e)}})}(xt);var Nt=vt(xt.exports),St=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0}}},Lt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Rt=t("DefaultErrorHandler",class{handle(t){return t instanceof a||t instanceof i?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error("没有注册无权限错误处理器"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof n?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof o&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Ot=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error("没有找到能处理该错误的处理器",t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),Mt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};Mt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var _t=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Vt=class extends _t{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const a=t.filter((t=>!!t)).length===t.length;return Mt.handleJudgmentExecute(this,a,e)}},Ft=class extends _t{constructor(t){super(t,"camelCase")}onExecute(t){return t?V(t):""}},kt=class extends _t{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Wt=class extends _t{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Bt=class extends _t{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ut=class extends _t{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return Mt.handleJudgmentExecute(this,i,a)}},zt=class extends _t{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=R(t)?!F(B(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),Mt.handleJudgmentExecute(this,s,i)}},Gt=class extends _t{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},jt=class extends _t{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Kt=class extends _t{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Xt=class extends _t{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=U(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ht=class extends _t{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=z(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Yt=class extends _t{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},qt=class extends _t{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return Mt.handleJudgmentExecute(this,a,e)}},Qt=class extends _t{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const i=t.find((t=>!!t));if(a.fn){const t=(null==(e=a.data)?void 0:e.root)||{};return i?a.fn(t):a.inverse(t)}return i||""}},$t=class extends _t{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},Jt=class extends _t{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},Zt=class extends _t{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},te=class extends _t{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var ee=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var a;return this.hsb=t.default||t,this.p=null,a=this.hsb,new Vt(a),new Ft(a),new kt(a),new Wt(a),new Bt(a),new Ut(a),new Gt(a),new jt(a),new Kt(a),new Xt(a),new Ht(a),new Yt(a),new qt(a),new Qt(a),new $t(a),new Jt(a),new Zt(a),new te(a),new zt(a),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function ae(t){const e=[],a=/^%(.+)%$/;for(const i in t){let s=!0,n=t[i];H(t[i])&&a.test(t[i])&&(s=!1,n=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:n})}return e}function ie(t,...e){if(!t||S(t))return{};return ne(Array.isArray(t)?t:ae(t),...e)}function se(t,e){const a=t.find((t=>!Y(t)&&(t[e]||Object.prototype.hasOwnProperty.call(t,e))));return{find:!!a,value:null==a?void 0:a[e]}}function ne(t,...e){const a=/\$\{[^}]*\}/g,i={};for(const s of t)if(s.rawValue)i[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(a);if(null!==t){let a=s.value;t.forEach((t=>{const{find:i,value:s}=se(e,t.slice(2,-1).toLowerCase());i&&(a=a.replace(t,"".concat(s)))})),i[s.key.toLowerCase()]=a}else{const{find:t,value:a}=se(e,s.value.toLowerCase());t&&(i[s.key.toLowerCase()]=a)}}return i}function oe(t,e){const a={};if(!t)return a;const i=Array.isArray(t)?t:ae(t),s=e[0];return i.forEach((t=>{const{rawValue:i,value:n}=t;!i&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(a[n]=e.map((t=>t[n])).join(";"))})),a}function re(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(a&&(h[a]=p),i&&(u[i]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=ie(n,d,c,r),f=ie(o,d,c,r);return Object.assign(h,m),Object.assign(u,f),{resultContext:h,resultParams:u}}function ce(t,e){if(t&&e){const a=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(a)return a}return null}function de(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:e,navigateParams:a,other:i}}function le(t){let e;if(t.controlRenders){const a=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==a?void 0:a.layoutPanel}return e}function he(t){const{width:e,height:a,widthMode:i,heightMode:s}=t,n={width:"",height:""};return"FULL"===i?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?n.height="100%":a&&a>0&&(n.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),n}function ue(t,e){const a=[],i=je.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return L(i)?a.push(i):R(i)?a.push(...i):O(i)&&Object.keys(i).forEach((t=>{i[t]&&a.push(t)})),a}function pe(t,e){const{mainStateAppDEFieldIds:a,demainStates:i}=t;if(a&&i){const t=[];return a.forEach((a=>{t.push(e[a])})),i.find((e=>{const{stateValue:a,state2Value:i,state3Value:s}=e;let n=!0;const o=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function me(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,n=(null==i?void 0:i.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...a.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function fe(t){return t.split(".").pop()}function ge(t,e){const a=fe(e);return H(t[a])}function we(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function Ee(t,e){var a,i;const s=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>s.includes(t.id))))||[]}function ve(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function ye(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Ie(t){return t.detreeNodes.find((t=>t.rootNode))}function De(t,e){return t.detreeNodes.find((t=>t.id===e))}function Ce(t,e){const a=e.parentId||Ie(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(i=t.searchMode,s=e.hasQuery,3===i||(s?1===i:2===i));var i,s}))}function Ae(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function be(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Pe(t){return"MDCTRL"===t.detailType}function Te(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function xe(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Ne(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn("未支持的引擎分类:".concat(t.engineType)),!1)))}function Se(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Le=["panelItems","panelTabPages","rootPanelItems"];function Re(t){let e=[];for(const a of Le)if(t[a]){e=t[a];break}const a=[];return e.length&&(a.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Se(t)||a.push(...Re(t))}))),a}function Oe(t){return Re(t)}async function Me(t,e,a={},i={}){return async function(t,e,a={},i={}){let s;try{s=await Ve(t,e,a,i)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const a=window.open(t,"_blank");a&&(a.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Eo.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,a,i)}async function _e(t,e,a={}){const i=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(i+1,e.length)),n=ot.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o("未找到指定实体的codeName: ".concat(r));n[c.toLowerCase()]=n[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete n.srfdename,"undo"!==n.srfwf){const t=n.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=a}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:a,viewId:l.id}}async function Ve(t,e,i={},s={}){var n;const r=ie(t.appViewNavContexts||[],i,e);e=Object.assign(e.clone(),r);const c=ie(t.appViewNavParams||[],i,e);Object.assign(i,c);const d=t.appDataEntityId,l=fe(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||i[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,i);if(t.ok){h=t.data;let a=h.linkurl;if(a){if(e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://"))return{type:"url",url:a};if(a.startsWith("appredirectview?")){return{type:"view",...await _e(e,a,s)}}throw new o("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(d,t.appId),g=await async function(t,e,a,i){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:a}=ve(t,n),s=i[a.toLowerCase()];if(H(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(n,"]值为空"),i)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(H(r))return H(a.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=ve(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(Y(c)&&t.formTypeAppDEFieldId){const{codeName:e}=ve(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=H(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(f,t,i,h);let w="";if(!g.startsWith("view://")){const n=g.split(":"),o=2===n.length?g:n.slice(0,2).join(":"),r="".concat(f.name.toUpperCase(),":").concat(g),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===g||e===o}));if(d){if(w=d.refAppViewId,w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(d,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(g,"]或[").concat(r,"]或工作流[").concat(o,"]对应视图"))}{const t=new URL(g);t.searchParams.size>0&&t.searchParams.forEach(((t,e)=>{i[e]=t}));const e=t.pathname.replace("//","").split("/"),[a,s]=e;w=s||a}if(w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(t,"标识[".concat(g,"]未匹配到实际引用视图"))}function Fe(t,e,a){if(Object.is(e,"IN"))return Be(t,a);if(Object.is(e,"NOTIN"))return!Be(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return ke(t,a)<0;case"LTANDEQ":return ke(t,a)<=0;case"GT":return ke(t,a)>0;case"GTANDEQ":return ke(t,a)>=0;case"ISNULL":return Y(t);case"ISNOTNULL":return H(t);case"TESTNULL":return rt(t);case"IN":return Be(t,a);case"NOTIN":return!Be(t,a);case"LIKE":return Ue(t,a);case"LEFTLIKE":return Ue(t,a,"start");case"RIGHTLIKE":return Ue(t,a,"end");default:throw new o("值操作:".concat(e,",暂未支持"))}}function ke(t,e){const a=Number(t),i=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(i))return We(a,i);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return We(s,n);throw new o("".concat(t," 和 ").concat(e," 无法比较大小"))}function We(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Be(t,e){if(!e||"string"!=typeof e)throw new o("范围比较的条件值不存或者不是字符串");if(t){return e.split(",").includes("".concat(t))}return!1}function Ue(t,e,a){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=i.indexOf(s);switch(a){case"start":return 0===n;case"end":return n+s.length===i.length;default:return-1!==n}}var ze={singleRowReturn:!1,isAsync:!0},Ge=t("ScriptFunction",class{constructor(t,e,a=ze){this.argKeys=[],this.options=a;const i=this.formatCode(e,a);this.calcArgKeys(t,a);const s=new Function(...this.argKeys,i);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error("报错脚本",i),t}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?ct(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),i.push(a[t])})),i}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),je=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Ge(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function Ke(t,e,a){const i={isPast:!0,infoMessage:a.ruleInfo};if(function(t){return"GROUP"===t.condType}(a)){const s=a.conds;s&&s.length>0&&(i.isPast=function(t,e,a="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===a;for(let i=0,n=t.length;i<n;i++){const n=e(t[i],i);if("AND"===a){if(!n){s=!1;break}}else if("OR"===a&&n){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:n}=Ke(t,e,a);return i.infoMessage=n,s}),a.condOp,!!a.notMode),!i.isPast&&("AND"===a.condOp&&a.notMode||"OR"===a.condOp&&!a.notMode)&&(i.infoMessage=a.ruleInfo))}else{t=(null==a?void 0:a.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=n[a=a?a.toLowerCase():""]?n[a]:a}(rt(i)||dt(i))&&(i="内容必须符合值规则");const c=Fe(t,e,a);if(!c&&r)throw new o(i);return!c}(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){Y(n)&&(n="值必须符合值范围规则");if(Y(t)){if(r)throw new o("值为空");return n="值为空",!0}if(Xe(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!=i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"REGEX"===t.condType}(a))i.isPast=!Xe(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){Y(n)&&(n="内容长度必须符合范围规则");if(Y(t)){if(r)throw new o("值为空");return n="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!==i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(a)&&(null==a?void 0:a.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Xe(e[t],n,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,a,i,s){Y(i)&&(i="值必须符合脚本规则");const n=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=je.execScriptFn({value:t,data:n},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(i="",!c&&s)throw new o(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=n||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=a.notMode?!i.isPast:i.isPast}return i}function Xe(t,e,a,i){Y(a)&&(a="值必须符合正则规则");if(Y(t)){if(i)throw new o("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new o(a);return!0}return a="",!1}function He(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.defdlogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!He(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>He(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Fe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}function Ye(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.panelItemLogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!Ye(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>Ye(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Fe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}var qe=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=lt(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:i,mainMenuAlign:s}=t;let n="";i?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(a,"_").concat(n):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function Qe(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var $e=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))($e||{})),Je=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(Je||{})),Ze=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(Ze||{})),ta=t("StudioViewEvents",class{});ta.onViewMounted="onMounted",ta.onViewDestroyed="onDestroyed";var ea=t("StudioPanelEvents",class{});ea.onClick="onClick",ea.onChange="onChange",ea.onEnter="onEnter",ea.onLeave="onLeave";var aa=t("StudioControlEvents",class{});aa.onBeforeLoad="onBeforeLoad",aa.onLoadSuccess="onLoadSuccess",aa.onLoadError="onLoadError",aa.onBeforeLoadDraft="onBeforeLoadDraft",aa.onLoadDraftSuccess="onLoadDraftSuccess",aa.onLoadDraftError="onLoadDraftError",aa.onBeforeSave="onBeforeSave",aa.onSaveSuccess="onSaveSuccess",aa.onSaveError="onSaveError",aa.onBeforeRemove="onBeforeRemove",aa.onRemoveSuccess="onRemoveSuccess",aa.onRemoveError="onRemoveError",aa.CLICK="onClick";var ia=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(ia||{})),sa=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(sa||{})),na=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(na||{})),oa=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(oa||{})),ra=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))(ra||{})),ca=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(ca||{})),da=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new q,beforeDismiss:new q},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function la(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var ha=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),ua=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=lt(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let a=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];a+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}a+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=a,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),pa=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn("事务已经开启, 单个界面域只能开启一个事务"):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error("当前事务未提交,不可以直接关闭事务");this.state.isOpen=!1}},ma=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new pa,this.id=t||Q()}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const a=t.majorAppDataEntityId;this.rs2Map.has(a)||this.rs2Map.set(a,[]),this.rs2Map.get(a).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),fa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ma(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error("无效的界面域标识[".concat(t,"]"))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),ga=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}}),wa=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new $}add(t,e){this.stack.push(e),this.stackMap.set(t,e),this.recalculateActiveStack(),this.evt.emit("add",e),this.evt.emit("change",{type:"add",view:e})}remove(t){const e=this.stackMap.get(t);e&&(this.stack.splice(this.stack.indexOf(e),1),this.stackMap.delete(t),this.recalculateActiveStack(),this.evt.emit("remove",e),this.evt.emit("change",{type:"remove",view:e}))}getActives(){return this.activeStack}active(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("active",e),this.evt.emit("change",{type:"active",view:e}))}deactivate(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("deactivate",e),this.evt.emit("change",{type:"deactivate",view:e}))}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function Ea(t,e=!0){const a=await Promise.allSettled(t),i=[],s=[];if(a.forEach((t=>{"fulfilled"===t.status?i.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return i}var va={position:"fixed",zIndex:"10000"};function ya(t,e=document.body,a=!0){const i=Da(t);if(null==i)throw new Error("Cannot clone a null or undefined element.");const s=i.cloneNode(!0);if(a)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:a,boundingLeft:i,boundingTop:s}){t.style.left="".concat(i,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(a,"px"),Object.assign(t.style,va)}(s,Ia(i)),e.appendChild(s),s}function Ia(t){const e=t.offsetWidth,a=t.offsetHeight,i=window.getComputedStyle(t),s=parseFloat(i.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:a,padding:s,boundingLeft:n,boundingTop:o}}function Da(t){return"string"==typeof t?document.querySelector(t):t}var Ca={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Aa={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},ba=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Pa={CSS:{},springs:{}};function Ta(t,e,a){return Math.min(Math.max(t,e),a)}function xa(t,e){return t.indexOf(e)>-1}function Na(t,e){return t.apply(null,e)}var Sa={arr:function(t){return Array.isArray(t)},obj:function(t){return xa(Object.prototype.toString.call(t),"Object")},pth:function(t){return Sa.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Sa.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Sa.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Sa.hex(t)||Sa.rgb(t)||Sa.hsl(t)},key:function(t){return!Ca.hasOwnProperty(t)&&!Aa.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function La(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Ra(t,e){var a=La(t),i=Ta(Sa.und(a[0])?1:a[0],.1,100),s=Ta(Sa.und(a[1])?100:a[1],.1,100),n=Ta(Sa.und(a[2])?10:a[2],.1,100),o=Ta(Sa.und(a[3])?0:a[3],.1,100),r=Math.sqrt(s/i),c=n/(2*Math.sqrt(s*i)),d=c<1?r*Math.sqrt(1-c*c):0,l=1,h=c<1?(c*r-o)/d:-o+r;function u(t){var a=e?e*t/1e3:t;return a=c<1?Math.exp(-a*c*r)*(l*Math.cos(d*a)+h*Math.sin(d*a)):(l+h*a)*Math.exp(-a*r),0===t||1===t?t:1-a}return e?u:function(){var e=Pa.springs[t];if(e)return e;for(var a=1/6,i=0,s=0;;)if(1===u(i+=a)){if(++s>=16)break}else s=0;var n=i*a*1e3;return Pa.springs[t]=n,n}}function Oa(t){return void 0===t&&(t=10),function(e){return Math.ceil(Ta(e,1e-6,1)*t)*(1/t)}}var Ma,_a,Va=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function a(t,e){return 3*e-6*t}function i(t){return 3*t}function s(t,s,n){return((e(s,n)*t+a(s,n))*t+i(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*a(s,n)*t+i(s)}return function(e,a,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var r=new Float32Array(11);if(e!==a||i!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,i);return function(t){return e===a&&i===o||0===t||1===t?t:s(d(t),a,o)}}function d(a){for(var o=0,c=1;10!==c&&r[c]<=a;++c)o+=t;--c;var d=o+(a-r[c])/(r[c+1]-r[c])*t,l=n(d,e,i);return l>=.001?function(t,e,a,i){for(var o=0;o<4;++o){var r=n(e,a,i);if(0===r)return e;e-=(s(e,a,i)-t)/r}return e}(a,d,e,i):0===l?d:function(t,e,a,i,n){var o,r,c=0;do{(o=s(r=e+(a-e)/2,i,n)-t)>0?a=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(a,o,o+t,e,i)}}}(),Fa=(Ma={linear:function(){return function(t){return t}}},_a={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,a=4;t<((e=Math.pow(2,--a))-1)/11;);return 1/Math.pow(4,3-a)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var a=Ta(t,1,10),i=Ta(e,.1,2);return function(t){return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/i)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){_a[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(_a).forEach((function(t){var e=_a[t];Ma["easeIn"+t]=e,Ma["easeOut"+t]=function(t,a){return function(i){return 1-e(t,a)(1-i)}},Ma["easeInOut"+t]=function(t,a){return function(i){return i<.5?e(t,a)(2*i)/2:1-e(t,a)(-2*i+2)/2}},Ma["easeOutIn"+t]=function(t,a){return function(i){return i<.5?(1-e(t,a)(1-2*i))/2:(e(t,a)(2*i-1)+1)/2}}})),Ma);function ka(t,e){if(Sa.fnc(t))return t;var a=t.split("(")[0],i=Fa[a],s=La(t);switch(a){case"spring":return Ra(t,e);case"cubicBezier":return Na(Va,s);case"steps":return Na(Oa,s);default:return Na(i,s)}}function Wa(t){try{return document.querySelectorAll(t)}catch(t){return}}function Ba(t,e){for(var a=t.length,i=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<a;n++)if(n in t){var o=t[n];e.call(i,o,n,t)&&s.push(o)}return s}function Ua(t){return t.reduce((function(t,e){return t.concat(Sa.arr(e)?Ua(e):e)}),[])}function za(t){return Sa.arr(t)?t:(Sa.str(t)&&(t=Wa(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Ga(t,e){return t.some((function(t){return t===e}))}function ja(t){var e={};for(var a in t)e[a]=t[a];return e}function Ka(t,e){var a=ja(t);for(var i in t)a[i]=e.hasOwnProperty(i)?e[i]:t[i];return a}function Xa(t,e){var a=ja(t);for(var i in e)a[i]=Sa.und(t[i])?e[i]:t[i];return a}function Ha(t){return Sa.rgb(t)?(a=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+a[1]+",1)":e:Sa.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,a,i){return e+e+a+a+i+i})),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)+",1)"}(t):Sa.hsl(t)?function(t){var e,a,i,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),n=parseInt(s[1],10)/360,o=parseInt(s[2],10)/100,r=parseInt(s[3],10)/100,c=s[4]||1;function d(t,e,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?t+6*(e-t)*a:a<.5?e:a<2/3?t+(e-t)*(2/3-a)*6:t}if(0==o)e=a=i=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),a=d(h,l,n),i=d(h,l,n-1/3)}return"rgba("+255*e+","+255*a+","+255*i+","+c+")"}(t):void 0;var e,a}function Ya(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function qa(t,e){return Sa.fnc(t)?t(e.target,e.id,e.total):t}function Qa(t,e){return t.getAttribute(e)}function $a(t,e,a){if(Ga([a,"deg","rad","turn"],Ya(e)))return e;var i=Pa.CSS[e+a];if(!Sa.und(i))return i;var s=document.createElement(t.tagName),n=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;n.appendChild(s),s.style.position="absolute",s.style.width=100+a;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return Pa.CSS[e+a]=r,r}function Ja(t,e,a){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return a?$a(t,s,a):s}}function Za(t,e){return Sa.dom(t)&&!Sa.inp(t)&&(!Sa.nil(Qa(t,e))||Sa.svg(t)&&t[e])?"attribute":Sa.dom(t)&&Ga(ba,e)?"transform":Sa.dom(t)&&"transform"!==e&&Ja(t,e)?"css":null!=t[e]?"object":void 0}function ti(t){if(Sa.dom(t)){for(var e,a=t.style.transform||"",i=/(\w+)\(([^)]*)\)/g,s=new Map;e=i.exec(a);)s.set(e[1],e[2]);return s}}function ei(t,e,a,i){var s=xa(e,"scale")?1:0+function(t){return xa(t,"translate")||"perspective"===t?"px":xa(t,"rotate")||xa(t,"skew")?"deg":void 0}(e),n=ti(t).get(e)||s;return a&&(a.transforms.list.set(e,n),a.transforms.last=e),i?$a(t,n,i):n}function ai(t,e,a,i){switch(Za(t,e)){case"transform":return ei(t,e,i,a);case"css":return Ja(t,e,a);case"attribute":return Qa(t,e);default:return t[e]||0}}function ii(t,e){var a=/^(\*=|\+=|-=)/.exec(t);if(!a)return t;var i=Ya(t)||0,s=parseFloat(e),n=parseFloat(t.replace(a[0],""));switch(a[0][0]){case"+":return s+n+i;case"-":return s-n+i;case"*":return s*n+i}}function si(t,e){if(Sa.col(t))return Ha(t);if(/\s/g.test(t))return t;var a=Ya(t),i=a?t.substr(0,t.length-a.length):t;return e?i+e:i}function ni(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function oi(t){for(var e,a=t.points,i=0,s=0;s<a.numberOfItems;s++){var n=a.getItem(s);s>0&&(i+=ni(e,n)),e=n}return i}function ri(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*Qa(t,"r")}(t);case"rect":return function(t){return 2*Qa(t,"width")+2*Qa(t,"height")}(t);case"line":return function(t){return ni({x:Qa(t,"x1"),y:Qa(t,"y1")},{x:Qa(t,"x2"),y:Qa(t,"y2")})}(t);case"polyline":return oi(t);case"polygon":return function(t){var e=t.points;return oi(t)+ni(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function ci(t,e){var a=e||{},i=a.el||function(t){for(var e=t.parentNode;Sa.svg(e)&&Sa.svg(e.parentNode);)e=e.parentNode;return e}(t),s=i.getBoundingClientRect(),n=Qa(i,"viewBox"),o=s.width,r=s.height,c=a.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:i,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function di(t,e,a){function i(a){void 0===a&&(a=0);var i=e+a>=1?e+a:0;return t.el.getPointAtLength(i)}var s=ci(t.el,t.svg),n=i(),o=i(-1),r=i(1),c=a?1:s.w/s.vW,d=a?1:s.h/s.vH;switch(t.property){case"x":return(n.x-s.x)*c;case"y":return(n.y-s.y)*d;case"angle":return 180*Math.atan2(r.y-o.y,r.x-o.x)/Math.PI}}function li(t,e){var a=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=si(Sa.pth(t)?t.totalLength:t,e)+"";return{original:i,numbers:i.match(a)?i.match(a).map(Number):[0],strings:Sa.str(t)||e?i.split(a):[]}}function hi(t){return Ba(t?Ua(Sa.arr(t)?t.map(za):za(t)):[],(function(t,e,a){return a.indexOf(t)===e}))}function ui(t){var e=hi(t);return e.map((function(t,a){return{target:t,id:a,total:e.length,transforms:{list:ti(t)}}}))}function pi(t,e){var a=ja(e);if(/^spring/.test(a.easing)&&(a.duration=Ra(a.easing)),Sa.arr(t)){var i=t.length;2===i&&!Sa.obj(t[0])?t={value:t}:Sa.fnc(e.duration)||(a.duration=e.duration/i)}var s=Sa.arr(t)?t:[t];return s.map((function(t,a){var i=Sa.obj(t)&&!Sa.pth(t)?t:{value:t};return Sa.und(i.delay)&&(i.delay=a?0:e.delay),Sa.und(i.endDelay)&&(i.endDelay=a===s.length-1?e.endDelay:0),i})).map((function(t){return Xa(t,a)}))}function mi(t,e){var a=[],i=e.keyframes;for(var s in i&&(e=Xa(function(t){for(var e=Ba(Ua(t.map((function(t){return Object.keys(t)}))),(function(t){return Sa.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),a={},i=function(i){var s=e[i];a[s]=t.map((function(t){var e={};for(var a in t)Sa.key(a)?a==s&&(e.value=t[a]):e[a]=t[a];return e}))},s=0;s<e.length;s++)i(s);return a}(i),e)),e)Sa.key(s)&&a.push({name:s,tweens:pi(e[s],t)});return a}function fi(t,e){var a;return t.tweens.map((function(i){var s=function(t,e){var a={};for(var i in t){var s=qa(t[i],e);Sa.arr(s)&&1===(s=s.map((function(t){return qa(t,e)}))).length&&(s=s[0]),a[i]=s}return a.duration=parseFloat(a.duration),a.delay=parseFloat(a.delay),a}(i,e),n=s.value,o=Sa.arr(n)?n[1]:n,r=Ya(o),c=ai(e.target,t.name,r,e),d=a?a.to.original:c,l=Sa.arr(n)?n[0]:d,h=Ya(l)||Ya(c),u=r||h;return Sa.und(o)&&(o=d),s.from=li(l,u),s.to=li(ii(o,l),u),s.start=a?a.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=ka(s.easing,s.duration),s.isPath=Sa.pth(n),s.isPathTargetInsideSVG=s.isPath&&Sa.svg(e.target),s.isColor=Sa.col(s.from.original),s.isColor&&(s.round=1),a=s,s}))}var gi={css:function(t,e,a){return t.style[e]=a},attribute:function(t,e,a){return t.setAttribute(e,a)},object:function(t,e,a){return t[e]=a},transform:function(t,e,a,i,s){if(i.list.set(e,a),e===i.last||s){var n="";i.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function wi(t,e){ui(t).forEach((function(t){for(var a in e){var i=qa(e[a],t),s=t.target,n=Ya(i),o=ai(s,a,n,t),r=ii(si(i,n||Ya(o)),o),c=Za(s,a);gi[c](s,a,r,t.transforms,!0)}}))}function Ei(t,e){return Ba(Ua(t.map((function(t){return e.map((function(e){return function(t,e){var a=Za(t.target,e.name);if(a){var i=fi(e,t),s=i[i.length-1];return{type:a,property:e.name,animatable:t,tweens:i,duration:s.end,delay:i[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Sa.und(t)}))}function vi(t,e){var a=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=a?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,s.delay=a?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,s.endDelay=a?s.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,s}var yi=0;var Ii=[],Di=function(){var t;function e(a){for(var i=Ii.length,s=0;s<i;){var n=Ii[s];n.paused?(Ii.splice(s,1),i--):(n.tick(a),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ai.suspendWhenDocumentHidden&&(Ci()?t=cancelAnimationFrame(t):(Ii.forEach((function(t){return t._onDocumentVisibility()})),Di()))})),function(){t||Ci()&&Ai.suspendWhenDocumentHidden||!(Ii.length>0)||(t=requestAnimationFrame(e))}}();function Ci(){return!!document&&document.hidden}function Ai(t){void 0===t&&(t={});var e,a=0,i=0,s=0,n=0,o=null;function r(t){var e=window.Promise&&new Promise((function(t){return o=t}));return t.finished=e,e}var c=function(t){var e=Ka(Ca,t),a=Ka(Aa,t),i=mi(a,t),s=ui(t.targets),n=Ei(s,i),o=vi(n,a),r=yi;return yi++,Xa(e,{id:r,children:[],animatables:s,animations:n,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function l(t){return c.reversed?c.duration-t:t}function h(){a=0,i=l(c.currentTime)*(1/Ai.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,a=c.animations,i=a.length;e<i;){var s=a[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=Ba(o,(function(e){return t<e.end}))[0]||d);for(var l=Ta(t-d.start-d.delay,0,d.duration)/d.duration,h=isNaN(l)?1:d.easing(l),u=d.to.strings,p=d.round,m=[],f=d.to.numbers.length,g=void 0,w=0;w<f;w++){var E=void 0,v=d.to.numbers[w],y=d.from.numbers[w]||0;E=d.isPath?di(d.value,h*v,d.isPathTargetInsideSVG):y+h*(v-y),p&&(d.isColor&&w>2||(E=Math.round(E*p)/p)),m.push(E)}var I=u.length;if(I){g=u[0];for(var D=0;D<I;D++){u[D];var C=u[D+1],A=m[D];isNaN(A)||(g+=C?A+C:A+" ")}}else g=m[0];gi[s.type](n.target,s.property,g,n.transforms),s.currentValue=g,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function f(t){var h=c.duration,f=c.delay,g=h-c.endDelay,w=l(t);c.progress=Ta(w/h*100,0,100),c.reversePlayback=w<c.currentTime,e&&function(t){if(c.reversePlayback)for(var a=n;a--;)u(t,e[a]);else for(var i=0;i<n;i++)u(t,e[i])}(w),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),w<=f&&0!==c.currentTime&&p(0),(w>=g&&c.currentTime!==h||!h)&&p(h),w>f&&w<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Ta(w,0,h),c.began&&m("update"),t>=h&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(a=s,m("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,m("loopComplete"),m("complete"),!c.passThrough&&"Promise"in window&&(o(),r(c)))))}return r(c),c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var a=n=e.length;a--;)c.children[a].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,p(c.reversed?c.duration:0)},c._onDocumentVisibility=h,c.set=function(t,e){return wi(t,e),c},c.tick=function(t){s=t,a||(a=s),f((s+(i-a))*Ai.speed)},c.seek=function(t){f(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,Ii.push(c),h(),Di())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){Pi(hi(t),c)},c.reset(),c.autoplay&&c.play(),c}function bi(t,e){for(var a=e.length;a--;)Ga(t,e[a].animatable.target)&&e.splice(a,1)}function Pi(t,e){var a=e.animations,i=e.children;bi(t,a);for(var s=i.length;s--;){var n=i[s],o=n.animations;bi(t,o),o.length||n.children.length||i.splice(s,1)}a.length||i.length||e.pause()}Ai.version="3.2.1",Ai.speed=1,Ai.suspendWhenDocumentHidden=!0,Ai.running=Ii,Ai.remove=function(t){for(var e=hi(t),a=Ii.length;a--;){Pi(e,Ii[a])}},Ai.get=ai,Ai.set=wi,Ai.convertPx=$a,Ai.path=function(t,e){var a=Sa.str(t)?Wa(t)[0]:t,i=e||100;return function(t){return{property:t,el:a,svg:ci(a),totalLength:ri(a)*(i/100)}}},Ai.setDashoffset=function(t){var e=ri(t);return t.setAttribute("stroke-dasharray",e),e},Ai.stagger=function(t,e){void 0===e&&(e={});var a=e.direction||"normal",i=e.easing?ka(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Sa.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=Ya(l?t[1]:t)||0,m=e.start||0+(l?h:0),f=[],g=0;return function(t,e,w){if(r&&(o=0),c&&(o=(w-1)/2),d&&(o=w-1),!f.length){for(var E=0;E<w;E++){if(s){var v=c?(s[0]-1)/2:o%s[0],y=c?(s[1]-1)/2:Math.floor(o/s[0]),I=v-E%s[0],D=y-Math.floor(E/s[0]),C=Math.sqrt(I*I+D*D);"x"===n&&(C=-I),"y"===n&&(C=-D),f.push(C)}else f.push(Math.abs(o-E));g=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/g)*g}))),"reverse"===a&&(f=f.map((function(t){return n?t<0?-1*t:-t:Math.abs(g-t)})))}return m+(l?(u-h)/g:h)*(Math.round(100*f[e])/100)+p}},Ai.timeline=function(t){void 0===t&&(t={});var e=Ai(t);return e.duration=0,e.add=function(a,i){var s=Ii.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&Ii.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=Xa(a,Ka(Aa,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Sa.und(i)?d:ii(i,d),o(e),e.seek(c.timelineOffset);var l=Ai(c);o(l),n.push(l);var h=vi(n,t);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Ai.easing=ka,Ai.penner=Fa,Ai.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var Ti=Ai,xi={duration:1e3,loop:!1,easing:"easeInOutSine"};function Ni(t,e){const a={};if(e.complete&&t.complete){const i=e.complete,s=t.complete;a.complete=t=>{i(t),s(t)}}return{...t,...e,...a}}function Si(t,e,a={}){const{left:i,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-i,c=o-s;return new Promise((e=>{const i=Ni({targets:t,translateX:r,translateY:c,...xi,complete:()=>{e(!0)}},a);Ti(i)}))}var Li=t("AnimeUtil",class{async movePoint(t,e,a={}){const i=Da(e);if(!i)return ibiz.log.debug("终点元素不存在"),!1;const s=ya(t,document.body);if(!s)return ibiz.log.debug("动画元素不存在"),!1;const{padding:n,width:o,height:r}=Ia(s),c={borderRadius:["0%","50%"],maxWidth:[o,"6px"],maxHeight:[r,"6px"],minWidth:[o,"6px"],minHeight:[r,"6px"],padding:[n,"6px"],duration:700};Object.assign(c,a);const d=await Si(s,i,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,a={}){return Si(t,e,a)}resize(t,e={}){return function(t,e={}){return new Promise((a=>{const i=Ni({scale:[1,.8,1],targets:t,...xi,complete:()=>{a(!0)}},e);Ti(i)}))}(t,e)}async moveAndResize(t,e,a={}){const i=await this.movePoint(t,e,a);return i&&await this.resize(e,{duration:500}),i}}),Ri=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==a)return!1;let i=-1;if(e==a?i=0:e>a&&(i=1),"EQ"===t||"ABSEQ"===t)return 0===i;if("GT"===t)return i>0;if("GTANDEQ"===t)return i>=0;if("LT"===t)return i<0;if("LTANDEQ"===t)return i<=0;if("NOTEQ"===t)return 0!==i}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Oi=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Mi=class extends Oi{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let n=0;n<e;n++)if(a){const e=t[n];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[n];this.setParam(e),i=!1,s=!0}else if(s){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},_i=class t extends Oi{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,n=!1;for(let r=0;r<a;r++){if(i&&s){if("!"===e[r]){this.setNotMode(!0),i=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,i=!1,n=!0}else if(n){const a=e[r];if(!(a instanceof Array))throw new o("值必须为数组");a.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new Mi;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Vi=class extends _i{},Fi=class extends Mi{},ki=class t extends Ri{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof _i){const t=e.getChildPSModelCondBases();if(null==t||dt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let n=s;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,a,i)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Mi){dt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||dt(o)?n=e.getValue():(dt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===o?n=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Fi}createPSModelGroupCond(){return new Vi}};ki.PARAMTYPE_DATACONTEXT="DATACONTEXT",ki.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Wi=t("PSDEDQCondEngine",ki);async function Bi(t,e){var a;const i=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(i)return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode);ibiz.log.error("未匹配到插件[".concat(t,"]模型"))}var Ui=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function zi(t,e){ibiz.register.register("".concat(Ui,"_").concat(t),e)}function Gi(t){return ibiz.register.get("".concat(Ui,"_").concat(t))}async function ji(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=Gi(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Gi(a),e)return e;throw new o("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Gi(i),e)return e;throw new o("找不系统计数器类型".concat(i,"对应的适配器"))}var Ki=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Xi(t){return ibiz.register.get("".concat(Ki,"_").concat(t))}async function Hi(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=Xi(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Xi("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=Xi(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var Yi=t("EDITOR_PROVIDER_PREFIX","EDITOR");function qi(t){return ibiz.register.get("".concat(Yi,"_").concat(t))}async function Qi(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Bi(n,o);if(t&&(e=qi(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=qi("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let n="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(n+="_".concat(i)),e=qi(n),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=qi(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var $i=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Ji(t){return ibiz.register.get("".concat($i,"_").concat(t))}async function Zi(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Bi(i,s);if(t&&(e=Ji(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=Ji(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var ts=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function es(t){return ibiz.register.get("".concat(ts,"_").concat(t))}async function as(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=es(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const o=i?"".concat(a,"_EDIT"):a;if(e=es(o),e)return e;ibiz.log.error("找不到表格列类型".concat(o,"对应的适配器"))}var is=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function ss(t){return ibiz.register.get("".concat(is,"_").concat(t.toUpperCase()))}async function ns(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:n,controlRenders:o}=t;if(s){const t=await Bi(s,n);if(t&&(a=ss(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if(o&&o.length>0)a=ss("PREDEFINE_RENDER");else{if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=ss(i),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器,注册key为").concat(i))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT",s="RAWITEM_".concat(i);if(a=ss(s),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器,注册key为").concat(s))}if("FIELD"===i){const{editor:e}=t;if(e&&e.predefinedType){if(a=ss("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}a=ss(i)}if(a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var os=t("PORTLET_PROVIDER_PREFIX","PORTLET");function rs(t){return ibiz.register.get("".concat(os,"_").concat(t))}async function cs(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Bi(i,s);if(t&&(e=rs(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=rs(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var ds=t("UIACTION_PROVIDER_PREFIX","UIACTION");function ls(t,e){ibiz.register.register("".concat(ds,"_").concat(t),e)}function hs(t){return ibiz.register.get("".concat(ds,"_").concat(t))}async function us(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:n}=t;if(i){const t=await Bi(i,s);if(t&&(e=hs(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=hs("".concat(a,"_").concat(n)),e)return e;if(e=hs(a),e)return e;throw new o("找不界面行为模式".concat(a,"对应的适配器"))}var ps=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function ms(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Bi(a,i);if(s){if(e=ibiz.register.get("".concat(ps,"_").concat(s)),e)return e;throw new o("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var fs=t("VIEW_PROVIDER_PREFIX","VIEW");function gs(t){return ibiz.register.get("".concat(fs,"_").concat(t))}var ws=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var Es=t("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new o("文件流数据不存在")}}),vs=t("BrowserPlatformProvider",class extends Es{});var ys=window.navigator.userAgent.toLowerCase();function Is(){return/Android|Adr/i.test(ys)?"Android":/iPhone|iPod|iPad/i.test(ys)?"IOS":/MicroMessenger/i.test(ys)?"WeChat":/DingTalk/i.test(ys)?"DingTalk":/miniProgram/i.test(ys)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var Ds=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Cs(t,e){ibiz.register.register("".concat(Ds,"_").concat(t),e)}function As(t){return ibiz.register.get("".concat(Ds,"_").concat(t))}function bs(){const t=As(Is());return t||As("Browser")}var Ps=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ts(t,e){ibiz.register.register("".concat(Ps,"_").concat(t),e)}function xs(t){return ibiz.register.get("".concat(Ps,"_").concat(t))}async function Ns(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Bi(i,s);if(t&&(e=xs(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=xs(a),e)return e;throw new o("找不实体行为方法类型为".concat(a,"的适配器"))}var Ss=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Ls(t){return ibiz.register.get("".concat(Ss,"_").concat(t))}async function Rs(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Bi(s,i);if(t&&(e=Ls(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=Ls(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var Os=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Ms(t){return ibiz.register.get("".concat(Os,"_").concat(t))}async function _s(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Bi(a,i);if(t&&(e=Ms(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}return e=Ms(s),e}var Vs=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var Fs=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new $,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=lt(t)),e&&(this.params=lt(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&H(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),ks=t("AppDECounter",class extends Fs{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new a(this.model,"未找到获取计数器行为!");this.action=i,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),Ws=t("AppDECounterProvider",class{createCounter(t){return new ks(t)}});function Bs(){zi("DEDR",(()=>new Ws))}var Us=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Wi;return 1===e.length?a.parse(this.calcCond(e)[0]):e.length>1&&a.parse(["AND",this.calcCond(e)][0]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);a.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.condOp),a.push(e.fieldName),e.condValue?e.vartypeId?a.push({type:e.vartypeId,value:e.condValue}):a.push(e.condValue):a.push("")}}e.push(a)})),e}});Us.map=new WeakMap;var zs=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new i(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:i,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:n,iconPathAppDEFieldId:o,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d,clsAppDEFieldId:l,colorAppDEFieldId:h}=this.codeList,u=a?t[a]:t.srfkey;if(e.id=u,e.value=u,e.text=i?t[i]:t.srfmajortext,(s||n||o||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),n&&(e.sysImage.cssClassX=t[n]),o&&(e.sysImage.imagePath=t[o]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Qs(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=je.execSingleLine(t[d])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:n,minorSortAppDEFieldId:o,minorSortDir:r,pvalueAppDEFieldId:c,customCond:d}=this.codeList,l={...e};if(o&&r&&Object.assign(l,{sort:"".concat(o.toLowerCase(),",").concat(r.toLowerCase())}),d){const e=ie(je.execSingleLine(d),l,t);Object.assign(l,e)}if(l.size||(l.size=1e4),this.isPredefined&&this.codeList.codeName){let t=this.codeList.codeName;if("OPERATOR"===this.codeList.predefinedType){const e=this.codeList.codeName.indexOf("__");t=-1!==e?this.codeList.codeName.substring(e+2):this.codeList.codeName}const e=await i.net.get("/dictionaries/codelist/".concat(t),l);return Object.freeze(e.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!n)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,n,t,void 0,l);let u=[];if(h.data.length)if(c){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:a}=this.codeList,i={},s=[];return t.forEach((t=>{i[t[e]]=this.convertData(t)})),t.forEach((t=>{const n=i[t[a]];n?(n.children=n.children||[],n.children.push(i[t[e]])):s.push(i[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const i=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||rt(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(a,o);const r=await i;return o.items=r,delete o.promise,r}});function Gs(t,e){if(null!=e){const{srfkey:t}=e;if(!rt(t)&&!dt(t))return!0}throw new o("执行「".concat(t,"」不存在「srfkey」无法处理"))}function js(t,e){const{srfsessionid:a}=e;if(!rt(a)&&!dt(a))return!0;throw new o("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Ks=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const a=this.cacheMap.get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,lt(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new o("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{js("add",t),(rt(e.srfkey)||dt(e.srfkey))&&(e.srfkey=Q()),e.srftempdate=(new Date).getTime();const a=()=>{this.cacheMap.set(e.srfkey,lt(e)),ibiz.log.warn("add",e.srfkey,e)},i=this.getTransaction(t);return i?i.change(e.srfkey,(()=>{a()})):a(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{js("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),lt(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{js("update",t),Gs("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i){const s=lt(i);s.assign(e);const n=()=>{i.assign(e),a!==e.srfkey&&this.cacheMap.delete(a),this.cacheMap.set(e.srfkey,i),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{js("delete",t);const a=e;if(this.cacheMap.has(a)){const e=this.cacheMap.get(a),i=()=>{this.cacheMap.delete(a),ibiz.log.warn("delete",a)},s=this.getTransaction(t);return s?s.change(a,(()=>{i()})):i(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{js("add",t);const a=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},i=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(rt(s.srfkey)||dt(s.srfkey))&&(s.srfkey=Q()),s.srftempdate=(new Date).getTime();const n=lt(s);i?i.change(n.srfkey,(()=>{a(n)})):a(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{js("update",t);const a=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},i=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];Gs("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(n.srfkey,"的数据"));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error("数据[".concat(n.srfdename,"-").concat(n.srfmajortext,"(").concat(n.srfkey,")]不存在,无法更新!"));{const t=lt(c);t.assign(n),e[s]=t,i?i.change(n.srfkey,(()=>{c.assign(n),a(c,r)})):(c.assign(n),a(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{js("delete",t)}catch(t){return ibiz.log.error(t),e}const a=[];for(let t=0;t<e.length;t++){const i=e[t];this.cacheMap.has(i)||a.push(i)}if(a.length>0)throw new Error("未找到以下数据「".concat(a.join("、"),"」,无法删除!"));const i=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},s=this.getTransaction(t);for(let t=0;t<e.length;t++){const a=e[t];s?s.change(a,(()=>{i(a)})):i(a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ht(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];e[a]=ht(i)}return ut(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>ce(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>rt(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),Xs=/\$\{(.*?)\}/g;function Hs(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(Xs);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,i)=>i===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function Ys(t,e){const a=Hs(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((i,s)=>{e=s===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return a.path}return""}var qs=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(rt(e.page)||dt(e.page)||(this.page=e.page),rt(e.size)||dt(e.size)||(this.size=e.size),rt(e.query)||dt(e.query)||(this.query=e.query),!rt(e.sort)&&!dt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Qs(t){return[1,"1",!0,"true"].includes(t)}var $s=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let i=[];return(null==a?void 0:a.length)&&(i=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var a;let i=t.text;t.textLanguageRes&&(i=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const n={text:i,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?je.execSingleLine(t.data):void 0,sysImage:t.sysImage};return(null==(a=t.codeItems)?void 0:a.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new zs(t),this.cache.set(s,i),await i.init()),i.get(e,a)}async get(t,e,a){const i=this.allCodeLists.get(t);if(!i)throw new o("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),Js=t("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),Zs=t("CounterService",class{static async getCounter(t,e,a){const i=t.id;if(this.counterMap.has(i)){const t=this.counterMap.get(i);if(!1===t.isDestroyed)return t;this.counterMap.delete(i)}const s=(await ji(t)).createCounter(t);return await s.init(e,a),this.counterMap.set(i,s),s}static async getCounterByRef(t,e,i){const{appCounter:s}=t;if(!s)throw new a(t,"未配置应用计数器!");return this.getCounter(s,e,i)}});Zs.counterMap=new Map;var tn=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},i={}){switch(t){case"wfstart":return this.wfStart(e,a,i);case"wfsubmit":return this.wfSubmit(e,a,i);case"reassign":return this.wfReassign(e,a,i);case"addstepbefore":return this.wfAddStepBefore(e,a,i);case"addstepafter":return this.wfAddStepAfter(e,a,i);case"sendback":return this.wfSendBack(e,a,i);case"sendcopy":return this.wfSendCopy(e,a,i);default:throw new o("「".concat(t,"」未实现"))}}}),en=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Ys(a,this.model),n="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}},an=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(an||{})),sn=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:lt(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=ce(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const s=ce(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:rt(this.srfkey)?Q():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:a}=this,i={};Object.keys(e).forEach((t=>{i[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();i[s]={enumerable:!0,set(i){e[s]=a(i,t.stdDataType)},get:()=>e[s]},e[s]=a(e[s],t.stdDataType)})),Object.defineProperties(this,i)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return a=e instanceof t?e._data:e,Object.keys(a).forEach((t=>{void 0===a[t]&&delete a[t]})),Object.assign(this._data,a),this}convertVal(t,e){if(null==t)return t;if(rt(e))return t;if(l.isNumber(e)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),nn=t("MethodDto",class{constructor(t,e,a,i){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.dtoMap=new Map,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,a)=>{e[a+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((a=>{const i=parseInt(a,10);e[i-1]=t[i]})),e}async get(t,e,s=!1){const n={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(n[d]=0===e[d].length?null:this.convertArrayToListMap(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const i=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=i.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const a=lt(t);a[this.entity.codeName.toLowerCase()]=e.srfkey;const i={};h.parentAppDEFieldId&&(i[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,a,i)}else{if(r.entity.id===this.entity.id)throw new a(c,"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!");u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,a=[];for(let i=0;i<e.length;i++)a.push(await r.get(t,e[i],!0));n[d]=a}}break;default:throw new i(c,"未支持的应用实体方法输入属性类型: ".concat(c.type))}}return{...e,...n}}async sets(t,e){const a=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const i=this.fields.filter((t=>"DTOS"===t.type)).map((async i=>{const s=i.codeName.toLowerCase();if(i.listMap&&"object"==typeof e[s])e[s]=this.convertListMapToArray(e[s]);else{if(!i.refAppDataEntityId)return;const n=a.getDERConfig(i.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,i);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const a=e[this.entity.keyAppDEFieldId];i.refPickupAppDEFieldId&&r.forEach((t=>{t[i.refPickupAppDEFieldId]=a})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<i.length;t++)await i[t];const s=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,s),s})))}async calcRs(t,e=0){if(e>10)return;e+=1;const a=ibiz.uiDomainManager.get(t.srfsessionid),i=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<i.length;s++){const n=i[s];if(!n.refAppDataEntityId)continue;if(0===a.getDERConfig(n.refAppDataEntityId).length){const i=await this.getFieldDto(t,n);i.entity.minorAppDERSs&&a.setDERConfig(n.refAppDataEntityId,i.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await i.calcRs(t,e)}}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=ce(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,a.id);s.isLocalMode=!0;const n=s.createMethodDto(i,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),on=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ks(e),this.configCache=new Js(e.appId,"PSAppDataEntity",e.codeName),this.wf=new tn(e),this.file=new en(e)}async getMethod(t,e=!1){const s=e?"ac-".concat(t):t;if(this.methodMap.has(s))return this.methodMap.get(s);const n=ce(this.model.appDEMethods,t);if(!n)throw new a(this.model,"未找到服务方法: ".concat(t));const o=await Ns(n);if(!o)throw new i(n,"未支持的服务方法类型: ".concat(n.methodType));const r=o.create(this,this.model,n,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(s,r),r}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),onmessage:e=>{if(e.data){const a=JSON.parse(e.data);t(a)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},a={}){const i=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return i.net.post(s,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],i="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return Ys(t,this.model)+i}newEntity(t){return t instanceof sn?t.clone():new sn(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new nn(this,this.model,null==e?void 0:e.isLocalMode,t)}}),rn=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],cn=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:rt(this.srfkey)?Q():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a){const i=!a||a.isOriginField;rn.includes(t)||(i||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=lt(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),dn=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,i){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,i)}handleResponse(t){return h(t)}toUIData(t){return new cn(t,this.dataUIMap)}}),ln=t("MDControlService",class extends dn{async fetch(t,e={}){var a;const i=(null==(a=this.model.fetchControlAction)?void 0:a.appDEMethodId)||"fetchdefault";let s=await this.exec(i,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var a;const i=(null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;const i=(null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;const i=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var a;const i=(null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,a={}){throw new o("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&(J(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),hn=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const s=pe(i,e);if(s){ibiz.log.debug("匹配主状态",s);const e=me(s,i);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),un=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new hn(e),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),pn=t("V7AuthService",class{get isAnonymous(){return"1"===Z(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error("未找到匿名登录配置用户名或密码"),!1;const a=await this.login(t,e);if(a){tt(u.IS_ANONYMOUS,"1",0,!0);const t=Z(u.TOKEN),e=Z(u.TOKEN_EXPIRES),a=Z(u.TOKEN_REMEMBER),i=Z(u.REFRESH_TOKEN);tt(u.TOKEN,t,0,!0),tt(u.TOKEN_EXPIRES,e,0,!0),tt(u.TOKEN_REMEMBER,a,0,!0),i&&tt(u.REFRESH_TOKEN,i,0,!0)}return a}async login(t,e,a){try{const i=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:s}=i;if(s&&s.token){const t=a?7:0;a&&tt(u.TOKEN_REMEMBER,"1",t,!0),tt(u.TOKEN,s.token,t,!0);const e=(new Date).getTime()+1e3*(s.expirein||7199);tt(u.TOKEN_EXPIRES,"".concat(e),t,!0),s.refresh_token&&tt(u.REFRESH_TOKEN,s.refresh_token,t,!0),et(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),et(u.TOKEN),et(u.TOKEN_EXPIRES),et(u.TOKEN_REMEMBER),et(u.REFRESH_TOKEN),et(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0,!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=Z(u.TOKEN),e=Z(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const a=3e5;t=t>a?t-a:0,setTimeout((async()=>{const t=Z(u.TOKEN_REMEMBER),e=Z(u.REFRESH_TOKEN),a=t?7:0;let i;if(i=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),i.ok){tt(u.TOKEN,i.data.token,a,!0);const t=(new Date).getTime()+1e3*(i.data.expirein||7199);tt(u.TOKEN_EXPIRES,"".concat(t),a,!0),i.data.refresh_token&&tt(u.REFRESH_TOKEN,i.data.refresh_token,a,!0),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}getAuthInfo(){const t=Z(u.TOKEN),e=!!Z(u.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}}),mn=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return rt(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),fn=t("MethodInput",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodInput;if(s){const a=ce(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),gn=t("MethodReturn",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodReturn;if(s){const a=ce(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const a=ibiz.hub.getApp(this.entity.appId),i=ibiz.uiDomainManager.get(t.srfsessionid);i&&!0!==i.state.rsInit&&(await this.dto.calcRs(t),i.calcParentRs(),i.state.rsInit=!0),a.deService.clearTempCacheByRs({srfappid:a.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return Y(e)&&(e={}),new sn(this.entity,e)}}),wn=t("Method",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i,this.app=ibiz.hub.getApp(e.appId),this.input=new fn(t,e,a),this.result=new gn(t,e,a)}async request(t,e,i,s){const{actionType:n,requestMethod:o}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(o){case"POST":n=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":n=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":n=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":n=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,o?"未支持的请求方式: ".concat(o):"未配置请求方式")}return n}throw new a(this.method,"未支持的行为类型[".concat(n,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Ys(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),En=class{constructor(t,e,a,i){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:R(a)?a:[a],params:i}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},vn=class{},yn=class extends vn{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return Fe(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Fe(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(n[this.dstField],this.op,this.value)}}},In=class t extends vn{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new yn(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},Dn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new In(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Cn=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new Dn(t)))}},An=class extends Cn{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},bn=class extends Cn{async exec(t){}},Pn=class extends Cn{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function Tn(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[a],t.isEntityParam(a)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=lt(ibiz.env);break;case"EXPRESSION":if(!o)throw new i(e,"表达式为空");c=je.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new i(e,"暂未支持源值类型".concat(r))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:je.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(d,"报错,源参数:"),c),t}return c}var xn=class extends Cn{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,i=Tn(e,t);e.params[a]=lt(i)}bindParam(t,e){const a=Tn(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:i}=t;let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Tn(e,t);s?e.params[i][s]=n:e.params[i]=n}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Tn(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Nn=class extends Cn{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,n=t.params[i],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(a,e,t.context,n);r.ok&&(t.params[s]=r.data)}},Sn=class extends Cn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Tn(t,this.model);t.params[e]=s}},Ln=class extends Cn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},Rn=class extends Cn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},On=class extends Cn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Tn(t,this.model);t.params[e]=lt(s)}},Mn=class extends Cn{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},_n=class extends Cn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Tn(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},Vn=class extends Cn{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},Fn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=lt(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=lt(t.data||{});else{if(a.envParam)throw new i(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new i(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new i(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new i(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new i(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new i(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new i(a,"未支持的逻辑参数类型: 操作会话变量")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},kn=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new a(t,"脚本代码模式没有配置脚本代码");this.scriptFn=je.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new bn(t);break;case"END":a=new Pn(t);break;case"DEACTION":a=new An(t);break;case"PREPAREPARAM":a=new xn(t);break;case"DEDATASET":a=new Nn(t);break;case"THROWEXCEPTION":a=new Vn(t);break;case"BINDPARAM":a=new Sn(t);break;case"RESETPARAM":a=new Ln(t);break;case"COPYPARAM":a=new On(t);break;case"RENEWPARAM":a=new Rn(t);break;case"APPENDPARAM":a=new _n(t);break;case"SORTPARAM":a=new Mn(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new Fn(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,i){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:i});const s=new En(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Wn=new Map;async function Bn(t,e,a={},i={}){Wn.has(t)||Wn.set(t,new kn(t));return Wn.get(t).exec(e,a,i)}async function Un(t,e,a,i,s){const n=await async function(t,e,a){return we(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!n)throw new o("".concat(e,"找不到实体逻辑").concat(t));return Bn(n,a,i,s)}async function zn(t,e,a,i){const n=lt(e),o=a?lt(a):a,r=i?lt(i):i;try{const e=await Bn(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Gn(t,e,a,i,s){const n=Ee(t,e);if(n.length){(await Promise.all(n.map((t=>Bn(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function jn(t,e,a,i,s={}){if(i){if(!R(i))return Gn(t,e,a,i,s);await Promise.all(i.map((i=>Gn(t,e,a,i,s))))}}var Kn=t("DEActionMethod",class extends wn{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){let s;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await jn(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const n=we(this.method.appDELogicId,this.entity);if(!n)throw new a(this.method,"缺少实体处理逻辑");s=await zn(n,t,e,i)}else switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),this.method.codeName){case"Create":s=await this.create(t,e,i||{});break;case"Get":s=await this.get(t,i);break;case"GetDraft":s=await this.getDraft(t,i);break;case"Remove":s=await this.remove(t,i);break;case"Update":s=await this.update(t,e,i);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,i);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);if(this.method.needResourceKey){let i=t[this.entity.codeName.toLowerCase()];M(i)&&(i=R(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),a="".concat(a,"/").concat(i)}const n=await this.request(a,t,e,i);n.data=await this.result.handle(t,n.data),s=n}}return s.data&&await jn(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new o("create行为没有传data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.post(i,e,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new o("update行为没有传data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e);return i.data=await this.result.handle(t,i.data),i}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,a)),new p(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new p(t):new p(t,500)}catch(t){return new p(t,500)}}async removeTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(a,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const i=this.service.local.delete(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,i){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let i=s.getDERConfigByMajor(this.entity.id);if(i.length>0){const s=this.service.local.get(e,t);i=at(i,"removeOrder");for(const n of i){if("DER1N"!==n.rstype)throw new a(n,"目前只支持[DER1N]关系类型关联删除删除");const{removeActionType:i,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=lt(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(i){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const a=await l.remove(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[n.parentAppDEFieldId.toLowerCase()]=void 0;const a=await l.updateTemp(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e="无法删除[".concat(this.entity.logicName,"-").concat(s.srfmajortext,"], 数据被[").concat(l.model.logicName,"-").concat(t,"]引用");throw new Error(o||e)}}}}o&&n.state.isOpen&&n.commit()}catch(t){throw o&&n.state.isOpen&&n.rollback(),t}finally{o&&n.state.isOpen&&n.close()}}async updateTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,a)),i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.get(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new p(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{if(a.parentAppDEFieldId){const{majorAppDataEntityId:i,parentAppDEFieldId:s}=a,n=fe(i),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),Xn=class{create(t,e,a,i){return new Kn(t,e,a,i.localMode)}},Hn=t("FetchMethod",class extends wn{async exec(t,e,a){const s=e&&!R(e)?e:a||{};let n;if(this.isLocalMode){const e=Us.getCond(this.method),a=new qs(t,s),i=await this.searchLocal(e,a);n=new p(i,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":n=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);n=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const o=n.data||[];n.data=o.map((t=>this.createEntity(t)))}return n.data&&await jn(this.entity,"compute",t,n.data,s),n}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=this.service.local.getList();t?i.length>0&&(i=i.filter((a=>t.test(a,e)))):i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const s=t[a[e]];if(i.test(s))return!0}return!1}))),rt(e.sortField)||dt(e.sortField)||(i="DESC"===e.sortMode?it(i,e.sortField):at(i,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return i.slice(o,r).map((t=>lt(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new a(this.method,"没有指定数据来源代码表");const s=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),Yn=t("AcFetchMethod",class extends Hn{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),qn=class{create(t,e,a,i){return i.acMode?new Yn(t,e,a,i.localMode):new Hn(t,e,a,i.localMode)}};function Qn(){const t=new Xn;Ts("DEACTION",(()=>t));const e=new qn;Ts("FETCH",(()=>e)),Ts("FETCHTEMP",(()=>e))}var $n=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={ok:!0};return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),rt(e.data)&&(e.data=[]),e.page=t.page,e.total=34,e.data=Array.from({length:t.size},((t,e)=>({id:e+1,status:"RECEIVED",title:"标题".concat(e+1),content:"内容".concat(e+1,"长内容"),short_content:"内容".concat(e+1,"短内容"),create_time:(new Date).toISOString()}))),e}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}}),Jn=t("TreeNodeData",class{constructor(t,e,a){this._uuid=Q(),this._leaf=!1,this._leaf=!0===a.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._parent&&(this._context={...this._parent._context}),a.navContext&&(this._context=Object.assign(this._context||{},a.navContext)),a.navParams&&(this._params={...a.navParams}),this._nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath),e.rawContent&&(a.htmlStr=e.rawContent)),Object.values(a).length>0?a:void 0}}),Zn=t("TreeCodeListNodeData",class extends Jn{constructor(t,e,a){super(t,e,a);const{data:i}=a;this._text=i.text,this._value=i.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=fe(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),to=["_id","_value","_text","_deData","clone"],eo=t("TreeDataSetNodeData",class t extends Jn{constructor(e,a,i){var s,n;super(e,a,i);const{data:o}=i;this._deData=o;const r="".concat(e.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get(){return e.textAppDEFieldId?this._deData[e.textAppDEFieldId]:this._deData.srfmajortext},set(t){e.textAppDEFieldId?this._deData[e.textAppDEFieldId]=t:this._deData.srfmajortext=t},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get(){return e.idAppDEFieldId?this._deData[e.idAppDEFieldId]:this._deData.srfkey},set(t){e.idAppDEFieldId?this._deData[e.idAppDEFieldId]=t:this._deData.srfkey=t},enumerable:!0,configurable:!0}),e.appDataEntityId){const t=fe(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:o.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId&&(this._leaf=Qs(o[e.leafFlagAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();c.set(e,a),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(n=e.detreeNodeColumns)||n.forEach((t=>{if("DEFGRIDCOLUMN"!==t.columnType)return;const e=t.detreeColumnId,a=t.dataItemName;e&&a?l.set(e,a):ibiz.log.error("模型异常缺少detreeColumnId或者dataItemName",t)}));const h=new Map;h.set("srfuf","srfuf");const u=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:h.has(t)?h.get(t):void 0;return this.clone=()=>{const a=lt(this._deData),i=new t(e,this._parent,{data:a,leaf:this._leaf,navContext:this._context,navParams:this._params});return Object.keys(this).forEach((t=>{const e=u(t);rt(e)&&!to.includes(t)&&(i[t]=this[t])})),i},new Proxy(this,{set(t,e,a){const i=u(e);return rt(i)?t[e]=a:t._deData[i]=a,!0},get(t,e,a){const i=u(e);return rt(i)?t[e]:rt(t._deData[i])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[i];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return m(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:i}=t;a&&this._deData[a]&&(e.imagePath=this._deData[a]),e&&(this._icon=e);const s=null==i?void 0:i.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return je.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,i=null==a?void 0:a.find((t=>"text"===t.id));return i&&(e=this.calcDataItemScript(i)),e}}),ao=t("TreeStaticNodeData",class extends Jn{constructor(t,e,a){var i,s;super(t,e,a);const n="root"===t.nodeValue?void 0:t.nodeValue,o="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),this._text=t.text,this._value=n,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=n||(null==t?void 0:t._value)}this.srfkey=(null==(i=this._deData)?void 0:i.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),io=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,rt(a.isOriginField)||(this.isOriginField=a.isOriginField),rt(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),so=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var no=["REGION","REGION2","REGION3","REGION4"],oo=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:i,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,no.includes(this._itemStyle)?s&&l.set("_areaCode",s):(s&&l.set("_longitude",s),n&&l.set("_latitude",n)),c&&l.set("_tooltip",c),o&&l.set("_text",o),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:l.has(a)?t[l.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:l.has(a)?t[l.get(a)]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}});var ro=t("PanelData",class{constructor(t,e){const a=new $,i={},s={};return t.forEach((t=>{var e;i[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,n,o)=>(Object.prototype.hasOwnProperty.call(i,n)?i[n]?e[i[n]]=o:t[n]=o:e[n]=o,a.emit("change",n),i[n]&&i[n]!==n&&a.emit("change",i[n]),s[n]&&s[n]!==n&&a.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?a:i[s]?e[i[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const a=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,a),a}})}destroy(){this._evt.reset()}});var co=t("ChartData",class{constructor(t,e,a,i){return this._seriesModelId=null==e?void 0:e.id,this._catalog=a,this._groupName=i,this._uuid=Q(),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}}),lo=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},ho=t("GanttStaticNodeData",class extends ao{constructor(t,e,a,i){super(e,a,i),this._snDataItemValue=lo(t.sndataItemName,e),this._beginDataItemValue=lo(t.beginDataItemName,e),this._endDataItemValue=lo(t.endDataItemName,e),this._prevDataItemValue=lo(t.prevDataItemName,e),this._finishDataItemValue=lo(t.finishDataItemName,e),this._totalDataItemValue=lo(t.totalDataItemName,e)}}),uo=t("GanttDataSetNodeData",class extends eo{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=lo(t.sndataItemName,e,s),this._beginDataItemValue=lo(t.beginDataItemName,e,s),this._endDataItemValue=lo(t.endDataItemName,e,s),this._prevDataItemValue=lo(t.prevDataItemName,e,s),this._finishDataItemValue=lo(t.finishDataItemName,e,s),this._totalDataItemValue=lo(t.totalDataItemName,e,s)}}),po=t("GanttCodeListNodeData",class extends Zn{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=lo(t.sndataItemName,e,s),this._beginDataItemValue=lo(t.beginDataItemName,e,s),this._endDataItemValue=lo(t.endDataItemName,e,s),this._prevDataItemValue=lo(t.prevDataItemName,e,s),this._finishDataItemValue=lo(t.finishDataItemName,e,s),this._totalDataItemValue=lo(t.totalDataItemName,e,s)}}),mo=t("MqttService",class{constructor(t,e,a){this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new $,this.options={connectTimeout:6e3,clientId:Q(),username:"",password:"",keepalive:60,clean:!0},this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),a=t.default?t.default:t,{location:i}=window;this.client=a.connect("ws://".concat(i.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end(),this.evt.reset()}}),fo=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,a){const i=e.srfsessionid||"applocation";this.cache.has(i)||this.cache.set(i,new Map);const s=this.cache.get(i);if(!s.has(a)){const e=await ibiz.hub.getAppDataEntity(a,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(a,"]"));const n=t.constructorCache.get(a.toUpperCase());let r;r=n?await n(i,e):new on(i,e),s.set(a,r)}return s.get(a)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}clearTempCacheByRs(t,e,a=[]){if(!0===a.includes(e))return;a.push(e);const i=t.srfsessionid;if(!this.cache.has(i))return;const s=this.cache.get(i).get(e);s&&s.local.clear();const n=ibiz.uiDomainManager.get(t.srfsessionid);if(n){n.getDERConfigByMajor(e).forEach((e=>{this.clearTempCacheByRs(t,e.minorAppDataEntityId,a)}))}}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};fo.constructorCache=new Map;var go=t("DEServiceUtil",fo),wo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=lt(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new o("应用视图[".concat(t,"]不存在"));if((n.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=fe(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===a.srfuf&&(n[t]=void 0,delete a.srfuf)}if(r.redirectView){return Me(await ibiz.hub.getAppView(t),n,a,s)}const{openMode:c="INDEXVIEWTAB"}=r,d=s.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&n.toRouteDepth&&(n.toRouteDepth=void 0),d){case"INDEXVIEWTAB":case"INDEXVIEWTAB_POPUP":return s.noWaitRoute?(this.openIndexViewTab(r,n,a),{ok:!0}):this.openIndexViewTab(r,n,a);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,n,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,n,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,a);case"USER":return this.openUserCustom(r,n,a);default:return this.openIndexViewTab(r,n,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}openIndexViewTabByModal(t,e,a={}){return ibiz.openView.rootByModal(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,e,a,i={}){if(!e)throw new o("气泡打开缺少event");return ibiz.openView.popover(t.id,e,a,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};wo.TAG="ibiz.app-view.open";var Eo=t("OpenAppViewCommand",wo),vo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,ie(r,a,e));const h=ie(c,a,e);switch(d){case"APPVIEW":return this.openAppView(n,l,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(n);case"PDTAPPFUNC":return this.openPdAppFunc(n,l,h);case"JAVASCRIPT":return this.executeJavaScript(n,l,h);case"CUSTOM":return this.custom(n,l,h);default:throw new i(n,"未支持的应用功能类型: ".concat(d))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new o("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(Eo.TAG,t.appViewId,e,a,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,a){throw ibiz.log.warn("openPdAppFunc",t,e,a),new o("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new o("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new o("未实现")}};vo.TAG="ibiz.app-func.exec";var yo=t("AppFuncCommand",vo);function Io(){new yo,new Eo}var Do=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new Js(t.appId,"PSSysApp",t.codeName),this.deService=new go(t),this.codeList=new $s(t),this.authority=new un(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),await this.initMqtt()}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,i;let s=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!s&&e){s=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}async initMqtt(){this.mqtt&&this.mqtt.close(),ibiz.env.enableMqtt&&ibiz.appData&&ibiz.appData.mqtttopic&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new mo(ibiz.appData.mqtttopic,g(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.asyncAction.next(t)})),await this.mqtt.connect())}}),Co=class{parse(t){return t}},Ao=class{constructor(){this.appMenu=new Co}},bo=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const a=this.calcAppViewId(t);this.viewConfigs.set(a,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new o("视图[".concat(e,"]不存在"));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},Po=class{constructor(){this.view=new bo}},To=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(To||{})),xo=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(xo||{})),No=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(No||{})),So=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t))(So||{})),Lo=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new o("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Ro=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Lo(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Oo=t("CTXState",class{}),Mo=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new $(3e3),this.controllersMap=new Map,this.state=new Oo}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),_o=t("ActivityCounter",class extends Lo{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),Vo=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await ye(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:i,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==i&&"MULTIKEY"!==i||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),Fo=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),ko=t("QXEventEx",class extends ${constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((a=>{a(t,...e)}))}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),i=this.anyEventFns.map((a=>a(t,...e))),s=Promise.all(i),n=await a,o=await s;return n.concat(...o)}reset(){super.reset(),st(this.anyEventFns)}}),Wo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new ko}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function Bo(t){return window.location.hash.split("/").length>2*t+2}function Uo(t,e){return(!rt(t)&&""!==t||!rt(e)&&""!==e)&&t!==e}function zo(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof cn&&(e=e.getOrigin()),e}function Go(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType?i.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{je.execScriptFn({rule:t,value:e,callback:a,source:i},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=a||e;i.push({validator:(e,a,i,s)=>{if(Y(s[t]))return!0;const{isPast:n,infoMessage:c}=Ke(t,s,r.groupCond);return n||i(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function jo(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:n}=t;return a&&e.push({validator:(t,e,i)=>{if(rt(e)||!(e.length>a))return!0;i(new Error("内容长度必须小于等于".concat(a,",当前长度为").concat(e.length)))}}),i&&e.push({validator:(t,e,a)=>{if(rt(e)||!(e.length<i))return!0;a(new Error("内容长度必须大于等于".concat(i,",当前长度为").concat(e.length)))}}),rt(s)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&nt(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),rt(n)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&nt(e)&&e<n))return!0;a(new Error("值必须大于等于".concat(n)))}}),e}var Ko=t("ValueExUtil",class{static mergeDefault(t){return pt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(rt(e)||""===e)return"";const{valueType:a,objectNameField:i,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!i)throw new o("缺少objectNameField");const t=i.toLowerCase();return"OBJECTS"===a?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===a?e.join(s):"".concat(e)}});function Xo(t,e){var a;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(rt(n)&&rt(r))return;if("RESET"===n)return null;const u=d[s];if(!mt(u)){if(!n&&r)return r;switch(n){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return gt().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new o("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return Q();default:throw new i({},"默认值类型[".concat(n,"]未支持"))}}}var Ho="asyncimportdata2",Yo="importdata2";async function qo(t,e,a){if(!ibiz.util.getExcelUtil)throw new o("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new o("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function Qo(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(i.name);0===i.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await a.net.get(s)).data}var $o="__self",Jo=t("BaseController",class{constructor(t,e,a,i){this.model=t,this.context=e,this.params=a,this.ctx=i,this.id=Q(),this.state={},this.name="",this.evt=new Wo(this.getEventArgs.bind(this)),this.mountCounter=new _o(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll($o),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(t=>{this.childNames.includes(t)&&this.mountCounter.enroll(t)})),this.ctx.evt.on("onRegister",((t,e)=>{this.childNames.includes(t)&&e.evt.on("onMounted",(()=>{this.mountCounter.attend(t)}))}))}async mountSelf(){this.mountCounter.registration.get($o)||this.mountCounter.attend($o)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),Zo=class t{constructor(t){this.msgGroupId=t,this.viewMsgMap=new Map}async init(t){var e,a;const i=ibiz.hub.getApp(t.srfappid).model,s=null==(e=i.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=n.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),n.splice(e,1))})),n.length)throw new o("没有找到".concat(n.join(","),"视图消息模型"))}getDeFieldName(t,e){var a,i;if(e)return null==(i=null==(a=ve(t,e))?void 0:a.name)?void 0:i.toLowerCase()}static async fetchDataSet(t,e,i){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new a(t,"未配置实体数据集");const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,i);return o.data.length?o.data:[]}async calcViewMessages(t,e){const a=this.msgGroup.appViewMsgGroupDetails,i=[];return(null==a?void 0:a.length)&&await Promise.all(a.map((async a=>{if(1===this.viewMsgMap.get(a.appViewMsgId).dynamicMode){const s=await this.calcDynaMsgs(a,t,e);i.push(...s)}else{const t=this.calcStaticMsg(a);i.push(t)}}))),i}calcStaticMsg(t){const{position:e}=t,a=this.viewMsgMap.get(t.appViewMsgId),{title:i,message:s,removeMode:n,position:o,messageType:r}=a,{userTag:c,userTag2:d,userTag3:l,userTag4:h}=a;return{title:i,message:s,position:e||o,messageType:r,removeMode:n,extraParams:{userTag:c,userTag2:d,userTag3:l,userTag4:h}}}async calcDynaMsgs(e,i,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u}=n;if(!o)throw new a(n,"未配置应用实体");const p=await ibiz.hub.getAppDataEntity(o,i.srfappid),m={...s},f=this.getDeFieldName(p,r);f&&(m.sort="".concat(f,",asc"));const g=await t.fetchDataSet(n,i,m);if(!g.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(p,c),v=this.getDeFieldName(p,u),y=this.getDeFieldName(p,h),I=this.getDeFieldName(p,l),D=this.getDeFieldName(p,d);return g.map((t=>{const e={};return v&&!rt(t[v])&&(e.position=t[v]),E&&!rt(t[E])&&(e.title=t[E]),y&&!rt(t[y])&&(e.message=t[y]),I&&!rt(t[I])&&(e.messageType=t[I]),D&&!rt(t[D])&&(e.removeMode=t[D]),ct(w,e)}))}},tr=t("ViewController",class extends Jo{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),d.create({},e),a||{},new Mo(i)),this.session={},this.modal=new da({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Ro,this.isCloseView=!1,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Ne(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn("未找到视图引擎实现:",t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await Zs.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{mt(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await Hi(t);this.providers[t.name]=e;const a=Te(this.model);a&&await Promise.all(a.map((async t=>{const e=await Hi(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=xe(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),Object.values(this.counters).forEach((t=>t.destroy())),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){if(this.context.srfappid=this.model.appId,rt(this.context.srfsessionid)||dt(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}const t=this.model.appViewNavContexts;let e={};H(t)&&(e=ie(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let i={};H(a)&&(i=ie(a,this.params,this.context)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const i of this.engines)if(a=await i.call(t,e),void 0!==a)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(void 0===a)throw new o("没有引擎支持预置界面行为".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Zo(t),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){const[e,...a]=t,i={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(i,{confirmButtonText:e.extraParams.userTag}),"WARN"===e.messageType?await ibiz.modal.warning(i):"ERROR"===e.messageType?await ibiz.modal.error(i):await ibiz.modal.info(i),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),er=(t("MobViewController",class extends tr{}),t("WFStepTraceViewController",class extends tr{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),a=null==(t=this.ctx.parent)?void 0:t.view;if(a&&a.model.appDataEntityId){const t=await e.deService.getService(a.context,a.model.appDataEntityId),i=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(i);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let n={};i&&t&&(n=ie(i,t,a,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=ie(s,t,a,e)),{context:o,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Ko.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=gt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),ar=(t("CodeListEditorController",class extends er{async loadCodeList(t){const{context:e,params:i}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,i),a}throw new a(this.model,"编辑器类型[".concat(this.model.editorType,"],未配置代码表"))}}),t("ControlController",class extends Jo{constructor(t,e,a,i){if(super(t,d.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=le(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=lt(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await Hi(this.controlPanel);this.providers[this.controlPanel.name]=t}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)}))}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let i={};H(e)&&(i=ie(e,this.params,this.context)),Object.assign(this.context,i);let s={};H(a)&&(s=ie(a,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let i=this.getData()||[];return(null==t?void 0:t.data)&&(i=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(a,t.viewParam),{context:e,params:a,data:i}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};H(t)&&(e=ie(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:i}=this.model,s=null==(a=null==i?void 0:i.ctrlMsgItems)?void 0:a.find((e=>e.name===t));let o,r;if(s&&s.content){r=rt(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),o=je.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();o=ibiz.i18n.t(e,""),o===e&&(o="")}if(!o&&(null==e?void 0:e.default)&&(o=e.default),!o&&(null==e?void 0:e.error)&&(o=o||e.error.message),o){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new n(o,r);ibiz.message.success(o,r,0===r)}}})),ir=t("MDControlController",class extends ar{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)}));const e=this.onDataChange.bind(this);this.onDataChange=_((t=>{e(t)}),300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const a=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(a.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};return a&&(n.page=e-1,n.size=a),!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(i,s);"number"==typeof n.total&&(this.state.total=n.total),a?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new o("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{const n=fe(this.model.appDataEntityId);await Ea(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[n]=t.srfkey,await this.service.remove(i,a),s=!0}this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:i,default:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:i}),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,a;const{selectedData:i}=this.state;v(i,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,i=await ibiz.hub.getAppDataEntity(e,this.model.appId),s=null==(t=i.appDEDataImports)?void 0:t.find((t=>t.id===a));if(!s)throw new o("无导入模型!");let n="DataImport";s.enableCustomized&&(n="DataImport2");const r=ibiz.overlay.createModal(n,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),sr=t("AppMenuController",class extends ar{constructor(t,e,a,i){super(t,e,a,i),this.itemProviders={},this.flattenAllItems()}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await _s(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new o("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const n=this.itemProviders[t];if(n&&n.onClick)return n.onClick(s,e,this);if(!s.appFuncId)throw new a(s,"没有配置应用功能");const r=this.context.clone();r.srfappid=s.appId,this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(yo.TAG,s.appFuncId,r,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let i=!0;t.accessKey&&(i=this.app.authority.calcByResCode(t.accessKey));let s=i;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}a.permitted=i,a.visible=s}return this.state.menuItemsState[t.id]=a,a}flattenAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var a;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(a=e.appMenuItems)?void 0:a.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),nr=(t("AppMenuIconViewController",class extends sr{async onClickMenuItem(t,e){const i=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new o("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!i.appFuncId)throw new a(i,"没有配置应用功能");const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(yo.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends ln{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const i=a.map((async a=>{const i=a.appDEDataSetId||"fetchdefault";return this.exec2(i,t,e,void 0,a.appDataEntityId)}));return(await Promise.all(i)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new o("未找到日历项模型");const i=a[e];if(!i)throw new o("未找到日历项模型");return t.map((t=>new so(i,t)))}async exec2(t,e,a={},i={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,a,i)}}));t("CalendarController",class extends ir{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new nr(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(a,i)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const a=t.beginTime,i=e.beginTime;let s=0;return gt(a).isAfter(i)?s=-1:gt(a).isBefore(i)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:i}=t;if(!a||!i){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:gt(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:gt(a).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:i}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};if(!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),a&&(n.page=e-1,n.size=a),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});gt.extend(It),gt.extend(Ct),gt.extend(bt),gt.extend(Tt),gt.extend(Nt);var or="$default_group",rr=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:s,id:n,userParam:o}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=i||{};this.xAxisIndex=N(r),this.yAxisIndex=N(c),this.seriesName=s||n,this.staticOptions=this.calcStaticOptions(),o&&(this.seriesUserParam=fr(o))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(rt(e))return;if(rt(t))return e;const i=this.chartGenerator.codeListMap.get(t);if(null==i?void 0:i.length){const t=i.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}prepareChartData(t,e,a,i){var s;this.groupField&&Object.assign(e,{[this.groupField]:i}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const n=new co(e,this.model,a,i);t[i].get(a).chartData=n,null==(s=this.chartDataArr)||s.push(n)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=or;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(rt(e))return;s=e}if(!e[s]&&(e[s]=new Map,i&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(i).forEach((t=>{e[s].set(t.text,{value:0})}))}const n=this.translateVal(i,t[this.catalogField],!0);if(n)e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=x(e[s].get(n).value,t[this.valueField]),e[s].get(n).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s);else if(i&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(i).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,s)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const a=t[e],i=this.calcSeriesData(a);let s={...this.staticOptions,data:i};return e!==or&&(s.name=e),this.seriesUserParam&&(s=ft(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push([a,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,i;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[or].get(t.name))?void 0:e.chartData:null==(i=null==(a=this.groupData)?void 0:a[t.seriesName].get(t.name))?void 0:i.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(lt(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=gt(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(gt(t[this.catalogField]).format("YYYY"),"-").concat(gt(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(gt(t[this.catalogField]).format("YYYY"),"-").concat(gt(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const i=t[a];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(i.keys()).sort(((t,e)=>gt(t).diff(gt(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,n]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,i.get(t))})),t[a]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(gt(e))}))}));const i=gt.max(a),s=gt.min(a);if("DAY"===e){let e=s;const a=i;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const a=i.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const a=i.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let a=1;a<=4;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const a=gt("".concat(e,"-12-31")).isoWeek();for(let i=1;i<=a;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},cr=class extends rr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:i}=this.model;return i&&(t.step="middle"),t}},dr=class extends rr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},lr=class extends rr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},hr=class extends rr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},ur=class extends rr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},pr=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},mr=class extends rr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new pr(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),i=Object.keys(e).map((t=>{const i=e[t],s=a.indicatorKeys.map((t=>i.has(t)?i.get(t).value:0));return{name:t===or?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=ft(s,this.seriesUserParam)),s}};function fr(t){const e={};return t&&Object.keys(t).forEach((a=>{const i=a.indexOf(".");if(-1===i)return;const s=a.slice(i+1);if(s)try{e[s]=JSON.parse(t[a])}catch(i){e[s]=t[a]}})),e}var gr=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:i,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==i?void 0:i.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(i)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=fr(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new cr(t,this);break;case"bar":e=new dr(t,this);break;case"scatter":e=new ur(t,this);break;case"pie":e=new hr(t,this);break;case"funnel":e=new lr(t,this);break;case"radar":e=new mr(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:i,titlePos:s}=t,n={show:e,text:a,subtext:i,left:"center"},o=null==s?void 0:s.toLowerCase();return"left"===o||"right"===o?n.left=o:"bottom"!==o&&"top"!==o||(n.top=o),n}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,i={};i.show=e;const s=null==a?void 0:a.toLowerCase();return"left"===s||"right"===s?(i.left=s,i.top="middle",i.orient="vertical"):"bottom"===s&&(i.top=s),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:i,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===i?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===i&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===i?45:0}};s&&(n=ft(n,fr(s))),e.push(n)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const i=ibiz.hub.getApp(t.srfappid),s=async a=>{if(!a||this.codeListMap.has(a))return;const s=await i.codeList.get(a,t,e);this.codeListMap.set(a,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await s(e),await s(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const i=e.length,s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=i;t<=n;t++)this.seriesGeneratorIndexMap.set(t,a)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=ft(this.staticOptions,this.options),this.chartUserParam&&(this.options=ft(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},wr=t("ChartService",class extends ln{}),Er=(t("ChartController",class extends ir{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new wr(this.model),await this.service.init(this.context),this.generator=new gr(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new o("chart对象没有正确初始化");if(!this.options)throw new o("options还没计算");this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends ar{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):"")}))}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),vr=class{};function yr(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=lt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(o))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:je.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(r,"报错,源参数:"),c),t}return c}var Ir=class extends vr{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=yr(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return Fe(n,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=yr(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return Fe(n,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(n,this.op,this.value)}}},Dr=class t extends vr{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Ir(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},Cr=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===(e||0)&&a&&(this.groupCond=new Dr(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(e))}}},Ar=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new Cr(t)))}},br=class extends Ar{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},Pr=class extends Ar{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:n}=t;if(!e)throw new a(this.model,"未配置界面行为");let o=[s];if(i){const e=t.params[i];o=e instanceof Array?e:[e]}await qr.execAndResolved(e,{...n,context:t.context,params:t.viewParam,data:o},this.model.appId)}},Tr=class extends Ar{async exec(t){}},xr=class extends Ar{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}},Nr=class extends Ar{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new i(a,"暂未支持逻辑处理参数操作".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:i}=t;if(!i)throw new o("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=yr(e,t);if(s)try{je.execScriptFn({srcVal:n,dstParam:e.params[i]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error("给目标参数属性".concat(a,"赋值报错,目标参数:"),e.params[i]),t}else e.params[i]=n}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=yr(e,t);e.params[a]=lt(i)}bindParam(t,e){const a=yr(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=yr(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i;e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Sr=class extends Ar{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:i,invokeParamId:s}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!s)throw new a(this.model,"没有配置操作参数");if(!e)throw new a(this.model,"没有配置调用方法");const n=t.params[s];if(!n)throw new o("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new o("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new o("没有找到调用方法".concat(e));await r[e](n)}},Lr=class extends Ar{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=yr(t,this.model);t.params[e]=s}},Rr=class extends Ar{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:n}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:o}=this.model,{message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:o||"消息",desc:r};let d=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,d=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,d=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,d=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const l=await ibiz.modal.confirm(c);t.setLastReturn(d[l?0:1])}},Or=class extends Ar{async exec(t){const e=await ms(this.model);e&&await e.exec(this.model,t)}},Mr=class extends Ar{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];ibiz.log.info("逻辑节点".concat(i,"操作参数值:"),s)}},_r=class extends Ar{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},Vr=class extends Ar{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=yr(t,this.model);t.params[e]=lt(s)}},Fr=class extends Ar{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=yr(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},kr=class extends Ar{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s;t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},Wr=class extends Ar{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Br=class extends Ar{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,o);c.ok&&(t.params[n]=c.data)}},Ur=class extends Ar{async exec(t){const{errorInfo:e}=this.model;throw new o(e)}},zr=class extends Ar{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:i,fireCtrlId:s}=this.model;if(!s)throw new a(this.model,"没有配置触发对象");if(!e)throw new a(this.model,"没有配置事件名称参数");if(!i)throw new a(this.model,"没有配置事件参数");const n=t.params[s];if(!n)throw new o("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new o("没有找到事件参数对象".concat(i));await n.evt.emit(e,r)}},Gr=class extends Ar{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!i)throw new a(this.model,"没有配置实体");if(!e)throw new a(this.model,"没有配置实体逻辑");if(!s)throw new a(this.model,"没有配置传入逻辑参数");const r=t.params[s];if(!r)throw new o("没有找到传入参数".concat(s));const c=await Un(e,i,t.context,r,t.params);n&&(t.params[n]=c)}},jr=class extends Ar{async exec(t){je.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Kr=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:n,params:o,data:r}=s,c=ibiz.hub.getApp(a.appId);if("layoutPanel"!==a.codeName)if(a.default)a.entityListParam?t.params[e]=r||[]:t.params[e]=r&&r.length>0?r[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const i=s.view.getController(a.codeName.toLowerCase());i?t.params[e]=i:ibiz.log.error("视图逻辑初始化参数,未找到".concat(a.codeName,"指定部件对象"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=c;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=o;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}else t.params[e]=s.view.layoutPanel.panelItems}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},Xr=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Tr(t);break;case"END":a=new xr(t);break;case"DEACTION":a=new br(t);break;case"DEUIACTION":a=new Pr(t);break;case"PREPAREJSPARAM":a=new Nr(t);break;case"RESETPARAM":a=new _r(t);break;case"COPYPARAM":a=new Vr(t);break;case"BINDPARAM":a=new Lr(t);break;case"VIEWCTRLINVOKE":a=new Sr(t);break;case"MSGBOX":a=new Rr(t);break;case"DEBUGPARAM":a=new Mr(t);break;case"APPENDPARAM":a=new Fr(t);break;case"SORTPARAM":a=new kr(t);break;case"RENEWPARAM":a=new Wr(t);break;case"DEDATASET":a=new Br(t);break;case"THROWEXCEPTION":a=new Ur(t);break;case"VIEWCTRLFIREEVENT":a=new zr(t);break;case"DELOGIC":a=new Gr(t);break;case"PFPLUGIN":a=new Or(t);break;case"RAWJSCODE":a=new jr(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Kr(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new Er(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(i);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Hr=new Map;async function Yr(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new o("找不到实体".concat(e,"的界面逻辑").concat(t));Hr.has(s)||Hr.set(s,new Xr(s));const n=Hr.get(s);return await n.exec(a),null}var qr=t("UIActionUtil",class{static async exec(t,e,a){const i=await ye(t,a);if(!i)throw new o("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await us(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const n=await this.exec(t,e,a);if(n.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(n.refresh)switch(n.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(i=e.view.parentView)||i.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await ye(t,a)).asyncAction&&!n.cancel&&this.handleAsyncAction(e.event)}static async handleAsyncAction(t){this.handleAsyncActionAnime(t)}static async handleAsyncActionAnime(t){t&&t.target&&await ibiz.util.anime.moveAndResize(t.target,"#".concat("preset-message"))}}),Qr=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:n,uilogicAttachMode:o}=t;if("REPLACE"===o){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Yr(s,n,e),i}if(!await this.isConfirm(t,e))return this.returnError(i);const r=await this.execAction(t,e);if(Object.assign(i,r),!0===i.cancel)return this.returnError(i);if("AFTER"===t.uilogicAttachMode){if(!s)throw new a(t,"没有配置实体界面逻辑");await Yr(s,n,this.mergeArgsByResult(e,i))}const c=this.mergeArgsByResult(e,i);if(t.closeEditView)this.doNextAction(t,c,t.appId);else{const e=await this.doNextAction(t,c,t.appId);if(e&&(Object.assign(i,e),!0===e.cancel))return this.returnError(i)}return i}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return!t.enableConfirm||!a||ibiz.confirm.warning({title:"操作确认",desc:a})}async doNextAction(t,e,a){const i=t.nextId;if(i)return qr.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const n=fe(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[a[0]];break;case"MULTIDATA":s=a;break;case"MULTIKEY":s=n&&a.length>0?a.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||n,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=ie(c,d?oe(c,a):a[0]||{},i,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:ie(h,d?oe(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=n,s=o;break;case"success":i=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||i);t!==s.lanResTag&&(i=t)}if(i){const{data:t}=a,e={...a};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,je.execScriptFn(e,"`".concat(i,"`"),{isAsync:!1,singleRowReturn:!0})}}}),$r=t("BackendUIActionProvider",class extends Qr{async execAction(t,e){const{context:i,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new a(t,"未配置实体或实体行为");const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,i,n,s),p={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(Eo.TAG,m,l,h,{event:o});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===u.length&&u.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((t=>{t.srfactionparam=e}))}}const f=ibiz.hub.getApp(null==i?void 0:i.srfappid),g=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await f.deService.exec(c,d,l,w?g:g[0],p);if(E.ok){const a=this.calcMessage("success",t,e);a&&ibiz.message.success(a)}return Object.assign(r,{data:J(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),Jr=t("SysUIActionProvider",class extends Qr{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,i=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===i)return{closeView:!0};return await a.callUIAction(i,e)||{}}}),Zr=t("FrontUIActionProvider",class extends Qr{async execAction(t,e){const{context:s,params:n,data:o,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=I.fill(t.htmlPageUrl,s,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:l}=await this.handleParams(t,s,o,n),h=await ibiz.commands.execute(Eo.TAG,e,i,l,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(d.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(d.data=h.data,d.nextContext=i,d.nextParams={...n,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return d}doOther(t,e){const{scriptCode:i}=t,{context:s,params:n,data:o,event:r,view:c}=e;if(i){return je.execScriptFn({context:s,params:n,data:o,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:n,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),d=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!d)throw new o("没有找到实体打印项");{let t="";if(!n||!n[c.codeName.toLowerCase()])throw new o("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(n[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:d.codeName,...r}});if(!e.ok)throw new o("打印失败");if(r&&r.srfcontenttype){const t=null==(s=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:s.slice(9),a=URL.createObjectURL(e.data),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){var a;const{resultContext:i,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let c="DataImport";if(r&&r.enableCustomized&&(c="DataImport2"),r){const t=ibiz.overlay.createModal(c,{dismiss:()=>t.dismiss(),appDataEntity:n,dataImport:r,context:i,params:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new o("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new o("没有找到实体导出项");{const t="/".concat(null==(i=n.codeName2)?void 0:i.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(r.codeName),a={page:0,size:r.maxRowCount?r.maxRowCount:1e3,...e.params,...s},c=await ibiz.net.request(t,{method:"post",data:a});if(200!==c.status)throw new o("导出请求失败");{let t="".concat(n.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([c.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}}}),tc=t("WFWithdrawUIActionProvider",class extends Qr{async execAction(t,e){const{view:a}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),ec=class extends Qr{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function ac(){const t=new Zr;ls("FRONT",(()=>t));const e=new $r;ls("BACKEND",(()=>e));const a=new Jr;ls("SYS",(()=>a));const i=new tc;ls("DEUIACTION_WFWithdraw",(()=>i));const s=new ec;ls("SYS_Logout",(()=>s))}var ic=t("ToolbarController",class extends ar{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new Fo,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const i=t.uiactionId,s=await ye(i,t.appId);if(!s)throw new o("没有找到界面行为模型".concat(i));const n=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;n&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(a,n.params),await qr.execAndResolved(i,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new Vo(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const i="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:i?"extra":"deuiaction"}),i||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof cn&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const t={};a&&(t.data=[a]),r(this.model,(e=>{const a=this.state.buttonsState[e.id];if(a){if(a.visible){const i=this.scheduler.triggerItemVisible(e.id,t);void 0!==i&&(a.visible=i)}if(!a.disabled){const i=this.scheduler.triggerItemEnable(e.id,t);void 0!==i&&(a.disabled=!i)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),sc=t("ContextMenuController",class extends ic{}),nc=(t("DashboardController",class extends ar{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=zo(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var i;if(t.controlType&&a.includes(t.controlType))return;const s=await cs(t);if(s){this.providers[t.id]=s;const a=await s.createController(t,this,e);this.portlets[t.id]=a,(null==(i=t.controls)?void 0:i.length)&&await this.initPortlets(t.controls,a)}})))}async dataChangeNotify(t){await Ea(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t){var e,a;this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null,this.model=t,this.config=new Js(t.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(a=this.model.codeName)?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),oc=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=he(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new nc}onDataChange(t){let e=t.data[0];e&&e instanceof cn&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Fo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Vo(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:i}=this.dashboard.view.model;i&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=ue(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),rc=(t("ContainerPortletController",class extends oc{}),t("ViewPortletController",class extends oc{}),t("MenuPortletController",class extends oc{}),t("ChartPortletController",class extends oc{}),t("ActionBarPortletController",class extends oc{}),t("HtmlPortletController",class extends oc{}),t("ListPortletController",class extends oc{}),t("RawItemPortletController",class extends oc{}),t("DataViewControlService",class extends ln{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new io(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new io(e,e);this.dataUIMap.set(e,i)}))}})),cc=t("DataViewControlController",class extends ir{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new rc(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const a=new Fo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Vo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),t.groupActionGroupState=a}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[a],i=this.state.groups.find((t=>t.key===e));i&&i.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var a,i;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof cn&&(s=s.getOrigin()),s&&(null==(a=e.groupActionGroupState)||a.update(s,this.model.appDataEntityId))):null==(i=e.groupActionGroupState)||i.update(void 0,this.model.appDataEntityId)}));else{const a=this.state.groups.find((e=>-1!==e.children.indexOf(t)));a&&(null==(e=a.groupActionGroupState)||e.update(a.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const i=new Fo,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),i;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Vo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.getOrigin())}return i}async onActionClick(t,e,a){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};qr.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const i=t.uiactionId,s={...this.params,srfgroup:a.key};await qr.execAndResolved(i,{context:this.context,params:s,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:i,minorSortDir:s}=this.model,n=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:o}=t;if(t.capLanguageRes&&(o=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:o,key:t.appDEFieldId};n&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),dc=t("ExpBarControlController",class extends ar{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),i=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem())}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&Bo(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:i}=t,s=this.getNavViewMsg(e[0],a,i);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,a,i){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?fe(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:a,params:i,data:e},{resultContext:h,resultParams:u}=re(d,l),p=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new o("多节点视图由子类实现")}getNavViewMsg(t,e,a){const i=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:i,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),lc=(t("CalendarExpBarController",class extends dc{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:i}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:i,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends dc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const i=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(n,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:n.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,a)=>{0===a?e.push(t):e.push("".concat(e[a-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends dc{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,a,i){var s;const{context:n,params:o}=super.prepareParams(t,e,a,i);if(e._seriesModelId){const a=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(a){const{navigateContexts:t,navigateParams:s}=a,r=ie(t,e,i,n),c=ie(s,e,i,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,a){var i;let s;if(t._seriesModelId){const e=null==(i=this.XDataModel.dechartSerieses)?void 0:i.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends ar{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new cn,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Ea(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,i=void 0){await Promise.all(t.map((async t=>{const s=await Zi(t);if(!s)return;if(e.details[t.id])throw new a(t,"初始化异常: 表单成员[".concat(t.id,"](").concat(t.detailType,")已存在,表单项标识重复请检查配置"));e.providers[t.id]=s;const n=await s.createController(t,e,i);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),Pe(t))return;const o=be(t);o.length&&await this.initDetailControllers(o,e,n)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Uo(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}})),hc=class extends dn{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===i?n:r,h="create"===i?o:c,u=s.id.toLowerCase(),p=Xo({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:a});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},uc=t("SearchFormService",class extends hc{async getDraft(t,e={}){let a={ok:!0,status:200,data:this.getFilteredData({...e})};return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new io(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}}),pc=(t("SearchFormController",class extends lc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Js(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new uc(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const a=this.state.data[e];null!=a&&""!==a&&(t[e]=a)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const i=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===i,a="BOTTOM"!==i,"NONE"===t&&(e=!0,a=!0);const s=t=>{let i,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],n=e,!0))),i&&i.length>0){const o=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<i.length&&(t[n]=o)}};(a||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new o("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o("没有找到保存的搜索条件");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),mc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(mc||{})),fc=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(fc||{})),gc=t("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:i}=this.model;if(t){const{width:e,height:a}=he(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName),i&&i.lanResTag&&(this.model.caption=ibiz.i18n.t(i.lanResTag,this.model.caption))}createState(){var t;return new pc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const i=a.relatedDetailNames||[];if(e||C(i,t))try{const t=He(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=ue(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=ue(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),wc=t("FormButtonState",class extends pc{constructor(){super(...arguments),this.loading=!1}}),Ec=(t("FormButtonController",class extends gc{createState(){var t;return new wc(null==(t=this.parent)?void 0:t.state)}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await qr.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends pc{constructor(){super(...arguments),this.showMask=!1}})),vc=(t("FormDRUIPartController",class extends gc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Ec(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),C(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;H(e)&&(t=Object.assign(t,ie(e,this.data,this.form.params,this.form.context)));const a=ie(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=Q(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends pc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),yc=t("FormGroupPanelController",class extends gc{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new vc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Fo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Vo(t.id,this.form.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await qr.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Ic=t("FormItemState",class extends pc{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),Dc=(t("FormItemController",class extends gc{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new Ic(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Qi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=la(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Go(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...jo(this.model.editor)),this.rules.length>0&&(this.validator=new wt({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&Y(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),t("FormMDCtrlController",class extends gc{get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return A.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return A.checkPermission(this.model.buildInActions,2)}get enableDelete(){return A.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}})),Cc=(t("FormMDCtrlMDController",class extends Dc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");"GRID"===t.controlType&&b(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await Hi(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new i(this.model,"多数据部件类型".concat(this.model.contentType,"暂不支持添加数据"));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController不存在")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends pc{}),Ac=(t("FormMDCtrlFormController",class extends Dc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new Cc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await Hi(t);e&&(this.formProvider=e);const{appDataEntityId:i}=this.model.contentControl;this.deName=fe(i)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const a={...this.params};return{id:t.srfkey,context:e,params:a}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const a=e.data[0],i=this.state.items.find((e=>e.id===t));i&&i.context[this.deName]!==a.srfkey&&(i.context[this.deName]=a.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o("没有找到对应".concat(t,"的表单控制器"));await e.remove();const a=this.state.items.findIndex((e=>e.id===t));-1!==a&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const i={id:Q(),context:e,params:a};void 0!==t?this.state.items.splice(t,0,i):this.state.items.push(i)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends Dc{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new i(this.model,"暂不支持重复器样式".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=lt(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,a)=>t!==a));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends vc{})),bc=(t("FormPageController",class extends yc{createState(){var t;return new Ac(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends pc{})),Pc=(t("FormRawItemController",class extends gc{createState(){var t;return new bc(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends pc{})),Tc=(t("FormTabPageController",class extends gc{createState(){var t;return new Pc(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends pc{constructor(){super(...arguments),this.activeTab=""}})),xc=(t("FormTabPanelController",class extends gc{createState(){var t;return new Tc(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}}),t("EditFormService",class extends hc{async get(t,e={}){var a;let i=await this.exec((null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"update"),i}async getDraft(t,e={}){var a;let i=await this.exec((null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}async remove(t,e={}){var a;return await this.exec((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const i=e instanceof cn?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var a;const i=e instanceof cn?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var i;const s=null==(i=this.model.goBackControlAction)?void 0:i.appDEMethodId;if(!s)throw new a(this.model,"缺少返回操作实体行为");let n=await this.exec(s,t,e instanceof cn?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,a={}){let i=await this.exec(t,e,a);return i=this.handleResponse(i),i}async wfStart(t,e,a){var i;const s=(null==(i=this.model.wfstartControlAction)?void 0:i.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,a instanceof cn?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let n="";n=e.type?e.type:(null==(i=s.wfsubmitControlAction)?void 0:i.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,a instanceof cn?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const a=e,i=a.id.toLowerCase(),s=a.fieldName||e.appDEFieldId;let n;n=s?new io(i,s,{isOriginField:!0,dataType:a.dataType}):new io(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,n)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}})),Nc=(t("EditFormController",class extends lc{constructor(){super(...arguments),this.oldData=new cn}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new xc(this.model),await this.service.init(this.context),this.autoSave=_(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=i.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=lt(this.context),e=lt(this.params),a=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(a&&this.params[a]){t[fe(this.model.appDataEntityId)]=this.params[a],delete e[a],delete this.params[a],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=Q(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!ge(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=lt(a);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),s=await this.service.get(e,i)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await P(500,this.save.bind(this),[t])}if(!await this.validate())throw new o("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],n=0===s.srfuf;let r;try{r=n?await this.service.create(a,s):await this.service.update(a,s)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):b(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(r.data.$origin,n?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i,s=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(s=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!s)return!1;await this.startLoading();try{i=await this.service.remove(e,a)}catch(t){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=i.ok}return this.state.data=new cn,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&b(this.data,t.data),this.data}async updateFormItem(t){var e;const a=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!a)throw new o("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=a,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=je.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},a=await this.service.updateFormItem(i,this.context,e);t=a.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"流程启动成功"})}async wfSubmit(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"流程提交成功"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{demand:t}=this.model,e={silent:!0,noFillBack:!0};t&&(e.data=this.getDiffData());try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((a=>{t[a]===this.oldData[a]&&a!==t.srfkeyfield||(e[a]=t[a])})),e.srfuf=t.srfuf,new cn(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return je.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),Sc=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),Lc=t("GridService",class extends ln{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const i=t.id.toLowerCase(),s=t.appDEFieldId;let n;if(s){const o=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));n=new io(i,o,{isOriginField:!0,dataType:r.dataType})}else n=new io(i,i);this.dataUIMap.set(i,n)}))}}async updateGridEditItem(t,e,a={}){const i=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await i.exec(t,e,a);return s=this.handleResponse(s),s}}),Rc={string:25,number:6,integer:9,date:5};var Oc=t("GridController",class extends ir{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new Lc(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await Qo(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var a;if(!t.properties)return;const{properties:i}=t;if(!(Object.keys(i).length>0))return;const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e})}));const n={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[],r=[];return s.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,valueType:"SIMPLE",dataType:Rc[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=lt(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===a.findIndex((e=>e.id===t.id)))),...a]}}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:i}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(s,"没有配置代码表"));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===i){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(s,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await Ea(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new Sc(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.state.rows.forEach((t=>{Object.values(t.uiActionGroupStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,i="CODELIST"===a,s=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[s];i||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:i}=this.model;if("ALL"!==t)return;if(!i||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const s=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,i,this.context,void 0,s);o.data.length&&([this.state.remoteAggResult]=o.data)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a))return void ibiz.log.error("不支持新建行");if("row"===a){if(this.state.rows.find((t=>t.showRowEdit)))throw new o("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(i,s);try{n=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;T(r,s),this.state.items.unshift(r);const c=new Sc(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,a=this.findRowState(t);if(!a)throw new o("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await P(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new o("行数据校验不通过,保存取消");let i;const s=fe(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{i=e?await this.service.create(n,t):await this.service.update(n,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:a.data}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await Ea(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await as(t);if(!a)return;this.providers[t.codeName]=a;const i=await a.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=i,t.enableRowEdit&&(this.editColumns[t.codeName]=i)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=i:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:a,frozenLastColumn:i}=this.model;t.forEach(((t,s)=>{t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":a&&s<a?t.fixed="left":i&&s>=e-i&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Uo(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Ea(Object.values(this.editColumns).map((async a=>a.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new o("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=lt(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let a;t&&(a=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(a,e)}async updateGridEditItem(t,e){var a;const i=null==(a=this.model.degridEditItemUpdates)?void 0:a.find((t=>t.id===e));if(!i)throw new o("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=i,d=n.map((t=>t.id));let l;if(r&&c)l=je.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},a=await this.service.updateGridEditItem(s,this.context,e);l=a.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let i;await this.startLoading();try{i=await this.service.fetch(e,a)}finally{await this.endLoading()}return i.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),i=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=a.codeList.getCodeList(t.codeListId),e.codeListItems=await a.codeList.get(t.codeListId,this.context)),e}));if(i)return Promise.all(i)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=null==(e=this.dataEntity.appDEDataExports)?void 0:e.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=t=>{var e;const a=new Map;this.allExportColumns&&this.allExportColumns.length>0?null==(e=this.allExportColumns)||e.forEach((t=>{t.codeListItems&&a.set(t.appDEFieldId,t.codeListItems)})):Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&a.set(t,this.fieldColumns[t].codeListItems)}));const i=lt(t.map((t=>t.getOrigin())));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;a.get(e)&&(t[e]=(null==(i=a.get(e).find((a=>a.value===t[e])))?void 0:i.text)||t[e])}))})),i};let i=[],s=[];this.allExportColumns&&this.allExportColumns.length>0?(i=this.allExportColumns.map((t=>t.appDEFieldId)),s=this.allExportColumns.map((t=>t.caption))):(i=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.id)),s=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.caption)));const n=(r=i,(await(async()=>{var e;const i=null==(e=t.params)?void 0:e.type;let s=[];if("activatedPage"===i&&(s=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:n}=t.params,o="customPage"===i?{page:0,offset:(a-1)*e,size:(n-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:o})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new o("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await qo(s,n,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=i.editItem,c=e?n:r,d=e?s:o,l=Xo({name:i.fieldName,valueType:c,defaultValue:d,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(a[i.fieldName]=l)})),a}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((a=>a.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.saveColumnStates()}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:this.initColumnStates()}changeColumnStateSort(t,e,a){const i=this.state.columnStates.find((e=>e.key===t));i&&(this.state.columnStates.splice(a,1),this.state.columnStates.splice(e,0,i),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}}),Mc=t("GridFieldColumnController",class extends Nc{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=_(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new Fo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Vo(t.id,this.grid.context.srfappid,e);a.addState(t.id,i)}})),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:i}=this.model;if(!i)return{context:e,params:a};const{navigateContexts:s,navigateParams:n}=de(i);let o={};s&&t&&(o=ie(s,t,a,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=ie(n,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:n}=this.model;if(!n)return;const o=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=lt(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Eo.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await qr.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:n}=this.model;if(rt(a)||"NONE"===a)return;const o=e||this.model.id;let r;if(t=t.filter((t=>!rt(t[o]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new i(this.model,"远程聚合暂未支持"):new i(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[o])));break;case"MIN":r=Math.min(...t.map((t=>t[o])));break;default:throw new i(this.model,"暂未支持属性列聚合模式".concat(a))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error("".concat(r," 值格式化错误"))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Ko.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=gt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),_c=(t("GridUAColumnController",class extends Nc{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new Fo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Vo(t.id,this.grid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends Mc{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=Ae(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Qi(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=la(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Go(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...jo(this.editItem.editor)),this.rules.length>0&&(this.validator=new wt({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let i=!1;a&&a.length>0&&a.forEach((t=>{e.includes(t)&&(i=!0)})),i&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new o("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&Y(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:i}=a;return t.errors[e]=i[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends Nc{}),t("ListService",class extends ln{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new io(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new io(e,e);this.dataUIMap.set(e,i)}))}})),Vc=(t("ListController",class extends ir{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new _c(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=a.get(e[t])||[];i.push(e),a.set(e[t],i)}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,i=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=a.filter((e=>-1===o.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends ar{constructor(t,e,a,i,s){super(t,e,a,i),this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var i,s;const n=await ns(t);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,a);e.panelItems[t.id]=o,(null==(i=t.panelItems)?void 0:i.length)&&!o.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new o("未获取到面板数据");const i=this.convertData(a);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=i,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=Oe(this.model),a=e.map((t=>t.id)),i=new ro(e,t);return i._evt.on("change",(t=>{a.includes(t)&&this.dataChangeNotify([t])})),i}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),Fc=(t("ViewLayoutPanelController",class extends Vc{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),kc=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=he(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new Fc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const i=a.relatedItemNames||[];if(e||C(i,t))try{const t=Ye(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=ue(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=ue(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends ar{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),i={...this.params};t&&Object.assign(a,ie(t,this.params,this.context)),e&&Object.assign(i,ie(e,this.params,this.context)),this.state.context=a,this.state.params=i}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),["ISNULL","ISNOTNULL"]),Wc=t("SearchBarFilterController",class{constructor(t,e){var a;let i;this.model=t,this.searchBar=e,this.noEditor=!1,t.appDEFieldId&&(i=ve(e.appDataEntity,t.appDEFieldId)),this.fieldName=i?i.codeName.toLowerCase():t.id,this.label=t.caption||(null==i?void 0:i.logicName)||t.id,this.valueOP=null==(a=t.defsearchMode)?void 0:a.valueOP,this.noEditor=this.valueOP?kc.includes(this.valueOP):!this.model.editor}get context(){return this.searchBar.context}get params(){return this.searchBar.params}async init(){if(!this.noEditor){if(!this.model.editor)throw new a(this.model,"缺少编辑器模型");this.editorProvider=await Qi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Bc=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=[{condop:"EQ",condtype:"DEFIELD",fieldname:"app_view_tag",value:this.viewTag}],e=await this.app.net.post("".concat(this.themeUrl,"/fetch_cur_user_all"),{searchconds:t,sort:"create_time,asc"});return e.ok&&(e.data=this.convertBackDataToFront(e.data)),e}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t));return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t))}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:"".concat(this.viewTag,"___").concat(t),caption:t,app_tag:this.model.appId,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{name:t.name,caption:t.caption,app_tag:this.model.appId,app_view_tag:this.viewTag,theme_model:JSON.stringify(e),valid_flag:t.show?1:0})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[a]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),a)}async updateBatch(t){const e=this.convertFrontDataToBack(t),a=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(a),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={app_tag:this.model.appId,app_view_tag:this.viewTag};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},Uc="",zc={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Gc={};function jc(t,e){if(t.enumSource)return{appId:Uc,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Gc["".concat(t.type,"_").concat(e)]}Object.keys(zc).forEach((t=>{zc[t].forEach((e=>{if(kc.includes(e))return;const a="".concat(t,"_").concat(e);Gc[a]||("date"!==t||["IN","NOTIN"].includes(e)?Gc[a]={appId:Uc,editorType:"TEXTBOX",id:a}:Gc[a]={appId:Uc,editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends ar{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Bc(this.model,this.view.model.codeName.toLowerCase()),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups(!0)}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await Qo(this.model.appDataEntityId,this.context);if(!e)return;const a=await async function(t,e){var a;if(!t.properties)return[];const{properties:i}=t;if(!(Object.keys(i).length>0))return[];const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e,enumSource:i[t].enumSource})}));const n={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[];return s.forEach((t=>{const e=zc[t.type];e?e.forEach((e=>{t&&o.push({appId:Uc,appDEFieldId:n[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Uc,valueOP:e},editor:jc(t,e)})})):ibiz.log.error("未支持的类型",t.type)})),o}(e,this),i=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===a.findIndex((e=>{var a;return e.appDEFieldId===t.appDEFieldId&&(!(null==(a=t.defsearchMode)?void 0:a.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&i.push(t)})),a.length>0&&(this.model=lt(this.model),this.model.searchBarFilters=a.concat(...i),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=ie(je.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=this.getOriginFilterNodes(),this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(null==(t=this.searchBarFilters)?void 0:t.length)&&(this.searchBarFilters.forEach((t=>{const e=new Wc(t,this);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.enableFilter)return;let t=!1,e=!1;if(r(this.state.filterNodes[0],(a=>{a.leaf&&(a.field&&a.valueOP&&!rt(a.value)?t=!0:e=!0)})),t&&!e){return[this.formatFilters(this.state.filterNodes[0])]}}formatFilters(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map((t=>this.formatFilters(t)))}}parseFilters(t){if("GROUP"===t.condtype)return{leaf:!1,logicType:"AND"===t.condop?"AND":"OR",children:(t.searchconds||[]).map((t=>this.parseFilters(t)))};if("DEFIELD"===t.condtype)return{leaf:!0,field:t.fieldname||null,valueOP:t.condop||null,value:t.value||null};throw new o("无效的condtype:".concat(t.condtype))}getOriginFilterNodes(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}async initSearBarGroups(t=!1){if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const a={name:t.id,caption:t.caption,saved:!1,show:!0,searchGroupData:{},order:100*(e+1),defaultSelect:!1,noEdit:!0};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(a.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(a.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(a.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(a.show="1"===e.valid_flag)}catch(e){ibiz.log.error("".concat(t.data,"非标准JSON格式:"),e)}return t.defaultGroup&&(a.defaultSelect=!0),a})));const e=await this.service.fetch();if(e.ok&&e.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)b(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,a)=>e.order>this.state.searchBarGroups[t].order?a:t),0);this.state.searchBarGroups.push({saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)})),t&&this.state.searchBarGroups&&this.state.searchBarGroups.length>0){this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){const t=this.state.searchBarGroups.find((t=>t.defaultSelect));t&&this.handleGroupClick(t)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:this.calcFilters(),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success("保存成功");else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.name===e.data.name));t&&(b(t,e.data),t.saved=!0),ibiz.message.success("保存成功")}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(b(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>this.parseFilters(t)));this.state.filterNodes=e}else this.state.filterNodes=this.getOriginFilterNodes();this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}}),t("TabExpPanelController",class extends ar{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&Bo(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);!0===e&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:i,navigateParams:s,appDataEntityId:n}=t,o={deName:fe(n),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=re(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}});var Kc=t("TreeService",class extends ln{async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ce(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:a});if(0===s.length)return;(await Ea(s.map((async a=>{const i=De(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ie(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];if(t.accessKey){if(!this.app.authority.calcByResCode(t.accessKey))return r}switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,o)];break;case"DE":r=await this.getDENodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var a;if(d&&(!c||c&&0===e)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,a,i){return new ao(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...a.params},l={...a.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<i;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=De(this.model,h._nodeId);t.appDataEntityId&&(p=fe(t.appDataEntityId)),u=h._value}const{resultContext:f,resultParams:g}=re({deName:p,navFilter:o?"n_".concat(o.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:s},{derValue:u,context:l,params:d,data:m});return Object.assign(l,f),Object.assign(d,g),{context:l,params:d,navContext:f,navParams:g}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new eo(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new Zn(t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}}),Xc=t("TreeController",class extends ir{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),a=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new sc(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async onDestroyed(){await super.onDestroyed(),this.counter&&this.counter.destroy()}async initService(){this.service=new Kc(this.model),await this.service.init(this.context)}async initCounter(){const{appCounterRefs:t}=this.model,e=null==t?void 0:t[0];e&&(this.counter=await Zs.getCounterByRef(e,this.context))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Ce(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var a;if(null==(a=t.parentDER1N)?void 0:a.pickupDEFName){const a=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&e.push({minorEntityId:a.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const a=t.decontextMenu;if(null==(e=null==a?void 0:a.detoolbarItems)?void 0:e.length){let e=0;const i=[];r(a,(t=>{if("DEUIACTION"===t.itemType){e+=1;const a=t;200===a.actionLevel&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:i[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let a;e&&await this.startLoading();try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;let i;this.state.isLoading=!0;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=i:this.state.rootNodes=i,await this.afterLoadNodes(i),i}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var a;const i=null==(a=this.contextMenuInfos[t._nodeId])?void 0:a.clickTBUIActionItem;if(i)return this.doUIAction(i.uiactionId,t,e,i.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e._id!==t._id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t._id);if(e&&!a)this.state.expandedKeys.push(t._id);else if(!e&&a){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),a=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(a)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,a,i){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await qr.exec(t,{...s,...n,event:a},i);if(o.closeView)this.view.closeView();else if(o.refresh)switch(o.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){let e=null;return e="DE"===t._nodeType?t:{...t,...t._deData||{}},{data:[e],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var a;(null==(a=t._children)?void 0:a.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"_id",i=this.state.items.find((e=>e[a]===t[a]));if(!i)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{_parent:t}=i;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?i._parent:i,n=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const a=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==a.length&&await Promise.all(a.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,a){var i,s;const n=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId);if((null==(i=t._parent)?void 0:i._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,n.appDataEntityId)}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return null==a?void 0:a.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,i){var s,n,o;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===i?e:e._parent,l=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(n=e._parent)?void 0:n._id)!==(null==(o=t._parent)?void 0:o._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===i)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let a=d._children.indexOf(e);"next"===i&&(a+=1),d._children.splice(a,0,t)}("inner"===i||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:f}=h;if(!0===f){if(!p)throw new a(h,"缺少配置排序属性");const e=p.toLowerCase(),i="ASC"===m,s=[...d._children];i||s.reverse();const n=t=>t+(100-t%100),o=t=>t[e]||0;let c;s.forEach(((a,i)=>{const d=a._deData;void 0===c?a===t&&(c=0===i?100:n(o(s[i-1]._deData)),d[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=o(d)&&(d[e]=n(c),r.push(a)),c=o(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const a=this.getNodeModel(t._nodeId),i=t._deData,s=fe(a.appDataEntityId),n=this.context.clone();n[s]=i.srfkey;const o=await e.deService.exec(a.appDataEntityId,"update",n,i);o.data&&(t._deData=o.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if("DE"!==t._nodeType)throw new o("不是实体树节点数据");t._text=e,await this.updateDeNodeData([t])}}),Hc=t("WizardPanelService",class extends dn{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}}),Yc=(t("WizardPanelController",class extends ar{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,i;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),n=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),o=null==n?void 0:n.stepTag;this.stepTags[s]=o})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Hc(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await Hi(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o("找不到".concat(t,"的表单控制器"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const i=await a.load();Object.assign(this.formData,i)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=fe(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new o("找不到标识为".concat(t,"的向导表单"));return a}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,{},this.params),e=fe(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new o("没有上一个表单");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,a=this.model.dewizard.dewizardForms;if(t&&a){const a=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),i=t[a+1];if(!i)throw new o("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends ln{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new io(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new io(e,e);this.dataUIMap.set(e,i)}))}})),qc=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Qc=(t("MDCtrlController",class extends ir{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new Yc(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new qc(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new qc(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Fo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new Vo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.data.getOrigin()),t.uaColStates[e.id]=i}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(new qc(e,this)))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(new qc(e,this))}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends rc{async updateGroup(t,e){var a;const i=(null==(a=this.model.updateGroupControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}})),$c=(t("KanbanController",class extends cc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new Qc(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:i}=this.model;if(!e)throw new a(this.model,"排序属性没配置");if(!i)throw new a(this.model,"排序方向没配置");const s="ASC"===i;t.forEach((t=>{const a=t[e];if(rt(a))t[e]=0;else{const e=Number(a);if(Number.isNaN(e))throw new o("".concat(t.srfmajortext,"的排序属性无法转换成数值"))}})),t.sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e]))}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,a){this.setSelectGroup(a.key),super.onGroupToolbarClick(t,e,a)}async onGroupActionClick(t,e,a,i){this.setSelectGroup(i.key);const s={...this.params,srfgroup:i},n=t.uiactionId;await qr.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:a},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o("看板部件必须开启分组");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));i.push({caption:a.text,color:a.color,key:a.value,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=n}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning("当前看板不允许调整分组!");const e="ASC"===this.model.minorSortDir,{from:a,to:i,fromIndex:s,toIndex:n}=t,o=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=d.children[s];return e[o]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[s];t.from!==t.to?(m[o]=t.to,p.splice(n,0,m)):(p.splice(s,1),p.splice(n,0,m));const f=d.children.splice(s,1);let g;l.children.splice(n,0,...f),e||(u.reverse(),p.reverse());let w,E=[];p.forEach(((t,e)=>{void 0===g?t!==u[e]&&(g=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=g,c.push(t)):(g>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),g=w,w=0,E=[]),t[r]=h(g),c.push(t)):(0===E.length&&(w=g),E.push(t)),g=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=fe(this.model.appDataEntityId),a=this.context.clone();a[e]=t.srfkey;const i=await this.service.updateGroup(a,t);if(i.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,i.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,a){const i=this.state.groups.find((e=>e.key===t));i&&(i[e]=a)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const a=t.split("quicktoolbar_")[1];this.setGroupController(a,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const a=t.split("batchtoolbar_")[1];this.setGroupController(a,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends Kc{})),Jc=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),Zc=t("TreeGridExController",class extends Xc{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new $c(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await Rs(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=a:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=a)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,a)=>{t.uaColumn&&(t.fixed=a+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new Jc(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug("简单模式,不保存");if("DE"!==t._nodeType)throw new o("非实体节点数据不能保存");const e=this.state.rows[t._uuid];if(!e)throw new o("行数据不存在");if(!e.modified)return void ibiz.log.debug("值没有发生改变");if(e.processing)return void await P(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=i,r=0===t._deData.srfuf;if(r)throw new o("暂不支持新建");if(!n)throw new a(i,"树节点没有配置更新实体行为");const c=fe(s),d=this.context.clone();d[c]=t._deData.srfkey;const l=ibiz.hub.getApp(this.context.srfappid);let h;try{h=await l.deService.exec(s,n,d,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(r?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=h.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await Ea(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((a=>{a.gridStateNotify(t,e)}))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Uo(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Ea(Object.values(this.columns).map((async a=>a.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const a={};return Object.values(this.fieldColumns).forEach((i=>{const s=i.nodeColumnControllerMap.get(t._nodeId);if(!s||!s.nodeEditItem)return;const{createDV:n,createDVT:o,updateDV:r,updateDVT:c}=s.nodeEditItem,d=e?o:c,l=e?n:r,h=Xo({name:i.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(a[i.name]=h)})),a}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data._deData.srfuf){t.cacheData=lt(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}}),td=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),ed=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:i,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==i?void 0:i.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==s?void 0:s.find((t=>t.id===o.dataItemName));if(!o||!r)throw new a(e,"节点没有配置对应表格列".concat(this.fieldColumn.name,"的数据项"));if(this.nodeColumn=o,this.nodeDataItem=r,o.enableRowEdit){const t=null==n?void 0:n.find((t=>t.id===o.id));if(!t)throw new a(e,"没有找到对应表格列".concat(this.fieldColumn.name,"的编辑项模型"));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await Qi(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const a=new Fo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new Vo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.name]=a}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const a=this.nodeColumn.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new o("未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:i,...n}),c=lt(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:a}=de(d);let i={};e&&t.data&&(i=ie(e,t.data,c,r)),Object.assign(r,i);let s={};a&&t.data&&(s=ie(a,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(Eo.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const a=this.nodeColumn.deuiactionId;await qr.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,a){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return Ko.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=gt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}async setRowValue(t,e,a){a=a||this.name,await this.treeGrid.setRowValue(t,a,e)}}),ad=(t("TreeGridExFieldColumnController",class extends td{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new ed(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const a=this.nodeColumnControllerMap.get(t.data._nodeId);a&&a.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends td{constructor(){super(...arguments),this.nodeColumnMap=new Map}async init(){await this.onInit(),await this.initNodeColumnMap()}initNodeColumnMap(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;const a=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));a&&this.nodeColumnMap.set(t.id,a)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const a=this.nodeColumnMap.get(t.data._nodeId);a.deuiactionGroup&&(e=a.deuiactionGroup)}return e}initActionStates(t){var e;const a=this.getUIActionGroup(t);if(!a)return void ibiz.log.warn("".concat(this.model.id,"操作列没有配置界面行为组"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Fo;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new Vo(t.id,this.treeGrid.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.model.id]=i}async onActionClick(t,e,a){const i=t.uiactionId;await qr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}}),t("TreeGridController",class extends Oc{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const i=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!i)throw new a(this.model,"树表格无值列模式");if(!s)throw new a(this.model,"树表格无父值列模式");this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=i.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends Lc{}),t("MEditViewPanelService",class extends ln{})),id=(t("MEditViewPanelController",class extends ir{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new ad(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const i=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);this.parameters=a&&i?[{parameterName:null==(t=i.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=i.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,a),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===a.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,a={id:t[e]?t[e]:"mockId:".concat(Q()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:i,pathName:s}=e;t[i]&&!Object.is(t[i],"")&&Object.assign(a.context,{[s]:t[i]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(a,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(a,{srfmajortext:"草稿--新建"})})),a}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex((t=>t.id===e));if(a<0)throw new o("编辑视图面板部件UI数据不存在");const i=this.state.panelUiItems[a];i.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):i.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),t("MapService",class extends ln{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const i=[];if(null==(a=this.model.sysMapItems)?void 0:a.length){const a=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:r}=s,c=t.clone(),d={...e};if(r){const a=je.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=de(a);i&&Object.assign(c,ie(i,e,t)),s&&Object.assign(d,ie(i,e,t))}}const l=await a.deService.exec(n,o,c,d);l.data&&i.push(...l.data.map((t=>new oo(t,s))))})))}return new p(i,200)}})),sd=(t("MapController",class extends ir{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new id(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);a.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(a,i);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),i=[],s=[];return a.forEach((t=>{"REGION"===t._itemStyle?i.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=i,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const a=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=a;break;case"strareacode":this.state.strAreaCode="true"===a;break;case"jsonbaseurl":this.state.jsonBaseUrl=a}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends dn{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(null==(a=this.dataEntity.codeName2)?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let s=await ibiz.net.request(i,{method:"post",data:e});return s=this.handleResponse(s),s}})),nd=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},od=class extends nd{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},rd=class extends nd{},cd=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new od(t);case"USER2":return new rd(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},dd=(t("ReportPanelController",class extends ar{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=cd.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new sd(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam),i=await this.service.fetch(e,a);this.state.data=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),t("GanttService",class extends Kc{execDeService(t,e,a,i){return this.app.deService.exec(t,e,a,i)}async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ce(this.model,{parentId:t._nodeId,hasQuery:a});if(0===s.length)return;(await Ea(s.map((async a=>{const i=De(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ie(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new ho(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new uo(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new po(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}})),ld=(t("GanttController",class extends Zc{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new dd(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}transformNodeDataItem(t,e){var a;const i={};return null==(a=t.detreeNodeDataItems)||a.forEach((t=>{t.id&&t.appDEFieldId&&e.hasOwnProperty(t.id.toLowerCase())&&Object.assign(i,{[t.appDEFieldId.toLowerCase()]:e[t.id.toLowerCase()]})})),i}async updateNodeData(t,e,a=!1){const i=t.srfkey?"srfkey":"_id",s=this.state.items.find((e=>e[i]===t[i]));if(!s||!s.srfkey)return void ibiz.log.error("找不到对应的动态实体树节点数据",t);const n=this.getNodeModel(s._nodeId);if(n){const i=a?this.transformNodeDataItem(n,e):e;if(Object.keys(i).length>0){const e=fe(n.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(n.appDataEntityId,"update",a,i)).status&&this.refreshNodeChildren(t,!0)}}}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),hd=class{constructor(){this.convert=new Ao,this.controller=new ld,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new Po,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,a=-1){const i=this.calcAppViewId(t);if(this.view2appMap.has(i)){const t=this.view2appPriorityMap.get(i);if(t&&t<a)return}this.view2appMap.set(i,e),-1!==a&&this.view2appPriorityMap.set(i,a)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(t),t}throw new o("视图[".concat(e,"]不存在"))}async loadAppView(t,e,a){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,a)}throw new o("视图[".concat(e,"]不存在"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return a=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new o("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new Do(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Js(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,a){return(await this.getAppAsync(t)).deService.getService(a,e)}reset(){this.appMap.clear(),this.configCache=void 0}},ud=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:i}=t,s="".concat(i,"_").concat(a),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),pd=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:i}=this.view;ibiz.log.debug("".concat(a.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_header;e&&(e.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_footer;t&&(t.state.visible=!1)}}}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,i;let s=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else s=!0;if(ibiz.env.isMob){if(this.leftToolbar)s=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)s=!0;else{const t=null==(a=this.viewLayoutPanel)?void 0:a.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)s=!0;else{const t=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;t&&(t.state.visible=!1)}return s}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:i}=this.view;if(!t)throw new o("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),n=await s.deService.exec(t,"get",a,i),{data:r}=n;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),md=(t("MDViewEngine",class extends pd{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault&&(this.searchBar&&this.searchBar.hasDefaultSelect&&"grid"===this.xdataControlName?this.searchBar.setDefaultSelect():this.load())}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?this.openData(e):"New"===t?this.newData(e):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Search"===t?(await this.searchForm.search(),null):"Reset"===t?(await this.searchForm.reset(),null):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,i;const{data:s,event:n}=t,o=(t.context||this.view.context).clone(),r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||fe(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!c.ok}}async newData(t){var e,i,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=lt(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:n,event:o,view:this.view}));if(-1===d)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){let t=super.calcViewHeaderVisible();if(this.searchBar&&this.searchBar.state.visible)t=!0;else{const t=this.viewLayoutPanel.panelItems.view_searchbar;t&&(t.state.visible=!1)}return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),class{constructor(){this.layoutPanel=new qe,this.theme=new ua,this.text=new ha,this.hbs=new ee,this.rawValue=new ga,this.action=qr,this.error=new Ot,this.viewStack=new wa,this.anime=new Li,this.error.register(new Rt)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}}),fd=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o("Method not implemented.")}destroy(){}},gd=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},wd=class extends fd{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const i=this.logic.scriptCode;this.scriptFn=je.createScriptFn(t,i,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Ed=class extends fd{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Yr(e,i,t)}},vd=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),pt(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const i={itemName:t,triggerType:e},s=this.triggerAndExecute(i,a);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const i=this.getExecuteParams(e);return a.execute(i)}triggerControlEvent(t,e,a){const i={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(i,a)}},yd=class extends vd{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Id=class extends vd{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Dd=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}},Cd=class{constructor(){this.executorFactory=new gd,this.triggerFactory=new Dd}createViewScheduler(t){return new Id(t)}createControlScheduler(t){return new yd(t)}},Ad=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new o("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},bd=class extends Ad{},Pd=class extends Ad{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:i}=t;return{context:e,params:a,data:(null==i?void 0:i[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(a=this.logic.itemName)?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},Td=class extends Ad{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new a(this.logic,"定时器缺少定时间隔");this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},xd=class extends fd{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:i,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const d=c.refAppViewId;if(!d)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const l=c.navigateContexts||[],h=Object.assign(i,ie(l,r[0],s,i));let u={};const p=c.navigateParams;return H(p)&&(u=ie(p,r[0],s,i)),ibiz.commands.execute(Eo.TAG,d,h,u,n)}async calcOpenViewRef(t,e){const i=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=i.formTypeAppDEFieldId||i.dataTypeAppDEFieldId;if(!s)throw new a(t,"".concat(i.codeName,"[多表单实体] or [索引实体]缺少类型属性配置"));const{data:n}=e,r=n[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return d}async executeNewDataAppUILogic(t,e){const{context:s,params:n,...o}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=fe(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(p=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(p=u,!p||!p.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},f={};const g=(null==r?void 0:r[0])||{},w=p.navigateContexts;H(w)&&(m=ie(w,g,n,s)),m=Object.assign(s,m);const E=p.navigateParams;if(H(E)&&(f=ie(E,g,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&g&&(f[t]=g.srfkey,f.srfcopymode=!0)}f.srfuf=0;const v=await ibiz.commands.execute(Eo.TAG,p.refAppViewId,m,f,o);return l&&v.data&&await this.doBatchAdd(t,v.data,s,p,e.view),v}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const l=await ibiz.commands.execute(Eo.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(i=l.data)?void 0:i[0];if(!h)throw new o("请选中一条数据");const u=h.srfkey,p=null==n?void 0:n.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new o("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}async doBatchAdd(t,e,i,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new a(c,"实体没有从关系集合!");let h="";if(null==d||d.forEach((t=>{const e=fe(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o("没有找到".concat(l,"在当前实体的外键属性"));const u={srfkey:h},p=null==(r=n.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,a]=e.split(":");t&&a&&(u[t]=a)}}ibiz.log.debug("批量新建转换映射属性",u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((a=>{const i=u[a];e[i]=t[a]})),e}));ibiz.log.debug("批量新建创建数据",m);const f=ibiz.hub.getApp(i.srfappid).deService;await f.exec(c.id,"Create",i,m)}}},Nd=class extends Ad{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>ta[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Sd=class extends Ad{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>aa[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},Ld=class extends fd{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");qr.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Et.dirname(this.url.pathname)}dir(t){return this.url.origin+Et.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=a,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
|
|
1
|
+
System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var a,i,s,n,o,r,c,d,l,h,u,p,m,f,g,w,E,v,y,I,D,C,A,b,P,T,x,N,S,R,L,O,M,_,V,F,k,W,U,z,B,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,ft,gt,wt,Et,vt;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,n=t.NoticeError,o=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.IBizContext,l=t.DataTypes,h=t.clone,u=t.CoreConst,p=t.HttpResponse,m=t.updateKeyDefine,f=t.Net,g=t.getToken,w=t.NOOP,E=t.IBizParams,v=t.isElementSame,y=t.findRecursiveChild,I=t.StringUtil,D=t.debounceAndAsyncMerge,C=t.isOverlap,A=t.BitMask,b=t.mergeInLeft,P=t.awaitTimeout,T=t.mergeDefaultInLeft,x=t.plus,N=t.toNumberOrNil},function(t){S=t.isEmpty,R=t.isString,L=t.isArray,O=t.isObject,M=t.isNil,_=t.debounce,V=t.camelCase,F=t.eq,k=t.gt,W=t.gte,U=t.findIndex,z=t.lt,B=t.lte,G=t.upperFirst,j=t.snakeCase,K=t.kebabCase,X=t.isFunction,H=t.isNumber},function(t){Y=t.notNilEmpty,q=t.isNilOrEmpty,Q=t.AsyncSeriesHook,J=t.createUUID,$=t.QXEvent,Z=t.isArray,tt=t.getCookie,et=t.setCookie,at=t.clearCookie,it=t.ascSort,st=t.descSort,nt=t.clearAll,ot=t.isNumber},function(t){rt=t.default},function(t){ct=t.isNil,dt=t.mergeRight,lt=t.isEmpty,ht=t.clone,ut=t.equals,pt=t.where,mt=t.mergeLeft,ft=t.isNotNil,gt=t.mergeDeepRight},function(t){wt=t.default},function(t){Et=t.default},function(t){vt=t.default}],execute:function(){t({asyncImportData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(qo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const n=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(o=n.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(o!==i)return;const s=a.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED");var o},calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t;let i;if(e||a){switch(i={display:"flex"},e){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(a){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:ge,calcDynaClass:pe,calcDynaSysParams:async function(t,e,a={}){const i=a.appId||e.srfappid,s=a.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,i);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdeanme)n.srfparentkey=s.srfparentkey,n.srfparentdeanme=s.srfparentdeanme;else{const t=qs(e,o);if(t&&t.keys.length>1){const a=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[a],n.srfparentdeanme=s.srfparentdeanme||a}}return n},calcFilterModelBySchema:Hc,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:l(a,i),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcLayoutHeightWidth:ue,calcMainStateOPPrivsStrs:fe,calcNavParams:ce,calcResPath:Qs,calcSearchConds:Jc,compare:We,compareNumber:Ue,contains:ze,convertNavData:se,convertNavDataByArray:oe,convertObjectToNavParams:ie,execDELogic:Bn,execDELogicAction:jn,execDELogicById:Gn,execFieldLogics:Xn,execUILogic:Qr,exportData:Jo,fieldValueToBoolean:$s,filterFieldLogics:ve,filterValueRules:ha,findChildFormDetails:Pe,findDELogic:Ee,findEditItem:be,findFieldById:ye,findModelChild:de,formatFilters:qc,formatMultiData:re,generateEditorRules:Xo,generateRules:Ko,getAllPanelField:Me,getAppCounterProvider:Xi,getAppMenuItemProvider:Fs,getAppViewRef:function(t,e){var a,i;let s=t.appViewRefs||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(a=t.actiontype||"DEFAULT",ibiz.register.get("".concat(vs,"_").concat(a)));var a;if(e)return e;throw new o("找不异步操作类型".concat(t.actiontype,"对应的适配器"))},getChildNodeRSs:Ae,getControl:function(t,e){var a,i;let s=t.controls||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.controls));return s.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlPanel:he,getControlProvider:qi,getControlsByView:xe,getDEMethodProvider:Rs,getDERedirectToView:Fe,getDeACMode:async function(t,e,a){var i;const s=await ibiz.hub.getAppDataEntity(e,a);return null==(i=s.appDEACModes)?void 0:i.find((e=>e.id===t))},getDefaultValue:Yo,getEditorProvider:$i,getEntitySchema:$o,getFormDetailProvider:es,getGridColumnProvider:ss,getInternalMessageProvider:function(t){const e=(a=t.content_type||"DEFAULT",ibiz.register.get("".concat(ks,"_").concat(a)));var a;if(e)return e;throw new o("找不站内信类型".concat(t.content_type,"对应的适配器"))},getMatchResPath:qs,getOriginData:jo,getOriginFilterNodes:Yc,getPFPlugin:function(t,e){const i=ibiz.hub.getApp(e);if(!i)throw new a(i,"未找到应用");const{model:s}=i;if(!s.appPFPluginRefs)throw new a(s,"应用未配置插件");const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error("未找到插件".concat(t));return n},getPanelItemProvider:rs,getPlatformProvider:Ts,getPlatformType:Cs,getPortletProvider:ls,getRootNode:De,getTreeGridExColumnProvider:Ms,getTreeNode:Ce,getUIActionById:Ie,getUIActionItemsByActionLevel:function(t,e){const a=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const i=t;i.actionLevel===e&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),a},getUIActionProvider:ms,getUILogicNodeProvider:gs,getViewEngines:Se,getViewLogics:Ne,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=Es(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Es("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=Es(a));e||(e=Es("DEFAULT"));return e},getWFContext:Je,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:s),c=null==o?void 0:o.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:va,hasDeCodeName:we,hasSubRoute:Bo,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Qo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));return(await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}})).data},install:function(){const{ibiz:t}=window;t.util=new Ad,t.hub=new Id,t.register=new Lt,t.config=new Rt,t.auth=new fn,t.asyncAction=new gn,t.internalMessage=new Zn,t.engine=new Dd,t.uiDomainManager=new ga,Co(),sc(),$n(),Bs(),ibiz.scheduler=new Od,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Vd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Vd(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Vd(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Fd(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new _d(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new Wd(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Ud(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Td(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new xd(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new xd(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new kd(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new zd(t,e))),function(){const t=new Is;bs("Browser",(()=>t))}(),t.platform=Ts()},installCommand:Co,isDataContainer:Re,isFormDataContainer:Te,isValueChange:Go,matchMainState:me,openRedirectView:_e,parseFilters:Qc,parseUserParams:le,presetAppCounterProvider:Bs,presetDEMethodProvider:$n,presetUIActionProvider:sc,registerAppCounterProvider:ji,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(_s,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(vs,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(Hi,"_").concat(t),e)},registerDEMethodProvider:Ns,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Qi,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Zi,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(as,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(ks,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(ns,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:bs,registerPortletProvider:function(t,e){ibiz.register.register("".concat(cs,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(Ls,"_").concat(t),e)},registerUIActionProvider:us,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(fs,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(ws,"_").concat(t),e)},strContain:Be,testCond:ke,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await Ve(t,e,a);await ibiz.commands.execute(yo.TAG,i.viewId,i.context,i.params,i.opts)},verifyDeRules:Xe,verifyFormGroupLogic:Ye,verifyPanelGroupLogic:qe});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function yt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var It={exports:{}};!function(t,e){t.exports=function(t,e,a){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var a;1===e.length&&e[0].length>0&&(e=e[0]),a=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](a)||(a=e[i]);return a};a.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},a.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}}}(It);var Dt=yt(It.exports),Ct={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Ct);var At=yt(Ct.exports),bt={exports:{}};!function(t,e){var a,i;t.exports=(a="month",i="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var n=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):n.bind(this)(t,e)};var o=s.startOf;s.startOf=function(t,e){var s=this.$utils(),n=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return n?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return o.bind(this)(t,e)}})}(bt);var Pt=yt(bt.exports),Tt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var n=e.prototype;n.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var n=s(this).startOf(i).add(1,i).date(e),o=s(this).endOf(a);if(n.isBefore(o))return 1}var r=s(this).startOf(i).date(e).startOf(a).subtract(1,"millisecond"),c=this.diff(r,a,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},n.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Tt);var xt=yt(Tt.exports),Nt={exports:{}};!function(t,e){var a;t.exports=(a="day",function(t,e,i){var s=function(t){return t.add(4-t.isoWeekday(),a)},n=e.prototype;n.isoWeekYear=function(){return s(this).year()},n.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,a));return r.diff(c,"week")+1},n.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var o=n.startOf;n.startOf=function(t,e){var a=this.$utils(),i=!!a.u(e)||e;return"isoweek"===a.p(t)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):o.bind(this)(t,e)}})}(Nt);var St=yt(Nt.exports),Rt=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0}}},Lt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Ot=t("DefaultErrorHandler",class{handle(t){return t instanceof a||t instanceof i?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error("没有注册无权限错误处理器"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof n?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof o&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Mt=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error("没有找到能处理该错误的处理器",t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),_t=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};_t.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Vt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Ft=class extends Vt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const a=t.filter((t=>!!t)).length===t.length;return _t.handleJudgmentExecute(this,a,e)}},kt=class extends Vt{constructor(t){super(t,"camelCase")}onExecute(t){return t?V(t):""}},Wt=class extends Vt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Ut=class extends Vt{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return _t.handleJudgmentExecute(this,i,a)}},zt=class extends Vt{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return _t.handleJudgmentExecute(this,i,a)}},Bt=class extends Vt{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return _t.handleJudgmentExecute(this,i,a)}},Gt=class extends Vt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=L(t)?!F(U(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),_t.handleJudgmentExecute(this,s,i)}},jt=class extends Vt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Kt=class extends Vt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Xt=class extends Vt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Ht=class extends Vt{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=z(t,e);return _t.handleJudgmentExecute(this,i,a)}},Yt=class extends Vt{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=B(t,e);return _t.handleJudgmentExecute(this,i,a)}},qt=class extends Vt{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return _t.handleJudgmentExecute(this,i,a)}},Qt=class extends Vt{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return _t.handleJudgmentExecute(this,a,e)}},Jt=class extends Vt{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const i=t.find((t=>!!t));if(a.fn){const t=(null==(e=a.data)?void 0:e.root)||{};return i?a.fn(t):a.inverse(t)}return i||""}},$t=class extends Vt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},Zt=class extends Vt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},te=class extends Vt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},ee=class extends Vt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var ae=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var a;return this.hsb=t.default||t,this.p=null,a=this.hsb,new Ft(a),new kt(a),new Wt(a),new Ut(a),new zt(a),new Bt(a),new jt(a),new Kt(a),new Xt(a),new Ht(a),new Yt(a),new qt(a),new Qt(a),new Jt(a),new $t(a),new Zt(a),new te(a),new ee(a),new Gt(a),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function ie(t){const e=[],a=/^%(.+)%$/;for(const i in t){let s=!0,n=t[i];Y(t[i])&&a.test(t[i])&&(s=!1,n=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:n})}return e}function se(t,...e){if(!t||S(t))return{};return oe(Array.isArray(t)?t:ie(t),...e)}function ne(t,e){const a=t.find((t=>!q(t)&&(t[e]||Object.prototype.hasOwnProperty.call(t,e))));return{find:!!a,value:null==a?void 0:a[e]}}function oe(t,...e){const a=/\$\{[^}]*\}/g,i={};for(const s of t)if(s.rawValue)i[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(a);if(null!==t){let a=s.value;t.forEach((t=>{const{find:i,value:s}=ne(e,t.slice(2,-1).toLowerCase());i&&(a=a.replace(t,"".concat(s)))})),i[s.key.toLowerCase()]=a}else{const{find:t,value:a}=ne(e,s.value.toLowerCase());t&&(i[s.key.toLowerCase()]=a)}}return i}function re(t,e){const a={};if(!t)return a;const i=Array.isArray(t)?t:ie(t),s=e[0];return i.forEach((t=>{const{rawValue:i,value:n}=t;!i&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(a[n]=e.map((t=>t[n])).join(";"))})),a}function ce(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(a&&(h[a]=p),i&&(u[i]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=se(n,d,c,r),f=se(o,d,c,r);return Object.assign(h,m),Object.assign(u,f),{resultContext:h,resultParams:u}}function de(t,e){if(t&&e){const a=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(a)return a}return null}function le(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:e,navigateParams:a,other:i}}function he(t){let e;if(t.controlRenders){const a=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==a?void 0:a.layoutPanel}return e}function ue(t){const{width:e,height:a,widthMode:i,heightMode:s}=t,n={width:"",height:""};return"FULL"===i?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?n.height="100%":a&&a>0&&(n.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),n}function pe(t,e){const a=[],i=Ke.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return R(i)?a.push(i):L(i)?a.push(...i):O(i)&&Object.keys(i).forEach((t=>{i[t]&&a.push(t)})),a}function me(t,e){const{mainStateAppDEFieldIds:a,demainStates:i}=t;if(a&&i){const t=[];return a.forEach((a=>{t.push(e[a])})),i.find((e=>{const{stateValue:a,state2Value:i,state3Value:s}=e;let n=!0;const o=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function fe(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,n=(null==i?void 0:i.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...a.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function ge(t){return t.split(".").pop()}function we(t,e){const a=ge(e);return Y(t[a])}function Ee(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function ve(t,e){var a,i;const s=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>s.includes(t.id))))||[]}function ye(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function Ie(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function De(t){return t.detreeNodes.find((t=>t.rootNode))}function Ce(t,e){return t.detreeNodes.find((t=>t.id===e))}function Ae(t,e){const a=e.parentId||De(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(i=t.searchMode,s=e.hasQuery,3===i||(s?1===i:2===i));var i,s}))}function be(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function Pe(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Te(t){return"MDCTRL"===t.detailType}function xe(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function Ne(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Se(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn("未支持的引擎分类:".concat(t.engineType)),!1)))}function Re(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Le=["panelItems","panelTabPages","rootPanelItems"];function Oe(t){let e=[];for(const a of Le)if(t[a]){e=t[a];break}const a=[];return e.length&&(a.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Re(t)||a.push(...Oe(t))}))),a}function Me(t){return Oe(t)}async function _e(t,e,a={},i={}){return async function(t,e,a={},i={}){let s;try{s=await Fe(t,e,a,i)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const a=window.open(t,"_blank");a&&(a.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(yo.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,a,i)}async function Ve(t,e,a={}){const i=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(i+1,e.length)),n=rt.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o("未找到指定实体的codeName: ".concat(r));n[c.toLowerCase()]=n[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete n.srfdename,"undo"!==n.srfwf){const t=n.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=a}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:a,viewId:l.id}}async function Fe(t,e,i={},s={}){var n;const r=se(t.appViewNavContexts||[],i,e);e=Object.assign(e.clone(),r);const c=se(t.appViewNavParams||[],i,e);Object.assign(i,c);const d=t.appDataEntityId,l=ge(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||i[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,i);if(t.ok){h=t.data;let a=h.linkurl;if(a){if(e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://"))return{type:"url",url:a};if(a.startsWith("appredirectview?")){return{type:"view",...await Ve(e,a,s)}}throw new o("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(d,t.appId),g=await async function(t,e,a,i){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:a}=ye(t,n),s=i[a.toLowerCase()];if(Y(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(n,"]值为空"),i)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(Y(r))return Y(a.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=ye(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(q(c)&&t.formTypeAppDEFieldId){const{codeName:e}=ye(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=Y(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(f,t,i,h);let w="";if(!g.startsWith("view://")){const n=g.split(":"),o=2===n.length?g:n.slice(0,2).join(":"),r="".concat(f.name.toUpperCase(),":").concat(g),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===g||e===o}));if(d){if(w=d.refAppViewId,w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(d,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(g,"]或[").concat(r,"]或工作流[").concat(o,"]对应视图"))}{const t=new URL(g);t.searchParams.size>0&&t.searchParams.forEach(((t,e)=>{i[e]=t}));const e=t.pathname.replace("//","").split("/"),[a,s]=e;w=s||a}if(w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(t,"标识[".concat(g,"]未匹配到实际引用视图"))}function ke(t,e,a){if(Object.is(e,"IN"))return ze(t,a);if(Object.is(e,"NOTIN"))return!ze(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return We(t,a)<0;case"LTANDEQ":return We(t,a)<=0;case"GT":return We(t,a)>0;case"GTANDEQ":return We(t,a)>=0;case"ISNULL":return q(t);case"ISNOTNULL":return Y(t);case"TESTNULL":return ct(t);case"IN":return ze(t,a);case"NOTIN":return!ze(t,a);case"LIKE":return Be(t,a);case"LEFTLIKE":return Be(t,a,"start");case"RIGHTLIKE":return Be(t,a,"end");default:throw new o("值操作:".concat(e,",暂未支持"))}}function We(t,e){const a=Number(t),i=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(i))return Ue(a,i);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return Ue(s,n);throw new o("".concat(t," 和 ").concat(e," 无法比较大小"))}function Ue(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function ze(t,e){if(!e||"string"!=typeof e)throw new o("范围比较的条件值不存或者不是字符串");if(t){return e.split(",").includes("".concat(t))}return!1}function Be(t,e,a){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=i.indexOf(s);switch(a){case"start":return 0===n;case"end":return n+s.length===i.length;default:return-1!==n}}var Ge={singleRowReturn:!1,isAsync:!0},je=t("ScriptFunction",class{constructor(t,e,a=Ge){this.argKeys=[],this.options=a;const i=this.formatCode(e,a);this.calcArgKeys(t,a);const s=new Function(...this.argKeys,i);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error("报错脚本",i),t}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?dt(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),i.push(a[t])})),i}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),Ke=t("ScriptFactory",class{static createScriptFn(t,e,a){return new je(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function Xe(t,e,a){const i={isPast:!0,infoMessage:a.ruleInfo};if(function(t){return"GROUP"===t.condType}(a)){const s=a.conds;s&&s.length>0&&(i.isPast=function(t,e,a="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===a;for(let i=0,n=t.length;i<n;i++){const n=e(t[i],i);if("AND"===a){if(!n){s=!1;break}}else if("OR"===a&&n){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:n}=Xe(t,e,a);return i.infoMessage=n,s}),a.condOp,!!a.notMode),!i.isPast&&("AND"===a.condOp&&a.notMode||"OR"===a.condOp&&!a.notMode)&&(i.infoMessage=a.ruleInfo))}else{t=(null==a?void 0:a.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=n[a=a?a.toLowerCase():""]?n[a]:a}(ct(i)||lt(i))&&(i="内容必须符合值规则");const c=ke(t,e,a);if(!c&&r)throw new o(i);return!c}(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){q(n)&&(n="值必须符合值范围规则");if(q(t)){if(r)throw new o("值为空");return n="值为空",!0}if(He(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!=i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"REGEX"===t.condType}(a))i.isPast=!He(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(a))i.isPast=!function(t,e,a,i,s,n,r){q(n)&&(n="内容长度必须符合范围规则");if(q(t)){if(r)throw new o("值为空");return n="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!==i)if(s){if(c>i){if(r)throw new o(n);return!0}}else if(c>=i){if(r)throw new o(n);return!0}return n="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(a)&&(null==a?void 0:a.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!He(e[t],n,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,a,i,s){q(i)&&(i="值必须符合脚本规则");const n=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=Ke.execScriptFn({value:t,data:n},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(i="",!c&&s)throw new o(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=n||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=a.notMode?!i.isPast:i.isPast}return i}function He(t,e,a,i){q(a)&&(a="值必须符合正则规则");if(q(t)){if(i)throw new o("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new o(a);return!0}return a="",!1}function Ye(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.defdlogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!Ye(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>Ye(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return ke(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}function qe(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.panelItemLogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!qe(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>qe(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return ke(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}var Qe=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=ht(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:i,mainMenuAlign:s}=t;let n="";i?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(a,"_").concat(n):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function Je(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var $e=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))($e||{})),Ze=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(Ze||{})),ta=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(ta||{})),ea=t("StudioViewEvents",class{});ea.onViewMounted="onMounted",ea.onViewDestroyed="onDestroyed";var aa=t("StudioPanelEvents",class{});aa.onClick="onClick",aa.onChange="onChange",aa.onEnter="onEnter",aa.onLeave="onLeave";var ia=t("StudioControlEvents",class{});ia.onBeforeLoad="onBeforeLoad",ia.onLoadSuccess="onLoadSuccess",ia.onLoadError="onLoadError",ia.onBeforeLoadDraft="onBeforeLoadDraft",ia.onLoadDraftSuccess="onLoadDraftSuccess",ia.onLoadDraftError="onLoadDraftError",ia.onBeforeSave="onBeforeSave",ia.onSaveSuccess="onSaveSuccess",ia.onSaveError="onSaveError",ia.onBeforeRemove="onBeforeRemove",ia.onRemoveSuccess="onRemoveSuccess",ia.onRemoveError="onRemoveError",ia.CLICK="onClick";var sa=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(sa||{})),na=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(na||{})),oa=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(oa||{})),ra=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(ra||{})),ca=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))(ca||{})),da=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(da||{})),la=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new Q,beforeDismiss:new Q},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ha(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var ua=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),pa=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=ht(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let a=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];a+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}a+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=a,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),ma=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn("事务已经开启, 单个界面域只能开启一个事务"):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error("当前事务未提交,不可以直接关闭事务");this.state.isOpen=!1}},fa=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new ma,this.id=t||J()}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const a=t.majorAppDataEntityId;this.rs2Map.has(a)||this.rs2Map.set(a,[]),this.rs2Map.get(a).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),ga=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new fa(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error("无效的界面域标识[".concat(t,"]"))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),wa=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}}),Ea=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new $}add(t,e){this.stack.push(e),this.stackMap.set(t,e),this.recalculateActiveStack(),this.evt.emit("add",e),this.evt.emit("change",{type:"add",view:e})}remove(t){const e=this.stackMap.get(t);e&&(this.stack.splice(this.stack.indexOf(e),1),this.stackMap.delete(t),this.recalculateActiveStack(),this.evt.emit("remove",e),this.evt.emit("change",{type:"remove",view:e}))}getActives(){return this.activeStack}active(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("active",e),this.evt.emit("change",{type:"active",view:e}))}deactivate(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("deactivate",e),this.evt.emit("change",{type:"deactivate",view:e}))}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function va(t,e=!0){const a=await Promise.allSettled(t),i=[],s=[];if(a.forEach((t=>{"fulfilled"===t.status?i.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return i}var ya={position:"fixed",zIndex:"10000"};function Ia(t,e=document.body,a=!0){const i=Ca(t);if(null==i)throw new Error("Cannot clone a null or undefined element.");const s=i.cloneNode(!0);if(a)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:a,boundingLeft:i,boundingTop:s}){t.style.left="".concat(i,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(a,"px"),Object.assign(t.style,ya)}(s,Da(i)),e.appendChild(s),s}function Da(t){const e=t.offsetWidth,a=t.offsetHeight,i=window.getComputedStyle(t),s=parseFloat(i.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:a,padding:s,boundingLeft:n,boundingTop:o}}function Ca(t){return"string"==typeof t?document.querySelector(t):t}var Aa={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},ba={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Pa=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Ta={CSS:{},springs:{}};function xa(t,e,a){return Math.min(Math.max(t,e),a)}function Na(t,e){return t.indexOf(e)>-1}function Sa(t,e){return t.apply(null,e)}var Ra={arr:function(t){return Array.isArray(t)},obj:function(t){return Na(Object.prototype.toString.call(t),"Object")},pth:function(t){return Ra.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Ra.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Ra.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Ra.hex(t)||Ra.rgb(t)||Ra.hsl(t)},key:function(t){return!Aa.hasOwnProperty(t)&&!ba.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function La(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Oa(t,e){var a=La(t),i=xa(Ra.und(a[0])?1:a[0],.1,100),s=xa(Ra.und(a[1])?100:a[1],.1,100),n=xa(Ra.und(a[2])?10:a[2],.1,100),o=xa(Ra.und(a[3])?0:a[3],.1,100),r=Math.sqrt(s/i),c=n/(2*Math.sqrt(s*i)),d=c<1?r*Math.sqrt(1-c*c):0,l=1,h=c<1?(c*r-o)/d:-o+r;function u(t){var a=e?e*t/1e3:t;return a=c<1?Math.exp(-a*c*r)*(l*Math.cos(d*a)+h*Math.sin(d*a)):(l+h*a)*Math.exp(-a*r),0===t||1===t?t:1-a}return e?u:function(){var e=Ta.springs[t];if(e)return e;for(var a=1/6,i=0,s=0;;)if(1===u(i+=a)){if(++s>=16)break}else s=0;var n=i*a*1e3;return Ta.springs[t]=n,n}}function Ma(t){return void 0===t&&(t=10),function(e){return Math.ceil(xa(e,1e-6,1)*t)*(1/t)}}var _a,Va,Fa=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function a(t,e){return 3*e-6*t}function i(t){return 3*t}function s(t,s,n){return((e(s,n)*t+a(s,n))*t+i(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*a(s,n)*t+i(s)}return function(e,a,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var r=new Float32Array(11);if(e!==a||i!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,i);return function(t){return e===a&&i===o||0===t||1===t?t:s(d(t),a,o)}}function d(a){for(var o=0,c=1;10!==c&&r[c]<=a;++c)o+=t;--c;var d=o+(a-r[c])/(r[c+1]-r[c])*t,l=n(d,e,i);return l>=.001?function(t,e,a,i){for(var o=0;o<4;++o){var r=n(e,a,i);if(0===r)return e;e-=(s(e,a,i)-t)/r}return e}(a,d,e,i):0===l?d:function(t,e,a,i,n){var o,r,c=0;do{(o=s(r=e+(a-e)/2,i,n)-t)>0?a=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(a,o,o+t,e,i)}}}(),ka=(_a={linear:function(){return function(t){return t}}},Va={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,a=4;t<((e=Math.pow(2,--a))-1)/11;);return 1/Math.pow(4,3-a)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var a=xa(t,1,10),i=xa(e,.1,2);return function(t){return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/i)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Va[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Va).forEach((function(t){var e=Va[t];_a["easeIn"+t]=e,_a["easeOut"+t]=function(t,a){return function(i){return 1-e(t,a)(1-i)}},_a["easeInOut"+t]=function(t,a){return function(i){return i<.5?e(t,a)(2*i)/2:1-e(t,a)(-2*i+2)/2}},_a["easeOutIn"+t]=function(t,a){return function(i){return i<.5?(1-e(t,a)(1-2*i))/2:(e(t,a)(2*i-1)+1)/2}}})),_a);function Wa(t,e){if(Ra.fnc(t))return t;var a=t.split("(")[0],i=ka[a],s=La(t);switch(a){case"spring":return Oa(t,e);case"cubicBezier":return Sa(Fa,s);case"steps":return Sa(Ma,s);default:return Sa(i,s)}}function Ua(t){try{return document.querySelectorAll(t)}catch(t){return}}function za(t,e){for(var a=t.length,i=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<a;n++)if(n in t){var o=t[n];e.call(i,o,n,t)&&s.push(o)}return s}function Ba(t){return t.reduce((function(t,e){return t.concat(Ra.arr(e)?Ba(e):e)}),[])}function Ga(t){return Ra.arr(t)?t:(Ra.str(t)&&(t=Ua(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function ja(t,e){return t.some((function(t){return t===e}))}function Ka(t){var e={};for(var a in t)e[a]=t[a];return e}function Xa(t,e){var a=Ka(t);for(var i in t)a[i]=e.hasOwnProperty(i)?e[i]:t[i];return a}function Ha(t,e){var a=Ka(t);for(var i in e)a[i]=Ra.und(t[i])?e[i]:t[i];return a}function Ya(t){return Ra.rgb(t)?(a=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+a[1]+",1)":e:Ra.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,a,i){return e+e+a+a+i+i})),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)+",1)"}(t):Ra.hsl(t)?function(t){var e,a,i,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),n=parseInt(s[1],10)/360,o=parseInt(s[2],10)/100,r=parseInt(s[3],10)/100,c=s[4]||1;function d(t,e,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?t+6*(e-t)*a:a<.5?e:a<2/3?t+(e-t)*(2/3-a)*6:t}if(0==o)e=a=i=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),a=d(h,l,n),i=d(h,l,n-1/3)}return"rgba("+255*e+","+255*a+","+255*i+","+c+")"}(t):void 0;var e,a}function qa(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function Qa(t,e){return Ra.fnc(t)?t(e.target,e.id,e.total):t}function Ja(t,e){return t.getAttribute(e)}function $a(t,e,a){if(ja([a,"deg","rad","turn"],qa(e)))return e;var i=Ta.CSS[e+a];if(!Ra.und(i))return i;var s=document.createElement(t.tagName),n=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;n.appendChild(s),s.style.position="absolute",s.style.width=100+a;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return Ta.CSS[e+a]=r,r}function Za(t,e,a){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return a?$a(t,s,a):s}}function ti(t,e){return Ra.dom(t)&&!Ra.inp(t)&&(!Ra.nil(Ja(t,e))||Ra.svg(t)&&t[e])?"attribute":Ra.dom(t)&&ja(Pa,e)?"transform":Ra.dom(t)&&"transform"!==e&&Za(t,e)?"css":null!=t[e]?"object":void 0}function ei(t){if(Ra.dom(t)){for(var e,a=t.style.transform||"",i=/(\w+)\(([^)]*)\)/g,s=new Map;e=i.exec(a);)s.set(e[1],e[2]);return s}}function ai(t,e,a,i){var s=Na(e,"scale")?1:0+function(t){return Na(t,"translate")||"perspective"===t?"px":Na(t,"rotate")||Na(t,"skew")?"deg":void 0}(e),n=ei(t).get(e)||s;return a&&(a.transforms.list.set(e,n),a.transforms.last=e),i?$a(t,n,i):n}function ii(t,e,a,i){switch(ti(t,e)){case"transform":return ai(t,e,i,a);case"css":return Za(t,e,a);case"attribute":return Ja(t,e);default:return t[e]||0}}function si(t,e){var a=/^(\*=|\+=|-=)/.exec(t);if(!a)return t;var i=qa(t)||0,s=parseFloat(e),n=parseFloat(t.replace(a[0],""));switch(a[0][0]){case"+":return s+n+i;case"-":return s-n+i;case"*":return s*n+i}}function ni(t,e){if(Ra.col(t))return Ya(t);if(/\s/g.test(t))return t;var a=qa(t),i=a?t.substr(0,t.length-a.length):t;return e?i+e:i}function oi(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ri(t){for(var e,a=t.points,i=0,s=0;s<a.numberOfItems;s++){var n=a.getItem(s);s>0&&(i+=oi(e,n)),e=n}return i}function ci(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*Ja(t,"r")}(t);case"rect":return function(t){return 2*Ja(t,"width")+2*Ja(t,"height")}(t);case"line":return function(t){return oi({x:Ja(t,"x1"),y:Ja(t,"y1")},{x:Ja(t,"x2"),y:Ja(t,"y2")})}(t);case"polyline":return ri(t);case"polygon":return function(t){var e=t.points;return ri(t)+oi(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function di(t,e){var a=e||{},i=a.el||function(t){for(var e=t.parentNode;Ra.svg(e)&&Ra.svg(e.parentNode);)e=e.parentNode;return e}(t),s=i.getBoundingClientRect(),n=Ja(i,"viewBox"),o=s.width,r=s.height,c=a.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:i,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function li(t,e,a){function i(a){void 0===a&&(a=0);var i=e+a>=1?e+a:0;return t.el.getPointAtLength(i)}var s=di(t.el,t.svg),n=i(),o=i(-1),r=i(1),c=a?1:s.w/s.vW,d=a?1:s.h/s.vH;switch(t.property){case"x":return(n.x-s.x)*c;case"y":return(n.y-s.y)*d;case"angle":return 180*Math.atan2(r.y-o.y,r.x-o.x)/Math.PI}}function hi(t,e){var a=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=ni(Ra.pth(t)?t.totalLength:t,e)+"";return{original:i,numbers:i.match(a)?i.match(a).map(Number):[0],strings:Ra.str(t)||e?i.split(a):[]}}function ui(t){return za(t?Ba(Ra.arr(t)?t.map(Ga):Ga(t)):[],(function(t,e,a){return a.indexOf(t)===e}))}function pi(t){var e=ui(t);return e.map((function(t,a){return{target:t,id:a,total:e.length,transforms:{list:ei(t)}}}))}function mi(t,e){var a=Ka(e);if(/^spring/.test(a.easing)&&(a.duration=Oa(a.easing)),Ra.arr(t)){var i=t.length;2===i&&!Ra.obj(t[0])?t={value:t}:Ra.fnc(e.duration)||(a.duration=e.duration/i)}var s=Ra.arr(t)?t:[t];return s.map((function(t,a){var i=Ra.obj(t)&&!Ra.pth(t)?t:{value:t};return Ra.und(i.delay)&&(i.delay=a?0:e.delay),Ra.und(i.endDelay)&&(i.endDelay=a===s.length-1?e.endDelay:0),i})).map((function(t){return Ha(t,a)}))}function fi(t,e){var a=[],i=e.keyframes;for(var s in i&&(e=Ha(function(t){for(var e=za(Ba(t.map((function(t){return Object.keys(t)}))),(function(t){return Ra.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),a={},i=function(i){var s=e[i];a[s]=t.map((function(t){var e={};for(var a in t)Ra.key(a)?a==s&&(e.value=t[a]):e[a]=t[a];return e}))},s=0;s<e.length;s++)i(s);return a}(i),e)),e)Ra.key(s)&&a.push({name:s,tweens:mi(e[s],t)});return a}function gi(t,e){var a;return t.tweens.map((function(i){var s=function(t,e){var a={};for(var i in t){var s=Qa(t[i],e);Ra.arr(s)&&1===(s=s.map((function(t){return Qa(t,e)}))).length&&(s=s[0]),a[i]=s}return a.duration=parseFloat(a.duration),a.delay=parseFloat(a.delay),a}(i,e),n=s.value,o=Ra.arr(n)?n[1]:n,r=qa(o),c=ii(e.target,t.name,r,e),d=a?a.to.original:c,l=Ra.arr(n)?n[0]:d,h=qa(l)||qa(c),u=r||h;return Ra.und(o)&&(o=d),s.from=hi(l,u),s.to=hi(si(o,l),u),s.start=a?a.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=Wa(s.easing,s.duration),s.isPath=Ra.pth(n),s.isPathTargetInsideSVG=s.isPath&&Ra.svg(e.target),s.isColor=Ra.col(s.from.original),s.isColor&&(s.round=1),a=s,s}))}var wi={css:function(t,e,a){return t.style[e]=a},attribute:function(t,e,a){return t.setAttribute(e,a)},object:function(t,e,a){return t[e]=a},transform:function(t,e,a,i,s){if(i.list.set(e,a),e===i.last||s){var n="";i.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function Ei(t,e){pi(t).forEach((function(t){for(var a in e){var i=Qa(e[a],t),s=t.target,n=qa(i),o=ii(s,a,n,t),r=si(ni(i,n||qa(o)),o),c=ti(s,a);wi[c](s,a,r,t.transforms,!0)}}))}function vi(t,e){return za(Ba(t.map((function(t){return e.map((function(e){return function(t,e){var a=ti(t.target,e.name);if(a){var i=gi(e,t),s=i[i.length-1];return{type:a,property:e.name,animatable:t,tweens:i,duration:s.end,delay:i[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Ra.und(t)}))}function yi(t,e){var a=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=a?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,s.delay=a?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,s.endDelay=a?s.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,s}var Ii=0;var Di=[],Ci=function(){var t;function e(a){for(var i=Di.length,s=0;s<i;){var n=Di[s];n.paused?(Di.splice(s,1),i--):(n.tick(a),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){bi.suspendWhenDocumentHidden&&(Ai()?t=cancelAnimationFrame(t):(Di.forEach((function(t){return t._onDocumentVisibility()})),Ci()))})),function(){t||Ai()&&bi.suspendWhenDocumentHidden||!(Di.length>0)||(t=requestAnimationFrame(e))}}();function Ai(){return!!document&&document.hidden}function bi(t){void 0===t&&(t={});var e,a=0,i=0,s=0,n=0,o=null;function r(t){var e=window.Promise&&new Promise((function(t){return o=t}));return t.finished=e,e}var c=function(t){var e=Xa(Aa,t),a=Xa(ba,t),i=fi(a,t),s=pi(t.targets),n=vi(s,i),o=yi(n,a),r=Ii;return Ii++,Ha(e,{id:r,children:[],animatables:s,animations:n,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function l(t){return c.reversed?c.duration-t:t}function h(){a=0,i=l(c.currentTime)*(1/bi.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,a=c.animations,i=a.length;e<i;){var s=a[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=za(o,(function(e){return t<e.end}))[0]||d);for(var l=xa(t-d.start-d.delay,0,d.duration)/d.duration,h=isNaN(l)?1:d.easing(l),u=d.to.strings,p=d.round,m=[],f=d.to.numbers.length,g=void 0,w=0;w<f;w++){var E=void 0,v=d.to.numbers[w],y=d.from.numbers[w]||0;E=d.isPath?li(d.value,h*v,d.isPathTargetInsideSVG):y+h*(v-y),p&&(d.isColor&&w>2||(E=Math.round(E*p)/p)),m.push(E)}var I=u.length;if(I){g=u[0];for(var D=0;D<I;D++){u[D];var C=u[D+1],A=m[D];isNaN(A)||(g+=C?A+C:A+" ")}}else g=m[0];wi[s.type](n.target,s.property,g,n.transforms),s.currentValue=g,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function f(t){var h=c.duration,f=c.delay,g=h-c.endDelay,w=l(t);c.progress=xa(w/h*100,0,100),c.reversePlayback=w<c.currentTime,e&&function(t){if(c.reversePlayback)for(var a=n;a--;)u(t,e[a]);else for(var i=0;i<n;i++)u(t,e[i])}(w),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),w<=f&&0!==c.currentTime&&p(0),(w>=g&&c.currentTime!==h||!h)&&p(h),w>f&&w<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=xa(w,0,h),c.began&&m("update"),t>=h&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(a=s,m("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,m("loopComplete"),m("complete"),!c.passThrough&&"Promise"in window&&(o(),r(c)))))}return r(c),c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var a=n=e.length;a--;)c.children[a].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,p(c.reversed?c.duration:0)},c._onDocumentVisibility=h,c.set=function(t,e){return Ei(t,e),c},c.tick=function(t){s=t,a||(a=s),f((s+(i-a))*bi.speed)},c.seek=function(t){f(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,Di.push(c),h(),Ci())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){Ti(ui(t),c)},c.reset(),c.autoplay&&c.play(),c}function Pi(t,e){for(var a=e.length;a--;)ja(t,e[a].animatable.target)&&e.splice(a,1)}function Ti(t,e){var a=e.animations,i=e.children;Pi(t,a);for(var s=i.length;s--;){var n=i[s],o=n.animations;Pi(t,o),o.length||n.children.length||i.splice(s,1)}a.length||i.length||e.pause()}bi.version="3.2.1",bi.speed=1,bi.suspendWhenDocumentHidden=!0,bi.running=Di,bi.remove=function(t){for(var e=ui(t),a=Di.length;a--;){Ti(e,Di[a])}},bi.get=ii,bi.set=Ei,bi.convertPx=$a,bi.path=function(t,e){var a=Ra.str(t)?Ua(t)[0]:t,i=e||100;return function(t){return{property:t,el:a,svg:di(a),totalLength:ci(a)*(i/100)}}},bi.setDashoffset=function(t){var e=ci(t);return t.setAttribute("stroke-dasharray",e),e},bi.stagger=function(t,e){void 0===e&&(e={});var a=e.direction||"normal",i=e.easing?Wa(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Ra.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=qa(l?t[1]:t)||0,m=e.start||0+(l?h:0),f=[],g=0;return function(t,e,w){if(r&&(o=0),c&&(o=(w-1)/2),d&&(o=w-1),!f.length){for(var E=0;E<w;E++){if(s){var v=c?(s[0]-1)/2:o%s[0],y=c?(s[1]-1)/2:Math.floor(o/s[0]),I=v-E%s[0],D=y-Math.floor(E/s[0]),C=Math.sqrt(I*I+D*D);"x"===n&&(C=-I),"y"===n&&(C=-D),f.push(C)}else f.push(Math.abs(o-E));g=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/g)*g}))),"reverse"===a&&(f=f.map((function(t){return n?t<0?-1*t:-t:Math.abs(g-t)})))}return m+(l?(u-h)/g:h)*(Math.round(100*f[e])/100)+p}},bi.timeline=function(t){void 0===t&&(t={});var e=bi(t);return e.duration=0,e.add=function(a,i){var s=Di.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&Di.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=Ha(a,Xa(ba,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Ra.und(i)?d:si(i,d),o(e),e.seek(c.timelineOffset);var l=bi(c);o(l),n.push(l);var h=yi(n,t);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},bi.easing=Wa,bi.penner=ka,bi.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var xi=bi,Ni={duration:1e3,loop:!1,easing:"easeInOutSine"};function Si(t,e){const a={};if(e.complete&&t.complete){const i=e.complete,s=t.complete;a.complete=t=>{i(t),s(t)}}return{...t,...e,...a}}function Ri(t,e,a={}){const{left:i,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-i,c=o-s;return new Promise((e=>{const i=Si({targets:t,translateX:r,translateY:c,...Ni,complete:()=>{e(!0)}},a);xi(i)}))}var Li=t("AnimeUtil",class{async movePoint(t,e,a={}){const i=Ca(e);if(!i)return ibiz.log.debug("终点元素不存在"),!1;const s=Ia(t,document.body);if(!s)return ibiz.log.debug("动画元素不存在"),!1;const{padding:n,width:o,height:r}=Da(s),c={borderRadius:["0%","50%"],maxWidth:[o,"6px"],maxHeight:[r,"6px"],minWidth:[o,"6px"],minHeight:[r,"6px"],padding:[n,"6px"],duration:700};Object.assign(c,a);const d=await Ri(s,i,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,a={}){return Ri(t,e,a)}resize(t,e={}){return function(t,e={}){return new Promise((a=>{const i=Si({scale:[1,.8,1],targets:t,...Ni,complete:()=>{a(!0)}},e);xi(i)}))}(t,e)}async moveAndResize(t,e,a={}){const i=await this.movePoint(t,e,a);return i&&await this.resize(e,{duration:500}),i}}),Oi=t("FileUtil",class{calcOSSCatUrl(t,e,a){var i;let s="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const n=ibiz.hub.getApp(e.srfappid),o=a||n.model.defaultOSSCat||(null==(i=n.model.userParam)?void 0:i.DefaultOSSCat);return s=s.replace("/{cat}",o?"/".concat(o):""),s}calcFileUpDownUrl(t,e,a={},i={}){const{uploadParams:s,exportParams:n,osscat:o}=i;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return s&&(d=se(s,a,e,t)),n&&(l=se(n,a,e,t)),r+=rt.stringify(d,{addQueryPrefix:!0}),c+=rt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(!a.data)throw new o("文件流数据不存在");{const t=e;c(a.data,t)}}async fileUpload(t,e,a){const i=new FormData;i.append("file",e);const s=await ibiz.net.axios({url:t,method:"post",headers:a,data:i});if(200!==s.status)throw new o("文件上传失败");return s.data}}),Mi=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==a)return!1;let i=-1;if(e==a?i=0:e>a&&(i=1),"EQ"===t||"ABSEQ"===t)return 0===i;if("GT"===t)return i>0;if("GTANDEQ"===t)return i>=0;if("LT"===t)return i<0;if("LTANDEQ"===t)return i<=0;if("NOTEQ"===t)return 0!==i}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},_i=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Vi=class extends _i{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let n=0;n<e;n++)if(a){const e=t[n];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[n];this.setParam(e),i=!1,s=!0}else if(s){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},Fi=class t extends _i{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,n=!1;for(let r=0;r<a;r++){if(i&&s){if("!"===e[r]){this.setNotMode(!0),i=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,i=!1,n=!0}else if(n){const a=e[r];if(!(a instanceof Array))throw new o("值必须为数组");a.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new Vi;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},ki=class extends Fi{},Wi=class extends Vi{},Ui=class t extends Mi{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof Fi){const t=e.getChildPSModelCondBases();if(null==t||lt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let n=s;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,a,i)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Vi){lt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||lt(o)?n=e.getValue():(lt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===o?n=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Wi}createPSModelGroupCond(){return new ki}};Ui.PARAMTYPE_DATACONTEXT="DATACONTEXT",Ui.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var zi=t("PSDEDQCondEngine",Ui);async function Bi(t,e){var a;const i=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(i)return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode);ibiz.log.error("未匹配到插件[".concat(t,"]模型"))}var Gi=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function ji(t,e){ibiz.register.register("".concat(Gi,"_").concat(t),e)}function Ki(t){return ibiz.register.get("".concat(Gi,"_").concat(t))}async function Xi(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=Ki(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Ki(a),e)return e;throw new o("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Ki(i),e)return e;throw new o("找不系统计数器类型".concat(i,"对应的适配器"))}var Hi=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Yi(t){return ibiz.register.get("".concat(Hi,"_").concat(t))}async function qi(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=Yi(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Yi("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=Yi(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var Qi=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Ji(t){return ibiz.register.get("".concat(Qi,"_").concat(t))}async function $i(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Bi(n,o);if(t&&(e=Ji(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Ji("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let n="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(n+="_".concat(i)),e=Ji(n),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=Ji(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var Zi=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function ts(t){return ibiz.register.get("".concat(Zi,"_").concat(t))}async function es(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Bi(i,s);if(t&&(e=ts(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=ts(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var as=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function is(t){return ibiz.register.get("".concat(as,"_").concat(t))}async function ss(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:n}=t;if(s){const t=await Bi(s,n);if(t&&(e=is(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const o=i?"".concat(a,"_EDIT"):a;if(e=is(o),e)return e;ibiz.log.error("找不到表格列类型".concat(o,"对应的适配器"))}var ns=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function os(t){return ibiz.register.get("".concat(ns,"_").concat(t.toUpperCase()))}async function rs(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:n,controlRenders:o}=t;if(s){const t=await Bi(s,n);if(t&&(a=os(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if(o&&o.length>0)a=os("PREDEFINE_RENDER");else{if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=os(i),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器,注册key为").concat(i))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT",s="RAWITEM_".concat(i);if(a=os(s),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器,注册key为").concat(s))}if("FIELD"===i){const{editor:e}=t;if(e&&e.predefinedType){if(a=os("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}a=os(i)}if(a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var cs=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ds(t){return ibiz.register.get("".concat(cs,"_").concat(t))}async function ls(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Bi(i,s);if(t&&(e=ds(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=ds(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var hs=t("UIACTION_PROVIDER_PREFIX","UIACTION");function us(t,e){ibiz.register.register("".concat(hs,"_").concat(t),e)}function ps(t){return ibiz.register.get("".concat(hs,"_").concat(t))}async function ms(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:n}=t;if(i){const t=await Bi(i,s);if(t&&(e=ps(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=ps("".concat(a,"_").concat(n)),e)return e;if(e=ps(a),e)return e;throw new o("找不界面行为模式".concat(a,"对应的适配器"))}var fs=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function gs(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Bi(a,i);if(s){if(e=ibiz.register.get("".concat(fs,"_").concat(s)),e)return e;throw new o("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var ws=t("VIEW_PROVIDER_PREFIX","VIEW");function Es(t){return ibiz.register.get("".concat(ws,"_").concat(t))}var vs=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var ys=t("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new o("文件流数据不存在")}}),Is=t("BrowserPlatformProvider",class extends ys{});var Ds=window.navigator.userAgent.toLowerCase();function Cs(){return/Android|Adr/i.test(Ds)?"Android":/iPhone|iPod|iPad/i.test(Ds)?"IOS":/MicroMessenger/i.test(Ds)?"WeChat":/DingTalk/i.test(Ds)?"DingTalk":/miniProgram/i.test(Ds)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var As=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function bs(t,e){ibiz.register.register("".concat(As,"_").concat(t),e)}function Ps(t){return ibiz.register.get("".concat(As,"_").concat(t))}function Ts(){const t=Ps(Cs());return t||Ps("Browser")}var xs=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ns(t,e){ibiz.register.register("".concat(xs,"_").concat(t),e)}function Ss(t){return ibiz.register.get("".concat(xs,"_").concat(t))}async function Rs(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Bi(i,s);if(t&&(e=Ss(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=Ss(a),e)return e;throw new o("找不实体行为方法类型为".concat(a,"的适配器"))}var Ls=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Os(t){return ibiz.register.get("".concat(Ls,"_").concat(t))}async function Ms(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Bi(s,i);if(t&&(e=Os(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=Os(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var _s=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Vs(t){return ibiz.register.get("".concat(_s,"_").concat(t))}async function Fs(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Bi(a,i);if(t&&(e=Vs(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}return e=Vs(s),e}var ks=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var Ws=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new $,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=ht(t)),e&&(this.params=ht(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&Y(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),Us=t("AppDECounter",class extends Ws{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new a(this.model,"未找到获取计数器行为!");this.action=i,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),zs=t("AppDECounterProvider",class{createCounter(t){return new Us(t)}});function Bs(){ji("DEDR",(()=>new zs))}var Gs=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new zi;return 1===e.length?a.parse(this.calcCond(e)[0]):e.length>1&&a.parse(["AND",this.calcCond(e)][0]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);a.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.condOp),a.push(e.fieldName),e.condValue?e.vartypeId?a.push({type:e.vartypeId,value:e.condValue}):a.push(e.condValue):a.push("")}}e.push(a)})),e}});Gs.map=new WeakMap;var js=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new i(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:i,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:n,iconPathAppDEFieldId:o,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d,clsAppDEFieldId:l,colorAppDEFieldId:h}=this.codeList,u=a?t[a]:t.srfkey;if(e.id=u,e.value=u,e.text=i?t[i]:t.srfmajortext,(s||n||o||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),n&&(e.sysImage.cssClassX=t[n]),o&&(e.sysImage.imagePath=t[o]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=$s(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=Ke.execSingleLine(t[d])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:n,minorSortAppDEFieldId:o,minorSortDir:r,pvalueAppDEFieldId:c,customCond:d}=this.codeList,l={...e};if(o&&r&&Object.assign(l,{sort:"".concat(o.toLowerCase(),",").concat(r.toLowerCase())}),d){const e=se(Ke.execSingleLine(d),l,t);Object.assign(l,e)}if(l.size||(l.size=1e4),this.isPredefined&&this.codeList.codeName){let t=this.codeList.codeName;if("OPERATOR"===this.codeList.predefinedType){const e=this.codeList.codeName.indexOf("__");t=-1!==e?this.codeList.codeName.substring(e+2):this.codeList.codeName}const e=await i.net.get("/dictionaries/codelist/".concat(t),l);return Object.freeze(e.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!n)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,n,t,void 0,l);let u=[];if(h.data.length)if(c){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:a}=this.codeList,i={},s=[];return t.forEach((t=>{i[t[e]]=this.convertData(t)})),t.forEach((t=>{const n=i[t[a]];n?(n.children=n.children||[],n.children.push(i[t[e]])):s.push(i[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const i=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||ct(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(a,o);const r=await i;return o.items=r,delete o.promise,r}});function Ks(t,e){if(null!=e){const{srfkey:t}=e;if(!ct(t)&&!lt(t))return!0}throw new o("执行「".concat(t,"」不存在「srfkey」无法处理"))}function Xs(t,e){const{srfsessionid:a}=e;if(!ct(a)&&!lt(a))return!0;throw new o("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Hs=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const a=this.cacheMap.get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,ht(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new o("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Xs("add",t),(ct(e.srfkey)||lt(e.srfkey))&&(e.srfkey=J()),e.srftempdate=(new Date).getTime();const a=()=>{this.cacheMap.set(e.srfkey,ht(e)),ibiz.log.warn("add",e.srfkey,e)},i=this.getTransaction(t);return i?i.change(e.srfkey,(()=>{a()})):a(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Xs("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),ht(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Xs("update",t),Ks("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i){const s=ht(i);s.assign(e);const n=()=>{i.assign(e),a!==e.srfkey&&this.cacheMap.delete(a),this.cacheMap.set(e.srfkey,i),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Xs("delete",t);const a=e;if(this.cacheMap.has(a)){const e=this.cacheMap.get(a),i=()=>{this.cacheMap.delete(a),ibiz.log.warn("delete",a)},s=this.getTransaction(t);return s?s.change(a,(()=>{i()})):i(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Xs("add",t);const a=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},i=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(ct(s.srfkey)||lt(s.srfkey))&&(s.srfkey=J()),s.srftempdate=(new Date).getTime();const n=ht(s);i?i.change(n.srfkey,(()=>{a(n)})):a(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Xs("update",t);const a=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},i=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];Ks("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o("更新联合主键数据失败,已有主键为".concat(n.srfkey,"的数据"));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error("数据[".concat(n.srfdename,"-").concat(n.srfmajortext,"(").concat(n.srfkey,")]不存在,无法更新!"));{const t=ht(c);t.assign(n),e[s]=t,i?i.change(n.srfkey,(()=>{c.assign(n),a(c,r)})):(c.assign(n),a(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Xs("delete",t)}catch(t){return ibiz.log.error(t),e}const a=[];for(let t=0;t<e.length;t++){const i=e[t];this.cacheMap.has(i)||a.push(i)}if(a.length>0)throw new Error("未找到以下数据「".concat(a.join("、"),"」,无法删除!"));const i=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},s=this.getTransaction(t);for(let t=0;t<e.length;t++){const a=e[t];s?s.change(a,(()=>{i(a)})):i(a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ut(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];e[a]=ut(i)}return pt(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>de(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>ct(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),Ys=/\$\{(.*?)\}/g;function qs(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(Ys);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,i)=>i===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function Qs(t,e){const a=qs(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((i,s)=>{e=s===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return a.path}return""}var Js=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(ct(e.page)||lt(e.page)||(this.page=e.page),ct(e.size)||lt(e.size)||(this.size=e.size),ct(e.query)||lt(e.query)||(this.query=e.query),!ct(e.sort)&&!lt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function $s(t){return[1,"1",!0,"true"].includes(t)}var Zs=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let i=[];return(null==a?void 0:a.length)&&(i=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var a;let i=t.text;t.textLanguageRes&&(i=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const n={text:i,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?Ke.execSingleLine(t.data):void 0,sysImage:t.sysImage};return(null==(a=t.codeItems)?void 0:a.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new js(t),this.cache.set(s,i),await i.init()),i.get(e,a)}async get(t,e,a){const i=this.allCodeLists.get(t);if(!i)throw new o("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),tn=t("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),en=t("CounterService",class{static async getCounter(t,e,a){const i=t.id;if(this.counterMap.has(i)){const t=this.counterMap.get(i);if(!1===t.isDestroyed)return t;this.counterMap.delete(i)}const s=(await Xi(t)).createCounter(t);return await s.init(e,a),this.counterMap.set(i,s),s}static async getCounterByRef(t,e,i){const{appCounter:s}=t;if(!s)throw new a(t,"未配置应用计数器!");return this.getCounter(s,e,i)}});en.counterMap=new Map;var an=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},i={}){switch(t){case"wfstart":return this.wfStart(e,a,i);case"wfsubmit":return this.wfSubmit(e,a,i);case"reassign":return this.wfReassign(e,a,i);case"addstepbefore":return this.wfAddStepBefore(e,a,i);case"addstepafter":return this.wfAddStepAfter(e,a,i);case"sendback":return this.wfSendBack(e,a,i);case"sendcopy":return this.wfSendCopy(e,a,i);default:throw new o("「".concat(t,"」未实现"))}}}),sn=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Qs(a,this.model),n="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}},nn=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(nn||{})),on=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:ht(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=de(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const s=de(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:ct(this.srfkey)?J():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:a}=this,i={};Object.keys(e).forEach((t=>{i[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();i[s]={enumerable:!0,set(i){e[s]=a(i,t.stdDataType)},get:()=>e[s]},e[s]=a(e[s],t.stdDataType)})),Object.defineProperties(this,i)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return a=e instanceof t?e._data:e,Object.keys(a).forEach((t=>{void 0===a[t]&&delete a[t]})),Object.assign(this._data,a),this}convertVal(t,e){if(null==t)return t;if(ct(e))return t;if(l.isNumber(e)){const e=ct(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),rn=t("MethodDto",class{constructor(t,e,a,i){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.dtoMap=new Map,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,a)=>{e[a+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((a=>{const i=parseInt(a,10);e[i-1]=t[i]})),e}async get(t,e,s=!1){const n={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(n[d]=0===e[d].length?null:this.convertArrayToListMap(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const i=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=i.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const a=ht(t);a[this.entity.codeName.toLowerCase()]=e.srfkey;const i={};h.parentAppDEFieldId&&(i[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,a,i)}else{if(r.entity.id===this.entity.id)throw new a(c,"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!");u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,a=[];for(let i=0;i<e.length;i++)a.push(await r.get(t,e[i],!0));n[d]=a}}break;default:throw new i(c,"未支持的应用实体方法输入属性类型: ".concat(c.type))}}return{...e,...n}}async sets(t,e){const a=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const i=this.fields.filter((t=>"DTOS"===t.type)).map((async i=>{const s=i.codeName.toLowerCase();if(i.listMap&&"object"==typeof e[s])e[s]=this.convertListMapToArray(e[s]);else{if(!i.refAppDataEntityId)return;const n=a.getDERConfig(i.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,i);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const a=e[this.entity.keyAppDEFieldId];i.refPickupAppDEFieldId&&r.forEach((t=>{t[i.refPickupAppDEFieldId]=a})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<i.length;t++)await i[t];const s=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,s),s})))}async calcRs(t,e=0){if(e>10)return;e+=1;const a=ibiz.uiDomainManager.get(t.srfsessionid),i=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<i.length;s++){const n=i[s];if(!n.refAppDataEntityId)continue;if(0===a.getDERConfig(n.refAppDataEntityId).length){const i=await this.getFieldDto(t,n);i.entity.minorAppDERSs&&a.setDERConfig(n.refAppDataEntityId,i.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await i.calcRs(t,e)}}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=de(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,a.id);s.isLocalMode=!0;const n=s.createMethodDto(i,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),cn=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Hs(e),this.configCache=new tn(e.appId,"PSAppDataEntity",e.codeName),this.wf=new an(e),this.file=new sn(e)}async getMethod(t,e=!1){const s=e?"ac-".concat(t):t;if(this.methodMap.has(s))return this.methodMap.get(s);const n=de(this.model.appDEMethods,t);if(!n)throw new a(this.model,"未找到服务方法: ".concat(t));const o=await Rs(n);if(!o)throw new i(n,"未支持的服务方法类型: ".concat(n.methodType));const r=o.create(this,this.model,n,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(s,r),r}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new o("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),onmessage:e=>{if(e.data){const a=JSON.parse(e.data);t(a)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},a={}){const i=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return i.net.post(s,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],i="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return Qs(t,this.model)+i}newEntity(t){return t instanceof on?t.clone():new on(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new rn(this,this.model,null==e?void 0:e.isLocalMode,t)}}),dn=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],ln=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:ct(this.srfkey)?J():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a){const i=!a||a.isOriginField;dn.includes(t)||(i||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=ht(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),hn=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,i){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,i)}handleResponse(t){return h(t)}toUIData(t){return new ln(t,this.dataUIMap)}}),un=t("MDControlService",class extends hn{async fetch(t,e={}){var a;const i=(null==(a=this.model.fetchControlAction)?void 0:a.appDEMethodId)||"fetchdefault";let s=await this.exec(i,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var a;const i=(null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;const i=(null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;const i=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var a;const i=(null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,a={}){throw new o("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&(Z(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),pn=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const s=me(i,e);if(s){ibiz.log.debug("匹配主状态",s);const e=fe(s,i);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),mn=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new pn(e),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),fn=t("V7AuthService",class{get isAnonymous(){return"1"===tt(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error("未找到匿名登录配置用户名或密码"),!1;const a=await this.login(t,e);if(a){et(u.IS_ANONYMOUS,"1",0,!0);const t=tt(u.TOKEN),e=tt(u.TOKEN_EXPIRES),a=tt(u.TOKEN_REMEMBER),i=tt(u.REFRESH_TOKEN);et(u.TOKEN,t,0,!0),et(u.TOKEN_EXPIRES,e,0,!0),et(u.TOKEN_REMEMBER,a,0,!0),i&&et(u.REFRESH_TOKEN,i,0,!0)}return a}async login(t,e,a){try{const i=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:s}=i;if(s&&s.token){const t=a?7:0;a&&et(u.TOKEN_REMEMBER,"1",t,!0),et(u.TOKEN,s.token,t,!0);const e=(new Date).getTime()+1e3*(s.expirein||7199);et(u.TOKEN_EXPIRES,"".concat(e),t,!0),s.refresh_token&&et(u.REFRESH_TOKEN,s.refresh_token,t,!0),at(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),at(u.TOKEN),at(u.TOKEN_EXPIRES),at(u.TOKEN_REMEMBER),at(u.REFRESH_TOKEN),at(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0,!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=tt(u.TOKEN),e=tt(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const a=3e5;t=t>a?t-a:0,setTimeout((async()=>{const t=tt(u.TOKEN_REMEMBER),e=tt(u.REFRESH_TOKEN),a=t?7:0;let i;if(i=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),i.ok){et(u.TOKEN,i.data.token,a,!0);const t=(new Date).getTime()+1e3*(i.data.expirein||7199);et(u.TOKEN_EXPIRES,"".concat(t),a,!0),i.data.refresh_token&&et(u.REFRESH_TOKEN,i.data.refresh_token,a,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}getAuthInfo(){const t=tt(u.TOKEN),e=!!tt(u.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}async loadAppData(){const t=await ibiz.net.get("/appdata");t.ok&&(ibiz.appData=t.data)}}),gn=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return ct(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),wn=t("MethodInput",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodInput;if(s){const a=de(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),En=t("MethodReturn",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodReturn;if(s){const a=de(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const a=ibiz.hub.getApp(this.entity.appId),i=ibiz.uiDomainManager.get(t.srfsessionid);i&&!0!==i.state.rsInit&&(await this.dto.calcRs(t),i.calcParentRs(),i.state.rsInit=!0),a.deService.clearTempCacheByRs({srfappid:a.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return q(e)&&(e={}),new on(this.entity,e)}}),vn=t("Method",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i,this.app=ibiz.hub.getApp(e.appId),this.input=new wn(t,e,a),this.result=new En(t,e,a)}async request(t,e,i,s){const{actionType:n,requestMethod:o}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(o){case"POST":n=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":n=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":n=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":n=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,o?"未支持的请求方式: ".concat(o):"未配置请求方式")}return n}throw new a(this.method,"未支持的行为类型[".concat(n,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Qs(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),yn=class{constructor(t,e,a,i){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:L(a)?a:[a],params:i}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},In=class{},Dn=class extends In{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return ke(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return ke(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return ke(n[this.dstField],this.op,this.value)}}},Cn=class t extends In{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Dn(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},An=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Cn(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},bn=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new An(t)))}},Pn=class extends bn{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},Tn=class extends bn{async exec(t){}},xn=class extends bn{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function Nn(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[a],t.isEntityParam(a)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=ht(ibiz.env);break;case"EXPRESSION":if(!o)throw new i(e,"表达式为空");c=Ke.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new i(e,"暂未支持源值类型".concat(r))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:Ke.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(d,"报错,源参数:"),c),t}return c}var Sn=class extends bn{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,i=Nn(e,t);e.params[a]=ht(i)}bindParam(t,e){const a=Nn(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:i}=t;let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Nn(e,t);s?e.params[i][s]=n:e.params[i]=n}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Nn(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Rn=class extends bn{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,n=t.params[i],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(a,e,t.context,n);r.ok&&(t.params[s]=r.data)}},Ln=class extends bn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Nn(t,this.model);t.params[e]=s}},On=class extends bn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},Mn=class extends bn{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},_n=class extends bn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Nn(t,this.model);t.params[e]=ht(s)}},Vn=class extends bn{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},Fn=class extends bn{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Nn(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},kn=class extends bn{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},Wn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=ht(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=ht(t.data||{});else{if(a.envParam)throw new i(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new i(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new i(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new i(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new i(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new i(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new i(a,"未支持的逻辑参数类型: 操作会话变量")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},Un=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new a(t,"脚本代码模式没有配置脚本代码");this.scriptFn=Ke.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Tn(t);break;case"END":a=new xn(t);break;case"DEACTION":a=new Pn(t);break;case"PREPAREPARAM":a=new Sn(t);break;case"DEDATASET":a=new Rn(t);break;case"THROWEXCEPTION":a=new kn(t);break;case"BINDPARAM":a=new Ln(t);break;case"RESETPARAM":a=new On(t);break;case"COPYPARAM":a=new _n(t);break;case"RENEWPARAM":a=new Mn(t);break;case"APPENDPARAM":a=new Fn(t);break;case"SORTPARAM":a=new Vn(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new Wn(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,i){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:i});const s=new yn(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},zn=new Map;async function Bn(t,e,a={},i={}){zn.has(t)||zn.set(t,new Un(t));return zn.get(t).exec(e,a,i)}async function Gn(t,e,a,i,s){const n=await async function(t,e,a){return Ee(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!n)throw new o("".concat(e,"找不到实体逻辑").concat(t));return Bn(n,a,i,s)}async function jn(t,e,a,i){const n=ht(e),o=a?ht(a):a,r=i?ht(i):i;try{const e=await Bn(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Kn(t,e,a,i,s){const n=ve(t,e);if(n.length){(await Promise.all(n.map((t=>Bn(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function Xn(t,e,a,i,s={}){if(i){if(!L(i))return Kn(t,e,a,i,s);await Promise.all(i.map((i=>Kn(t,e,a,i,s))))}}var Hn=t("DEActionMethod",class extends vn{async inputHandle(t,e){return L(e)?e:this.input.handle(t,e)}async exec(t,e,i){let s;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Xn(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const n=Ee(this.method.appDELogicId,this.entity);if(!n)throw new a(this.method,"缺少实体处理逻辑");s=await jn(n,t,e,i)}else switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),this.method.codeName){case"Create":s=await this.create(t,e,i||{});break;case"Get":s=await this.get(t,i);break;case"GetDraft":s=await this.getDraft(t,i);break;case"Remove":s=await this.remove(t,i);break;case"Update":s=await this.update(t,e,i);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,i);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);if(this.method.needResourceKey){let i=t[this.entity.codeName.toLowerCase()];M(i)&&(i=L(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),a="".concat(a,"/").concat(i)}const n=await this.request(a,t,e,i);n.data=await this.result.handle(t,n.data),s=n}}return s.data&&await Xn(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new o("create行为没有传data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.post(i,e,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new o("update行为没有传data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e);return i.data=await this.result.handle(t,i.data),i}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const a=this.createEntity(e);let i;return i=L(a)?await Promise.all(a.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,a)),new p(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new p(t):new p(t,500)}catch(t){return new p(t,500)}}async removeTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(a,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const i=this.service.local.delete(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,i){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let i=s.getDERConfigByMajor(this.entity.id);if(i.length>0){const s=this.service.local.get(e,t);i=it(i,"removeOrder");for(const n of i){if("DER1N"!==n.rstype)throw new a(n,"目前只支持[DER1N]关系类型关联删除删除");const{removeActionType:i,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=ht(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(i){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const a=await l.remove(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[n.parentAppDEFieldId.toLowerCase()]=void 0;const a=await l.updateTemp(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e="无法删除[".concat(this.entity.logicName,"-").concat(s.srfmajortext,"], 数据被[").concat(l.model.logicName,"-").concat(t,"]引用");throw new Error(o||e)}}}}o&&n.state.isOpen&&n.commit()}catch(t){throw o&&n.state.isOpen&&n.rollback(),t}finally{o&&n.state.isOpen&&n.close()}}async updateTemp(t,e){try{const a=this.createEntity(e);let i;return i=L(a)?await Promise.all(a.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,a)),i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.get(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new p(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{if(a.parentAppDEFieldId){const{majorAppDataEntityId:i,parentAppDEFieldId:s}=a,n=ge(i),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),Yn=class{create(t,e,a,i){return new Hn(t,e,a,i.localMode)}},qn=t("FetchMethod",class extends vn{async exec(t,e,a){const s=e&&!L(e)?e:a||{};let n;if(this.isLocalMode){const e=Gs.getCond(this.method),a=new Js(t,s),i=await this.searchLocal(e,a);n=new p(i,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":n=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);n=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const o=n.data||[];n.data=o.map((t=>this.createEntity(t)))}return n.data&&await Xn(this.entity,"compute",t,n.data,s),n}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=this.service.local.getList();t?i.length>0&&(i=i.filter((a=>t.test(a,e)))):i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const s=t[a[e]];if(i.test(s))return!0}return!1}))),ct(e.sortField)||lt(e.sortField)||(i="DESC"===e.sortMode?st(i,e.sortField):it(i,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return i.slice(o,r).map((t=>ht(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new a(this.method,"没有指定数据来源代码表");const s=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),Qn=t("AcFetchMethod",class extends qn{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Jn=class{create(t,e,a,i){return i.acMode?new Qn(t,e,a,i.localMode):new qn(t,e,a,i.localMode)}};function $n(){const t=new Yn;Ns("DEACTION",(()=>t));const e=new Jn;Ns("FETCH",(()=>e)),Ns("FETCHTEMP",(()=>e))}var Zn=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"update_time,desc"};Object.assign(e,t);const a=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return a.headers&&(a.headers["x-page"]&&(a.page=Number(a.headers["x-page"])),a.headers["x-per-page"]&&(a.size=Number(a.headers["x-per-page"])),a.headers["x-total"]&&(a.total=Number(a.headers["x-total"]))),ct(a.data)&&(a.data=[]),a}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}}),to=t("TreeNodeData",class{constructor(t,e,a){this._uuid=J(),this._leaf=!1,this._leaf=!0===a.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._parent&&(this._context={...this._parent._context}),a.navContext&&(this._context=Object.assign(this._context||{},a.navContext)),a.navParams&&(this._params={...a.navParams}),this._nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath),e.rawContent&&(a.htmlStr=e.rawContent)),Object.values(a).length>0?a:void 0}}),eo=t("TreeCodeListNodeData",class extends to{constructor(t,e,a){super(t,e,a);const{data:i}=a;this._text=i.text,this._value=i.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=ge(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),ao=["_id","_value","_text","_deData","clone"],io=t("TreeDataSetNodeData",class t extends to{constructor(e,a,i){var s,n;super(e,a,i);const{data:o}=i;this._deData=o;const r="".concat(e.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get(){return e.textAppDEFieldId?this._deData[e.textAppDEFieldId]:this._deData.srfmajortext},set(t){e.textAppDEFieldId?this._deData[e.textAppDEFieldId]=t:this._deData.srfmajortext=t},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get(){return e.idAppDEFieldId?this._deData[e.idAppDEFieldId]:this._deData.srfkey},set(t){e.idAppDEFieldId?this._deData[e.idAppDEFieldId]=t:this._deData.srfkey=t},enumerable:!0,configurable:!0}),e.appDataEntityId){const t=ge(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:o.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId&&(this._leaf=$s(o[e.leafFlagAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();c.set(e,a),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(n=e.detreeNodeColumns)||n.forEach((t=>{if("DEFGRIDCOLUMN"!==t.columnType)return;const e=t.detreeColumnId,a=t.dataItemName;e&&a?l.set(e,a):ibiz.log.error("模型异常缺少detreeColumnId或者dataItemName",t)}));const h=new Map;h.set("srfuf","srfuf");const u=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:h.has(t)?h.get(t):void 0;return this.clone=()=>{const a=ht(this._deData),i=new t(e,this._parent,{data:a,leaf:this._leaf,navContext:this._context,navParams:this._params});return Object.keys(this).forEach((t=>{const e=u(t);ct(e)&&!ao.includes(t)&&(i[t]=this[t])})),i},new Proxy(this,{set(t,e,a){const i=u(e);return ct(i)?t[e]=a:t._deData[i]=a,!0},get(t,e,a){const i=u(e);return ct(i)?t[e]:ct(t._deData[i])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[i];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return m(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:i}=t;a&&this._deData[a]&&(e.imagePath=this._deData[a]),e&&(this._icon=e);const s=null==i?void 0:i.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return Ke.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,i=null==a?void 0:a.find((t=>"text"===t.id));return i&&(e=this.calcDataItemScript(i)),e}}),so=t("TreeStaticNodeData",class extends to{constructor(t,e,a){var i,s;super(t,e,a);const n="root"===t.nodeValue?void 0:t.nodeValue,o="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),this._text=t.text,this._value=n,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=n||(null==t?void 0:t._value)}this.srfkey=(null==(i=this._deData)?void 0:i.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),no=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,ct(a.isOriginField)||(this.isOriginField=a.isOriginField),ct(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=ct(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),oo=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var ro=["REGION","REGION2","REGION3","REGION4"],co=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:i,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,ro.includes(this._itemStyle)?s&&l.set("_areaCode",s):(s&&l.set("_longitude",s),n&&l.set("_latitude",n)),c&&l.set("_tooltip",c),o&&l.set("_text",o),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:l.has(a)?t[l.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:l.has(a)?t[l.get(a)]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}});var lo=t("PanelData",class{constructor(t,e){const a=new $,i={},s={};return t.forEach((t=>{var e;i[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,n,o)=>(Object.prototype.hasOwnProperty.call(i,n)?i[n]?e[i[n]]=o:t[n]=o:e[n]=o,a.emit("change",n),i[n]&&i[n]!==n&&a.emit("change",i[n]),s[n]&&s[n]!==n&&a.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?a:i[s]?e[i[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const a=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,a),a}})}destroy(){this._evt.reset()}});var ho=t("ChartData",class{constructor(t,e,a,i){return this._seriesModelId=null==e?void 0:e.id,this._catalog=a,this._groupName=i,this._uuid=J(),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}}),uo=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},po=t("GanttStaticNodeData",class extends so{constructor(t,e,a,i){super(e,a,i),this._snDataItemValue=uo(t.sndataItemName,e),this._beginDataItemValue=uo(t.beginDataItemName,e),this._endDataItemValue=uo(t.endDataItemName,e),this._prevDataItemValue=uo(t.prevDataItemName,e),this._finishDataItemValue=uo(t.finishDataItemName,e),this._totalDataItemValue=uo(t.totalDataItemName,e)}}),mo=t("GanttDataSetNodeData",class extends io{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=uo(t.sndataItemName,e,s),this._beginDataItemValue=uo(t.beginDataItemName,e,s),this._endDataItemValue=uo(t.endDataItemName,e,s),this._prevDataItemValue=uo(t.prevDataItemName,e,s),this._finishDataItemValue=uo(t.finishDataItemName,e,s),this._totalDataItemValue=uo(t.totalDataItemName,e,s)}}),fo=t("GanttCodeListNodeData",class extends eo{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=uo(t.sndataItemName,e,s),this._beginDataItemValue=uo(t.beginDataItemName,e,s),this._endDataItemValue=uo(t.endDataItemName,e,s),this._prevDataItemValue=uo(t.prevDataItemName,e,s),this._finishDataItemValue=uo(t.finishDataItemName,e,s),this._totalDataItemValue=uo(t.totalDataItemName,e,s)}}),go=t("MqttService",class{constructor(t,e,a){this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new $,this.options={connectTimeout:6e3,clientId:J(),username:"",password:"",keepalive:60,clean:!0},this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),a=t.default?t.default:t,{location:i}=window;this.client=a.connect("ws://".concat(i.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end(),this.evt.reset()}}),wo=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,a){const i=e.srfsessionid||"applocation";this.cache.has(i)||this.cache.set(i,new Map);const s=this.cache.get(i);if(!s.has(a)){const e=await ibiz.hub.getAppDataEntity(a,this.appModel.appId);if(!e)throw new o("未找到应用实体[".concat(a,"]"));const n=t.constructorCache.get(a.toUpperCase());let r;r=n?await n(i,e):new cn(i,e),s.set(a,r)}return s.get(a)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}clearTempCacheByRs(t,e,a=[]){if(!0===a.includes(e))return;a.push(e);const i=t.srfsessionid;if(!this.cache.has(i))return;const s=this.cache.get(i).get(e);s&&s.local.clear();const n=ibiz.uiDomainManager.get(t.srfsessionid);if(n){n.getDERConfigByMajor(e).forEach((e=>{this.clearTempCacheByRs(t,e.minorAppDataEntityId,a)}))}}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};wo.constructorCache=new Map;var Eo=t("DEServiceUtil",wo),vo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=ht(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new o("应用视图[".concat(t,"]不存在"));if((n.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=ge(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===a.srfuf&&(n[t]=void 0,delete a.srfuf)}if(r.redirectView){return _e(await ibiz.hub.getAppView(t),n,a,s)}const{openMode:c="INDEXVIEWTAB"}=r,d=s.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&n.toRouteDepth&&(n.toRouteDepth=void 0),d){case"INDEXVIEWTAB":case"INDEXVIEWTAB_POPUP":return s.noWaitRoute?(this.openIndexViewTab(r,n,a),{ok:!0}):this.openIndexViewTab(r,n,a);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,n,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,n,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,a);case"USER":return this.openUserCustom(r,n,a);default:return this.openIndexViewTab(r,n,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}openIndexViewTabByModal(t,e,a={}){return ibiz.openView.rootByModal(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,e,a,i={}){if(!e)throw new o("气泡打开缺少event");return ibiz.openView.popover(t.id,e,a,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};vo.TAG="ibiz.app-view.open";var yo=t("OpenAppViewCommand",vo),Io=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,se(r,a,e));const h=se(c,a,e);switch(d){case"APPVIEW":return this.openAppView(n,l,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(n);case"PDTAPPFUNC":return this.openPdAppFunc(n,l,h);case"JAVASCRIPT":return this.executeJavaScript(n,l,h);case"CUSTOM":return this.custom(n,l,h);default:throw new i(n,"未支持的应用功能类型: ".concat(d))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new o("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(yo.TAG,t.appViewId,e,a,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,a){throw ibiz.log.warn("openPdAppFunc",t,e,a),new o("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new o("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new o("未实现")}};Io.TAG="ibiz.app-func.exec";var Do=t("AppFuncCommand",Io);function Co(){new Do,new yo}var Ao=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new tn(t.appId,"PSSysApp",t.codeName),this.deService=new Eo(t),this.codeList=new Zs(t),this.authority=new mn(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),await this.initMqtt()}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,i;let s=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!s&&e){s=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}async initMqtt(){this.mqtt&&this.mqtt.close(),ibiz.env.enableMqtt&&ibiz.appData&&ibiz.appData.mqtttopic&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new go(ibiz.appData.mqtttopic,g(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}}),bo=class{parse(t){return t}},Po=class{constructor(){this.appMenu=new bo}},To=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const a=this.calcAppViewId(t);this.viewConfigs.set(a,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new o("视图[".concat(e,"]不存在"));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},xo=class{constructor(){this.view=new To}},No=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(No||{})),So=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(So||{})),Ro=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ro||{})),Lo=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t))(Lo||{})),Oo=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new o("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Mo=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Oo(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),_o=t("CTXState",class{}),Vo=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new $(3e3),this.controllersMap=new Map,this.state=new _o}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),Fo=t("ActivityCounter",class extends Oo{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),ko=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await Ie(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:i,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==i&&"MULTIKEY"!==i||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),Wo=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),Uo=t("QXEventEx",class extends ${constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((a=>{a(t,...e)}))}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),i=this.anyEventFns.map((a=>a(t,...e))),s=Promise.all(i),n=await a,o=await s;return n.concat(...o)}reset(){super.reset(),nt(this.anyEventFns)}}),zo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new Uo}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function Bo(t){return window.location.hash.split("/").length>2*t+2}function Go(t,e){return(!ct(t)&&""!==t||!ct(e)&&""!==e)&&t!==e}function jo(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof ln&&(e=e.getOrigin()),e}function Ko(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType?i.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{Ke.execScriptFn({rule:t,value:e,callback:a,source:i},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=a||e;i.push({validator:(e,a,i,s)=>{if(q(s[t]))return!0;const{isPast:n,infoMessage:c}=Xe(t,s,r.groupCond);return n||i(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function Xo(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:n}=t;return a&&e.push({validator:(t,e,i)=>{if(ct(e)||!(e.length>a))return!0;i(new Error("内容长度必须小于等于".concat(a,",当前长度为").concat(e.length)))}}),i&&e.push({validator:(t,e,a)=>{if(ct(e)||!(e.length<i))return!0;a(new Error("内容长度必须大于等于".concat(i,",当前长度为").concat(e.length)))}}),ct(s)||e.push({validator:(t,e,a)=>{if(!(!ct(e)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),ct(n)||e.push({validator:(t,e,a)=>{if(!(!ct(e)&&ot(e)&&e<n))return!0;a(new Error("值必须大于等于".concat(n)))}}),e}var Ho=t("ValueExUtil",class{static mergeDefault(t){return mt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(ct(e)||""===e)return"";const{valueType:a,objectNameField:i,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!i)throw new o("缺少objectNameField");const t=i.toLowerCase();return"OBJECTS"===a?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===a?e.join(s):"".concat(e)}});function Yo(t,e){var a;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(ct(n)&&ct(r))return;if("RESET"===n)return null;const u=d[s];if(!ft(u)){if(!n&&r)return r;switch(n){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return wt().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new o("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return J();default:throw new i({},"默认值类型[".concat(n,"]未支持"))}}}var qo="asyncimportdata2",Qo="importdata2";async function Jo(t,e,a){if(!ibiz.util.getExcelUtil)throw new o("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new o("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function $o(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(i.name);0===i.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await a.net.get(s)).data}var Zo="__self",tr=t("BaseController",class{constructor(t,e,a,i){this.model=t,this.context=e,this.params=a,this.ctx=i,this.id=J(),this.state={},this.name="",this.evt=new zo(this.getEventArgs.bind(this)),this.mountCounter=new Fo(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Zo),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(t=>{this.childNames.includes(t)&&this.mountCounter.enroll(t)})),this.ctx.evt.on("onRegister",((t,e)=>{this.childNames.includes(t)&&e.evt.on("onMounted",(()=>{this.mountCounter.attend(t)}))}))}async mountSelf(){this.mountCounter.registration.get(Zo)||this.mountCounter.attend(Zo)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),er=class t{constructor(t){this.msgGroupId=t,this.viewMsgMap=new Map}async init(t){var e,a;const i=ibiz.hub.getApp(t.srfappid).model,s=null==(e=i.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=n.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),n.splice(e,1))})),n.length)throw new o("没有找到".concat(n.join(","),"视图消息模型"))}getDeFieldName(t,e){var a,i;if(e)return null==(i=null==(a=ye(t,e))?void 0:a.name)?void 0:i.toLowerCase()}static async fetchDataSet(t,e,i){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new a(t,"未配置实体数据集");const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,i);return o.data.length?o.data:[]}async calcViewMessages(t,e){const a=this.msgGroup.appViewMsgGroupDetails,i=[];return(null==a?void 0:a.length)&&await Promise.all(a.map((async a=>{if(1===this.viewMsgMap.get(a.appViewMsgId).dynamicMode){const s=await this.calcDynaMsgs(a,t,e);i.push(...s)}else{const t=this.calcStaticMsg(a);i.push(t)}}))),i}calcStaticMsg(t){const{position:e}=t,a=this.viewMsgMap.get(t.appViewMsgId),{title:i,message:s,removeMode:n,position:o,messageType:r}=a,{userTag:c,userTag2:d,userTag3:l,userTag4:h}=a;return{title:i,message:s,position:e||o,messageType:r,removeMode:n,extraParams:{userTag:c,userTag2:d,userTag3:l,userTag4:h}}}async calcDynaMsgs(e,i,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u}=n;if(!o)throw new a(n,"未配置应用实体");const p=await ibiz.hub.getAppDataEntity(o,i.srfappid),m={...s},f=this.getDeFieldName(p,r);f&&(m.sort="".concat(f,",asc"));const g=await t.fetchDataSet(n,i,m);if(!g.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(p,c),v=this.getDeFieldName(p,u),y=this.getDeFieldName(p,h),I=this.getDeFieldName(p,l),D=this.getDeFieldName(p,d);return g.map((t=>{const e={};return v&&!ct(t[v])&&(e.position=t[v]),E&&!ct(t[E])&&(e.title=t[E]),y&&!ct(t[y])&&(e.message=t[y]),I&&!ct(t[I])&&(e.messageType=t[I]),D&&!ct(t[D])&&(e.removeMode=t[D]),dt(w,e)}))}},ar=t("ViewController",class extends tr{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),d.create({},e),a||{},new Vo(i)),this.session={},this.modal=new la({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Mo,this.isCloseView=!1,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Se(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn("未找到视图引擎实现:",t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await en.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ft(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await qi(t);this.providers[t.name]=e;const a=xe(this.model);a&&await Promise.all(a.map((async t=>{const e=await qi(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=Ne(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),Object.values(this.counters).forEach((t=>t.destroy())),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){if(this.context.srfappid=this.model.appId,ct(this.context.srfsessionid)||lt(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}const t=this.model.appViewNavContexts;let e={};Y(t)&&(e=se(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let i={};Y(a)&&(i=se(a,this.params,this.context)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const i of this.engines)if(a=await i.call(t,e),void 0!==a)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(void 0===a)throw new o("没有引擎支持预置界面行为".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new er(t),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){const[e,...a]=t,i={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(i,{confirmButtonText:e.extraParams.userTag}),"WARN"===e.messageType?await ibiz.modal.warning(i):"ERROR"===e.messageType?await ibiz.modal.error(i):await ibiz.modal.info(i),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),ir=(t("MobViewController",class extends ar{}),t("WFStepTraceViewController",class extends ar{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),a=null==(t=this.ctx.parent)?void 0:t.view;if(a&&a.model.appDataEntityId){const t=await e.deService.getService(a.context,a.model.appDataEntityId),i=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(i);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let n={};i&&t&&(n=se(i,t,a,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=se(s,t,a,e)),{context:o,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Ho.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),sr=(t("CodeListEditorController",class extends ir{async loadCodeList(t){const{context:e,params:i}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,i),a}throw new a(this.model,"编辑器类型[".concat(this.model.editorType,"],未配置代码表"))}}),t("ControlController",class extends tr{constructor(t,e,a,i){if(super(t,d.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=he(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=ht(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await qi(this.controlPanel);this.providers[this.controlPanel.name]=t}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)}))}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let i={};Y(e)&&(i=se(e,this.params,this.context)),Object.assign(this.context,i);let s={};Y(a)&&(s=se(a,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let i=this.getData()||[];return(null==t?void 0:t.data)&&(i=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(a,t.viewParam),{context:e,params:a,data:i}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};Y(t)&&(e=se(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:i}=this.model,s=null==(a=null==i?void 0:i.ctrlMsgItems)?void 0:a.find((e=>e.name===t));let o,r;if(s&&s.content){r=ct(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),o=Ke.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();o=ibiz.i18n.t(e,""),o===e&&(o="")}if(!o&&(null==e?void 0:e.default)&&(o=e.default),!o&&(null==e?void 0:e.error)&&(o=o||e.error.message),o){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new n(o,r);ibiz.message.success(o,r,0===r)}}})),nr=t("MDControlController",class extends sr{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)}));const e=this.onDataChange.bind(this);this.onDataChange=_((t=>{e(t)}),300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const a=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(a.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};return a&&(n.page=e-1,n.size=a),!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(i,s);"number"==typeof n.total&&(this.state.total=n.total),a?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new o("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{const n=ge(this.model.appDataEntityId);await va(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[n]=t.srfkey,await this.service.remove(i,a),s=!0}this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:i,default:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:i}),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,a;const{selectedData:i}=this.state;v(i,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,i=await ibiz.hub.getAppDataEntity(e,this.model.appId),s=null==(t=i.appDEDataImports)?void 0:t.find((t=>t.id===a));if(!s)throw new o("无导入模型!");let n="DataImport";s.enableCustomized&&(n="DataImport2");const r=ibiz.overlay.createModal(n,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),or=t("AppMenuController",class extends sr{constructor(t,e,a,i){super(t,e,a,i),this.itemProviders={},this.flattenAllItems()}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Fs(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new o("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const n=this.itemProviders[t];if(n&&n.onClick)return n.onClick(s,e,this);if(!s.appFuncId)throw new a(s,"没有配置应用功能");const r=this.context.clone();r.srfappid=s.appId,this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Do.TAG,s.appFuncId,r,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let i=!0;t.accessKey&&(i=this.app.authority.calcByResCode(t.accessKey));let s=i;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}a.permitted=i,a.visible=s}return this.state.menuItemsState[t.id]=a,a}flattenAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var a;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(a=e.appMenuItems)?void 0:a.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),rr=(t("AppMenuIconViewController",class extends or{async onClickMenuItem(t,e){const i=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new o("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!i.appFuncId)throw new a(i,"没有配置应用功能");const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(Do.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends un{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const i=a.map((async a=>{const i=a.appDEDataSetId||"fetchdefault";return this.exec2(i,t,e,void 0,a.appDataEntityId)}));return(await Promise.all(i)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new o("未找到日历项模型");const i=a[e];if(!i)throw new o("未找到日历项模型");return t.map((t=>new oo(i,t)))}async exec2(t,e,a={},i={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,a,i)}}));t("CalendarController",class extends nr{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new rr(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(a,i)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const a=t.beginTime,i=e.beginTime;let s=0;return wt(a).isAfter(i)?s=-1:wt(a).isBefore(i)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:i}=t;if(!a||!i){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:wt(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:wt(a).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:i}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,n={...this.params};if(!s&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),a&&(n.page=e-1,n.size=a),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});wt.extend(Dt),wt.extend(At),wt.extend(Pt),wt.extend(xt),wt.extend(St);var cr="$default_group",dr=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:s,id:n,userParam:o}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=i||{};this.xAxisIndex=N(r),this.yAxisIndex=N(c),this.seriesName=s||n,this.staticOptions=this.calcStaticOptions(),o&&(this.seriesUserParam=wr(o))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(ct(e))return;if(ct(t))return e;const i=this.chartGenerator.codeListMap.get(t);if(null==i?void 0:i.length){const t=i.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}prepareChartData(t,e,a,i){var s;this.groupField&&Object.assign(e,{[this.groupField]:i}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const n=new ho(e,this.model,a,i);t[i].get(a).chartData=n,null==(s=this.chartDataArr)||s.push(n)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=cr;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(ct(e))return;s=e}if(!e[s]&&(e[s]=new Map,i&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(i).forEach((t=>{e[s].set(t.text,{value:0})}))}const n=this.translateVal(i,t[this.catalogField],!0);if(n)e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=x(e[s].get(n).value,t[this.valueField]),e[s].get(n).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s);else if(i&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(i).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,s)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const a=t[e],i=this.calcSeriesData(a);let s={...this.staticOptions,data:i};return e!==cr&&(s.name=e),this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push([a,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,i;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[cr].get(t.name))?void 0:e.chartData:null==(i=null==(a=this.groupData)?void 0:a[t.seriesName].get(t.name))?void 0:i.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(ht(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=wt(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(wt(t[this.catalogField]).format("YYYY"),"-").concat(wt(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(wt(t[this.catalogField]).format("YYYY"),"-").concat(wt(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const i=t[a];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(i.keys()).sort(((t,e)=>wt(t).diff(wt(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,n]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,i.get(t))})),t[a]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(wt(e))}))}));const i=wt.max(a),s=wt.min(a);if("DAY"===e){let e=s;const a=i;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const a=i.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const a=i.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let a=1;a<=4;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[n]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const a=wt("".concat(e,"-12-31")).isoWeek();for(let i=1;i<=a;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},lr=class extends dr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:i}=this.model;return i&&(t.step="middle"),t}},hr=class extends dr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},ur=class extends dr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},pr=class extends dr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},mr=class extends dr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},fr=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},gr=class extends dr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new fr(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),i=Object.keys(e).map((t=>{const i=e[t],s=a.indicatorKeys.map((t=>i.has(t)?i.get(t).value:0));return{name:t===cr?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}};function wr(t){const e={};return t&&Object.keys(t).forEach((a=>{const i=a.indexOf(".");if(-1===i)return;const s=a.slice(i+1);if(s)try{e[s]=JSON.parse(t[a])}catch(i){e[s]=t[a]}})),e}var Er=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:i,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==i?void 0:i.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(i)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=wr(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new lr(t,this);break;case"bar":e=new hr(t,this);break;case"scatter":e=new mr(t,this);break;case"pie":e=new pr(t,this);break;case"funnel":e=new ur(t,this);break;case"radar":e=new gr(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:i,titlePos:s}=t,n={show:e,text:a,subtext:i,left:"center"},o=null==s?void 0:s.toLowerCase();return"left"===o||"right"===o?n.left=o:"bottom"!==o&&"top"!==o||(n.top=o),n}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,i={};i.show=e;const s=null==a?void 0:a.toLowerCase();return"left"===s||"right"===s?(i.left=s,i.top="middle",i.orient="vertical"):"bottom"===s&&(i.top=s),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:i,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===i?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===i&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===i?45:0}};s&&(n=gt(n,wr(s))),e.push(n)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const i=ibiz.hub.getApp(t.srfappid),s=async a=>{if(!a||this.codeListMap.has(a))return;const s=await i.codeList.get(a,t,e);this.codeListMap.set(a,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await s(e),await s(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const i=e.length,s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=i;t<=n;t++)this.seriesGeneratorIndexMap.set(t,a)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=gt(this.staticOptions,this.options),this.chartUserParam&&(this.options=gt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},vr=t("ChartService",class extends un{}),yr=(t("ChartController",class extends nr{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new vr(this.model),await this.service.init(this.context),this.generator=new Er(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new o("chart对象没有正确初始化");if(!this.options)throw new o("options还没计算");this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends sr{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):"")}))}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),Ir=class{};function Dr(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=ht(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(o))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:Ke.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(r,"报错,源参数:"),c),t}return c}var Cr=class extends Ir{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=Dr(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return ke(n,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=Dr(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return ke(n,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return ke(n,this.op,this.value)}}},Ar=class t extends Ir{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Cr(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const n=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}return this.notMode?!s:s}},br=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===(e||0)&&a&&(this.groupCond=new Ar(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(e))}}},Pr=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new br(t)))}},Tr=class extends Pr{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data)}},xr=class extends Pr{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:n}=t;if(!e)throw new a(this.model,"未配置界面行为");let o=[s];if(i){const e=t.params[i];o=e instanceof Array?e:[e]}await Jr.execAndResolved(e,{...n,context:t.context,params:t.viewParam,data:o},this.model.appId)}},Nr=class extends Pr{async exec(t){}},Sr=class extends Pr{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}},Rr=class extends Pr{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new i(a,"暂未支持逻辑处理参数操作".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:i}=t;if(!i)throw new o("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const n=Dr(e,t);if(s)try{Ke.execScriptFn({srcVal:n,dstParam:e.params[i]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error("给目标参数属性".concat(a,"赋值报错,目标参数:"),e.params[i]),t}else e.params[i]=n}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=Dr(e,t);e.params[a]=ht(i)}bindParam(t,e){const a=Dr(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:i,srcIndex:s,srcSize:n}=t,o=Dr(e,t),r=i||0,c=s||0,d=n||o.length;e.params[a].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,n=i;e.params[a].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Lr=class extends Pr{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:i,invokeParamId:s}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!s)throw new a(this.model,"没有配置操作参数");if(!e)throw new a(this.model,"没有配置调用方法");const n=t.params[s];if(!n)throw new o("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new o("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new o("没有找到调用方法".concat(e));await r[e](n)}},Or=class extends Pr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Dr(t,this.model);t.params[e]=s}},Mr=class extends Pr{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:n}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:o}=this.model,{message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:o||"消息",desc:r};let d=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,d=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,d=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,d=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const l=await ibiz.modal.confirm(c);t.setLastReturn(d[l?0:1])}},_r=class extends Pr{async exec(t){const e=await gs(this.model);e&&await e.exec(this.model,t)}},Vr=class extends Pr{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];ibiz.log.info("逻辑节点".concat(i,"操作参数值:"),s)}},Fr=class extends Pr{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},kr=class extends Pr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Dr(t,this.model);t.params[e]=ht(s)}},Wr=class extends Pr{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Dr(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},Ur=class extends Pr{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const n=s;t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},zr=class extends Pr{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Br=class extends Pr{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,o);c.ok&&(t.params[n]=c.data)}},Gr=class extends Pr{async exec(t){const{errorInfo:e}=this.model;throw new o(e)}},jr=class extends Pr{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:i,fireCtrlId:s}=this.model;if(!s)throw new a(this.model,"没有配置触发对象");if(!e)throw new a(this.model,"没有配置事件名称参数");if(!i)throw new a(this.model,"没有配置事件参数");const n=t.params[s];if(!n)throw new o("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new o("没有找到事件参数对象".concat(i));await n.evt.emit(e,r)}},Kr=class extends Pr{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!i)throw new a(this.model,"没有配置实体");if(!e)throw new a(this.model,"没有配置实体逻辑");if(!s)throw new a(this.model,"没有配置传入逻辑参数");const r=t.params[s];if(!r)throw new o("没有找到传入参数".concat(s));const c=await Gn(e,i,t.context,r,t.params);n&&(t.params[n]=c)}},Xr=class extends Pr{async exec(t){Ke.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Hr=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:n,params:o,data:r}=s,c=ibiz.hub.getApp(a.appId);if("layoutPanel"!==a.codeName)if(a.default)a.entityListParam?t.params[e]=r||[]:t.params[e]=r&&r.length>0?r[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const i=s.view.getController(a.codeName.toLowerCase());i?t.params[e]=i:ibiz.log.error("视图逻辑初始化参数,未找到".concat(a.codeName,"指定部件对象"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=c;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=o;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}else t.params[e]=s.view.layoutPanel.panelItems}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},Yr=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new Nr(t);break;case"END":a=new Sr(t);break;case"DEACTION":a=new Tr(t);break;case"DEUIACTION":a=new xr(t);break;case"PREPAREJSPARAM":a=new Rr(t);break;case"RESETPARAM":a=new Fr(t);break;case"COPYPARAM":a=new kr(t);break;case"BINDPARAM":a=new Or(t);break;case"VIEWCTRLINVOKE":a=new Lr(t);break;case"MSGBOX":a=new Mr(t);break;case"DEBUGPARAM":a=new Vr(t);break;case"APPENDPARAM":a=new Wr(t);break;case"SORTPARAM":a=new Ur(t);break;case"RENEWPARAM":a=new zr(t);break;case"DEDATASET":a=new Br(t);break;case"THROWEXCEPTION":a=new Gr(t);break;case"VIEWCTRLFIREEVENT":a=new jr(t);break;case"DELOGIC":a=new Kr(t);break;case"PFPLUGIN":a=new _r(t);break;case"RAWJSCODE":a=new Xr(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Hr(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new yr(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(i);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},qr=new Map;async function Qr(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new o("找不到实体".concat(e,"的界面逻辑").concat(t));qr.has(s)||qr.set(s,new Yr(s));const n=qr.get(s);return await n.exec(a),null}var Jr=t("UIActionUtil",class{static async exec(t,e,a){const i=await Ie(t,a);if(!i)throw new o("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await ms(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const n=await this.exec(t,e,a);if(n.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(n.refresh)switch(n.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(i=e.view.parentView)||i.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await Ie(t,a)).asyncAction&&!n.cancel&&this.handleAsyncAction(e.event)}static async handleAsyncAction(t){this.handleAsyncActionAnime(t)}static async handleAsyncActionAnime(t){t&&t.target&&await ibiz.util.anime.moveAndResize(t.target,"#".concat("preset-message"))}}),$r=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:n,uilogicAttachMode:o}=t;if("REPLACE"===o){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Qr(s,n,e),i}if(!await this.isConfirm(t,e))return this.returnError(i);const r=await this.execAction(t,e);if(Object.assign(i,r),!0===i.cancel)return this.returnError(i);if("AFTER"===t.uilogicAttachMode){if(!s)throw new a(t,"没有配置实体界面逻辑");await Qr(s,n,this.mergeArgsByResult(e,i))}const c=this.mergeArgsByResult(e,i);if(t.closeEditView)this.doNextAction(t,c,t.appId);else{const e=await this.doNextAction(t,c,t.appId);if(e&&(Object.assign(i,e),!0===e.cancel))return this.returnError(i)}return i}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return!t.enableConfirm||!a||ibiz.confirm.warning({title:"操作确认",desc:a})}async doNextAction(t,e,a){const i=t.nextId;if(i)return Jr.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const n=ge(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[a[0]];break;case"MULTIDATA":s=a;break;case"MULTIKEY":s=n&&a.length>0?a.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||n,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=se(c,d?re(c,a):a[0]||{},i,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:se(h,d?re(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=n,s=o;break;case"success":i=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||i);t!==s.lanResTag&&(i=t)}if(i){const{data:t}=a,e={...a};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,Ke.execScriptFn(e,"`".concat(i,"`"),{isAsync:!1,singleRowReturn:!0})}}}),Zr=t("BackendUIActionProvider",class extends $r{async execAction(t,e){const{context:i,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new a(t,"未配置实体或实体行为");const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,i,n,s),p={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(yo.TAG,m,l,h,{event:o});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===u.length&&u.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((t=>{t.srfactionparam=e}))}}const f=ibiz.hub.getApp(null==i?void 0:i.srfappid),g=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await f.deService.exec(c,d,l,w?g:g[0],p);if(E.ok){const a=this.calcMessage("success",t,e);a&&ibiz.message.success(a)}return Object.assign(r,{data:Z(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),tc=t("SysUIActionProvider",class extends $r{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,i=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===i)return{closeView:!0};return await a.callUIAction(i,e)||{}}}),ec=t("FrontUIActionProvider",class extends $r{async execAction(t,e){const{context:s,params:n,data:o,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=I.fill(t.htmlPageUrl,s,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:l}=await this.handleParams(t,s,o,n),h=await ibiz.commands.execute(yo.TAG,e,i,l,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(d.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(d.data=h.data,d.nextContext=i,d.nextParams={...n,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return d}doOther(t,e){const{scriptCode:i}=t,{context:s,params:n,data:o,event:r,view:c}=e;if(i){return Ke.execScriptFn({context:s,params:n,data:o,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:n,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),d=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!d)throw new o("没有找到实体打印项");{let t="";if(!n||!n[c.codeName.toLowerCase()])throw new o("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(n[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:d.codeName,...r}});if(!e.ok)throw new o("打印失败");if(r&&r.srfcontenttype){const t=null==(s=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:s.slice(9),a=URL.createObjectURL(e.data),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){var a;const{resultContext:i,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let c="DataImport";if(r&&r.enableCustomized&&(c="DataImport2"),r){const t=ibiz.overlay.createModal(c,{dismiss:()=>t.dismiss(),appDataEntity:n,dataImport:r,context:i,params:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new o("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=n.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new o("没有找到实体导出项");{const t="/".concat(null==(i=n.codeName2)?void 0:i.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(r.codeName),a={page:0,size:r.maxRowCount?r.maxRowCount:1e3,...e.params,...s},c=await ibiz.net.request(t,{method:"post",data:a});if(200!==c.status)throw new o("导出请求失败");{let t="".concat(n.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([c.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}}}),ac=t("WFWithdrawUIActionProvider",class extends $r{async execAction(t,e){const{view:a}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),ic=class extends $r{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function sc(){const t=new ec;us("FRONT",(()=>t));const e=new Zr;us("BACKEND",(()=>e));const a=new tc;us("SYS",(()=>a));const i=new ac;us("DEUIACTION_WFWithdraw",(()=>i));const s=new ic;us("SYS_Logout",(()=>s))}var nc=t("ToolbarController",class extends sr{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new Wo,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const i=t.uiactionId,s=await Ie(i,t.appId);if(!s)throw new o("没有找到界面行为模型".concat(i));const n=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;n&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(a,n.params),await Jr.execAndResolved(i,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new ko(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const i="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:i?"extra":"deuiaction"}),i||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof ln&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const t={};a&&(t.data=[a]),r(this.model,(e=>{const a=this.state.buttonsState[e.id];if(a){if(a.visible){const i=this.scheduler.triggerItemVisible(e.id,t);void 0!==i&&(a.visible=i)}if(!a.disabled){const i=this.scheduler.triggerItemEnable(e.id,t);void 0!==i&&(a.disabled=!i)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),oc=t("ContextMenuController",class extends nc{}),rc=(t("DashboardController",class extends sr{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=jo(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var i;if(t.controlType&&a.includes(t.controlType))return;const s=await ls(t);if(s){this.providers[t.id]=s;const a=await s.createController(t,this,e);this.portlets[t.id]=a,(null==(i=t.controls)?void 0:i.length)&&await this.initPortlets(t.controls,a)}})))}async dataChangeNotify(t){await va(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t){var e,a;this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null,this.model=t,this.config=new tn(t.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(a=this.model.codeName)?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),cc=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=ue(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new rc}onDataChange(t){let e=t.data[0];e&&e instanceof ln&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Wo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new ko(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:i}=this.dashboard.view.model;i&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=pe(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),dc=(t("ContainerPortletController",class extends cc{}),t("ViewPortletController",class extends cc{}),t("MenuPortletController",class extends cc{}),t("ChartPortletController",class extends cc{}),t("ActionBarPortletController",class extends cc{}),t("HtmlPortletController",class extends cc{}),t("ListPortletController",class extends cc{}),t("RawItemPortletController",class extends cc{}),t("DataViewControlService",class extends un{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new no(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new no(e,e);this.dataUIMap.set(e,i)}))}})),lc=t("DataViewControlController",class extends nr{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new dc(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const a=new Wo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new ko(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),t.groupActionGroupState=a}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[a],i=this.state.groups.find((t=>t.key===e));i&&i.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var a,i;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof ln&&(s=s.getOrigin()),s&&(null==(a=e.groupActionGroupState)||a.update(s,this.model.appDataEntityId))):null==(i=e.groupActionGroupState)||i.update(void 0,this.model.appDataEntityId)}));else{const a=this.state.groups.find((e=>-1!==e.children.indexOf(t)));a&&(null==(e=a.groupActionGroupState)||e.update(a.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const i=new Wo,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),i;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new ko(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.getOrigin())}return i}async onActionClick(t,e,a){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};Jr.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const i=t.uiactionId,s={...this.params,srfgroup:a.key};await Jr.execAndResolved(i,{context:this.context,params:s,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:i,minorSortDir:s}=this.model,n=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:o}=t;if(t.capLanguageRes&&(o=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:o,key:t.appDEFieldId};n&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),hc=t("ExpBarControlController",class extends sr{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),i=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){if(t.isInitialLoad)this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem();else{const t=this.xDataController.state.selectedData;t[0]&&this.xDataController.setActive(t[0])}}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&Bo(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:i}=t,s=this.getNavViewMsg(e[0],a,i);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,a,i){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?ge(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:a,params:i,data:e},{resultContext:h,resultParams:u}=ce(d,l),p=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new o("多节点视图由子类实现")}getNavViewMsg(t,e,a){const i=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:i,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),uc=(t("CalendarExpBarController",class extends hc{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:i}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:i,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends hc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}async onMounted(){super.onMounted(),this.xDataController&&this.xDataController.evt.on("onAfterRefreshParent",(t=>{const e=this.xDataController.state.selectedData;e[0]&&this.xDataController.setActive(e[0])}))}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const i=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(n,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:n.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,a)=>{0===a?e.push(t):e.push("".concat(e[a-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends hc{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,a,i){var s;const{context:n,params:o}=super.prepareParams(t,e,a,i);if(e._seriesModelId){const a=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(a){const{navigateContexts:t,navigateParams:s}=a,r=se(t,e,i,n),c=se(s,e,i,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,a){var i;let s;if(t._seriesModelId){const e=null==(i=this.XDataModel.dechartSerieses)?void 0:i.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends sr{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new ln,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await va(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,i=void 0){await Promise.all(t.map((async t=>{const s=await es(t);if(!s)return;if(e.details[t.id])throw new a(t,"初始化异常: 表单成员[".concat(t.id,"](").concat(t.detailType,")已存在,表单项标识重复请检查配置"));e.providers[t.id]=s;const n=await s.createController(t,e,i);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),Te(t))return;const o=Pe(t);o.length&&await this.initDetailControllers(o,e,n)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Go(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}})),pc=class extends hn{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===i?n:r,h="create"===i?o:c,u=s.id.toLowerCase(),p=Yo({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:a});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},mc=t("SearchFormService",class extends pc{async getDraft(t,e={}){let a={ok:!0,status:200,data:this.getFilteredData({...e})};return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new no(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}}),fc=(t("SearchFormController",class extends uc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new tn(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new mc(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const a=this.state.data[e];null!=a&&""!==a&&(t[e]=a)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const i=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===i,a="BOTTOM"!==i,"NONE"===t&&(e=!0,a=!0);const s=t=>{let i,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],n=e,!0))),i&&i.length>0){const o=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<i.length&&(t[n]=o)}};(a||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new o("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o("没有找到保存的搜索条件");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),gc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(gc||{})),wc=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(wc||{})),Ec=t("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:i}=this.model;if(t){const{width:e,height:a}=ue(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName),i&&i.lanResTag&&(this.model.caption=ibiz.i18n.t(i.lanResTag,this.model.caption))}createState(){var t;return new fc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const i=a.relatedDetailNames||[];if(e||C(i,t))try{const t=Ye(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=pe(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=pe(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),vc=t("FormButtonState",class extends fc{constructor(){super(...arguments),this.loading=!1}}),yc=(t("FormButtonController",class extends Ec{createState(){var t;return new vc(null==(t=this.parent)?void 0:t.state)}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await Jr.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends fc{constructor(){super(...arguments),this.showMask=!1}})),Ic=(t("FormDRUIPartController",class extends Ec{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new yc(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),C(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;Y(e)&&(t=Object.assign(t,se(e,this.data,this.form.params,this.form.context)));const a=se(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=J(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends fc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),Dc=t("FormGroupPanelController",class extends Ec{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new Ic(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Wo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new ko(t.id,this.form.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await Jr.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Cc=t("FormItemState",class extends fc{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),Ac=(t("FormItemController",class extends Ec{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new Cc(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await $i(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ha(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Ko(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...Xo(this.model.editor)),this.rules.length>0&&(this.validator=new Et({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&q(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),t("FormMDCtrlController",class extends Ec{get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return A.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return A.checkPermission(this.model.buildInActions,2)}get enableDelete(){return A.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}})),bc=(t("FormMDCtrlMDController",class extends Ac{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");"GRID"===t.controlType&&b(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await qi(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new i(this.model,"多数据部件类型".concat(this.model.contentType,"暂不支持添加数据"));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController不存在")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends fc{}),Pc=(t("FormMDCtrlFormController",class extends Ac{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new bc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await qi(t);e&&(this.formProvider=e);const{appDataEntityId:i}=this.model.contentControl;this.deName=ge(i)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const a={...this.params};return{id:t.srfkey,context:e,params:a}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const a=e.data[0],i=this.state.items.find((e=>e.id===t));i&&i.context[this.deName]!==a.srfkey&&(i.context[this.deName]=a.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o("没有找到对应".concat(t,"的表单控制器"));await e.remove();const a=this.state.items.findIndex((e=>e.id===t));-1!==a&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const i={id:J(),context:e,params:a};void 0!==t?this.state.items.splice(t,0,i):this.state.items.push(i)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends Ac{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new i(this.model,"暂不支持重复器样式".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=ht(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,a)=>t!==a));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends Ic{})),Tc=(t("FormPageController",class extends Dc{createState(){var t;return new Pc(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends fc{})),xc=(t("FormRawItemController",class extends Ec{createState(){var t;return new Tc(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends fc{})),Nc=(t("FormTabPageController",class extends Ec{createState(){var t;return new xc(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends fc{constructor(){super(...arguments),this.activeTab=""}})),Sc=(t("FormTabPanelController",class extends Ec{createState(){var t;return new Nc(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}}),t("EditFormService",class extends pc{async get(t,e={}){var a;let i=await this.exec((null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"update"),i}async getDraft(t,e={}){var a;let i=await this.exec((null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}async remove(t,e={}){var a;return await this.exec((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const i=e instanceof ln?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var a;const i=e instanceof ln?e.getOrigin():e,s=this.getFilteredData(i);let n=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var i;const s=null==(i=this.model.goBackControlAction)?void 0:i.appDEMethodId;if(!s)throw new a(this.model,"缺少返回操作实体行为");let n=await this.exec(s,t,e instanceof ln?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,a={}){let i=await this.exec(t,e,a);return i=this.handleResponse(i),i}async wfStart(t,e,a){var i;const s=(null==(i=this.model.wfstartControlAction)?void 0:i.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,a instanceof ln?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let n="";n=e.type?e.type:(null==(i=s.wfsubmitControlAction)?void 0:i.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,a instanceof ln?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const a=e,i=a.id.toLowerCase(),s=a.fieldName||e.appDEFieldId;let n;n=s?new no(i,s,{isOriginField:!0,dataType:a.dataType}):new no(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,n)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}})),Rc=(t("EditFormController",class extends uc{constructor(){super(...arguments),this.oldData=new ln}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new Sc(this.model),await this.service.init(this.context),this.autoSave=_(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=i.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=ht(this.context),e=ht(this.params),a=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(a&&this.params[a]){t[ge(this.model.appDataEntityId)]=this.params[a],delete e[a],delete this.params[a],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=J(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!we(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=ht(a);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),s=await this.service.get(e,i)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await P(500,this.save.bind(this),[t])}if(!await this.validate())throw new o("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],n=0===s.srfuf;let r;try{r=n?await this.service.create(a,s):await this.service.update(a,s)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):b(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(r.data.$origin,n?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i,s=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(s=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!s)return!1;await this.startLoading();try{i=await this.service.remove(e,a)}catch(t){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=i.ok}return this.state.data=new ln,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&b(this.data,t.data),this.data}async updateFormItem(t){var e;const a=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!a)throw new o("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=a,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=Ke.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},a=await this.service.updateFormItem(i,this.context,e);t=a.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"流程启动成功"})}async wfSubmit(t){if(!await this.validate())throw new o("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"流程提交成功"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{demand:t}=this.model,e={silent:!0,noFillBack:!0};t&&(e.data=this.getDiffData());try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((a=>{t[a]===this.oldData[a]&&a!==t.srfkeyfield||(e[a]=t[a])})),e.srfuf=t.srfuf,new ln(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return Ke.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),Lc=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),Oc=t("GridService",class extends un{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const i=t.id.toLowerCase(),s=t.appDEFieldId;let n;if(s){const o=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));n=new no(i,o,{isOriginField:!0,dataType:r.dataType})}else n=new no(i,i);this.dataUIMap.set(i,n)}))}}async updateGridEditItem(t,e,a={}){const i=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await i.exec(t,e,a);return s=this.handleResponse(s),s}}),Mc={string:25,number:6,integer:9,date:5};var _c=t("GridController",class extends nr{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new Oc(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await $o(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var a;if(!t.properties)return;const{properties:i}=t;if(!(Object.keys(i).length>0))return;const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e})}));const n={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[],r=[];return s.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,valueType:"SIMPLE",dataType:Mc[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=ht(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===a.findIndex((e=>e.id===t.id)))),...a]}}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:i}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(s,"没有配置代码表"));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===i){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(s,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await va(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new Lc(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.state.rows.forEach((t=>{Object.values(t.uiActionGroupStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,i="CODELIST"===a,s=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[s];i||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:i}=this.model;if("ALL"!==t)return;if(!i||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const s=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,i,this.context,void 0,s);o.data.length&&([this.state.remoteAggResult]=o.data)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a))return void ibiz.log.error("不支持新建行");if("row"===a){if(this.state.rows.find((t=>t.showRowEdit)))throw new o("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(i,s);try{n=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;T(r,s),this.state.items.unshift(r);const c=new Lc(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,a=this.findRowState(t);if(!a)throw new o("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await P(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new o("行数据校验不通过,保存取消");let i;const s=ge(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{i=e?await this.service.create(n,t):await this.service.update(n,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:a.data}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await va(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await ss(t);if(!a)return;this.providers[t.codeName]=a;const i=await a.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=i,t.enableRowEdit&&(this.editColumns[t.codeName]=i)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=i:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:a,frozenLastColumn:i}=this.model;t.forEach(((t,s)=>{t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":a&&s<a?t.fixed="left":i&&s>=e-i&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Go(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await va(Object.values(this.editColumns).map((async a=>a.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new o("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=ht(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let a;t&&(a=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(a,e)}async updateGridEditItem(t,e){var a;const i=null==(a=this.model.degridEditItemUpdates)?void 0:a.find((t=>t.id===e));if(!i)throw new o("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=i,d=n.map((t=>t.id));let l;if(r&&c)l=Ke.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},a=await this.service.updateGridEditItem(s,this.context,e);l=a.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let i;await this.startLoading();try{i=await this.service.fetch(e,a)}finally{await this.endLoading()}return i.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),i=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=a.codeList.getCodeList(t.codeListId),e.codeListItems=await a.codeList.get(t.codeListId,this.context)),e}));if(i)return Promise.all(i)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=null==(e=this.dataEntity.appDEDataExports)?void 0:e.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=t=>{var e;const a=new Map;this.allExportColumns&&this.allExportColumns.length>0?null==(e=this.allExportColumns)||e.forEach((t=>{t.codeListItems&&a.set(t.appDEFieldId,t.codeListItems)})):Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&a.set(t,this.fieldColumns[t].codeListItems)}));const i=ht(t.map((t=>t.getOrigin())));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;a.get(e)&&(t[e]=(null==(i=a.get(e).find((a=>a.value===t[e])))?void 0:i.text)||t[e])}))})),i};let i=[],s=[];this.allExportColumns&&this.allExportColumns.length>0?(i=this.allExportColumns.map((t=>t.appDEFieldId)),s=this.allExportColumns.map((t=>t.caption))):(i=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.id)),s=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.caption)));const n=(r=i,(await(async()=>{var e;const i=null==(e=t.params)?void 0:e.type;let s=[];if("activatedPage"===i&&(s=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:n}=t.params,o="customPage"===i?{page:0,offset:(a-1)*e,size:(n-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:o})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new o("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await Jo(s,n,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=i.editItem,c=e?n:r,d=e?s:o,l=Yo({name:i.fieldName,valueType:c,defaultValue:d,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(a[i.fieldName]=l)})),a}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((a=>a.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.saveColumnStates()}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:this.initColumnStates()}changeColumnStateSort(t,e,a){const i=this.state.columnStates.find((e=>e.key===t));i&&(this.state.columnStates.splice(a,1),this.state.columnStates.splice(e,0,i),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}}),Vc=t("GridFieldColumnController",class extends Rc{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=_(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new Wo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new ko(t.id,this.grid.context.srfappid,e);a.addState(t.id,i)}})),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:i}=this.model;if(!i)return{context:e,params:a};const{navigateContexts:s,navigateParams:n}=le(i);let o={};s&&t&&(o=se(s,t,a,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=se(n,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:n}=this.model;if(!n)return;const o=Je(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=ht(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(yo.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await Jr.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:n}=this.model;if(ct(a)||"NONE"===a)return;const o=e||this.model.id;let r;if(t=t.filter((t=>!ct(t[o]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new i(this.model,"远程聚合暂未支持"):new i(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[o])));break;case"MIN":r=Math.min(...t.map((t=>t[o])));break;default:throw new i(this.model,"暂未支持属性列聚合模式".concat(a))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error("".concat(r," 值格式化错误"))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Ho.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),Fc=(t("GridUAColumnController",class extends Rc{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new Wo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new ko(t.id,this.grid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends Vc{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=be(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await $i(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ha(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Ko(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...Xo(this.editItem.editor)),this.rules.length>0&&(this.validator=new Et({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let i=!1;a&&a.length>0&&a.forEach((t=>{e.includes(t)&&(i=!0)})),i&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new o("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&q(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:i}=a;return t.errors[e]=i[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends Rc{}),t("ListService",class extends un{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new no(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new no(e,e);this.dataUIMap.set(e,i)}))}})),kc=(t("ListController",class extends nr{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new Fc(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=a.get(e[t])||[];i.push(e),a.set(e[t],i)}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,i=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=a.filter((e=>-1===o.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends sr{constructor(t,e,a,i,s){super(t,e,a,i),this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var i,s;const n=await rs(t);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,a);e.panelItems[t.id]=o,(null==(i=t.panelItems)?void 0:i.length)&&!o.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new o("未获取到面板数据");const i=this.convertData(a);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=i,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=Me(this.model),a=e.map((t=>t.id)),i=new lo(e,t);return i._evt.on("change",(t=>{a.includes(t)&&this.dataChangeNotify([t])})),i}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),Wc=(t("ViewLayoutPanelController",class extends kc{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),Uc=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=ue(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new Wc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const i=a.relatedItemNames||[];if(e||C(i,t))try{const t=qe(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=pe(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=pe(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends sr{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),i={...this.params};t&&Object.assign(a,se(t,this.params,this.context)),e&&Object.assign(i,se(e,this.params,this.context)),this.state.context=a,this.state.params=i}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),["ISNULL","ISNOTNULL"]),zc=t("SearchBarFilterController",class{constructor(t,e,a,i){var s;let n;this.model=t,this.appDataEntity=e,this.noEditor=!1,this.context=a,this.params=i,t.appDEFieldId&&(n=ye(e,t.appDEFieldId)),this.fieldName=n?n.codeName.toLowerCase():t.id,this.label=t.caption||(null==n?void 0:n.logicName)||t.id,this.valueOP=null==(s=t.defsearchMode)?void 0:s.valueOP,this.noEditor=this.valueOP?Uc.includes(this.valueOP):!this.model.editor}async init(){if(!this.noEditor){if(!this.model.editor)throw new a(this.model,"缺少编辑器模型");this.editorProvider=await $i(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Bc=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=[{condop:"EQ",condtype:"DEFIELD",fieldname:"app_view_tag",value:this.viewTag}],e=await this.app.net.post("".concat(this.themeUrl,"/fetch_cur_user_all"),{searchconds:t,sort:"create_time,asc"});return e.ok&&(e.data=this.convertBackDataToFront(e.data)),e}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t));return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t))}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:"".concat(this.viewTag,"___").concat(t),caption:t,app_tag:this.model.appId,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{name:t.name,caption:t.caption,app_tag:this.model.appId,app_view_tag:this.viewTag,theme_model:JSON.stringify(e),valid_flag:t.show?1:0})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[a]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),a)}async updateBatch(t){const e=this.convertFrontDataToBack(t),a=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(a),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={app_tag:this.model.appId,app_view_tag:this.viewTag};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},Gc="",jc={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Kc={};function Xc(t,e){if(t.enumSource)return{appId:Gc,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Kc["".concat(t.type,"_").concat(e)]}async function Hc(t,e,a){var i;if(!t.properties)return[];const{properties:s}=t;if(!(Object.keys(s).length>0))return[];const n=[];Object.keys(s).forEach((t=>{let e;switch(s[t].type){case"string":e="string","date-time"===s[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(s[t].type))}n.push({key:t,description:s[t].description,type:e,enumSource:s[t].enumSource})}));const o={};null==(i=(await ibiz.hub.getAppDataEntity(e,a)).appDEFields)||i.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const r=[];return n.forEach((t=>{const e=jc[t.type];e?e.forEach((e=>{t&&r.push({appId:Gc,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Gc,valueOP:e},editor:Xc(t,e)})})):ibiz.log.error("未支持的类型",t.type)})),r}function Yc(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}function qc(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map((t=>qc(t)))}}function Qc(t){if("GROUP"===t.condtype)return{leaf:!1,logicType:"AND"===t.condop?"AND":"OR",children:(t.searchconds||[]).map((t=>Qc(t)))};if("DEFIELD"===t.condtype)return{leaf:!0,field:t.fieldname||null,valueOP:t.condop||null,value:t.value||null};throw new o("无效的condtype:".concat(t.condtype))}function Jc(t){let e=!1,a=!1;if(r(t[0],(t=>{t.leaf&&(t.field&&t.valueOP&&!ct(t.value)?e=!0:a=!0)})),e&&!a){return[qc(t[0])]}}Object.keys(jc).forEach((t=>{jc[t].forEach((e=>{if(Uc.includes(e))return;const a="".concat(t,"_").concat(e);Kc[a]||("date"!==t||["IN","NOTIN"].includes(e)?Kc[a]={appId:Gc,editorType:"TEXTBOX",id:a}:Kc[a]={appId:Gc,editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends sr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!0}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Bc(this.model,this.view.model.codeName.toLowerCase()),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups(!0)}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await $o(this.model.appDataEntityId,this.context);if(!e)return;const a=await Hc(e,this.model.appDataEntityId,this.model.appId),i=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===a.findIndex((e=>{var a;return e.appDEFieldId===t.appDEFieldId&&(!(null==(a=t.defsearchMode)?void 0:a.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&i.push(t)})),a.length>0&&(this.model=ht(this.model),this.model.searchBarFilters=a.concat(...i),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=se(Ke.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(null==(t=this.searchBarFilters)?void 0:t.length)&&(this.searchBarFilters.forEach((t=>{const e=new zc(t,this.appDataEntity,this.context,this.params);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.enableFilter)return;return Jc(this.state.filterNodes)}async initSearBarGroups(t=!1){if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const a={name:t.id,caption:t.caption,saved:!1,show:!0,searchGroupData:{},order:100*(e+1),defaultSelect:!1,noEdit:!0};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(a.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(a.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(a.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(a.show="1"===e.valid_flag)}catch(e){ibiz.log.error("".concat(t.data,"非标准JSON格式:"),e)}return t.defaultGroup&&(a.defaultSelect=!0),a})));const e=await this.service.fetch();if(e.ok&&e.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)b(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,a)=>e.order>this.state.searchBarGroups[t].order?a:t),0);this.state.searchBarGroups.push({saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)})),t&&this.state.searchBarGroups&&this.state.searchBarGroups.length>0){this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){const t=this.state.searchBarGroups.find((t=>t.defaultSelect));t&&this.handleGroupClick(t)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:this.calcFilters(),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success("保存成功");else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.name===e.data.name));t&&(b(t,e.data),t.saved=!0),ibiz.message.success("保存成功")}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(b(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Qc(t)));this.state.filterNodes=e}else this.state.filterNodes=[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}];this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}}),t("TabExpPanelController",class extends sr{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&Bo(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);!0===e&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:i,navigateParams:s,appDataEntityId:n}=t,o={deName:ge(n),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ce(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}});var $c=t("TreeService",class extends un{async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ae(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:a});if(0===s.length)return;(await va(s.map((async a=>{const i=Ce(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=De(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===Ae(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];if(t.accessKey){if(!this.app.authority.calcByResCode(t.accessKey))return r}switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,o)];break;case"DE":r=await this.getDENodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var a;if(d&&(!c||c&&0===e)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,a,i){return new so(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...a.params},l={...a.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<i;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Ce(this.model,h._nodeId);t.appDataEntityId&&(p=ge(t.appDataEntityId)),u=h._value}const{resultContext:f,resultParams:g}=ce({deName:p,navFilter:o?"n_".concat(o.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:s},{derValue:u,context:l,params:d,data:m});return Object.assign(l,f),Object.assign(d,g),{context:l,params:d,navContext:f,navParams:g}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new io(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new eo(t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}}),Zc=t("TreeController",class extends nr{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),a=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new oc(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async onDestroyed(){await super.onDestroyed(),this.counter&&this.counter.destroy()}async initService(){this.service=new $c(this.model),await this.service.init(this.context)}async initCounter(){const{appCounterRefs:t}=this.model,e=null==t?void 0:t[0];e&&(this.counter=await en.getCounterByRef(e,this.context))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Ae(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var a;if(null==(a=t.parentDER1N)?void 0:a.pickupDEFName){const a=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&e.push({minorEntityId:a.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const a=t.decontextMenu;if(null==(e=null==a?void 0:a.detoolbarItems)?void 0:e.length){let e=0;const i=[];r(a,(t=>{if("DEUIACTION"===t.itemType){e+=1;const a=t;200===a.actionLevel&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:i[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let a;e&&await this.startLoading();try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;let i;this.state.isLoading=!0;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=i:this.state.rootNodes=i,await this.afterLoadNodes(i),i}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var a;const i=null==(a=this.contextMenuInfos[t._nodeId])?void 0:a.clickTBUIActionItem;if(i)return this.doUIAction(i.uiactionId,t,e,i.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e._id!==t._id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t._id);if(e&&!a)this.state.expandedKeys.push(t._id);else if(!e&&a){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),a=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(a)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,a,i){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await Jr.exec(t,{...s,...n,event:a},i);if(o.closeView)this.view.closeView();else if(o.refresh)switch(o.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){let e=null;return e="DE"===t._nodeType?t:{...t,...t._deData||{}},{data:[e],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var a;(null==(a=t._children)?void 0:a.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"_id",i=this.state.items.find((e=>e[a]===t[a]));if(!i)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{_parent:t}=i;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?i._parent:i,n=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const a=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==a.length&&await Promise.all(a.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,a){var i,s;const n=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId);if((null==(i=t._parent)?void 0:i._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,n.appDataEntityId)}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return null==a?void 0:a.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,i){var s,n,o;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===i?e:e._parent,l=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(n=e._parent)?void 0:n._id)!==(null==(o=t._parent)?void 0:o._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===i)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let a=d._children.indexOf(e);"next"===i&&(a+=1),d._children.splice(a,0,t)}("inner"===i||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:f}=h;if(!0===f){if(!p)throw new a(h,"缺少配置排序属性");const e=p.toLowerCase(),i="ASC"===m,s=[...d._children];i||s.reverse();const n=t=>t+(100-t%100),o=t=>t[e]||0;let c;s.forEach(((a,i)=>{const d=a._deData;void 0===c?a===t&&(c=0===i?100:n(o(s[i-1]._deData)),d[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=o(d)&&(d[e]=n(c),r.push(a)),c=o(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const a=this.getNodeModel(t._nodeId),i=t._deData,s=ge(a.appDataEntityId),n=this.context.clone();n[s]=i.srfkey;const o=await e.deService.exec(a.appDataEntityId,"update",n,i);o.data&&(t._deData=o.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if("DE"!==t._nodeType)throw new o("不是实体树节点数据");t._text=e,await this.updateDeNodeData([t])}}),td=t("WizardPanelService",class extends hn{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let n=await this.exec(s,t,e,a);return n=this.handleResponse(n),n}}),ed=(t("WizardPanelController",class extends sr{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,i;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),n=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),o=null==n?void 0:n.stepTag;this.stepTags[s]=o})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new td(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await qi(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o("找不到".concat(t,"的表单控制器"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const i=await a.load();Object.assign(this.formData,i)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=ge(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new o("找不到标识为".concat(t,"的向导表单"));return a}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,{},this.params),e=ge(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new o("没有上一个表单");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,a=this.model.dewizard.dewizardForms;if(t&&a){const a=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),i=t[a+1];if(!i)throw new o("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends un{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new no(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new no(e,e);this.dataUIMap.set(e,i)}))}})),ad=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),id=(t("MDCtrlController",class extends nr{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new ed(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new ad(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new ad(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Wo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new ko(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.data.getOrigin()),t.uaColStates[e.id]=i}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(new ad(e,this)))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(new ad(e,this))}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,key:a.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends dc{async updateGroup(t,e){var a;const i=(null==(a=this.model.updateGroupControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}})),sd=(t("KanbanController",class extends lc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new id(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:i}=this.model;if(!e)throw new a(this.model,"排序属性没配置");if(!i)throw new a(this.model,"排序方向没配置");const s="ASC"===i;t.forEach((t=>{const a=t[e];if(ct(a))t[e]=0;else{const e=Number(a);if(Number.isNaN(e))throw new o("".concat(t.srfmajortext,"的排序属性无法转换成数值"))}})),t.sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e]))}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,a){this.setSelectGroup(a.key),super.onGroupToolbarClick(t,e,a)}async onGroupActionClick(t,e,a,i){this.setSelectGroup(i.key);const s={...this.params,srfgroup:i},n=t.uiactionId;await Jr.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:a},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o("看板部件必须开启分组");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];ct(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));i.push({caption:a.text,color:a.color,key:a.value,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const n=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=n}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning("当前看板不允许调整分组!");const e="ASC"===this.model.minorSortDir,{from:a,to:i,fromIndex:s,toIndex:n}=t,o=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=d.children[s];return e[o]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[s];t.from!==t.to?(m[o]=t.to,p.splice(n,0,m)):(p.splice(s,1),p.splice(n,0,m));const f=d.children.splice(s,1);let g;l.children.splice(n,0,...f),e||(u.reverse(),p.reverse());let w,E=[];p.forEach(((t,e)=>{void 0===g?t!==u[e]&&(g=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=g,c.push(t)):(g>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),g=w,w=0,E=[]),t[r]=h(g),c.push(t)):(0===E.length&&(w=g),E.push(t)),g=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=ge(this.model.appDataEntityId),a=this.context.clone();a[e]=t.srfkey;const i=await this.service.updateGroup(a,t);if(i.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,i.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,a){const i=this.state.groups.find((e=>e.key===t));i&&(i[e]=a)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const a=t.split("quicktoolbar_")[1];this.setGroupController(a,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const a=t.split("batchtoolbar_")[1];this.setGroupController(a,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends $c{})),nd=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),od=t("TreeGridExController",class extends Zc{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new sd(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await Ms(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=a:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=a)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,a)=>{t.uaColumn&&(t.fixed=a+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new nd(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug("简单模式,不保存");if("DE"!==t._nodeType)throw new o("非实体节点数据不能保存");const e=this.state.rows[t._uuid];if(!e)throw new o("行数据不存在");if(!e.modified)return void ibiz.log.debug("值没有发生改变");if(e.processing)return void await P(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=i,r=0===t._deData.srfuf;if(r)throw new o("暂不支持新建");if(!n)throw new a(i,"树节点没有配置更新实体行为");const c=ge(s),d=this.context.clone();d[c]=t._deData.srfkey;const l=ibiz.hub.getApp(this.context.srfappid);let h;try{h=await l.deService.exec(s,n,d,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(r?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=h.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await va(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((a=>{a.gridStateNotify(t,e)}))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Go(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await va(Object.values(this.columns).map((async a=>a.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const a={};return Object.values(this.fieldColumns).forEach((i=>{const s=i.nodeColumnControllerMap.get(t._nodeId);if(!s||!s.nodeEditItem)return;const{createDV:n,createDVT:o,updateDV:r,updateDVT:c}=s.nodeEditItem,d=e?o:c,l=e?n:r,h=Yo({name:i.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(a[i.name]=h)})),a}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o("同时只能有一行开启行编辑");if(1===t.data._deData.srfuf){t.cacheData=ht(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}}),rd=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),cd=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:i,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==i?void 0:i.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==s?void 0:s.find((t=>t.id===o.dataItemName));if(!o||!r)throw new a(e,"节点没有配置对应表格列".concat(this.fieldColumn.name,"的数据项"));if(this.nodeColumn=o,this.nodeDataItem=r,o.enableRowEdit){const t=null==n?void 0:n.find((t=>t.id===o.id));if(!t)throw new a(e,"没有找到对应表格列".concat(this.fieldColumn.name,"的编辑项模型"));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await $i(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const a=new Wo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new ko(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.name]=a}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const a=this.nodeColumn.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new o("未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=Je(t.data),r=Object.assign(this.context.clone(),{srfkey:i,...n}),c=ht(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:a}=le(d);let i={};e&&t.data&&(i=se(e,t.data,c,r)),Object.assign(r,i);let s={};a&&t.data&&(s=se(a,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(yo.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const a=this.nodeColumn.deuiactionId;await Jr.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,a){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return Ho.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=wt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}async setRowValue(t,e,a){a=a||this.name,await this.treeGrid.setRowValue(t,a,e)}}),dd=(t("TreeGridExFieldColumnController",class extends rd{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new cd(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const a=this.nodeColumnControllerMap.get(t.data._nodeId);a&&a.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends rd{constructor(){super(...arguments),this.nodeColumnMap=new Map}async init(){await this.onInit(),await this.initNodeColumnMap()}initNodeColumnMap(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;const a=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));a&&this.nodeColumnMap.set(t.id,a)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const a=this.nodeColumnMap.get(t.data._nodeId);a.deuiactionGroup&&(e=a.deuiactionGroup)}return e}initActionStates(t){var e;const a=this.getUIActionGroup(t);if(!a)return void ibiz.log.warn("".concat(this.model.id,"操作列没有配置界面行为组"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Wo;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new ko(t.id,this.treeGrid.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.model.id]=i}async onActionClick(t,e,a){const i=t.uiactionId;await Jr.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}}),t("TreeGridController",class extends _c{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const i=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!i)throw new a(this.model,"树表格无值列模式");if(!s)throw new a(this.model,"树表格无父值列模式");this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=i.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends Oc{}),t("MEditViewPanelService",class extends un{})),ld=(t("MEditViewPanelController",class extends nr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new dd(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const i=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);this.parameters=a&&i?[{parameterName:null==(t=i.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=i.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,a),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===a.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,a={id:t[e]?t[e]:"mockId:".concat(J()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:i,pathName:s}=e;t[i]&&!Object.is(t[i],"")&&Object.assign(a.context,{[s]:t[i]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(a,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(a,{srfmajortext:"草稿--新建"})})),a}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex((t=>t.id===e));if(a<0)throw new o("编辑视图面板部件UI数据不存在");const i=this.state.panelUiItems[a];i.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):i.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),t("MapService",class extends un{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const i=[];if(null==(a=this.model.sysMapItems)?void 0:a.length){const a=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:r}=s,c=t.clone(),d={...e};if(r){const a=Ke.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=le(a);i&&Object.assign(c,se(i,e,t)),s&&Object.assign(d,se(i,e,t))}}const l=await a.deService.exec(n,o,c,d);l.data&&i.push(...l.data.map((t=>new co(t,s))))})))}return new p(i,200)}})),hd=(t("MapController",class extends nr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new ld(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);a.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(a,i);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),i=[],s=[];return a.forEach((t=>{"REGION"===t._itemStyle?i.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=i,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const a=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=a;break;case"strareacode":this.state.strAreaCode="true"===a;break;case"jsonbaseurl":this.state.jsonBaseUrl=a}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends hn{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(null==(a=this.dataEntity.codeName2)?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let s=await ibiz.net.request(i,{method:"post",data:e});return s=this.handleResponse(s),s}})),ud=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},pd=class extends ud{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},md=class extends ud{},fd=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new pd(t);case"USER2":return new md(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},gd=(t("ReportPanelController",class extends sr{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=fd.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new hd(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam),i=await this.service.fetch(e,a);this.state.data=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),t("GanttService",class extends $c{execDeService(t,e,a,i){return this.app.deService.exec(t,e,a,i)}async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ae(this.model,{parentId:t._nodeId,hasQuery:a});if(0===s.length)return;(await va(s.map((async a=>{const i=Ce(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=De(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const n=0===Ae(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,o);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new po(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map((e=>new mo(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map((e=>new fo(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:o,navParams:r})))}return[]}})),wd=(t("GanttController",class extends od{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new gd(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}transformNodeDataItem(t,e){var a;const i={};return null==(a=t.detreeNodeDataItems)||a.forEach((t=>{t.id&&t.appDEFieldId&&e.hasOwnProperty(t.id.toLowerCase())&&Object.assign(i,{[t.appDEFieldId.toLowerCase()]:e[t.id.toLowerCase()]})})),i}async updateNodeData(t,e,a=!1){const i=t.srfkey?"srfkey":"_id",s=this.state.items.find((e=>e[i]===t[i]));if(!s||!s.srfkey)return void ibiz.log.error("找不到对应的动态实体树节点数据",t);const n=this.getNodeModel(s._nodeId);if(n){const i=a?this.transformNodeDataItem(n,e):e;if(Object.keys(i).length>0){const e=ge(n.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(n.appDataEntityId,"update",a,i)).status&&this.refreshNodeChildren(t,!0)}}}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),Ed=class{constructor(){this.evt=new $,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new gn}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;const e=this.formatAsyncAction(t.data);-1===this.actions.findIndex((t=>t.asyncacitonid===e.asyncacitonid))?this.add(e):this.update(e)}))}formatAsyncAction(t){if(["begintime","endtime","createdate","updatedate"].forEach((e=>{H(t[e])&&(t[e]=wt(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!M(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!M(t.completionrate)){const e=Number(t.completionrate);Number.isNaN(e)?t.completionrate=void 0:t.completionrate=e}return t}add(t){this.actions.unshift(t),this.finishedStates.includes(t.actionstate)?this.noticeResult(t):(this.doingNum+=1,ibiz.notice.showDoingNotice({num:this.doingNum})),this.evt.emit("add",ht(t)),this.evt.emit("dataChange")}update(t){const e=this.actions.findIndex((e=>e.asyncacitonid===t.asyncacitonid));this.actions.splice(e,1,t),this.finishedStates.includes(t.actionstate)&&(this.doingNum-=1,this.doingNum<=0&&ibiz.notice.closeDoingNotice(),this.noticeResult(t)),this.evt.emit("change",ht(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}},vd=class{constructor(){this.evt=new $,this.total=0,this.page=0,this.size=20,this.messages=[],this.service=new Zn}async init(){this.load()}async load(){await this.fetch(!1)}async loadMore(){await this.fetch(!0)}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"update_time,desc"},a=await this.service.fetch(e);this.total=a.total,t?this.messages.push(...a.data):this.messages=a.data,this.evt.emit("dataChange")}},yd=class{constructor(){this.total=0,this.asyncAction=new Ed,this.internalMessage=new vd}async init(){await this.internalMessage.init(),await this.asyncAction.init()}},Id=class{constructor(){this.convert=new Po,this.controller=new wd,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new xo,this.notice=new yd,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,a=-1){const i=this.calcAppViewId(t);if(this.view2appMap.has(i)){const t=this.view2appPriorityMap.get(i);if(t&&t<a)return}this.view2appMap.set(i,e),-1!==a&&this.view2appPriorityMap.set(i,a)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(t),t}throw new o("视图[".concat(e,"]不存在"))}async loadAppView(t,e,a){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,a)}throw new o("视图[".concat(e,"]不存在"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return a=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new o("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new Ao(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new tn(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,a){return(await this.getAppAsync(t)).deService.getService(a,e)}reset(){this.appMap.clear(),this.configCache=void 0}},Dd=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:i}=t,s="".concat(i,"_").concat(a),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),Cd=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:i}=this.view;ibiz.log.debug("".concat(a.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_header;e&&(e.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_footer;t&&(t.state.visible=!1)}}}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,i;let s=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else s=!0;if(ibiz.env.isMob){if(this.leftToolbar)s=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)s=!0;else{const t=null==(a=this.viewLayoutPanel)?void 0:a.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)s=!0;else{const t=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;t&&(t.state.visible=!1)}return s}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:i}=this.view;if(!t)throw new o("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),n=await s.deService.exec(t,"get",a,i),{data:r}=n;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Ad=(t("MDViewEngine",class extends Cd{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault&&(this.searchBar&&this.searchBar.hasDefaultSelect&&"grid"===this.xdataControlName?this.searchBar.setDefaultSelect():this.load())}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?this.openData(e):"New"===t?this.newData(e):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Search"===t?(await this.searchForm.search(),null):"Reset"===t?(await this.searchForm.reset(),null):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,i;const{data:s,event:n}=t,o=(t.context||this.view.context).clone(),r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||ge(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!c.ok}}async newData(t){var e,i,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=ht(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:n,event:o,view:this.view}));if(-1===d)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){let t=super.calcViewHeaderVisible();if(this.searchBar&&this.searchBar.state.visible)t=!0;else{const t=this.viewLayoutPanel.panelItems.view_searchbar;t&&(t.state.visible=!1)}return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),class{constructor(){this.layoutPanel=new Qe,this.theme=new pa,this.text=new ua,this.hbs=new ae,this.rawValue=new wa,this.action=Jr,this.error=new Mt,this.viewStack=new Ea,this.anime=new Li,this.file=new Oi,this.error.register(new Ot)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}}),bd=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o("Method not implemented.")}destroy(){}},Pd=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},Td=class extends bd{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const i=this.logic.scriptCode;this.scriptFn=Ke.createScriptFn(t,i,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},xd=class extends bd{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Qr(e,i,t)}},Nd=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),mt(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const i={itemName:t,triggerType:e},s=this.triggerAndExecute(i,a);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const i=this.getExecuteParams(e);return a.execute(i)}triggerControlEvent(t,e,a){const i={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(i,a)}},Sd=class extends Nd{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Rd=class extends Nd{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Ld=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}},Od=class{constructor(){this.executorFactory=new Pd,this.triggerFactory=new Ld}createViewScheduler(t){return new Rd(t)}createControlScheduler(t){return new Sd(t)}},Md=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new o("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},_d=class extends Md{},Vd=class extends Md{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:i}=t;return{context:e,params:a,data:(null==i?void 0:i[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(a=this.logic.itemName)?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},Fd=class extends Md{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new a(this.logic,"定时器缺少定时间隔");this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},kd=class extends bd{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:i,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const d=c.refAppViewId;if(!d)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const l=c.navigateContexts||[],h=Object.assign(i,se(l,r[0],s,i));let u={};const p=c.navigateParams;return Y(p)&&(u=se(p,r[0],s,i)),ibiz.commands.execute(yo.TAG,d,h,u,n)}async calcOpenViewRef(t,e){const i=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=i.formTypeAppDEFieldId||i.dataTypeAppDEFieldId;if(!s)throw new a(t,"".concat(i.codeName,"[多表单实体] or [索引实体]缺少类型属性配置"));const{data:n}=e,r=n[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return d}async executeNewDataAppUILogic(t,e){const{context:s,params:n,...o}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=ge(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(p=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(p=u,!p||!p.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},f={};const g=(null==r?void 0:r[0])||{},w=p.navigateContexts;Y(w)&&(m=se(w,g,n,s)),m=Object.assign(s,m);const E=p.navigateParams;if(Y(E)&&(f=se(E,g,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&g&&(f[t]=g.srfkey,f.srfcopymode=!0)}f.srfuf=0;const v=await ibiz.commands.execute(yo.TAG,p.refAppViewId,m,f,o);return l&&v.data&&await this.doBatchAdd(t,v.data,s,p,e.view),v}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const l=await ibiz.commands.execute(yo.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(i=l.data)?void 0:i[0];if(!h)throw new o("请选中一条数据");const u=h.srfkey,p=null==n?void 0:n.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new o("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}async doBatchAdd(t,e,i,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new a(c,"实体没有从关系集合!");let h="";if(null==d||d.forEach((t=>{const e=ge(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o("没有找到".concat(l,"在当前实体的外键属性"));const u={srfkey:h},p=null==(r=n.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,a]=e.split(":");t&&a&&(u[t]=a)}}ibiz.log.debug("批量新建转换映射属性",u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((a=>{const i=u[a];e[i]=t[a]})),e}));ibiz.log.debug("批量新建创建数据",m);const f=ibiz.hub.getApp(i.srfappid).deService;await f.exec(c.id,"Create",i,m)}}},Wd=class extends Md{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>ea[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Ud=class extends Md{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>ia[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},zd=class extends bd{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");Jr.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=vt.dirname(this.url.pathname)}dir(t){return this.url.origin+vt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=a,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
|