@ibiz-template/runtime 0.5.0 → 0.5.1-dev.0
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 +165 -144
- package/dist/index.system.min.js +1 -1
- package/out/constant/view-type.d.ts +5 -1
- package/out/constant/view-type.d.ts.map +1 -1
- package/out/constant/view-type.js +4 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +1 -2
- 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 +6 -7
- package/out/controller/control/gantt/gantt.controller.js +2 -2
- package/out/controller/control/gantt/gantt.service.js +2 -2
- package/out/controller/control/tree/tree.controller.d.ts +8 -3
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +63 -63
- package/out/controller/control/tree/tree.service.js +8 -8
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +2 -2
- package/out/interface/controller/event/view/i-sub-app-ref-view.event.d.ts +12 -0
- package/out/interface/controller/event/view/i-sub-app-ref-view.event.d.ts.map +1 -0
- package/out/interface/controller/event/view/i-sub-app-ref-view.event.js +1 -0
- package/out/interface/controller/event/view/index.d.ts +1 -0
- package/out/interface/controller/event/view/index.d.ts.map +1 -1
- package/out/interface/controller/event/view/index.js +1 -0
- package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -2
- package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree.state.d.ts +26 -25
- package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
- package/out/interface/controller/state/view/i-sub-app-ref-view.state.d.ts +11 -0
- package/out/interface/controller/state/view/i-sub-app-ref-view.state.d.ts.map +1 -0
- package/out/interface/controller/state/view/i-sub-app-ref-view.state.js +1 -0
- package/out/interface/controller/state/view/index.d.ts +1 -0
- package/out/interface/controller/state/view/index.d.ts.map +1 -1
- package/out/interface/controller/state/view/index.js +1 -0
- package/out/service/dto/method.dto.d.ts +12 -1
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +15 -3
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts +3 -3
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.js +10 -10
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +27 -27
- package/out/service/vo/tree-node-data/tree-node-data.d.ts +12 -13
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +8 -8
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-static-node-data.js +11 -11
- package/package.json +5 -5
- package/src/constant/view-type.ts +5 -0
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +6 -7
- package/src/controller/control/gantt/gantt.controller.ts +2 -2
- package/src/controller/control/gantt/gantt.service.ts +2 -2
- package/src/controller/control/tree/tree.controller.ts +70 -65
- package/src/controller/control/tree/tree.service.ts +8 -8
- package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +7 -3
- package/src/interface/controller/event/view/i-sub-app-ref-view.event.ts +12 -0
- package/src/interface/controller/event/view/index.ts +1 -0
- package/src/interface/controller/state/control/i-gantt.state.ts +2 -2
- package/src/interface/controller/state/control/i-tree.state.ts +27 -25
- package/src/interface/controller/state/view/i-sub-app-ref-view.state.ts +10 -0
- package/src/interface/controller/state/view/index.ts +1 -0
- package/src/service/dto/method.dto.ts +14 -2
- package/src/service/vo/gantt-node-data/gantt-code-list-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-static-node-data.ts +2 -2
- package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +13 -13
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +35 -35
- package/src/service/vo/tree-node-data/tree-node-data.ts +19 -22
- package/src/service/vo/tree-node-data/tree-static-node-data.ts +16 -15
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,o,n,r,c,l,d,h,p,u,m,g,f,w,E,y,I,v,D,C,A,b,P,T,x,N,S,L,R,O,M,V,_,F,k,W,U,B,z,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,ot,nt,rt,ct,lt,dt,ht,pt,ut,mt,gt,ft,wt,Et;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,o=t.NoticeError,n=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,l=t.IBizContext,d=t.DataTypes,h=t.clone,p=t.CoreConst,u=t.HttpResponse,m=t.updateKeyDefine,g=t.Net,f=t.getToken,w=t.NOOP,E=t.IBizParams,y=t.isElementSame,I=t.findRecursiveChild,v=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,V=t.debounce,_=t.camelCase,F=t.eq,k=t.gt,W=t.gte,U=t.findIndex,B=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,J=t.QXEvent,$=t.ascSort,Z=t.isArray,tt=t.getCookie,et=t.setCookie,at=t.clearCookie,it=t.descSort,st=t.clearAll,ot=t.isNumber},function(t){nt=t.default},function(t){rt=t.isNil,ct=t.mergeRight,lt=t.isEmpty,dt=t.clone,ht=t.equals,pt=t.where,ut=t.mergeLeft,mt=t.isNotNil,gt=t.mergeDeepRight},function(t){ft=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(Ao);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const o=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(n=o.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(n!==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 n},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,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:o,colMD:n,colMDOffset:r,colLG:c,colLGOffset:l}=t,d=(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:d(a,i),sm:d(s,o),md:d(n,r),lg:d(c,l)}},calcLayoutHeightWidth:he,calcMainStateOPPrivsStrs:me,calcNavParams:re,calcResPath:Ni,compare:ke,compareNumber:We,contains:Ue,convertNavData:ie,convertNavDataByArray:oe,convertObjectToNavParams:ae,execDELogic:Is,execDELogicAction:Ds,execDELogicById:vs,execFieldLogics:As,execUILogic:Pn,exportData:Po,fieldValueToBoolean:Li,filterFieldLogics:Ee,filterValueRules:ca,findChildFormDetails:be,findDELogic:we,findEditItem:Ae,findFieldById:ye,findModelChild:ce,formatMultiData:ne,generateEditorRules:vo,generateRules:Io,getAllPanelField:Oe,getAppCounterProvider:Ta,getAppMenuItemProvider:Ei,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,ibiz.register.get("".concat(ti,"_").concat(a)));var a;if(e)return e;throw new n("找不异步操作类型".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:de,getControlProvider:Sa,getControlsByView:Te,getDEMethodProvider:pi,getDERedirectToView:_e,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:Co,getEditorProvider:Oa,getEntitySchema:To,getFormDetailProvider:_a,getGridColumnProvider:Wa,getMatchResPath:xi,getOriginData:yo,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 o=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!o)throw new Error("未找到插件".concat(t));return o},getPanelItemProvider:za,getPlatformProvider:ci,getPlatformType:si,getPortletProvider:Ka,getRootNode:ve,getTreeGridExColumnProvider:gi,getTreeNode:De,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:qa,getUILogicNodeProvider:Ja,getViewEngines:Ne,getViewLogics:xe,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Za(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Za("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=Za(a));e||(e=Za("DEFAULT"));return e},getWFContext:Qe,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:o}=e,n=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?o:s),c=null==n?void 0:n.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:ma,hasDeCodeName:fe,hasSubRoute:wo,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(bo);(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 Gr,t.hub=new Ur,t.register=new Lt,t.config=new St,t.auth=new Xi,t.asyncAction=new Hi,t.engine=new Br,t.uiDomainManager=new pa,$s(),Mn(),Ss(),Di(),ibiz.scheduler=new $r,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new ec(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new ec(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new ec(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new ac(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new tc(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new sc(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new oc(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Xr(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Hr(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Hr(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new ic(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new nc(t,e))),function(){const t=new ai;ni("Browser",(()=>t))}(),t.platform=ci()},installCommand:$s,isDataContainer:Se,isFormDataContainer:Pe,isValueChange:Eo,matchMainState:ue,openRedirectView:Me,parseUserParams:le,presetAppCounterProvider:Di,presetDEMethodProvider:Ss,presetUIActionProvider:Mn,registerAppCounterProvider:ba,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(fi,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ti,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(xa,"_").concat(t),e)},registerDEMethodProvider:di,registerEditorProvider:function(t,e){ibiz.register.register("".concat(La,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Ma,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Fa,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Ua,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ni,registerPortletProvider:function(t,e){ibiz.register.register("".concat(Ga,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(ui,"_").concat(t),e)},registerUIActionProvider:Ha,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(Qa,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat($a,"_").concat(t),e)},strContain:Be,testCond:Fe,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await Ve(t,e,a);await ibiz.commands.execute(qs.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 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 vt=yt(It.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=yt(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 o=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):o.bind(this)(t,e)};var n=s.startOf;s.startOf=function(t,e){var s=this.$utils(),o=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return o?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return n.bind(this)(t,e)}})}(At);var bt=yt(At.exports),Pt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var o=e.prototype;o.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 o=s(this).startOf(i).add(1,i).date(e),n=s(this).endOf(a);if(o.isBefore(n))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)},o.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Pt);var Tt=yt(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)},o=e.prototype;o.isoWeekYear=function(){return s(this).year()},o.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,o,n,r=s(this),c=(e=this.isoWeekYear(),n=4-(o=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),o.isoWeekday()>4&&(n+=7),o.add(n,a));return r.diff(c,"week")+1},o.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var n=o.startOf;o.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"):n.bind(this)(t,e)}})}(xt);var Nt=yt(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 o?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof n&&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 Vt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},_t=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 Mt.handleJudgmentExecute(this,a,e)}},Ft=class extends Vt{constructor(t){super(t,"camelCase")}onExecute(t){return t?_(t):""}},kt=class extends Vt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Wt=class extends Vt{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ut=class extends Vt{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Bt=class extends Vt{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return Mt.handleJudgmentExecute(this,i,a)}},zt=class extends Vt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=R(t)?!F(U(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),Mt.handleJudgmentExecute(this,s,i)}},Gt=class extends Vt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},jt=class extends Vt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Kt=class extends Vt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Xt=class extends Vt{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=B(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ht=class extends Vt{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=z(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Yt=class extends Vt{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},qt=class extends Vt{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return Mt.handleJudgmentExecute(this,a,e)}},Qt=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||""}},Jt=class extends Vt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},$t=class extends Vt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},Zt=class extends Vt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},te=class extends Vt{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 _t(a),new Ft(a),new kt(a),new Wt(a),new Ut(a),new Bt(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 Jt(a),new $t(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,o=t[i];H(t[i])&&a.test(t[i])&&(s=!1,o=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:o})}return e}function ie(t,...e){if(!t||S(t))return{};return oe(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 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}=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 ne(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:o}=t;!i&&o&&Object.prototype.hasOwnProperty.call(s,o)&&(a[o]=e.map((t=>t[o])).join(";"))})),a}function re(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:o,navParams:n}=t,{context:r,params:c,data:l,derValue:d}=e,h={},p={},u=d||l.srfkey;u&&(a&&(h[a]=u),i&&(p[i]=u),s&&(p["n_".concat(s.toLowerCase(),"_eq")]=u));const m=ie(o,l,c,r),g=ie(n,l,c,r);return Object.assign(h,m),Object.assign(p,g),{resultContext:h,resultParams:p}}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 le(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const o=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:o});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:o});break;default:Object.assign(i,{key:o})}}}return{navigateContexts:e,navigateParams:a,other:i}}function de(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,o={width:"",height:""};return"FULL"===i?o.width="100%":e&&e>0&&(o.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?o.height="100%":a&&a>0&&(o.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),o}function pe(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 ue(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 o=!0;const n=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(n[e])){o=!1;break}return o}))}}function me(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,o=(null==i?void 0:i.map((t=>t.name)))||[];let n=[];if(s)n=o;else{n=[...a.deopprivs,...e.deopprivs].filter((t=>!o.includes(t.name))).map((t=>t.name))}return n}function ge(t){return t.split(".").pop()}function fe(t,e){const a=ge(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 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 ve(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||ve(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 _e(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(qs.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)),o=nt.parse(s,{delimiter:";"}),r=o.srfdename||"";if(!r)throw new n("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new n("未找到指定实体的codeName: ".concat(r));o[c.toLowerCase()]=o[r.toLowerCase()];const l="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),d=await ibiz.hub.getAppView(l);if(delete o.srfdename,"undo"!==o.srfwf){const t=o.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));o.wf=e,o.wfVersion=a}return o.srfprocessinstanceid&&(t.srfprocessinstanceid=o.srfprocessinstanceid,delete o.srfprocessinstanceid),{context:t,params:o,opts:a,viewId:d.id}}async function _e(t,e,i={},s={}){var o;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 l=t.appDataEntityId,d=ge(l);let h=(null==(o=s.data)?void 0:o[0])||{};e[d]=h[d]||e[d]||i[d];const p=t.getDataAppDEActionId,u=ibiz.hub.getApp(t.appId),m=await u.deService.getService(e,l);ibiz.loading.showRedirect();try{const t=await m.exec(p||"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 n("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(l,t.appId),f=await async function(t,e,a,i){let s="";const o=e.typeAppDEFieldId;if(o){const{codeName:a}=ye(t,o),s=i[a.toLowerCase()];if(H(s))return"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(o,"]值为空"),i)}const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(H(r))return H(a.wf)?"".concat(n,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(n,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=ye(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(Y(c)&&t.formTypeAppDEFieldId){const{codeName:e}=ye(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=H(c)?"".concat(n,":").concat(c.toString().toUpperCase()):"".concat(n);return s}(g,t,i,h),w=f.split(":"),E=2===w.length?f:w.slice(0,2).join(":"),y="".concat(g.name.toUpperCase(),":").concat(f),I=[];t.redirectAppViewRefs&&I.push(...t.redirectAppViewRefs),t.appViewRefs&&I.push(...t.appViewRefs);const v=I.find((t=>{const e=t.name||t.id;return e===y||e===f||e===E}));if(v){const t=v.refAppViewId;if(t)return{type:"view",viewId:t,context:e,params:i,opts:{...s,data:[h]}};throw new a(v,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==I?void 0:I.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(f,"]或[").concat(y,"]或工作流[").concat(E,"]对应视图"))}function Fe(t,e,a){if(Object.is(e,"IN"))return Ue(t,a);if(Object.is(e,"NOTIN"))return!Ue(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 Ue(t,a);case"NOTIN":return!Ue(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 n("值操作:".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(),o=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(o))return We(s,o);throw new n("".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 Ue(t,e){if(!e||"string"!=typeof e)throw new n("范围比较的条件值不存或者不是字符串");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(),o=i.indexOf(s);switch(a){case"start":return 0===o;case"end":return o+s.length===i.length;default:return-1!==o}}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 console.log("报错脚本",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,o=t.length;i<o;i++){const o=e(t[i],i);if("AND"===a){if(!o){s=!1;break}}else if("OR"===a&&o){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:o}=Ke(t,e,a);return i.infoMessage=o,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,o,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=o[a=a?a.toLowerCase():""]?o[a]:a}(rt(i)||lt(i))&&(i="内容必须符合值规则");const c=Fe(t,e,a);if(!c&&r)throw new n(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,o,r){Y(o)&&(o="值必须符合值范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!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 n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!=i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!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,o,r){Y(o)&&(o="内容长度必须符合范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!==i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!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:o,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Xe(e[t],o,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:o}=function(t,e,a,i,s){Y(i)&&(i="值必须符合脚本规则");const o=e;let r="",c=!0;const l=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:o},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),l(t)}if(i="",!c&&s)throw new n(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=o||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 n("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new n(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=dt(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 o="";i?o="BLANK_MODE":s&&(o=s.toUpperCase());let n="";return n=""!==o?"".concat(e,"_").concat(a,"_").concat(o):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(n)&&(n+="_NO_NAV"),n}});function Qe(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Je=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))(Je||{})),$e=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))($e||{})),Ze=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Ze||{})),ta=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))(ta||{})),ea=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))(ea||{})),aa=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))(aa||{})),ia=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))(ia||{})),sa=t("StudioViewEvents",class{});sa.onViewMounted="onMounted",sa.onViewDestroyed="onDestroyed";var oa=t("StudioPanelEvents",class{});oa.onClick="onClick",oa.onChange="onChange",oa.onEnter="onEnter",oa.onLeave="onLeave";var na=t("StudioControlEvents",class{});na.onBeforeLoad="onBeforeLoad",na.onLoadSuccess="onLoadSuccess",na.onLoadError="onLoadError",na.onBeforeLoadDraft="onBeforeLoadDraft",na.onLoadDraftSuccess="onLoadDraftSuccess",na.onLoadDraftError="onLoadDraftError",na.onBeforeSave="onBeforeSave",na.onSaveSuccess="onSaveSuccess",na.onSaveError="onSaveError",na.onBeforeRemove="onBeforeRemove",na.onRemoveSuccess="onRemoveSuccess",na.onRemoveError="onRemoveError",na.CLICK="onClick";var ra=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 ca(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var la=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")}}),da=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=dt(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")}}),ha=t("UIDomain",class{constructor(t){this.rsMap=new Map,this.id=t||Q()}setDERConfig(t,e){this.rsMap.has(t)||this.rsMap.set(t,[]);this.rsMap.get(t).push(e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),pa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ha(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))}}),ua=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}});async function ma(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 ga=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){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}},fa=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},wa=class extends fa{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let o=0;o<e;o++)if(a){const e=t[o];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[o];this.setParam(e),i=!1,s=!0}else if(s){const e=t[o];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}},Ea=class t extends fa{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,o=!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,o=!0}else if(o){const a=e[r];if(!(a instanceof Array))throw new n("值必须为数组");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 wa;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},ya=class extends Ea{},Ia=class extends wa{},va=class t extends ga{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof Ea){const t=e.getChildPSModelCondBases();if(null==t||lt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let o=s;for(let e=0;e<t.length;e++){const n=t[e];if(this.testCond(n,a,i)){if(!s){o=!0;break}}else if(s){o=!1;break}}return e.isNotMode()?!o:o}if(e instanceof wa){lt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let o=null;const n=e.getValueType(),r=e.getValue();return null==n||lt(n)?o=e.getValue():(lt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===n?o=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===n&&(o=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,o)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Ia}createPSModelGroupCond(){return new ya}};va.PARAMTYPE_DATACONTEXT="DATACONTEXT",va.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Da=t("PSDEDQCondEngine",va);async function Ca(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 Aa=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function ba(t,e){ibiz.register.register("".concat(Aa,"_").concat(t),e)}function Pa(t){return ibiz.register.get("".concat(Aa,"_").concat(t))}async function Ta(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Pa(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Pa(a),e)return e;throw new n("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Pa(i),e)return e;throw new n("找不系统计数器类型".concat(i,"对应的适配器"))}var xa=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Na(t){return ibiz.register.get("".concat(xa,"_").concat(t))}async function Sa(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Na(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Na("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=Na(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var La=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Ra(t){return ibiz.register.get("".concat(La,"_").concat(t))}async function Oa(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:o,appId:n}=t;if(o){const t=await Ca(o,n);if(t&&(e=Ra(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Ra("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let o="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(o+="_".concat(i)),e=Ra(o),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=Ra(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var Ma=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Va(t){return ibiz.register.get("".concat(Ma,"_").concat(t))}async function _a(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=Va(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=Va(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var Fa=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function ka(t){return ibiz.register.get("".concat(Fa,"_").concat(t))}async function Wa(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=ka(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const n=i?"".concat(a,"_EDIT"):a;if(e=ka(n),e)return e;ibiz.log.error("找不到表格列类型".concat(n,"对应的适配器"))}var Ua=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Ba(t){return ibiz.register.get("".concat(Ua,"_").concat(t.toUpperCase()))}async function za(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(a=Ba(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=Ba(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=Ba(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=Ba("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}if(a=Ba(i),a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var Ga=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ja(t){return ibiz.register.get("".concat(Ga,"_").concat(t))}async function Ka(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=ja(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=ja(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var Xa=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Ha(t,e){ibiz.register.register("".concat(Xa,"_").concat(t),e)}function Ya(t){return ibiz.register.get("".concat(Xa,"_").concat(t))}async function qa(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:o}=t;if(i){const t=await Ca(i,s);if(t&&(e=Ya(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=Ya("".concat(a,"_").concat(o)),e)return e;if(e=Ya(a),e)return e;throw new n("找不界面行为模式".concat(a,"对应的适配器"))}var Qa=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function Ja(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Ca(a,i);if(s){if(e=ibiz.register.get("".concat(Qa,"_").concat(s)),e)return e;throw new n("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var $a=t("VIEW_PROVIDER_PREFIX","VIEW");function Za(t){return ibiz.register.get("".concat($a,"_").concat(t))}var ti=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var ei=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 n("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new n("文件流数据不存在")}}),ai=t("BrowserPlatformProvider",class extends ei{});var ii=window.navigator.userAgent.toLowerCase();function si(){return/Android|Adr/i.test(ii)?"Android":/iPhone|iPod|iPad/i.test(ii)?"IOS":/MicroMessenger/i.test(ii)?"WeChat":/DingTalk/i.test(ii)?"DingTalk":/miniProgram/i.test(ii)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var oi=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ni(t,e){ibiz.register.register("".concat(oi,"_").concat(t),e)}function ri(t){return ibiz.register.get("".concat(oi,"_").concat(t))}function ci(){const t=ri(si());return t||ri("Browser")}var li=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function di(t,e){ibiz.register.register("".concat(li,"_").concat(t),e)}function hi(t){return ibiz.register.get("".concat(li,"_").concat(t))}async function pi(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=hi(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=hi(a),e)return e;throw new n("找不实体行为方法类型为".concat(a,"的适配器"))}var ui=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function mi(t){return ibiz.register.get("".concat(ui,"_").concat(t))}async function gi(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Ca(s,i);if(t&&(e=mi(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=mi(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var fi=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function wi(t){return ibiz.register.get("".concat(fi,"_").concat(t))}async function Ei(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Ca(a,i);if(t&&(e=wi(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}if(e=wi(s),e)return e;ibiz.log.error("找不到应用菜单项类型".concat(s,"对应的适配器"))}var yi=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=l.create(),this.params={},this.evt=new J,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=dt(t)),e&&(this.params=dt(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 n("未实现计数器加载方法")}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()}}),Ii=t("AppDECounter",class extends yi{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}}),vi=t("AppDECounterProvider",class{createCounter(t){return new Ii(t)}});function Di(){ba("DEDR",(()=>new vi))}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 Da;return a.parse(["OR",this.calcCond(e)]),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.fieldName),e.condValue||a.push("")}}e.push(a)})),e}}).map=new WeakMap;var Ci=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"].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:o,iconPathAppDEFieldId:n,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:l}=this.codeList,d=a?t[a]:t.srfkey;if(e.id=d,e.value=d,e.text=i?t[i]:t.srfmajortext,(s||o||n||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),o&&(e.sysImage.cssClassX=t[o]),n&&(e.sysImage.imagePath=t[n]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Li(t[c])),l&&t[l])try{e.data=je.execSingleLine(t[l])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:o,minorSortAppDEFieldId:n,minorSortDir:r,pvalueAppDEFieldId:c,customCond:l}=this.codeList,d={...e};if(n&&r&&Object.assign(d,{sort:"".concat(n.toLowerCase(),",").concat(r.toLowerCase())}),l){const e=ie(je.execSingleLine(l),d,t);Object.assign(d,e)}if(d.size||(d.size=1e4),this.isPredefined){const t=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),d);return Object.freeze(t.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!o)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,o,t,void 0,d);let p=[];return h.data.length&&h.data.forEach((t=>{if(c){const t=this.prepareTreeData(h.data);t&&(p=t)}else p.push(this.convertData(t))})),Object.freeze(p)}prepareTreeData(t,e){const{pvalueAppDEFieldId:a}=this.codeList;let i=[];if(i=t.filter((t=>e?t[a]===e:!t[a])),0!==i.length)return i.map((e=>{const a=this.convertData(e);return a.children=this.prepareTreeData(t,a.value),a}))}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,o=-1===s||rt(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,n={expirationTime:(new Date).getTime()+o,promise:i};this.cache.set(a,n);const r=await i;return n.items=r,delete n.promise,r}});function Ai(t,e){if(null!=e){const{srfkey:t}=e;if(!rt(t)&&!lt(t))return!0}throw new n("执行「".concat(t,"」不存在「srfkey」无法处理"))}function bi(t,e){const{srfsessionid:a}=e;if(!rt(a)&&!lt(a))return!0;throw new n("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Pi=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,dt(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 n("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{return bi("add",t),(rt(e.srfkey)||lt(e.srfkey))&&(e.srfkey=Q()),e.srftempdate=(new Date).getTime(),this.cacheMap.set(e.srfkey,dt(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{bi("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),dt(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 n("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{bi("update",t),Ai("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i)return i.assign(e),this.cacheMap.set(a,i),ibiz.log.warn("update",a,e),dt(i);throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{bi("delete",t);const a=e;if(this.cacheMap.has(a)){const t=this.cacheMap.get(a);return t.srftempdate=(new Date).getTime(),this.cacheMap.delete(a),ibiz.log.warn("delete",a),t}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{bi("add",t);for(let t=0;t<e.length;t++){const a=e[t];(rt(a.srfkey)||lt(a.srfkey))&&(a.srfkey=Q()),a.srftempdate=(new Date).getTime();const i=dt(a);this.cacheMap.set(a.srfkey,i),e[t]=i,ibiz.log.warn("add",a.srfkey,a)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{bi("update",t);for(let t=0;t<e.length;t++){const a=e[t];Ai("update",a),a.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a.srfkey);if(!i)throw new Error("数据[".concat(a.srfdename,"-").concat(a.srfmajortext,"(").concat(a.srfkey,")]不存在,无法更新!"));i.assign(a),this.cacheMap.set(a.srfkey,i),ibiz.log.warn("update",a.srfkey,a),e[t]=dt(i)}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{bi("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("、"),"」,无法删除!"));for(let t=0;t<e.length;t++){const a=e[t];this.cacheMap.delete(a),ibiz.log.warn("delete",a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}select(t,e={}){try{bi("getList",t);const a=this.cacheMap.values();let i=Array.from(a);i=$(i,"srfordervalue");const s={},o={},n={},r={};e.srfkey&&(s.srfkey=ht(e.srfkey),delete e.srfkey);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];null==a?(o[t]=ht(null),n[t]=ht(void 0),r[t]=ht("")):s[t]=ht(a)}if(!lt(s)){const t=pt(s),e=pt(o),a=pt(n),c=pt(r);i=i.filter((i=>{if(lt(o)){if(t(i))return!0}else if(t(i)&&(e(i)||a(i)||c(i)))return!0;return!1}))}return i.map((t=>t.clone()))}catch(t){return ibiz.log.error(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 pt(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("||")}}),Ti=/\$\{(.*?)\}/g;function xi(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(Ti);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 Ni(t,e){const a=xi(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 Si=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)||lt(e.page)||(this.page=e.page),rt(e.size)||lt(e.size)||(this.size=e.size),rt(e.query)||lt(e.query)||(this.query=e.query),!rt(e.sort)&&!lt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}rt(e.srfparentkey)||lt(e.srfparentkey)||(this.srfparentkey=e.srfparentkey),rt(e.srfparentdename)||lt(e.srfparentdename)||(this.srfparentdename=e.srfparentdename),this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort,delete this.data.srfparentkey,delete this.data.srfparentdename}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Li(t){return[1,"1",!0,"true"].includes(t)}var Ri=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 o={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)&&(o.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(o)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new Ci(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 n("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),Oi=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||{}}}),Mi=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 Ta(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)}});Mi.counterMap=new Map;var Vi=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(){return this.app.net.get("".concat(this.getBaseUrl(),"/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 n("「".concat(t,"」未实现"))}}}),_i=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Ni(a,this.model),o="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(o,{method:"post",data:i,responseType:"blob"})}},Fi=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(Fi||{})),ki=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:dt(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(d.isNumber(e)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),Wi=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Pi(e),this.configCache=new Oi(e.appId,"PSAppDataEntity",e.codeName),this.wf=new Vi(e),this.file=new _i(e)}async getMethod(t,e=!1){const a=e?"ac-".concat(t):t;if(this.methodMap.has(a))return this.methodMap.get(a);const s=ce(this.model.appDEMethods,t),o=await pi(s);if(!o)throw new i(s,"未支持的服务方法类型: ".concat(s.methodType));const n=o.create(this,this.model,s,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(a,n),n}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new n("".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 selectLocal(t,e={}){return this.local.select(t,e)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new n("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),o=this.calcSsePath(e);return new Promise(((e,n)=>{s.net.sse("/".concat(o),{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=>{n(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 Ni(t,this.model)+i}newEntity(t){return t instanceof ki?t.clone():new ki(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}}),Ui=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],Bi=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;Ui.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=dt(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),zi=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 Bi(t,this.dataUIMap)}}),Gi=t("MDControlService",class extends zi{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 n("未实现")}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}}),ji=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=ue(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}}),Ki=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 n("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new ji(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}}),Xi=t("V7AuthService",class{get isAnonymous(){return"1"===tt(p.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(p.IS_ANONYMOUS,"1",0,!0);const t=tt(p.TOKEN),e=tt(p.TOKEN_EXPIRES),a=tt(p.TOKEN_REMEMBER);et(p.TOKEN,t,0,!0),et(p.TOKEN_EXPIRES,e,0,!0),et(p.TOKEN_REMEMBER,a,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){a&&et(p.TOKEN_REMEMBER,"1",7,!0),et(p.TOKEN,s.token,a?7:0,!0);const t=(new Date).getTime()+1e3*(s.expirein||7199);et(p.TOKEN_EXPIRES,"".concat(t),a?7:0,!0),at(p.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(p.TOKEN),at(p.TOKEN_EXPIRES),at(p.TOKEN_REMEMBER),at(p.IS_ANONYMOUS),!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=tt(p.TOKEN),e=tt(p.TOKEN_EXPIRES),a=tt(p.TOKEN_REMEMBER);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=await ibiz.net.get("/uaa/refreshtoken2");if(t.ok){et(p.TOKEN,t.data.token,a?7:0,!0);const e=(new Date).getTime()+1e3*(t.data.expirein||7199);et(p.TOKEN_EXPIRES,"".concat(e),a?7:0,!0)}this.extendLogin()}),t)}}getAuthInfo(){const t=tt(p.TOKEN),e=!!tt(p.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}}),Hi=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))}}),Yi=t("MethodDto",class t{constructor(t,e,a,i){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.dtoMap=new Map,this.isCalcRs=!1,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}select(t,e){return this.service.local.select(t,e)}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,a=!1){const s={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let n=0;n<this.fields.length;n++){const r=this.fields[n],c=r.codeName.toLowerCase();switch(r.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(r.listMap)e[c]&&(s[c]=0===e[c].length?null:this.convertArrayToListMap(e[c]));else{if(void 0!==e[c]&&!1===a)break;if(!r.refAppDataEntityId)break;let i=o.getDERConfig(r.refAppDataEntityId);const n=i.findIndex((t=>t.majorDECodeName===this.entity.codeName));i=i.slice(n+1);const l=await this.getFieldDto(t,r),d={};r.refPickupAppDEFieldId&&(d[r.refPickupAppDEFieldId]=e.srfkey),i.forEach((t=>{d[t.pickupDEFName.toLowerCase()]=null}));const h=await l.select(t,d);if(h){const e=[];for(let a=0;a<h.length;a++)e.push(await l.get(t,h[a],!0));s[c]=e}}break;default:throw new i(r,"未支持的应用实体方法输入属性类型: ".concat(r.type))}}return{...e,...s}}async sets(t,e){return this.isLocalMode&&this.service.local.clear(),await this.calcRs(t),Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const i=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[i])e[i]=this.convertListMapToArray(e[i]);else{if(!a.refAppDataEntityId)return;const s=await this.getFieldDto(t,a),o=e[i];if(o){const i=e[this.entity.keyAppDEFieldId];o.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await s.sets(t,o)}else await s.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[t];const i=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,i),i})))}async calcRs(t,e=0){if(this.isCalcRs||e>10)return;this.isCalcRs=!0,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 o=i[s];if(!o.refAppDataEntityId)continue;if(-1===a.getDERConfig(o.refAppDataEntityId).findIndex((t=>t.pickupDEFName===o.refPickupAppDEFieldId))){const i=await this.getFieldDto(t,o);a.setDERConfig(o.refAppDataEntityId,{majorDEName:this.entity.name,majorDECodeName:this.entity.codeName,majorDECodeName2:this.entity.codeName2,minorDEName:i.entity.name,minorDECodeName:i.entity.codeName,minorDECodeName2:i.entity.codeName2,pickupDEFName:o.refPickupAppDEFieldId}),await i.calcRs(t,e)}}}async getFieldDto(e,a){if(this.dtoMap.has(a.codeName))return this.dtoMap.get(a.codeName);const i=await ibiz.hub.getAppDataEntity(a.refAppDataEntityId,this.entity.appId),s=ce(i.appDEMethodDTOs||[],a.refAppDEMethodDTOId),o=await this.app.deService.getService(e,i.id);o.isLocalMode=!0;const n=new t(o,i,!0,s);return this.dtoMap.set(a.codeName,n),n}}),qi=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=new Yi(t,e,this.isLocalMode,a))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),Qi=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=new Yi(t,e,this.isLocalMode,a))}}async handle(t,e){if(this.dto){return(await this.dto.sets(t,[e]))[0]}return Y(e)&&(e={}),new ki(this.entity,e)}}),Ji=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 qi(t,e,a),this.result=new Qi(t,e,a)}async request(t,e,i,s){const{actionType:o,requestMethod:n}=this.method;if("REMOTE"===o){const e=this.method.codeName.toLowerCase();let o=null;switch(n){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,n?"未支持的请求方式: ".concat(n):"未配置请求方式")}return o}throw new a(this.method,"未支持的行为类型[".concat(o,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Ni(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),$i=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)}},Zi=class{},ts=class extends Zi{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 o=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(o[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Fe(o[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o[this.dstField],this.op,this.value)}}},es=class t extends Zi{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new ts(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 o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},as=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new es(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},is=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new as(t)))}},ss=class extends is{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},os=class extends is{async exec(t){}},ns=class extends is{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 rs(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM";let r,c=s;switch(n){case"SRCDLPARAM":r=t.params[a],t.isEntityParam(a)&&(c=null==c?void 0:c.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);case"WEBCONTEXT":case"VIEWPARAM":r=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":r=t.parameters.context;break;case"ENVPARAM":r=dt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}if(r&&c)try{r=Array.isArray(r)?r[Number(c)]:je.execScriptFn({srcValue:r},"srcValue.".concat(c),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(c,"报错,源参数:"),r),t}return r}var cs=class extends is{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=rs(e,t);e.params[a]=dt(i)}bindParam(t,e){const a=rs(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 o=rs(e,t);s?e.params[i][s]=o:e.params[i]=o}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:o}=t,n=rs(e,t),r=i||0,c=s||0,l=o||n.length;e.params[a].splice(r,0,...n.slice(c,l))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},ls=class extends is{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,o=t.params[i],n=ibiz.hub.getApp(t.context.srfappid),r=await n.deService.exec(a,e,t.context,o);r.ok&&(t.params[s]=r.data)}},ds=class extends is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=rs(t,this.model);t.params[e]=s}},hs=class extends is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},ps=class extends is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},us=class extends is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=rs(t,this.model);t.params[e]=dt(s)}},ms=class extends is{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},gs=class extends is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=rs(t,this.model),c=s||0,l=o||0,d=n||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},fs=class extends is{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},ws=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]=dt(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]=dt(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]={}}}},Es=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 os(t);break;case"END":a=new ns(t);break;case"DEACTION":a=new ss(t);break;case"PREPAREPARAM":a=new cs(t);break;case"DEDATASET":a=new ls(t);break;case"THROWEXCEPTION":a=new fs(t);break;case"BINDPARAM":a=new ds(t);break;case"RESETPARAM":a=new hs(t);break;case"COPYPARAM":a=new us(t);break;case"RENEWPARAM":a=new ps(t);break;case"APPENDPARAM":a=new gs(t);break;case"SORTPARAM":a=new ms(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 ws(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 $i(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:o}=this.model;if(!o||!this.nodes.has(o))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(o);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}}},ys=new Map;async function Is(t,e,a={},i={}){ys.has(t)||ys.set(t,new Es(t));return ys.get(t).exec(e,a,i)}async function vs(t,e,a,i,s){const o=await async function(t,e,a){return we(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!o)throw new n("".concat(e,"找不到实体逻辑").concat(t));return Is(o,a,i,s)}async function Ds(t,e,a,i){const o=dt(e),n=a?dt(a):a,r=i?dt(i):i;try{const e=await Is(t,o,n,r);return new u(e)}catch(t){if(t instanceof s)return new u(t,500);throw t}}async function Cs(t,e,a,i,s){const o=Ee(t,e);if(o.length){(await Promise.all(o.map((t=>Is(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function As(t,e,a,i,s={}){if(i){if(!R(i))return Cs(t,e,a,i,s);await Promise.all(i.map((i=>Cs(t,e,a,i,s))))}}var bs=t("DEActionMethod",class extends Ji{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){if(e&&await As(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const s=we(this.method.appDELogicId,this.entity);if(!s)throw new a(this.method,"缺少实体处理逻辑");return Ds(s,t,e,i)}let s;switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await As(this.entity,"change",t,e,i),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 o=await this.request(a,t,e,i);o.data=await this.result.handle(t,o.data),s=o}}return s.data&&await As(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new n("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 n("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 u(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new u(t):new u(t,500)}catch(t){return new u(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()]);const i=this.service.local.delete(t,a);return i?new u(i):new u(i,500)}catch(t){throw new s(t)}}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 u(i):new u(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 u(i):new u(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new u(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{const{majorDECodeName:i,pickupDEFName:s}=a,o=i.toLowerCase(),n=s.toLowerCase(),r=t[o];r&&r!==e.srfkey&&(e[n]=r)})),e}}),Ps=class{create(t,e,a,i){return new bs(t,e,a,i.localMode)}},Ts=t("FetchMethod",class extends Ji{async exec(t,e,a){const s=e&&!R(e)?e:a||{};if(this.isLocalMode){const e=await this.searchLocal(null,new Si(t,s));return new u(e,200)}let o;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);o=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const n=o.data||[];return o.data=n.map((t=>this.createEntity(t))),o.data&&await As(this.entity,"compute",t,o.data,s),o}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=[];t?(i=this.service.local.getList(),i.length>0&&(i=i.filter((a=>t.test(a,e))))):(i=await this.service.local.select(e.context,e.data),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)||lt(e.sortField)||(i="DESC"===e.sortMode?it(i,e.sortField):$(i,e.sortField));const{page:s,size:o}=e,n=s*o,r=(s+1)*o-1;return i.slice(n,r).map((t=>dt(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:o,majorAppDEFieldId:n}=this.entity,r=s.map((t=>({[o]:t.value,[n]:t.text})));return new u(r,200)}}),xs=t("AcFetchMethod",class extends Ts{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Ns=class{create(t,e,a,i){return i.acMode?new xs(t,e,a,i.localMode):new Ts(t,e,a,i.localMode)}};function Ss(){const t=new Ps;di("DEACTION",(()=>t));const e=new Ns;di("FETCH",(()=>e)),di("FETCHTEMP",(()=>e))}var Ls=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)),Object.values(a).length>0?a:void 0}}),Rs=t("TreeCodeListNodeData",class extends Ls{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)}}),Os=t("TreeDataSetNodeData",class extends Ls{constructor(t,e,a){var i;super(t,e,a);const{data:s}=a;this.deData=s,this.text=t.textAppDEFieldId?s[t.textAppDEFieldId]:s.srfmajortext,this.value=t.idAppDEFieldId?s[t.idAppDEFieldId]:s.srfkey;const o="".concat(t.id,"@").concat(s.srfkey).toLowerCase();if(Object.defineProperty(this,"id",{get(){return this.parent?"".concat(this.parent.id,":").concat(o):o},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=ge(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:s.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext,this.icon=this.calcIcon(t),this.textHtml=this.calcTextHtml(t),t.leafFlagAppDEFieldId&&(this.leaf=Li(s[t.leafFlagAppDEFieldId]));const n=new Map,r={};return null==(i=t.detreeNodeDataItems)||i.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();n.set(e,a),t.defaultValue&&(r[e]=t.defaultValue)})),new Proxy(this,{set:(t,e,a)=>(Object.prototype.hasOwnProperty.call(t.deData,e)?t.deData[e]=a:n.has(e)?t.deData[n.get(e)]=a:t[e]=a,!0),get:(t,e,a)=>void 0!==t[e]?t[e]:n.has(e)?t.deData[n.get(e)]||r[e]:void 0!==t.deData[e]?t.deData[e]:void 0,ownKeys(t){const e=[...new Set([...Object.keys(t),...n.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}}),Ms=t("TreeStaticNodeData",class extends Ls{constructor(t,e,a){var i,s;super(t,e,a);const o="root"===t.nodeValue?void 0:t.nodeValue,n="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"id",{get(){return this.parent?"".concat(this.parent.id,":").concat(n):n},enumerable:!0,configurable:!0}),this.text=t.text,this.value=o,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=o||(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)}}),Vs=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(d.isNumber(this.dataType)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),_s=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 Fs=["REGION","REGION2","REGION3","REGION4"],ks=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:o,textAppDEFieldId:n,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:l}=e,d=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,Fs.includes(this._itemStyle)?s&&d.set("_areaCode",s):(s&&d.set("_longitude",s),o&&d.set("_latitude",o)),c&&d.set("_tooltip",c),n&&d.set("_text",n),r&&d.set("_value",r),l&&(this._symbol=l.rawContent||l.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:d.has(a)?t[d.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:d.has(a)?t[d.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 Ws=t("PanelData",class{constructor(t,e){const a=new J,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,o,n)=>(Object.prototype.hasOwnProperty.call(i,o)?i[o]?e[i[o]]=n:t[o]=n:e[o]=n,a.emit("change",o),i[o]&&i[o]!==o&&a.emit("change",i[o]),s[o]&&s[o]!==o&&a.emit("change",s[o]),!0),get:(t,s,o)=>"_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 Us=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}})}}),Bs=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.id===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},zs=t("GanttStaticNodeData",class extends Ms{constructor(t,e,a,i){super(e,a,i),this.sndataIteValue=Bs(t.sndataItemName,e),this.beginDataItemValue=Bs(t.beginDataItemName,e),this.endDataItemValue=Bs(t.endDataItemName,e),this.prevDataItemValue=Bs(t.prevDataItemName,e),this.finishDataItemValue=Bs(t.finishDataItemName,e),this.totalDataItemValue=Bs(t.totalDataItemName,e)}}),Gs=t("GanttDataSetNodeData",class extends Os{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this.sndataIteValue=Bs(t.sndataItemName,e,s),this.beginDataItemValue=Bs(t.beginDataItemName,e,s),this.endDataItemValue=Bs(t.endDataItemName,e,s),this.prevDataItemValue=Bs(t.prevDataItemName,e,s),this.finishDataItemValue=Bs(t.finishDataItemName,e,s),this.totalDataItemValue=Bs(t.totalDataItemName,e,s)}}),js=t("GanttCodeListNodeData",class extends Rs{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this.sndataIteValue=Bs(t.sndataItemName,e,s),this.beginDataItemValue=Bs(t.beginDataItemName,e,s),this.endDataItemValue=Bs(t.endDataItemName,e,s),this.prevDataItemValue=Bs(t.prevDataItemName,e,s),this.finishDataItemValue=Bs(t.finishDataItemName,e,s),this.totalDataItemValue=Bs(t.totalDataItemName,e,s)}}),Ks=t("MqttService",class{constructor(t,e,a){if(this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new J,this.options={connectTimeout:6e3,clientId:Q(),username:"",password:"",keepalive:60,clean:!0},Y(t)||Y(e))throw new Error("mqttTopic or token is empty");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.debug("mqtt reconnect")})),this.client.on("close",(()=>{console.debug("mqtt close")}))}close(){var t;null==(t=this.client)||t.end()}}),Xs=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 n("未找到应用实体[".concat(a,"]"));const o=t.constructorCache.get(a.toUpperCase());let r;r=o?await o(i,e):new Wi(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()}))}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};Xs.constructorCache=new Map;var Hs=t("DEServiceUtil",Xs),Ys=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=dt(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new n("应用视图[".concat(t,"]不存在"));if((o.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=ge(r.appDataEntityId);o.srfkey&&(o[t]=o.srfkey,o.srfkey=void 0),0===a.srfuf&&(o[t]=void 0,delete a.srfuf)}if(r.redirectView){return Me(await ibiz.hub.getAppView(t),o,a,s)}const{openMode:c="INDEXVIEWTAB"}=r;switch(s.openMode||c){case"INDEXVIEWTAB":return s.noWaitRoute?(this.openIndexViewTab(r,o,a),{ok:!0}):this.openIndexViewTab(r,o,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,o,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,o,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,o,a);case"USER":return this.openUserCustom(r,o,a);default:return this.openIndexViewTab(r,o,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(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 n("气泡打开缺少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)}};Ys.TAG="ibiz.app-view.open";var qs=t("OpenAppViewCommand",Ys),Qs=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!o)throw new n("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:l}=o,d=e.clone();Object.assign(d,ie(r,a,e));const h=ie(c,a,e);switch(l){case"APPVIEW":return this.openAppView(o,d,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(o);case"PDTAPPFUNC":return this.openPdAppFunc(o,d,h);case"JAVASCRIPT":return this.executeJavaScript(o,d,h);case"CUSTOM":return this.custom(o,d,h);default:throw new i(o,"未支持的应用功能类型: ".concat(l))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new n("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(qs.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 n("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new n("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new n("未实现")}};Qs.TAG="ibiz.app-func.exec";var Js=t("AppFuncCommand",Qs);function $s(){new Js,new qs}var Zs=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new g({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new Oi(t.appId,"PSSysApp",t.codeName),this.deService=new Hs(t),this.codeList=new Ri(t),this.authority=new Ki(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),ibiz.env.enableMqtt&&ibiz.appData&&(this.mqtt=new Ks(ibiz.appData.mqtttopic,f(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.asyncAction.next(t)})),await this.mqtt.connect())}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))}}),to=class{parse(t){return t}},eo=class{constructor(){this.appMenu=new to}},ao=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 n("视图[".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}},io=class{constructor(){this.view=new ao}},so=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(so||{})),oo=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(oo||{})),no=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(no||{})),ro=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 n("错误的调用!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}}),co=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new ro(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),lo=t("CTXState",class{}),ho=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new J(3e3),this.controllersMap=new Map,this.state=new lo}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}}),po=t("ActivityCounter",class extends ro{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())}}),uo=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:o}=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(o))&&(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)}}),mo=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))))}}),go=t("QXEventEx",class extends J{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),o=await a,n=await s;return o.concat(...n)}reset(){super.reset(),st(this.anyEventFns)}}),fo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new go}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 wo(t){return window.location.hash.split("/").length>2*t+2}function Eo(t,e){return(!rt(t)&&""!==t||!rt(e)&&""!==e)&&t!==e}function yo(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof Bi&&(e=e.getOrigin()),e}function Io(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,o=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&o)"REG"===o.ruleType?i.push({pattern:new RegExp(o.regExCode),message:o.ruleInfo,trigger:"change blur"}):"SCRIPT"===o.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{je.execScriptFn({rule:t,value:e,callback:a,source:i},o.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:o,infoMessage:c}=Ke(t,s,r.groupCond);return o||i(new n(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function vo(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:o}=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)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),rt(o)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&ot(e)&&e<o))return!0;a(new Error("值必须大于等于".concat(o)))}}),e}var Do=t("ValueExUtil",class{static mergeDefault(t){return ut(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 n("缺少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 Co(t,e){var a;const{name:s,valueType:o,defaultValue:r,valueFormat:c}=t,{data:l,context:d,params:h}=e;if(rt(o)&&rt(r))return;if("RESET"===o)return null;const p=l[s];if(!mt(p)){if(!o&&r)return r;switch(o){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(d,r))return d[r];break;case"OPERATORNAME":return d.srfusername;case"OPERATOR":return d.srfuserid;case"CURTIME":return ft().format(c);case"PARAM":return l[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new n("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return Q();default:throw new i({},"默认值类型[".concat(o,"]未支持"))}}}var Ao="asyncimportdata2",bo="importdata2";async function Po(t,e,a){if(!ibiz.util.getExcelUtil)throw new n("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new n("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function To(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid),s="/jsonschema/".concat(i.name);return(await a.net.get(s)).data}var xo="__self",No=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 fo(this.getEventArgs.bind(this)),this.mountCounter=new po(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(xo),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(xo)||this.mountCounter.attend(xo)}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(){}}),So=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 n("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const o=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=o.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),o.splice(e,1))})),o.length)throw new n("没有找到".concat(o.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:o}=t;if(!o)throw new a(t,"未配置实体数据集");const n=await ibiz.hub.getApp(e.srfappid).deService.exec(s,o,e,i);return n.data.length?n.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:o,position:n,messageType:r}=a,{userTag:c,userTag2:l,userTag3:d,userTag4:h}=a;return{title:i,message:s,position:e||n,messageType:r,removeMode:o,extraParams:{userTag:c,userTag2:l,userTag3:d,userTag4:h}}}async calcDynaMsgs(e,i,s){const o=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:n,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:l,msgTypeAppDEFieldId:d,contentAppDEFieldId:h,msgPosAppDEFieldId:p}=o;if(!n)throw new a(o,"未配置应用实体");const u=await ibiz.hub.getAppDataEntity(n,i.srfappid),m={...s},g=this.getDeFieldName(u,r);g&&(m.sort="".concat(g,",asc"));const f=await t.fetchDataSet(o,i,m);if(!f.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(u,c),y=this.getDeFieldName(u,p),I=this.getDeFieldName(u,h),v=this.getDeFieldName(u,d),D=this.getDeFieldName(u,l);return f.map((t=>{const e={};return y&&!rt(t[y])&&(e.position=t[y]),E&&!rt(t[E])&&(e.title=t[E]),I&&!rt(t[I])&&(e.message=t[I]),v&&!rt(t[v])&&(e.messageType=t[v]),D&&!rt(t[D])&&(e.removeMode=t[D]),ct(w,e)}))}},Lo=t("ViewController",class extends No{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),l.create({},e),a||{},new ho(i)),this.session={},this.modal=new ra({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new co,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 Mi.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 Sa(t);this.providers[t.name]=e;const a=Te(this.model);a&&await Promise.all(a.map((async t=>{const e=await Sa(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(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===this.context.srfsessionid&&ibiz.uiDomainManager.destroy(this.context.srfsessionid),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)||lt(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 n("没有引擎支持预置界面行为".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 So(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))}}),Ro=(t("MobViewController",class extends Lo{}),t("WFStepTraceViewController",class extends Lo{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}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")}}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let o={};i&&t&&(o=ie(i,t,a,e));const n=Object.assign(e.clone(),o);let r={};return s&&t&&(r=ie(s,t,a,e)),{context:n,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}})),Oo=(t("CodeListEditorController",class extends Ro{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 No{constructor(t,e,a,i){if(super(t,l.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=de(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=dt(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 Sa(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 n,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),n=je.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();n=ibiz.i18n.t(e,""),n===e&&(n="")}if(!n&&(null==e?void 0:e.default)&&(n=e.default),!n&&(null==e?void 0:e.error)&&(n=n||e.error.message),n){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new o(n,r);ibiz.message.success(n,r,0===r)}}})),Mo=t("MDControlController",class extends Oo{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=V((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,o={...this.params};return a&&(o.page=e-1,o.size=a),!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),t&&Object.assign(o,t),o}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),o=await this.service.fetch(i,s);"number"==typeof o.total&&(this.state.total=o.total),a?this.state.items.push(...o.data):this.state.items=o.data,await this.afterLoad(t,o.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 n("未选中数据");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 o=ge(this.model.appDataEntityId);await ma(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[o]=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;y(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 n("无导入模型!");let o="DataImport";s.enableCustomized&&(o="DataImport2");const r=ibiz.overlay.createModal(o,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),Vo=t("AppMenuController",class extends Oo{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 Ei(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=I(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new n("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const o=this.itemProviders[t];if(o&&o.onClick)return o.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(Js.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)}}),_o=(t("AppMenuIconViewController",class extends Vo{async onClickMenuItem(t,e){const i=I(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new n("找不到名为".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(Js.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends Gi{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 n("未找到日历项模型");const i=a[e];if(!i)throw new n("未找到日历项模型");return t.map((t=>new _s(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 Mo{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new _o(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 ft(a).isAfter(i)?s=-1:ft(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:ft(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:ft(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,o={...this.params};if(!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),a&&(o.page=e-1,o.size=a),t&&Object.assign(o,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(o);Object.assign(o,t)}return o}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}});ft.extend(vt),ft.extend(Ct),ft.extend(bt),ft.extend(Tt),ft.extend(Nt);var Fo="$default_group",ko=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:o,userParam:n}=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||o,this.staticOptions=this.calcStaticOptions(),n&&(this.seriesUserParam=Xo(n))}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 o=new Us(e,this.model,a,i);t[i].get(a).chartData=o,null==(s=this.chartDataArr)||s.push(o)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=Fo;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 o=this.translateVal(i,t[this.catalogField],!0);if(o)e[s].get(o)||e[s].set(o,{value:0}),e[s].get(o).value=x(e[s].get(o).value,t[this.valueField]),e[s].get(o).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(o).value},o,s):this.prepareChartData(e,t,o,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!==Fo&&(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[Fo].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(dt(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=ft(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(ft(t[this.catalogField]).format("YYYY"),"-").concat(ft(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(ft(t[this.catalogField]).format("YYYY"),"-").concat(ft(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)=>ft(t).diff(ft(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,o]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(o,10)})));const o=new Map;s.forEach((t=>{o.set(t,i.get(t))})),t[a]=o}))}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(ft(e))}))}));const i=ft.max(a),s=ft.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("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,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("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,10);e++){const a=ft("".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)}},Wo=class extends ko{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}},Uo=class extends ko{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}},Bo=class extends ko{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}},zo=class extends ko{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}},Go=class extends ko{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}},jo=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})))}}},Ko=class extends ko{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new jo(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===Fo?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}};function Xo(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 Ho=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:o}=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)),o&&(this.chartUserParam=Xo(o))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new Wo(t,this);break;case"bar":e=new Uo(t,this);break;case"scatter":e=new Go(t,this);break;case"pie":e=new zo(t,this);break;case"funnel":e=new Bo(t,this);break;case"radar":e=new Ko(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,o={show:e,text:a,subtext:i,left:"center"},n=null==s?void 0:s.toLowerCase();return"left"===n||"right"===n?o.left=n:"bottom"!==n&&"top"!==n||(o.top=n),o}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 o={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&&(o=gt(o,Xo(s))),e.push(o)})),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 o=e.length-1;for(let t=i;t<=o;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 n("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},Yo=t("ChartService",class extends Gi{}),qo=(t("ChartController",class extends Mo{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Yo(this.model),await this.service.init(this.context),this.generator=new Ho(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 n("chart对象没有正确初始化");if(!this.options)throw new n("options还没计算");this.chart.setOption(this.options),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 Oo{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)}}),Qo=class{};function Jo(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(n){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);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=dt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}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 $o=class extends Qo{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 o=Jo(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(o,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=Jo(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return Fe(o,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o,this.op,this.value)}}},Zo=class t extends Qo{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new $o(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 o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},tn=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 Zo(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))}}},en=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new tn(t)))}},an=class extends en{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},sn=class extends en{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:o}=t;if(!e)throw new a(this.model,"未配置界面行为");let n=[s];if(i){const e=t.params[i];n=e instanceof Array?e:[e]}await Tn.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:n},this.model.appId)}},on=class extends en{async exec(t){}},nn=class extends en{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))}}},rn=class extends en{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 n("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const o=Jo(e,t);if(s)try{je.execScriptFn({srcVal:o,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]=o}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=Jo(e,t);e.params[a]=dt(i)}bindParam(t,e){const a=Jo(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:o}=t,n=Jo(e,t),r=i||0,c=s||0,l=o||n.length;e.params[a].splice(r,0,...n.slice(c,l))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i;e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},cn=class extends en{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 o=t.params[s];if(!o)throw new n("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new n("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new n("没有找到调用方法".concat(e));await r[e](o)}},ln=class extends en{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Jo(t,this.model);t.params[e]=s}},dn=class extends en{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:o}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:n}=this.model,{message:r}=this.model;if(o){const e=t.params[o];e.title&&(n=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:n||"消息",desc:r};let l=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,l=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,l=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const d=await ibiz.modal.confirm(c);t.setLastReturn(l[d?0:1])}},hn=class extends en{async exec(t){const e=await Ja(this.model);e&&await e.exec(this.model,t)}},pn=class extends en{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];console.log("逻辑节点".concat(i,"操作参数值:"),s)}},un=class extends en{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},mn=class extends en{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Jo(t,this.model);t.params[e]=dt(s)}},gn=class extends en{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Jo(t,this.model),c=s||0,l=o||0,d=n||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},fn=class extends en{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s;t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},wn=class extends en{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},En=class extends en{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,n);c.ok&&(t.params[o]=c.data)}},yn=class extends en{async exec(t){const{errorInfo:e}=this.model;throw new n(e)}},In=class extends en{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 o=t.params[s];if(!o)throw new n("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new n("没有找到事件参数对象".concat(i));await o.evt.emit(e,r)}},vn=class extends en{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=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 n("没有找到传入参数".concat(s));const c=await vs(e,i,t.context,r,t.params);o&&(t.params[o]=c)}},Dn=class extends en{async exec(t){console.log(t),je.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Cn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:o,params:n,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]=o;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]=n;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]={}}}},An=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 on(t);break;case"END":a=new nn(t);break;case"DEACTION":a=new an(t);break;case"DEUIACTION":a=new sn(t);break;case"PREPAREJSPARAM":a=new rn(t);break;case"RESETPARAM":a=new un(t);break;case"COPYPARAM":a=new mn(t);break;case"BINDPARAM":a=new ln(t);break;case"VIEWCTRLINVOKE":a=new cn(t);break;case"MSGBOX":a=new dn(t);break;case"DEBUGPARAM":a=new pn(t);break;case"APPENDPARAM":a=new gn(t);break;case"SORTPARAM":a=new fn(t);break;case"RENEWPARAM":a=new wn(t);break;case"DEDATASET":a=new En(t);break;case"THROWEXCEPTION":a=new yn(t);break;case"VIEWCTRLFIREEVENT":a=new In(t);break;case"DELOGIC":a=new vn(t);break;case"PFPLUGIN":a=new hn(t);break;case"RAWJSCODE":a=new Dn(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 Cn(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 qo(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}}},bn=new Map;async function Pn(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new n("找不到实体".concat(e,"的界面逻辑").concat(t));bn.has(s)||bn.set(s,new An(s));const o=bn.get(s);return await o.exec(a),null}var Tn=t("UIActionUtil",class{static async exec(t,e,a){const i=await Ie(t,a);if(!i)throw new n("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await qa(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const o=await this.exec(t,e,a);if(o.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(o.refresh)switch(o.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")}}}),xn=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:o,uilogicAttachMode:n}=t;if("REPLACE"===n){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Pn(s,o,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 Pn(s,o,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 Tn.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const o=ge(t.appDataEntityId),n=(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=o&&a.length>0?a.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=o?[{[n]:t.srfkey||t[n]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(o&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||o,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const l=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,d=ie(c,l?ne(c,a):a[0]||{},i,e);Object.assign(r,d);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:ie(h,l?ne(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:o,cmlanguageRes:n,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=o,s=n;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})}}}),Nn=t("BackendUIActionProvider",class extends xn{async execAction(t,e){const{context:i,params:s,data:o,event:n}=e,r={},c=t.appDataEntityId,l=t.appDEMethodId;if(!c||!l)throw new a(t,"未配置实体或实体行为");const{resultContext:d,resultParams:h,resultData:p}=await this.handleParams(t,i,o,s),u={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(qs.TAG,m,d,h,{event:n});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===p.length&&p.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));p.forEach((t=>{t.srfactionparam=e}))}}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),f=p.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,u))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await g.deService.exec(c,l,d,w?f:f[0],u);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:d,nextParams:u}),r}}),Sn=t("SysUIActionProvider",class extends xn{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)||{}}}),Ln=t("FrontUIActionProvider",class extends xn{async execAction(t,e){const{context:s,params:o,data:n,event:r,noWaitRoute:c}=e;let l={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=v.fill(t.htmlPageUrl,s,null==n?void 0:n[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:d}=await this.handleParams(t,s,n,o),h=await ibiz.commands.execute(qs.TAG,e,i,d,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(l.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(l.data=h.data,l.nextContext=i,l.nextParams={...o,...d});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":l=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":l=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return l}doOther(t,e){const{scriptCode:i}=t,{context:s,params:o,data:n,event:r,view:c}=e;if(i){return je.execScriptFn({context:s,params:o,data:n,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:o,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),l=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!l)throw new n("没有找到实体打印项");{let t="";if(!o||!o[c.codeName.toLowerCase()])throw new n("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(o[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:l.codeName,...r}});if(!e.ok)throw new n("打印失败");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 i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),s=null==(a=i.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let o="DataImport";if(s&&s.enableCustomized&&(o="DataImport2"),s){const t=ibiz.overlay.createModal(o,{dismiss:()=>t.dismiss(),appDataEntity:i,dataImport:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new n("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=o.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new n("没有找到实体导出项");{const t="/".concat(null==(i=o.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 n("导出请求失败");{let t="".concat(o.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)}}}}),Rn=t("WFWithdrawUIActionProvider",class extends xn{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}}}),On=class extends xn{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function Mn(){const t=new Ln;Ha("FRONT",(()=>t));const e=new Nn;Ha("BACKEND",(()=>e));const a=new Sn;Ha("SYS",(()=>a));const i=new Rn;Ha("DEUIACTION_WFWithdraw",(()=>i));const s=new On;Ha("SYS_Logout",(()=>s))}var Vn=t("ToolbarController",class extends Oo{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new mo,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 n("没有找到界面行为模型".concat(i));const o=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;o&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],o=this.getEventArgs();o.params=Object.assign(a,o.params),await Tn.execAndResolved(i,{...o,data:s,event:e},t.appId)}finally{o&&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 uo(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 Bi&&(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)}}),_n=t("ContextMenuController",class extends Vn{}),Fn=(t("DashboardController",class extends Oo{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=yo(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 Ka(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 ma(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 Oi(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}})),kn=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 Fn}onDataChange(t){let e=t.data[0];e&&e instanceof Bi&&(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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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 Tn.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)}}),Wn=(t("ContainerPortletController",class extends kn{}),t("ViewPortletController",class extends kn{}),t("MenuPortletController",class extends kn{}),t("ChartPortletController",class extends kn{}),t("ActionBarPortletController",class extends kn{}),t("HtmlPortletController",class extends kn{}),t("ListPortletController",class extends kn{}),t("RawItemPortletController",class extends kn{}),t("DataViewControlService",class extends Gi{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 Vs(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new Vs(e,e);this.dataUIMap.set(e,i)}))}})),Un=t("DataViewControlController",class extends Mo{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 Wn(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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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 Bi&&(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 mo,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 uo(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 Tn.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 o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};Tn.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 Tn.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,o=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:n}=t;if(t.capLanguageRes&&(n=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:n,key:t.appDEFieldId};o&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),Bn=t("ExpBarControlController",class extends Oo{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&&wo(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:o,navigateContexts:n,navigateParams:r,appDataEntityId:c}=t,l={deName:c?ge(c):void 0,navFilter:o,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:n,navParams:r},d={context:a,params:i,data:e},{resultContext:h,resultParams:p}=re(l,d),u=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:u,params:{...p}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new n("多节点视图由子类实现")}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())}}),zn=(t("CalendarExpBarController",class extends Bn{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 Bn{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,o=this.getNodeModel(t.nodeId);if(!o)throw new n("找不到".concat(t.nodeId,"的节点模型"));const r=this.prepareParams(o,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:o.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 Bn{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:o,params:n}=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,o),c=ie(s,e,i,n);return{context:Object.assign(o.clone(),r),params:c}}}return{context:o,params:n}}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 o=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:o.context,params:o.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends Oo{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 Bi,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await ma(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,a=void 0){await Promise.all(t.map((async t=>{const i=await _a(t);if(!i)return;e.providers[t.id]=i;const s=await i.createController(t,e,a);if(e.details[t.id]=s,"FORMITEM"===t.detailType&&e.formItems.push(s),"MDCTRL"===t.detailType&&e.formMDCtrls.push(s),Pe(t))return;const o=be(t);o.length&&await this.initDetailControllers(o,e,s)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Eo(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)}})),Gn=class extends zi{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:o,createDV:n,updateDVT:r,updateDV:c,valueFormat:l}=s,d="create"===i?o:r,h="create"===i?n:c,p=s.id.toLowerCase(),u=Co({name:p,valueType:d,defaultValue:h,valueFormat:l},{data:t,context:e,params:a});void 0!==u&&(t[p]=u)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},jn=t("SearchFormService",class extends Gn{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 Vs(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}}),Kn=(t("SearchFormController",class extends zn{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Oi(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 jn(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,o="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],o=e,!0))),i&&i.length>0){const n=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(n.push(t),s(t))})),n.length<i.length&&(t[o]=n)}};(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 n("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new n("没有找到保存的搜索条件");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)})}})),Xn=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Xn||{})),Hn=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Hn||{})),Yn=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 Kn(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=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){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),qn=t("FormButtonState",class extends Kn{constructor(){super(...arguments),this.loading=!1}}),Qn=(t("FormButtonController",class extends Yn{createState(){var t;return new qn(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 Tn.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 Kn{constructor(){super(...arguments),this.showMask=!1}})),Jn=(t("FormDRUIPartController",class extends Yn{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Qn(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 Kn{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),$n=t("FormGroupPanelController",class extends Yn{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 Jn(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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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 Tn.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Zn=t("FormItemState",class extends Kn{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)})}}),tr=(t("FormItemController",class extends Yn{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new Zn(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 Oa(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ca(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Io(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...vo(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"})}setDefaultValue(t,e=this.data){const{createDVT:a,createDV:i,updateDVT:s,updateDV:o}=this.model,n=t?a:s,r=t?i:o,c=Co({name:this.name,valueType:n,defaultValue:r,valueFormat:this.model.valueFormat},{data:e,context:this.context,params:this.params});void 0!==c&&(e[this.name]=c)}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 Yn{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}})),er=(t("FormMDCtrlMDController",class extends tr{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 Sa(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 Kn{}),ar=(t("FormMDCtrlFormController",class extends tr{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new er(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 Sa(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 n("没有找到对应".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 tr{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=dt(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 Jn{})),ir=(t("FormPageController",class extends $n{createState(){var t;return new ar(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Kn{})),sr=(t("FormRawItemController",class extends Yn{createState(){var t;return new ir(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Kn{})),or=(t("FormTabPageController",class extends Yn{createState(){var t;return new sr(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPanelState",class extends Kn{})),nr=(t("FormTabPanelController",class extends Yn{createState(){var t;return new or(null==(t=this.parent)?void 0:t.state)}}),t("EditFormService",class extends Gn{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 Bi?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return o=this.handleResponse(o),o}async update(t,e){var a;const i=e instanceof Bi?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return o=this.handleResponse(o),o}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 o=await this.exec(s,t,e instanceof Bi?e.getOrigin():e);return o=this.handleResponse(o),o}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 Bi?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let o="";o=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(o,t,e,a instanceof Bi?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 o;o=s?new Vs(i,s,{isOriginField:!0,dataType:a.dataType}):new Vs(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,o)}}),{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}})),rr=(t("EditFormController",class extends zn{constructor(){super(...arguments),this.oldData=new Bi}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new nr(this.model),await this.service.init(this.context),this.autoSave=V(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=dt(this.context),e=dt(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=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(!fe(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=dt(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 n("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],o=0===s.srfuf;let r;try{r=o?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(o?"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(o?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(this.data.$origin,o?"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 Bi,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 n("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:o,scriptCode:r,showBusyIndicator:c}=a,l=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),o&&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==l?void 0:l.length)&&await Promise.all(l.map((e=>this.setDataValue(e,t[e])))),await P(2e3)}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new n("请检查表单填写!");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 n("请检查表单填写!");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 Bi(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})}})),cr=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}}))}}),lr=t("GridService",class extends Gi{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 o;if(s){const n=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));o=new Vs(i,n,{isOriginField:!0,dataType:r.dataType})}else o=new Vs(i,i);this.dataUIMap.set(i,o)}))}}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}}),dr={string:25,number:6,integer:9,date:5};var hr=t("GridController",class extends Mo{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 lr(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 To(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 o={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[],r=[];return s.forEach((t=>{n.push({appId:e.model.appId,appDEFieldId:o[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:o[t.key],id:t.key,valueType:"SIMPLE",dataType:dr[t.type]})})),{degridColumns:n,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=dt(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 o=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==o&&0!==o){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(o,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 ma(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new cr(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(),o=ibiz.hub.getApp(this.context.srfappid),n=await o.deService.exec(e,i,this.context,void 0,s);n.data.length&&([this.state.remoteAggResult]=n.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 n("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let o;Object.assign(i,s);try{o=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=o.data;T(r,s),this.state.items.unshift(r);const c=new cr(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 n("行数据不存在");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 n("行数据校验不通过,保存取消");let i;const s=ge(this.model.appDataEntityId),o=this.context.clone();o[s]=t.srfkey;try{i=e?await this.service.create(o,t):await this.service.update(o,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 ma(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await Wa(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(){r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,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)||Eo(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 ma(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 n("当前表格不支持行编辑,无法切换开启行编辑");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 n("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=dt(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 n("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:o,customCode:r,scriptCode:c}=i,l=o.map((t=>t.id));let d;if(r&&c)d=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);d=a.data}d&&(null==l?void 0:l.length)&&await Promise.all(l.map((e=>this.setRowValue(t,e,d[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=dt(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 o=(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:o}=t.params,n="customPage"===i?{page:0,offset:(a-1)*e,size:(o-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:n})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new n("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await Po(s,o,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:o,updateDV:n,updateDVT:r}=i.editItem,c=e?o:r,l=e?s:n,d=Co({name:i.fieldName,valueType:c,defaultValue:l,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==d&&(a[i.fieldName]=d)})),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}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:(this.state.columnStates=[],this.initColumnStates())}}),pr=t("GridFieldColumnController",class extends rr{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}async onInit(){await super.onInit(),this.loadCodeList=V(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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.model.codeName];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:o}=le(i);let n={};s&&t&&(n=ie(s,t,a,e));const r=Object.assign(e.clone(),n);let c={};o&&t&&(c=ie(o,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:o}=this.model;if(!o)return;const n=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...n}),c=dt(this.params),{context:l,params:d}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(qs.TAG,o,l,d,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await Tn.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:o}=this.model;if(rt(a)||"NONE"===a)return;const n=e||this.model.id;let r;if(t=t.filter((t=>!rt(t[n]))),"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[n])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[n])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[n])));break;case"MIN":r=Math.min(...t.map((t=>t[n])));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&&o&&(c+=o),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Do.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(d.isDate(this.dataType)){const t=ft(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 Tn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),ur=(t("GridUAColumnController",class extends rr{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 mo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new uo(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 Tn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends pr{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}get fieldName(){return this.model.dataItemName}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 Oa(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ca(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Io(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...vo(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 n("".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 rr{}),t("ListService",class extends Gi{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 Vs(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new Vs(e,e);this.dataUIMap.set(e,i)}))}})),mr=(t("ListController",class extends Mo{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 ur(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),o=await s.codeList.get(e,this.context,this.params),n=[];o.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),n.push(e.value)}));const r=a.filter((e=>-1===n.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends Oo{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 o=await za(t);if(!o)return;e.providers[t.id]=o;const n=await o.createController(t,e,a);e.panelItems[t.id]=n,(null==(i=t.panelItems)?void 0:i.length)&&!n.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,n),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,n)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new n("未获取到面板数据");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 Ws(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)}})),gr=(t("ViewLayoutPanelController",class extends mr{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)})}})),fr=(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 gr(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=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 Oo{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"]),wr=t("SearchBarFilterController",class{constructor(t,e){var a;let i;this.model=t,this.searchBar=e,this.noEditor=!1,t.appDEFieldId&&(i=ye(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?fr.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 Oa(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Er=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=await this.app.net.post("".concat(this.themeUrl,"/fetch_default"),{app_view_tag:this.viewTag,sort:"create_time,asc"});return t.ok&&(t.data=this.convertBackDataToFront(t.data)),t}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag});return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag})}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:t,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{id:t,theme_model:JSON.stringify(e),app_view_tag:this.viewTag,show:e.show})}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.name&&(e.caption=t.name),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={appId:t.appId,app_view_tag:this.viewTag,id:t.id};return t.caption&&(e.name=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}))}},yr={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"]},Ir={};Object.keys(yr).forEach((t=>{yr[t].forEach((e=>{if(fr.includes(e))return;const a="".concat(t,"_").concat(e);Ir[a]||("date"!==t||["IN","NOTIN"].includes(e)?Ir[a]={appId:"",editorType:"TEXTBOX",id:a}:Ir[a]={appId:"",editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends Oo{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.enableFilter=!0===this.model.enableFilter}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.initFilterState()}initFilterState(){this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){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 Er(this.model,this.view.model.codeName),await this.service.init(this.context)),await this.initByEntitySchema(),await this.initSearchBarFilters(),await this.initSearBarGroups()}async initByEntitySchema(){var t;this.enableFilter=!0;const e=await To(this.appDataEntity.id,this.context);if(!e)return;const a=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})}));const o={};null==(a=e.appDataEntity.appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[];return s.forEach((t=>{const e=yr[t.type];e?e.forEach((e=>{const a=Ir["".concat(t.type,"_").concat(e)];n.push({appId:"",appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:"",valueOP:e},editor:a})})):ibiz.log.error("未支持的类型",t.type)})),n}(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.push(...i),this.searchBarFilters=a}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){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 wr(t,this);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.model.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 n("无效的condtype:".concat(t.condtype))}getOriginFilterNodes(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}async initSearBarGroups(){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={...t,saved:!1,show:!0,searchGroupData:{},order:100*(e+1)};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 a})));const t=await this.service.fetch();t.ok&&t.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.id===t.id));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({appId:this.context.srfappid,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)}))}}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.id,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.id===e.data.id));t&&(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 Oo{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&&wo(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:o}=t,n={deName:ge(o),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:l}=re(n,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...l}}}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 vr=t("TreeService",class extends Gi{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 ma(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=ve(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,n)];break;case"DE":r=await this.getDENodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{var a;if(l&&(!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 Ms(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:o,parentFilter:n,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,l={...a.params},d={...a.context,...(null==e?void 0:e.context)||{}};let h,p,u,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&&(u=ge(t.appDataEntityId)),p=h.value}const{resultContext:g,resultParams:f}=re({deName:u,navFilter:n?"n_".concat(n.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:o,navContexts:s},{derValue:p,context:d,params:l,data:m});return Object.assign(d,g),Object.assign(l,f),{context:d,params:l,navContext:g,navParams:f}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:l}=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 d=await this.app.deService.exec(o,s,n,r);if(d.data.length){return d.data.map((e=>new Os(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:l})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,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,o);if(c.length){return c.map((e=>new Rs(t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}}),Dr=t("TreeController",class extends Mo{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(),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 _n(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async initService(){this.service=new vr(this.model),await this.service.init(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)})),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(),o=this.parseTreeNodeData(e),n=await Tn.exec(t,{...s,...o,event:a},i);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){return{data:[{...t,...t.deData||{}}],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)})),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,o=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:o})}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 o=this.getNodeModel(t.nodeId);if("inner"===a)return!!this.findDropNodeRS(e.nodeId,o.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,o.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,o,n;"inner"!==i||e.leaf||void 0!==e.children||await this.expandNodeByKey([e.id]);const r=[],c=this.getNodeModel(t.nodeId),l="inner"===i?e:e.parent,d=(null==e?void 0:e.id)!==(null==(s=t.parent)?void 0:s.id);let h=this.getNodeModel(e.nodeId);if("inner"===i||(null==(o=e.parent)?void 0:o.id)!==(null==(n=t.parent)?void 0:n.id)){const e=this.findDropNodeRS(l.nodeId,c.appDataEntityId);e&&(t.deData[e.pickupDEFName]=l.value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const p=t.parent.children;if(p.splice(p.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=l.children.indexOf(e);"next"===i&&(a+=1),l.children.splice(a,0,t)}("inner"===i||d)&&(t.parent=l,t.nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([l]));const{sortAppDEFieldId:u,sortDir:m,allowOrder:g}=h;if(!0===g){if(!u)throw new a(h,"缺少配置排序属性");const e=u.toLowerCase(),i="ASC"===m,s=[...l.children];i||s.reverse();const o=t=>t+(100-t%100),n=t=>t[e]||0;let c;s.forEach(((a,i)=>{const l=a.deData;void 0===c?a===t&&(c=0===i?100:o(n(s[i-1].deData)),l[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=n(l)&&(l[e]=o(c),r.push(a)),c=n(l))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:d})}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),o=this.context.clone();o[s]=i.srfkey;const n=await e.deService.exec(a.appDataEntityId,"update",o,i);n.data&&(t.deData=n.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t.nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if(!t.deData)throw new n("不是实体树节点数据");t.text=e,t.deData[i.textAppDEFieldId]=e,await this.updateDeNodeData([t])}}),Cr=t("WizardPanelService",class extends zi{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}}),Ar=(t("WizardPanelController",class extends Oo{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()),o=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),n=null==o?void 0:o.stepTag;this.stepTags[s]=n})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Cr(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 Sa(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 n("找不到".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 n("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new n("找不到标识为".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 n("没有上一个表单");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 n("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new n("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends Gi{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 Vs(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new Vs(e,e);this.dataUIMap.set(e,i)}))}})),br=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Pr=(t("MDCtrlController",class extends Mo{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 Ar(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 br(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 br(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 Tn.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 mo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new uo(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 br(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 br(e,this))}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}}),t("KanbanService",class extends Wn{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}})),Tr=(t("KanbanController",class extends Un{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new Pr(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 n("".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},o=t.uiactionId;await Tn.execAndResolved(o,{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 n("看板部件必须开启分组");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 o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=o}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:o}=t,n=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],l=this.state.groups.find((t=>t.key===a)),d=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=l.children[s];return e[n]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),p=[...d.children],u=[...d.children],m=l.children[s];t.from!==t.to?(m[n]=t.to,u.splice(o,0,m)):(u.splice(s,1),u.splice(o,0,m));const g=l.children.splice(s,1);let f;d.children.splice(o,0,...g),e||(p.reverse(),u.reverse());let w,E=[];u.forEach(((t,e)=>{void 0===f?t!==p[e]&&(f=p[e]?p[e][r]||100:0===e?100:h(p[e-1][r]),t[r]=f,c.push(t)):(f>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),f=w,w=0,E=[]),t[r]=h(f),c.push(t)):(0===E.length&&(w=f),E.push(t)),f=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 vr{})),xr=t("TreeGridExRowState",class{constructor(t,e){this.uaColStates={},this.data=t,Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)}))}}),Nr=t("TreeGridExController",class extends Dr{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={}}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new Tr(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 gi(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 xr(t,this)}))}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))}))}}),Sr=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(){}}),Lr=(t("TreeGridExFieldColumnController",class extends Sr{}),t("TreeGridExUAColumnController",class extends Sr{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 mo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new uo(t.id,this.treeGrid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await Tn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}}),t("TreeGridController",class extends hr{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 lr{}),t("MEditViewPanelService",class extends Gi{})),Rr=(t("MEditViewPanelController",class extends Mo{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new Lr(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 n("编辑视图面板部件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 Gi{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:o,appDEDataSetId:n,customCond:r}=s,c=t.clone(),l={...e};if(r){const a=je.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=le(a);i&&Object.assign(c,ie(i,e,t)),s&&Object.assign(l,ie(i,e,t))}}const d=await a.deService.exec(o,n,c,l);d.data&&i.push(...d.data.map((t=>new ks(t,s))))})))}return new u(i,200)}})),Or=(t("MapController",class extends Mo{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new Rr(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 zi{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}})),Mr=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},Vr=class extends Mr{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)}},_r=class extends Mr{},Fr=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new Vr(t);case"USER2":return new _r(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},kr=(t("ReportPanelController",class extends Oo{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=Fr.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new Or(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 vr{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 ma(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=ve(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,n)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{if(l&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t.children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new zs(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:l}=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 d=await this.app.deService.exec(o,s,n,r);if(d.data.length){return d.data.map((e=>new Gs(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:l})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,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,o);if(c.length){return c.map((e=>new js(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}})),Wr=(t("GanttController",class extends Nr{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new kr(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 o=this.getNodeModel(s.nodeId);if(o){const i=a?this.transformNodeDataItem(o,e):e;if(Object.keys(i).length>0){const e=ge(o.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(o.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}})),Ur=class{constructor(){this.convert=new eo,this.controller=new Wr,this.appMap=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new io,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){const a=this.calcAppViewId(t);this.view2appMap.set(a,e)}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 n("视图[".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 n("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new n("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new Zs(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Oi(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()):[]}reset(){this.appMap.clear(),this.configCache=void 0}},Br=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),o=this.viewEngines.get(s);if(o)return o(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),zr=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:o}=this.view;if(!1===o.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 n("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),o=await s.deService.exec(t,"get",a,i),{data:r}=o;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Gr=(t("MDViewEngine",class extends zr{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.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:o}=t,n=(t.context||this.view.context).clone(),r=t.params||this.view.params;n[((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:n,params:r,data:s,event:o,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:o,event:n,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=dt(this.view.params);r&&(c.srfcopymode=r);const l=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:o,event:n,view:this.view}));if(-1===l)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!l.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 da,this.text=new la,this.hbs=new ee,this.rawValue=new ua,this.action=Tn,this.error=new Ot,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)}}),jr=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new n("Method not implemented.")}destroy(){}},Kr=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)}},Xr=class extends jr{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)}},Hr=class extends jr{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Pn(e,i,t)}},Yr=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()),ut(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)}},qr=class extends Yr{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Qr=class extends Yr{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Jr=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)}},$r=class{constructor(){this.executorFactory=new Kr,this.triggerFactory=new Jr}createViewScheduler(t){return new Qr(t)}createControlScheduler(t){return new qr(t)}},Zr=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 n("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},tc=class extends Zr{},ec=class extends Zr{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new n("预定义逻辑类型".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)}},ac=class extends Zr{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 n("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},ic=class extends jr{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,...o}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new n("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const d=c.navigateContexts||[],h=Object.assign(i,ie(d,r[0],s,i));let p={};const u=c.navigateParams;return H(u)&&(p=ie(u,r[0],s,i)),ibiz.commands.execute(qs.TAG,l,h,p,o)}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:o}=e,r=o[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,l=null==c?void 0:c.find((t=>t.refMode===r));if(!l)throw new n("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return l}async executeNewDataAppUILogic(t,e){const{context:s,params:o,...n}=e,{data:r,view:c}=e,{enableWizardAdd:l,enableBatchAdd:d,batchAddOnly:h,newDataAppView:p}=t;let u;if(l){if(u=await this.getWizardNewViewRef(t,e),!u)return{ok:!1}}else if(d){const e=ge(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(u=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!u)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(u=p,!u||!u.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},g={};const f=(null==r?void 0:r[0])||{},w=u.navigateContexts;H(w)&&(m=ie(w,f,o,s)),m=Object.assign(s,m);const E=u.navigateParams;if(H(E)&&(g=ie(E,f,o,s)),o.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const y=await ibiz.commands.execute(qs.TAG,u.refAppViewId,m,g,n);return d&&y.data&&await this.doBatchAdd(t,y.data,s,u),y}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:o}=t,{context:r,params:c,...l}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const d=await ibiz.commands.execute(qs.TAG,s.refAppViewId,r,c,{...l,openMode:"POPUPMODAL"});if(!d.ok)return;const h=null==(i=d.data)?void 0:i[0];if(!h)throw new n("请选中一条数据");const p=h.srfkey,u=null==o?void 0:o.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===p.toUpperCase()}));if(!u)throw new n("没有找到与索引类型".concat(p,"相关的实体的编辑视图"));return u}async doBatchAdd(t,e,i,s){var o;if(null==e?void 0:e.length){const n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),r=n.minorAppDERSs,c=s.refMode.toLowerCase();if(!r)throw new a(n,"实体没有从关系集合!");let l;null==r||r.forEach((t=>{const e=ge(t.majorAppDataEntityId);c===e&&(l=t.parentAppDEFieldId)}));const d=null==(o=s.navigateParams)?void 0:o.find((t=>"keymapping"===t.key));let h=[];if(d){const t=d.value.split(";"),a={};for(const e of t){const[t,i]=e.split(":");t&&i&&(a[t]=i)}h=e.map((t=>{const e={[l]:t.srfkey};for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)){const s=a[i];Object.prototype.hasOwnProperty.call(t,i)&&(e[s]=t[i])}return e}))}else h=e.map((t=>({[l]:t.srfkey})));const p=ibiz.hub.getApp(i.srfappid).deService;await p.exec(n.id,"Create",i,h)}}},sc=class extends Zr{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>sa[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},oc=class extends Zr{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>na[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},nc=class extends jr{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");Tn.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,o,n,r,c,l,d,h,p,u,m,g,f,w,E,y,I,v,D,C,A,b,P,T,x,N,S,L,R,O,M,_,V,F,k,W,U,B,z,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,ot,nt,rt,ct,lt,dt,ht,pt,ut,mt,gt,ft,wt,Et;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,o=t.NoticeError,n=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,l=t.IBizContext,d=t.DataTypes,h=t.clone,p=t.CoreConst,u=t.HttpResponse,m=t.updateKeyDefine,g=t.Net,f=t.getToken,w=t.NOOP,E=t.IBizParams,y=t.isElementSame,I=t.findRecursiveChild,v=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,U=t.findIndex,B=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,J=t.QXEvent,$=t.ascSort,Z=t.isArray,tt=t.getCookie,et=t.setCookie,at=t.clearCookie,it=t.descSort,st=t.clearAll,ot=t.isNumber},function(t){nt=t.default},function(t){rt=t.isNil,ct=t.mergeRight,lt=t.isEmpty,dt=t.clone,ht=t.equals,pt=t.where,ut=t.mergeLeft,mt=t.isNotNil,gt=t.mergeDeepRight},function(t){ft=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(Ao);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const o=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(n=o.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(n!==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 n},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,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:o,colMD:n,colMDOffset:r,colLG:c,colLGOffset:l}=t,d=(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:d(a,i),sm:d(s,o),md:d(n,r),lg:d(c,l)}},calcLayoutHeightWidth:he,calcMainStateOPPrivsStrs:me,calcNavParams:re,calcResPath:Ni,compare:ke,compareNumber:We,contains:Ue,convertNavData:ie,convertNavDataByArray:oe,convertObjectToNavParams:ae,execDELogic:Is,execDELogicAction:Ds,execDELogicById:vs,execFieldLogics:As,execUILogic:Pn,exportData:Po,fieldValueToBoolean:Li,filterFieldLogics:Ee,filterValueRules:ca,findChildFormDetails:be,findDELogic:we,findEditItem:Ae,findFieldById:ye,findModelChild:ce,formatMultiData:ne,generateEditorRules:vo,generateRules:Io,getAllPanelField:Oe,getAppCounterProvider:Ta,getAppMenuItemProvider:Ei,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,ibiz.register.get("".concat(ti,"_").concat(a)));var a;if(e)return e;throw new n("找不异步操作类型".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:de,getControlProvider:Sa,getControlsByView:Te,getDEMethodProvider:pi,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:Co,getEditorProvider:Oa,getEntitySchema:To,getFormDetailProvider:Va,getGridColumnProvider:Wa,getMatchResPath:xi,getOriginData:yo,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 o=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!o)throw new Error("未找到插件".concat(t));return o},getPanelItemProvider:za,getPlatformProvider:ci,getPlatformType:si,getPortletProvider:Ka,getRootNode:ve,getTreeGridExColumnProvider:gi,getTreeNode:De,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:qa,getUILogicNodeProvider:Ja,getViewEngines:Ne,getViewLogics:xe,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Za(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Za("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=Za(a));e||(e=Za("DEFAULT"));return e},getWFContext:Qe,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:o}=e,n=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?o:s),c=null==n?void 0:n.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:ma,hasDeCodeName:fe,hasSubRoute:wo,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(bo);(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 Gr,t.hub=new Ur,t.register=new Lt,t.config=new St,t.auth=new Xi,t.asyncAction=new Hi,t.engine=new Br,t.uiDomainManager=new pa,$s(),Mn(),Ss(),Di(),ibiz.scheduler=new $r,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new ec(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new ec(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new ec(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new ac(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new tc(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new sc(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new oc(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Xr(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Hr(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Hr(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new ic(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new nc(t,e))),function(){const t=new ai;ni("Browser",(()=>t))}(),t.platform=ci()},installCommand:$s,isDataContainer:Se,isFormDataContainer:Pe,isValueChange:Eo,matchMainState:ue,openRedirectView:Me,parseUserParams:le,presetAppCounterProvider:Di,presetDEMethodProvider:Ss,presetUIActionProvider:Mn,registerAppCounterProvider:ba,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(fi,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ti,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(xa,"_").concat(t),e)},registerDEMethodProvider:di,registerEditorProvider:function(t,e){ibiz.register.register("".concat(La,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Ma,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Fa,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Ua,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ni,registerPortletProvider:function(t,e){ibiz.register.register("".concat(Ga,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(ui,"_").concat(t),e)},registerUIActionProvider:Ha,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(Qa,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat($a,"_").concat(t),e)},strContain:Be,testCond:Fe,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await _e(t,e,a);await ibiz.commands.execute(qs.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 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 vt=yt(It.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=yt(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 o=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):o.bind(this)(t,e)};var n=s.startOf;s.startOf=function(t,e){var s=this.$utils(),o=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return o?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return n.bind(this)(t,e)}})}(At);var bt=yt(At.exports),Pt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var o=e.prototype;o.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 o=s(this).startOf(i).add(1,i).date(e),n=s(this).endOf(a);if(o.isBefore(n))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)},o.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Pt);var Tt=yt(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)},o=e.prototype;o.isoWeekYear=function(){return s(this).year()},o.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,o,n,r=s(this),c=(e=this.isoWeekYear(),n=4-(o=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),o.isoWeekday()>4&&(n+=7),o.add(n,a));return r.diff(c,"week")+1},o.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var n=o.startOf;o.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"):n.bind(this)(t,e)}})}(xt);var Nt=yt(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 o?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof n&&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)}},Ut=class extends _t{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Bt=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(U(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=B(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||""}},Jt=class extends _t{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},$t=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 Ut(a),new Bt(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 Jt(a),new $t(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,o=t[i];H(t[i])&&a.test(t[i])&&(s=!1,o=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:o})}return e}function ie(t,...e){if(!t||S(t))return{};return oe(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 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}=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 ne(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:o}=t;!i&&o&&Object.prototype.hasOwnProperty.call(s,o)&&(a[o]=e.map((t=>t[o])).join(";"))})),a}function re(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:o,navParams:n}=t,{context:r,params:c,data:l,derValue:d}=e,h={},p={},u=d||l.srfkey;u&&(a&&(h[a]=u),i&&(p[i]=u),s&&(p["n_".concat(s.toLowerCase(),"_eq")]=u));const m=ie(o,l,c,r),g=ie(n,l,c,r);return Object.assign(h,m),Object.assign(p,g),{resultContext:h,resultParams:p}}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 le(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const o=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:o});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:o});break;default:Object.assign(i,{key:o})}}}return{navigateContexts:e,navigateParams:a,other:i}}function de(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,o={width:"",height:""};return"FULL"===i?o.width="100%":e&&e>0&&(o.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?o.height="100%":a&&a>0&&(o.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),o}function pe(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 ue(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 o=!0;const n=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(n[e])){o=!1;break}return o}))}}function me(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,o=(null==i?void 0:i.map((t=>t.name)))||[];let n=[];if(s)n=o;else{n=[...a.deopprivs,...e.deopprivs].filter((t=>!o.includes(t.name))).map((t=>t.name))}return n}function ge(t){return t.split(".").pop()}function fe(t,e){const a=ge(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 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 ve(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||ve(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(qs.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)),o=nt.parse(s,{delimiter:";"}),r=o.srfdename||"";if(!r)throw new n("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new n("未找到指定实体的codeName: ".concat(r));o[c.toLowerCase()]=o[r.toLowerCase()];const l="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),d=await ibiz.hub.getAppView(l);if(delete o.srfdename,"undo"!==o.srfwf){const t=o.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));o.wf=e,o.wfVersion=a}return o.srfprocessinstanceid&&(t.srfprocessinstanceid=o.srfprocessinstanceid,delete o.srfprocessinstanceid),{context:t,params:o,opts:a,viewId:d.id}}async function Ve(t,e,i={},s={}){var o;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 l=t.appDataEntityId,d=ge(l);let h=(null==(o=s.data)?void 0:o[0])||{};e[d]=h[d]||e[d]||i[d];const p=t.getDataAppDEActionId,u=ibiz.hub.getApp(t.appId),m=await u.deService.getService(e,l);ibiz.loading.showRedirect();try{const t=await m.exec(p||"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 n("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(l,t.appId),f=await async function(t,e,a,i){let s="";const o=e.typeAppDEFieldId;if(o){const{codeName:a}=ye(t,o),s=i[a.toLowerCase()];if(H(s))return"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(o,"]值为空"),i)}const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(H(r))return H(a.wf)?"".concat(n,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(n,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=ye(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(Y(c)&&t.formTypeAppDEFieldId){const{codeName:e}=ye(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=H(c)?"".concat(n,":").concat(c.toString().toUpperCase()):"".concat(n);return s}(g,t,i,h),w=f.split(":"),E=2===w.length?f:w.slice(0,2).join(":"),y="".concat(g.name.toUpperCase(),":").concat(f),I=[];t.redirectAppViewRefs&&I.push(...t.redirectAppViewRefs),t.appViewRefs&&I.push(...t.appViewRefs);const v=I.find((t=>{const e=t.name||t.id;return e===y||e===f||e===E}));if(v){const t=v.refAppViewId;if(t)return{type:"view",viewId:t,context:e,params:i,opts:{...s,data:[h]}};throw new a(v,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==I?void 0:I.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(f,"]或[").concat(y,"]或工作流[").concat(E,"]对应视图"))}function Fe(t,e,a){if(Object.is(e,"IN"))return Ue(t,a);if(Object.is(e,"NOTIN"))return!Ue(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 Ue(t,a);case"NOTIN":return!Ue(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 n("值操作:".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(),o=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(o))return We(s,o);throw new n("".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 Ue(t,e){if(!e||"string"!=typeof e)throw new n("范围比较的条件值不存或者不是字符串");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(),o=i.indexOf(s);switch(a){case"start":return 0===o;case"end":return o+s.length===i.length;default:return-1!==o}}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 console.log("报错脚本",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,o=t.length;i<o;i++){const o=e(t[i],i);if("AND"===a){if(!o){s=!1;break}}else if("OR"===a&&o){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:o}=Ke(t,e,a);return i.infoMessage=o,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,o,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=o[a=a?a.toLowerCase():""]?o[a]:a}(rt(i)||lt(i))&&(i="内容必须符合值规则");const c=Fe(t,e,a);if(!c&&r)throw new n(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,o,r){Y(o)&&(o="值必须符合值范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!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 n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!=i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!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,o,r){Y(o)&&(o="内容长度必须符合范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!==i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!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:o,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Xe(e[t],o,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:o}=function(t,e,a,i,s){Y(i)&&(i="值必须符合脚本规则");const o=e;let r="",c=!0;const l=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:o},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),l(t)}if(i="",!c&&s)throw new n(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=o||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 n("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new n(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=dt(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 o="";i?o="BLANK_MODE":s&&(o=s.toUpperCase());let n="";return n=""!==o?"".concat(e,"_").concat(a,"_").concat(o):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(n)&&(n+="_NO_NAV"),n}});function Qe(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Je=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))(Je||{})),$e=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))($e||{})),Ze=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Ze||{})),ta=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))(ta||{})),ea=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))(ea||{})),aa=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))(aa||{})),ia=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))(ia||{})),sa=t("StudioViewEvents",class{});sa.onViewMounted="onMounted",sa.onViewDestroyed="onDestroyed";var oa=t("StudioPanelEvents",class{});oa.onClick="onClick",oa.onChange="onChange",oa.onEnter="onEnter",oa.onLeave="onLeave";var na=t("StudioControlEvents",class{});na.onBeforeLoad="onBeforeLoad",na.onLoadSuccess="onLoadSuccess",na.onLoadError="onLoadError",na.onBeforeLoadDraft="onBeforeLoadDraft",na.onLoadDraftSuccess="onLoadDraftSuccess",na.onLoadDraftError="onLoadDraftError",na.onBeforeSave="onBeforeSave",na.onSaveSuccess="onSaveSuccess",na.onSaveError="onSaveError",na.onBeforeRemove="onBeforeRemove",na.onRemoveSuccess="onRemoveSuccess",na.onRemoveError="onRemoveError",na.CLICK="onClick";var ra=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 ca(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var la=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")}}),da=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=dt(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")}}),ha=t("UIDomain",class{constructor(t){this.rsMap=new Map,this.id=t||Q()}setDERConfig(t,e){this.rsMap.has(t)||this.rsMap.set(t,[]);this.rsMap.get(t).push(e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),pa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ha(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))}}),ua=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}});async function ma(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 ga=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){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}},fa=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},wa=class extends fa{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let o=0;o<e;o++)if(a){const e=t[o];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[o];this.setParam(e),i=!1,s=!0}else if(s){const e=t[o];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}},Ea=class t extends fa{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,o=!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,o=!0}else if(o){const a=e[r];if(!(a instanceof Array))throw new n("值必须为数组");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 wa;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},ya=class extends Ea{},Ia=class extends wa{},va=class t extends ga{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof Ea){const t=e.getChildPSModelCondBases();if(null==t||lt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let o=s;for(let e=0;e<t.length;e++){const n=t[e];if(this.testCond(n,a,i)){if(!s){o=!0;break}}else if(s){o=!1;break}}return e.isNotMode()?!o:o}if(e instanceof wa){lt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let o=null;const n=e.getValueType(),r=e.getValue();return null==n||lt(n)?o=e.getValue():(lt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===n?o=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===n&&(o=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,o)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Ia}createPSModelGroupCond(){return new ya}};va.PARAMTYPE_DATACONTEXT="DATACONTEXT",va.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Da=t("PSDEDQCondEngine",va);async function Ca(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 Aa=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function ba(t,e){ibiz.register.register("".concat(Aa,"_").concat(t),e)}function Pa(t){return ibiz.register.get("".concat(Aa,"_").concat(t))}async function Ta(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Pa(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Pa(a),e)return e;throw new n("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Pa(i),e)return e;throw new n("找不系统计数器类型".concat(i,"对应的适配器"))}var xa=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Na(t){return ibiz.register.get("".concat(xa,"_").concat(t))}async function Sa(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Na(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Na("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=Na(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var La=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Ra(t){return ibiz.register.get("".concat(La,"_").concat(t))}async function Oa(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:o,appId:n}=t;if(o){const t=await Ca(o,n);if(t&&(e=Ra(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Ra("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let o="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(o+="_".concat(i)),e=Ra(o),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=Ra(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var Ma=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function _a(t){return ibiz.register.get("".concat(Ma,"_").concat(t))}async function Va(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=_a(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=_a(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var Fa=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function ka(t){return ibiz.register.get("".concat(Fa,"_").concat(t))}async function Wa(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=ka(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const n=i?"".concat(a,"_EDIT"):a;if(e=ka(n),e)return e;ibiz.log.error("找不到表格列类型".concat(n,"对应的适配器"))}var Ua=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Ba(t){return ibiz.register.get("".concat(Ua,"_").concat(t.toUpperCase()))}async function za(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(a=Ba(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=Ba(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=Ba(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=Ba("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}if(a=Ba(i),a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var Ga=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ja(t){return ibiz.register.get("".concat(Ga,"_").concat(t))}async function Ka(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=ja(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=ja(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var Xa=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Ha(t,e){ibiz.register.register("".concat(Xa,"_").concat(t),e)}function Ya(t){return ibiz.register.get("".concat(Xa,"_").concat(t))}async function qa(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:o}=t;if(i){const t=await Ca(i,s);if(t&&(e=Ya(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=Ya("".concat(a,"_").concat(o)),e)return e;if(e=Ya(a),e)return e;throw new n("找不界面行为模式".concat(a,"对应的适配器"))}var Qa=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function Ja(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Ca(a,i);if(s){if(e=ibiz.register.get("".concat(Qa,"_").concat(s)),e)return e;throw new n("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var $a=t("VIEW_PROVIDER_PREFIX","VIEW");function Za(t){return ibiz.register.get("".concat($a,"_").concat(t))}var ti=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var ei=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 n("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new n("文件流数据不存在")}}),ai=t("BrowserPlatformProvider",class extends ei{});var ii=window.navigator.userAgent.toLowerCase();function si(){return/Android|Adr/i.test(ii)?"Android":/iPhone|iPod|iPad/i.test(ii)?"IOS":/MicroMessenger/i.test(ii)?"WeChat":/DingTalk/i.test(ii)?"DingTalk":/miniProgram/i.test(ii)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var oi=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ni(t,e){ibiz.register.register("".concat(oi,"_").concat(t),e)}function ri(t){return ibiz.register.get("".concat(oi,"_").concat(t))}function ci(){const t=ri(si());return t||ri("Browser")}var li=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function di(t,e){ibiz.register.register("".concat(li,"_").concat(t),e)}function hi(t){return ibiz.register.get("".concat(li,"_").concat(t))}async function pi(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=hi(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=hi(a),e)return e;throw new n("找不实体行为方法类型为".concat(a,"的适配器"))}var ui=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function mi(t){return ibiz.register.get("".concat(ui,"_").concat(t))}async function gi(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Ca(s,i);if(t&&(e=mi(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=mi(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var fi=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function wi(t){return ibiz.register.get("".concat(fi,"_").concat(t))}async function Ei(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Ca(a,i);if(t&&(e=wi(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}if(e=wi(s),e)return e;ibiz.log.error("找不到应用菜单项类型".concat(s,"对应的适配器"))}var yi=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=l.create(),this.params={},this.evt=new J,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=dt(t)),e&&(this.params=dt(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 n("未实现计数器加载方法")}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()}}),Ii=t("AppDECounter",class extends yi{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}}),vi=t("AppDECounterProvider",class{createCounter(t){return new Ii(t)}});function Di(){ba("DEDR",(()=>new vi))}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 Da;return a.parse(["OR",this.calcCond(e)]),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.fieldName),e.condValue||a.push("")}}e.push(a)})),e}}).map=new WeakMap;var Ci=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"].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:o,iconPathAppDEFieldId:n,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:l}=this.codeList,d=a?t[a]:t.srfkey;if(e.id=d,e.value=d,e.text=i?t[i]:t.srfmajortext,(s||o||n||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),o&&(e.sysImage.cssClassX=t[o]),n&&(e.sysImage.imagePath=t[n]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Li(t[c])),l&&t[l])try{e.data=je.execSingleLine(t[l])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:o,minorSortAppDEFieldId:n,minorSortDir:r,pvalueAppDEFieldId:c,customCond:l}=this.codeList,d={...e};if(n&&r&&Object.assign(d,{sort:"".concat(n.toLowerCase(),",").concat(r.toLowerCase())}),l){const e=ie(je.execSingleLine(l),d,t);Object.assign(d,e)}if(d.size||(d.size=1e4),this.isPredefined){const t=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),d);return Object.freeze(t.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!o)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,o,t,void 0,d);let p=[];return h.data.length&&h.data.forEach((t=>{if(c){const t=this.prepareTreeData(h.data);t&&(p=t)}else p.push(this.convertData(t))})),Object.freeze(p)}prepareTreeData(t,e){const{pvalueAppDEFieldId:a}=this.codeList;let i=[];if(i=t.filter((t=>e?t[a]===e:!t[a])),0!==i.length)return i.map((e=>{const a=this.convertData(e);return a.children=this.prepareTreeData(t,a.value),a}))}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,o=-1===s||rt(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,n={expirationTime:(new Date).getTime()+o,promise:i};this.cache.set(a,n);const r=await i;return n.items=r,delete n.promise,r}});function Ai(t,e){if(null!=e){const{srfkey:t}=e;if(!rt(t)&&!lt(t))return!0}throw new n("执行「".concat(t,"」不存在「srfkey」无法处理"))}function bi(t,e){const{srfsessionid:a}=e;if(!rt(a)&&!lt(a))return!0;throw new n("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Pi=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,dt(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 n("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{return bi("add",t),(rt(e.srfkey)||lt(e.srfkey))&&(e.srfkey=Q()),e.srftempdate=(new Date).getTime(),this.cacheMap.set(e.srfkey,dt(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{bi("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),dt(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 n("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{bi("update",t),Ai("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i)return i.assign(e),this.cacheMap.set(a,i),ibiz.log.warn("update",a,e),dt(i);throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{bi("delete",t);const a=e;if(this.cacheMap.has(a)){const t=this.cacheMap.get(a);return t.srftempdate=(new Date).getTime(),this.cacheMap.delete(a),ibiz.log.warn("delete",a),t}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{bi("add",t);for(let t=0;t<e.length;t++){const a=e[t];(rt(a.srfkey)||lt(a.srfkey))&&(a.srfkey=Q()),a.srftempdate=(new Date).getTime();const i=dt(a);this.cacheMap.set(a.srfkey,i),e[t]=i,ibiz.log.warn("add",a.srfkey,a)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{bi("update",t);for(let t=0;t<e.length;t++){const a=e[t];Ai("update",a),a.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a.srfkey);if(!i)throw new Error("数据[".concat(a.srfdename,"-").concat(a.srfmajortext,"(").concat(a.srfkey,")]不存在,无法更新!"));i.assign(a),this.cacheMap.set(a.srfkey,i),ibiz.log.warn("update",a.srfkey,a),e[t]=dt(i)}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{bi("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("、"),"」,无法删除!"));for(let t=0;t<e.length;t++){const a=e[t];this.cacheMap.delete(a),ibiz.log.warn("delete",a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}select(t,e={}){try{bi("getList",t);const a=this.cacheMap.values();let i=Array.from(a);i=$(i,"srfordervalue");const s={},o={},n={},r={};e.srfkey&&(s.srfkey=ht(e.srfkey),delete e.srfkey);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];null==a?(o[t]=ht(null),n[t]=ht(void 0),r[t]=ht("")):s[t]=ht(a)}if(!lt(s)){const t=pt(s),e=pt(o),a=pt(n),c=pt(r);i=i.filter((i=>{if(lt(o)){if(t(i))return!0}else if(t(i)&&(e(i)||a(i)||c(i)))return!0;return!1}))}return i.map((t=>t.clone()))}catch(t){return ibiz.log.error(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 pt(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("||")}}),Ti=/\$\{(.*?)\}/g;function xi(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(Ti);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 Ni(t,e){const a=xi(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 Si=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)||lt(e.page)||(this.page=e.page),rt(e.size)||lt(e.size)||(this.size=e.size),rt(e.query)||lt(e.query)||(this.query=e.query),!rt(e.sort)&&!lt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}rt(e.srfparentkey)||lt(e.srfparentkey)||(this.srfparentkey=e.srfparentkey),rt(e.srfparentdename)||lt(e.srfparentdename)||(this.srfparentdename=e.srfparentdename),this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort,delete this.data.srfparentkey,delete this.data.srfparentdename}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Li(t){return[1,"1",!0,"true"].includes(t)}var Ri=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 o={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)&&(o.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(o)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new Ci(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 n("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),Oi=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||{}}}),Mi=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 Ta(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)}});Mi.counterMap=new Map;var _i=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(){return this.app.net.get("".concat(this.getBaseUrl(),"/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 n("「".concat(t,"」未实现"))}}}),Vi=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Ni(a,this.model),o="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(o,{method:"post",data:i,responseType:"blob"})}},Fi=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(Fi||{})),ki=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:dt(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(d.isNumber(e)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),Wi=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Pi(e),this.configCache=new Oi(e.appId,"PSAppDataEntity",e.codeName),this.wf=new _i(e),this.file=new Vi(e)}async getMethod(t,e=!1){const a=e?"ac-".concat(t):t;if(this.methodMap.has(a))return this.methodMap.get(a);const s=ce(this.model.appDEMethods,t),o=await pi(s);if(!o)throw new i(s,"未支持的服务方法类型: ".concat(s.methodType));const n=o.create(this,this.model,s,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(a,n),n}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new n("".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 selectLocal(t,e={}){return this.local.select(t,e)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new n("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),o=this.calcSsePath(e);return new Promise(((e,n)=>{s.net.sse("/".concat(o),{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=>{n(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 Ni(t,this.model)+i}newEntity(t){return t instanceof ki?t.clone():new ki(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}}),Ui=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],Bi=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;Ui.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=dt(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),zi=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 Bi(t,this.dataUIMap)}}),Gi=t("MDControlService",class extends zi{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 n("未实现")}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}}),ji=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=ue(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}}),Ki=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 n("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new ji(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}}),Xi=t("V7AuthService",class{get isAnonymous(){return"1"===tt(p.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(p.IS_ANONYMOUS,"1",0,!0);const t=tt(p.TOKEN),e=tt(p.TOKEN_EXPIRES),a=tt(p.TOKEN_REMEMBER);et(p.TOKEN,t,0,!0),et(p.TOKEN_EXPIRES,e,0,!0),et(p.TOKEN_REMEMBER,a,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){a&&et(p.TOKEN_REMEMBER,"1",7,!0),et(p.TOKEN,s.token,a?7:0,!0);const t=(new Date).getTime()+1e3*(s.expirein||7199);et(p.TOKEN_EXPIRES,"".concat(t),a?7:0,!0),at(p.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(p.TOKEN),at(p.TOKEN_EXPIRES),at(p.TOKEN_REMEMBER),at(p.IS_ANONYMOUS),!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=tt(p.TOKEN),e=tt(p.TOKEN_EXPIRES),a=tt(p.TOKEN_REMEMBER);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=await ibiz.net.get("/uaa/refreshtoken2");if(t.ok){et(p.TOKEN,t.data.token,a?7:0,!0);const e=(new Date).getTime()+1e3*(t.data.expirein||7199);et(p.TOKEN_EXPIRES,"".concat(e),a?7:0,!0)}this.extendLogin()}),t)}}getAuthInfo(){const t=tt(p.TOKEN),e=!!tt(p.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}}),Hi=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))}}),Yi=t("MethodDto",class t{constructor(t,e,a,i,s){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.inSelfLoop=s,this.dtoMap=new Map,this.isCalcRs=!1,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}select(t,e){return this.service.local.select(t,e)}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,a=!1){const s={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let n=0;n<this.fields.length;n++){const r=this.fields[n],c=r.codeName.toLowerCase();switch(r.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(r.listMap)e[c]&&(s[c]=0===e[c].length?null:this.convertArrayToListMap(e[c]));else{if(void 0!==e[c]&&!1===a)break;if(!r.refAppDataEntityId)break;let i=o.getDERConfig(r.refAppDataEntityId);const n=i.findIndex((t=>t.majorDECodeName===this.entity.codeName));i=i.slice(n+1);const l=await this.getFieldDto(t,r),d={};r.refPickupAppDEFieldId&&(d[r.refPickupAppDEFieldId]=e.srfkey),i.forEach((t=>{d[t.pickupDEFName.toLowerCase()]=null}));const h=await l.select(t,d);if(h){const e=[];for(let a=0;a<h.length;a++)e.push(await l.get(t,h[a],!0));s[c]=e}}break;default:throw new i(r,"未支持的应用实体方法输入属性类型: ".concat(r.type))}}return{...e,...s}}async sets(t,e){return this.isLocalMode&&!this.inSelfLoop&&this.service.local.clear(),await this.calcRs(t),Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const i=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[i])e[i]=this.convertListMapToArray(e[i]);else{if(!a.refAppDataEntityId)return;const s=await this.getFieldDto(t,a),o=e[i];if(o){const i=e[this.entity.keyAppDEFieldId];o.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await s.sets(t,o)}else await s.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[t];const i=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,i),i})))}async calcRs(t,e=0){if(this.isCalcRs||e>10)return;this.isCalcRs=!0,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 o=i[s];if(!o.refAppDataEntityId)continue;if(-1===a.getDERConfig(o.refAppDataEntityId).findIndex((t=>t.pickupDEFName===o.refPickupAppDEFieldId))){const i=await this.getFieldDto(t,o);a.setDERConfig(o.refAppDataEntityId,{majorDEName:this.entity.name,majorDECodeName:this.entity.codeName,majorDECodeName2:this.entity.codeName2,minorDEName:i.entity.name,minorDECodeName:i.entity.codeName,minorDECodeName2:i.entity.codeName2,pickupDEFName:o.refPickupAppDEFieldId}),await i.calcRs(t,e)}}}async getFieldDto(e,a){if(this.dtoMap.has(a.codeName))return this.dtoMap.get(a.codeName);const i=await ibiz.hub.getAppDataEntity(a.refAppDataEntityId,this.entity.appId),s=ce(i.appDEMethodDTOs||[],a.refAppDEMethodDTOId),o=this.entity.codeName===i.codeName,n=await this.app.deService.getService(e,i.id);n.isLocalMode=!0;const r=new t(n,i,!0,s,o);return this.dtoMap.set(a.codeName,r),r}}),qi=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=new Yi(t,e,this.isLocalMode,a))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),Qi=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=new Yi(t,e,this.isLocalMode,a))}}async handle(t,e){if(this.dto){return(await this.dto.sets(t,[e]))[0]}return Y(e)&&(e={}),new ki(this.entity,e)}}),Ji=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 qi(t,e,a),this.result=new Qi(t,e,a)}async request(t,e,i,s){const{actionType:o,requestMethod:n}=this.method;if("REMOTE"===o){const e=this.method.codeName.toLowerCase();let o=null;switch(n){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,n?"未支持的请求方式: ".concat(n):"未配置请求方式")}return o}throw new a(this.method,"未支持的行为类型[".concat(o,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Ni(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),$i=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)}},Zi=class{},ts=class extends Zi{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 o=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(o[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Fe(o[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o[this.dstField],this.op,this.value)}}},es=class t extends Zi{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new ts(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 o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},as=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new es(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},is=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new as(t)))}},ss=class extends is{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},os=class extends is{async exec(t){}},ns=class extends is{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 rs(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM";let r,c=s;switch(n){case"SRCDLPARAM":r=t.params[a],t.isEntityParam(a)&&(c=null==c?void 0:c.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);case"WEBCONTEXT":case"VIEWPARAM":r=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":r=t.parameters.context;break;case"ENVPARAM":r=dt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}if(r&&c)try{r=Array.isArray(r)?r[Number(c)]:je.execScriptFn({srcValue:r},"srcValue.".concat(c),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(c,"报错,源参数:"),r),t}return r}var cs=class extends is{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=rs(e,t);e.params[a]=dt(i)}bindParam(t,e){const a=rs(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 o=rs(e,t);s?e.params[i][s]=o:e.params[i]=o}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:o}=t,n=rs(e,t),r=i||0,c=s||0,l=o||n.length;e.params[a].splice(r,0,...n.slice(c,l))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},ls=class extends is{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,o=t.params[i],n=ibiz.hub.getApp(t.context.srfappid),r=await n.deService.exec(a,e,t.context,o);r.ok&&(t.params[s]=r.data)}},ds=class extends is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=rs(t,this.model);t.params[e]=s}},hs=class extends is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},ps=class extends is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},us=class extends is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=rs(t,this.model);t.params[e]=dt(s)}},ms=class extends is{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},gs=class extends is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=rs(t,this.model),c=s||0,l=o||0,d=n||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},fs=class extends is{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},ws=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]=dt(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]=dt(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]={}}}},Es=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 os(t);break;case"END":a=new ns(t);break;case"DEACTION":a=new ss(t);break;case"PREPAREPARAM":a=new cs(t);break;case"DEDATASET":a=new ls(t);break;case"THROWEXCEPTION":a=new fs(t);break;case"BINDPARAM":a=new ds(t);break;case"RESETPARAM":a=new hs(t);break;case"COPYPARAM":a=new us(t);break;case"RENEWPARAM":a=new ps(t);break;case"APPENDPARAM":a=new gs(t);break;case"SORTPARAM":a=new ms(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 ws(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 $i(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:o}=this.model;if(!o||!this.nodes.has(o))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(o);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}}},ys=new Map;async function Is(t,e,a={},i={}){ys.has(t)||ys.set(t,new Es(t));return ys.get(t).exec(e,a,i)}async function vs(t,e,a,i,s){const o=await async function(t,e,a){return we(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!o)throw new n("".concat(e,"找不到实体逻辑").concat(t));return Is(o,a,i,s)}async function Ds(t,e,a,i){const o=dt(e),n=a?dt(a):a,r=i?dt(i):i;try{const e=await Is(t,o,n,r);return new u(e)}catch(t){if(t instanceof s)return new u(t,500);throw t}}async function Cs(t,e,a,i,s){const o=Ee(t,e);if(o.length){(await Promise.all(o.map((t=>Is(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function As(t,e,a,i,s={}){if(i){if(!R(i))return Cs(t,e,a,i,s);await Promise.all(i.map((i=>Cs(t,e,a,i,s))))}}var bs=t("DEActionMethod",class extends Ji{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){if(e&&await As(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const s=we(this.method.appDELogicId,this.entity);if(!s)throw new a(this.method,"缺少实体处理逻辑");return Ds(s,t,e,i)}let s;switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await As(this.entity,"change",t,e,i),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 o=await this.request(a,t,e,i);o.data=await this.result.handle(t,o.data),s=o}}return s.data&&await As(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new n("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 n("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 u(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new u(t):new u(t,500)}catch(t){return new u(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()]);const i=this.service.local.delete(t,a);return i?new u(i):new u(i,500)}catch(t){throw new s(t)}}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 u(i):new u(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 u(i):new u(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new u(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{const{majorDECodeName:i,pickupDEFName:s}=a,o=i.toLowerCase(),n=s.toLowerCase(),r=t[o];r&&r!==e.srfkey&&(e[n]=r)})),e}}),Ps=class{create(t,e,a,i){return new bs(t,e,a,i.localMode)}},Ts=t("FetchMethod",class extends Ji{async exec(t,e,a){const s=e&&!R(e)?e:a||{};if(this.isLocalMode){const e=await this.searchLocal(null,new Si(t,s));return new u(e,200)}let o;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);o=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const n=o.data||[];return o.data=n.map((t=>this.createEntity(t))),o.data&&await As(this.entity,"compute",t,o.data,s),o}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=[];t?(i=this.service.local.getList(),i.length>0&&(i=i.filter((a=>t.test(a,e))))):(i=await this.service.local.select(e.context,e.data),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)||lt(e.sortField)||(i="DESC"===e.sortMode?it(i,e.sortField):$(i,e.sortField));const{page:s,size:o}=e,n=s*o,r=(s+1)*o-1;return i.slice(n,r).map((t=>dt(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:o,majorAppDEFieldId:n}=this.entity,r=s.map((t=>({[o]:t.value,[n]:t.text})));return new u(r,200)}}),xs=t("AcFetchMethod",class extends Ts{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Ns=class{create(t,e,a,i){return i.acMode?new xs(t,e,a,i.localMode):new Ts(t,e,a,i.localMode)}};function Ss(){const t=new Ps;di("DEACTION",(()=>t));const e=new Ns;di("FETCH",(()=>e)),di("FETCHTEMP",(()=>e))}var Ls=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)),Object.values(a).length>0?a:void 0}}),Rs=t("TreeCodeListNodeData",class extends Ls{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)}}),Os=t("TreeDataSetNodeData",class extends Ls{constructor(t,e,a){var i;super(t,e,a);const{data:s}=a;this._deData=s,this._text=t.textAppDEFieldId?s[t.textAppDEFieldId]:s.srfmajortext,this._value=t.idAppDEFieldId?s[t.idAppDEFieldId]:s.srfkey;const o="".concat(t.id,"@").concat(s.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=ge(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:s.srfkey})}this._icon=this.calcIcon(t),this._textHtml=this.calcTextHtml(t),t.leafFlagAppDEFieldId&&(this._leaf=Li(s[t.leafFlagAppDEFieldId]));const n=new Map;n.set("srfkey","srfkey"),n.set("srfmajortext","srfmajortext");const r={};return null==(i=t.detreeNodeDataItems)||i.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();n.set(e,a),t.defaultValue&&(r[e]=t.defaultValue)})),new Proxy(this,{set:(t,e,a)=>(Object.prototype.hasOwnProperty.call(t._deData,e)?t._deData[e]=a:n.has(e)?t._deData[n.get(e)]=a:t[e]=a,!0),get:(t,e,a)=>void 0!==t[e]?t[e]:n.has(e)?t._deData[n.get(e)]||r[e]:void 0!==t._deData[e]?t._deData[e]:void 0,ownKeys(t){const e=[...new Set([...Object.keys(t),...n.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}}),Ms=t("TreeStaticNodeData",class extends Ls{constructor(t,e,a){var i,s;super(t,e,a);const o="root"===t.nodeValue?void 0:t.nodeValue,n="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(n):n},enumerable:!0,configurable:!0}),this._text=t.text,this._value=o,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=o||(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)}}),_s=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(d.isNumber(this.dataType)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),Vs=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 Fs=["REGION","REGION2","REGION3","REGION4"],ks=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:o,textAppDEFieldId:n,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:l}=e,d=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,Fs.includes(this._itemStyle)?s&&d.set("_areaCode",s):(s&&d.set("_longitude",s),o&&d.set("_latitude",o)),c&&d.set("_tooltip",c),n&&d.set("_text",n),r&&d.set("_value",r),l&&(this._symbol=l.rawContent||l.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:d.has(a)?t[d.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:d.has(a)?t[d.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 Ws=t("PanelData",class{constructor(t,e){const a=new J,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,o,n)=>(Object.prototype.hasOwnProperty.call(i,o)?i[o]?e[i[o]]=n:t[o]=n:e[o]=n,a.emit("change",o),i[o]&&i[o]!==o&&a.emit("change",i[o]),s[o]&&s[o]!==o&&a.emit("change",s[o]),!0),get:(t,s,o)=>"_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 Us=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}})}}),Bs=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.id===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},zs=t("GanttStaticNodeData",class extends Ms{constructor(t,e,a,i){super(e,a,i),this.sndataIteValue=Bs(t.sndataItemName,e),this.beginDataItemValue=Bs(t.beginDataItemName,e),this.endDataItemValue=Bs(t.endDataItemName,e),this.prevDataItemValue=Bs(t.prevDataItemName,e),this.finishDataItemValue=Bs(t.finishDataItemName,e),this.totalDataItemValue=Bs(t.totalDataItemName,e)}}),Gs=t("GanttDataSetNodeData",class extends Os{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this.sndataIteValue=Bs(t.sndataItemName,e,s),this.beginDataItemValue=Bs(t.beginDataItemName,e,s),this.endDataItemValue=Bs(t.endDataItemName,e,s),this.prevDataItemValue=Bs(t.prevDataItemName,e,s),this.finishDataItemValue=Bs(t.finishDataItemName,e,s),this.totalDataItemValue=Bs(t.totalDataItemName,e,s)}}),js=t("GanttCodeListNodeData",class extends Rs{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this.sndataIteValue=Bs(t.sndataItemName,e,s),this.beginDataItemValue=Bs(t.beginDataItemName,e,s),this.endDataItemValue=Bs(t.endDataItemName,e,s),this.prevDataItemValue=Bs(t.prevDataItemName,e,s),this.finishDataItemValue=Bs(t.finishDataItemName,e,s),this.totalDataItemValue=Bs(t.totalDataItemName,e,s)}}),Ks=t("MqttService",class{constructor(t,e,a){if(this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new J,this.options={connectTimeout:6e3,clientId:Q(),username:"",password:"",keepalive:60,clean:!0},Y(t)||Y(e))throw new Error("mqttTopic or token is empty");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.debug("mqtt reconnect")})),this.client.on("close",(()=>{console.debug("mqtt close")}))}close(){var t;null==(t=this.client)||t.end()}}),Xs=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 n("未找到应用实体[".concat(a,"]"));const o=t.constructorCache.get(a.toUpperCase());let r;r=o?await o(i,e):new Wi(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()}))}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};Xs.constructorCache=new Map;var Hs=t("DEServiceUtil",Xs),Ys=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=dt(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new n("应用视图[".concat(t,"]不存在"));if((o.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=ge(r.appDataEntityId);o.srfkey&&(o[t]=o.srfkey,o.srfkey=void 0),0===a.srfuf&&(o[t]=void 0,delete a.srfuf)}if(r.redirectView){return Me(await ibiz.hub.getAppView(t),o,a,s)}const{openMode:c="INDEXVIEWTAB"}=r;switch(s.openMode||c){case"INDEXVIEWTAB":return s.noWaitRoute?(this.openIndexViewTab(r,o,a),{ok:!0}):this.openIndexViewTab(r,o,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,o,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,o,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,o,a);case"USER":return this.openUserCustom(r,o,a);default:return this.openIndexViewTab(r,o,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(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 n("气泡打开缺少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)}};Ys.TAG="ibiz.app-view.open";var qs=t("OpenAppViewCommand",Ys),Qs=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!o)throw new n("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:l}=o,d=e.clone();Object.assign(d,ie(r,a,e));const h=ie(c,a,e);switch(l){case"APPVIEW":return this.openAppView(o,d,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(o);case"PDTAPPFUNC":return this.openPdAppFunc(o,d,h);case"JAVASCRIPT":return this.executeJavaScript(o,d,h);case"CUSTOM":return this.custom(o,d,h);default:throw new i(o,"未支持的应用功能类型: ".concat(l))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new n("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(qs.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 n("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new n("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new n("未实现")}};Qs.TAG="ibiz.app-func.exec";var Js=t("AppFuncCommand",Qs);function $s(){new Js,new qs}var Zs=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new g({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new Oi(t.appId,"PSSysApp",t.codeName),this.deService=new Hs(t),this.codeList=new Ri(t),this.authority=new Ki(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),ibiz.env.enableMqtt&&ibiz.appData&&(this.mqtt=new Ks(ibiz.appData.mqtttopic,f(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.asyncAction.next(t)})),await this.mqtt.connect())}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))}}),to=class{parse(t){return t}},eo=class{constructor(){this.appMenu=new to}},ao=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 n("视图[".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}},io=class{constructor(){this.view=new ao}},so=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(so||{})),oo=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(oo||{})),no=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(no||{})),ro=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 n("错误的调用!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}}),co=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new ro(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),lo=t("CTXState",class{}),ho=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new J(3e3),this.controllersMap=new Map,this.state=new lo}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}}),po=t("ActivityCounter",class extends ro{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())}}),uo=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:o}=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(o))&&(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)}}),mo=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))))}}),go=t("QXEventEx",class extends J{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),o=await a,n=await s;return o.concat(...n)}reset(){super.reset(),st(this.anyEventFns)}}),fo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new go}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 wo(t){return window.location.hash.split("/").length>2*t+2}function Eo(t,e){return(!rt(t)&&""!==t||!rt(e)&&""!==e)&&t!==e}function yo(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof Bi&&(e=e.getOrigin()),e}function Io(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,o=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&o)"REG"===o.ruleType?i.push({pattern:new RegExp(o.regExCode),message:o.ruleInfo,trigger:"change blur"}):"SCRIPT"===o.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{je.execScriptFn({rule:t,value:e,callback:a,source:i},o.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:o,infoMessage:c}=Ke(t,s,r.groupCond);return o||i(new n(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function vo(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:o}=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)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),rt(o)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&ot(e)&&e<o))return!0;a(new Error("值必须大于等于".concat(o)))}}),e}var Do=t("ValueExUtil",class{static mergeDefault(t){return ut(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 n("缺少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 Co(t,e){var a;const{name:s,valueType:o,defaultValue:r,valueFormat:c}=t,{data:l,context:d,params:h}=e;if(rt(o)&&rt(r))return;if("RESET"===o)return null;const p=l[s];if(!mt(p)){if(!o&&r)return r;switch(o){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(d,r))return d[r];break;case"OPERATORNAME":return d.srfusername;case"OPERATOR":return d.srfuserid;case"CURTIME":return ft().format(c);case"PARAM":return l[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new n("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return Q();default:throw new i({},"默认值类型[".concat(o,"]未支持"))}}}var Ao="asyncimportdata2",bo="importdata2";async function Po(t,e,a){if(!ibiz.util.getExcelUtil)throw new n("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new n("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function To(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid),s="/jsonschema/".concat(i.name);return(await a.net.get(s)).data}var xo="__self",No=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 fo(this.getEventArgs.bind(this)),this.mountCounter=new po(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(xo),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(xo)||this.mountCounter.attend(xo)}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(){}}),So=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 n("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const o=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=o.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),o.splice(e,1))})),o.length)throw new n("没有找到".concat(o.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:o}=t;if(!o)throw new a(t,"未配置实体数据集");const n=await ibiz.hub.getApp(e.srfappid).deService.exec(s,o,e,i);return n.data.length?n.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:o,position:n,messageType:r}=a,{userTag:c,userTag2:l,userTag3:d,userTag4:h}=a;return{title:i,message:s,position:e||n,messageType:r,removeMode:o,extraParams:{userTag:c,userTag2:l,userTag3:d,userTag4:h}}}async calcDynaMsgs(e,i,s){const o=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:n,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:l,msgTypeAppDEFieldId:d,contentAppDEFieldId:h,msgPosAppDEFieldId:p}=o;if(!n)throw new a(o,"未配置应用实体");const u=await ibiz.hub.getAppDataEntity(n,i.srfappid),m={...s},g=this.getDeFieldName(u,r);g&&(m.sort="".concat(g,",asc"));const f=await t.fetchDataSet(o,i,m);if(!f.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(u,c),y=this.getDeFieldName(u,p),I=this.getDeFieldName(u,h),v=this.getDeFieldName(u,d),D=this.getDeFieldName(u,l);return f.map((t=>{const e={};return y&&!rt(t[y])&&(e.position=t[y]),E&&!rt(t[E])&&(e.title=t[E]),I&&!rt(t[I])&&(e.message=t[I]),v&&!rt(t[v])&&(e.messageType=t[v]),D&&!rt(t[D])&&(e.removeMode=t[D]),ct(w,e)}))}},Lo=t("ViewController",class extends No{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),l.create({},e),a||{},new ho(i)),this.session={},this.modal=new ra({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new co,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 Mi.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 Sa(t);this.providers[t.name]=e;const a=Te(this.model);a&&await Promise.all(a.map((async t=>{const e=await Sa(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(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===this.context.srfsessionid&&ibiz.uiDomainManager.destroy(this.context.srfsessionid),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)||lt(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 n("没有引擎支持预置界面行为".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 So(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))}}),Ro=(t("MobViewController",class extends Lo{}),t("WFStepTraceViewController",class extends Lo{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}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")}}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let o={};i&&t&&(o=ie(i,t,a,e));const n=Object.assign(e.clone(),o);let r={};return s&&t&&(r=ie(s,t,a,e)),{context:n,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}})),Oo=(t("CodeListEditorController",class extends Ro{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 No{constructor(t,e,a,i){if(super(t,l.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=de(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=dt(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 Sa(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 n,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),n=je.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();n=ibiz.i18n.t(e,""),n===e&&(n="")}if(!n&&(null==e?void 0:e.default)&&(n=e.default),!n&&(null==e?void 0:e.error)&&(n=n||e.error.message),n){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new o(n,r);ibiz.message.success(n,r,0===r)}}})),Mo=t("MDControlController",class extends Oo{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,o={...this.params};return a&&(o.page=e-1,o.size=a),!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),t&&Object.assign(o,t),o}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),o=await this.service.fetch(i,s);"number"==typeof o.total&&(this.state.total=o.total),a?this.state.items.push(...o.data):this.state.items=o.data,await this.afterLoad(t,o.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 n("未选中数据");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 o=ge(this.model.appDataEntityId);await ma(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[o]=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;y(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 n("无导入模型!");let o="DataImport";s.enableCustomized&&(o="DataImport2");const r=ibiz.overlay.createModal(o,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),_o=t("AppMenuController",class extends Oo{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 Ei(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=I(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new n("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const o=this.itemProviders[t];if(o&&o.onClick)return o.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(Js.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)}}),Vo=(t("AppMenuIconViewController",class extends _o{async onClickMenuItem(t,e){const i=I(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new n("找不到名为".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(Js.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends Gi{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 n("未找到日历项模型");const i=a[e];if(!i)throw new n("未找到日历项模型");return t.map((t=>new Vs(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 Mo{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Vo(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 ft(a).isAfter(i)?s=-1:ft(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:ft(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:ft(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,o={...this.params};if(!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),a&&(o.page=e-1,o.size=a),t&&Object.assign(o,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(o);Object.assign(o,t)}return o}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}});ft.extend(vt),ft.extend(Ct),ft.extend(bt),ft.extend(Tt),ft.extend(Nt);var Fo="$default_group",ko=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:o,userParam:n}=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||o,this.staticOptions=this.calcStaticOptions(),n&&(this.seriesUserParam=Xo(n))}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 o=new Us(e,this.model,a,i);t[i].get(a).chartData=o,null==(s=this.chartDataArr)||s.push(o)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=Fo;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 o=this.translateVal(i,t[this.catalogField],!0);if(o)e[s].get(o)||e[s].set(o,{value:0}),e[s].get(o).value=x(e[s].get(o).value,t[this.valueField]),e[s].get(o).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(o).value},o,s):this.prepareChartData(e,t,o,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!==Fo&&(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[Fo].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(dt(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=ft(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(ft(t[this.catalogField]).format("YYYY"),"-").concat(ft(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(ft(t[this.catalogField]).format("YYYY"),"-").concat(ft(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)=>ft(t).diff(ft(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,o]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(o,10)})));const o=new Map;s.forEach((t=>{o.set(t,i.get(t))})),t[a]=o}))}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(ft(e))}))}));const i=ft.max(a),s=ft.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("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,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("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,10);e++){const a=ft("".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)}},Wo=class extends ko{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}},Uo=class extends ko{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}},Bo=class extends ko{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}},zo=class extends ko{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}},Go=class extends ko{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}},jo=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})))}}},Ko=class extends ko{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new jo(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===Fo?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}};function Xo(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 Ho=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:o}=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)),o&&(this.chartUserParam=Xo(o))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new Wo(t,this);break;case"bar":e=new Uo(t,this);break;case"scatter":e=new Go(t,this);break;case"pie":e=new zo(t,this);break;case"funnel":e=new Bo(t,this);break;case"radar":e=new Ko(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,o={show:e,text:a,subtext:i,left:"center"},n=null==s?void 0:s.toLowerCase();return"left"===n||"right"===n?o.left=n:"bottom"!==n&&"top"!==n||(o.top=n),o}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 o={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&&(o=gt(o,Xo(s))),e.push(o)})),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 o=e.length-1;for(let t=i;t<=o;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 n("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},Yo=t("ChartService",class extends Gi{}),qo=(t("ChartController",class extends Mo{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Yo(this.model),await this.service.init(this.context),this.generator=new Ho(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 n("chart对象没有正确初始化");if(!this.options)throw new n("options还没计算");this.chart.setOption(this.options),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 Oo{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)}}),Qo=class{};function Jo(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(n){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);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=dt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}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 $o=class extends Qo{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 o=Jo(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(o,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=Jo(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return Fe(o,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o,this.op,this.value)}}},Zo=class t extends Qo{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new $o(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 o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},tn=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 Zo(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))}}},en=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new tn(t)))}},an=class extends en{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},sn=class extends en{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:o}=t;if(!e)throw new a(this.model,"未配置界面行为");let n=[s];if(i){const e=t.params[i];n=e instanceof Array?e:[e]}await Tn.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:n},this.model.appId)}},on=class extends en{async exec(t){}},nn=class extends en{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))}}},rn=class extends en{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 n("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const o=Jo(e,t);if(s)try{je.execScriptFn({srcVal:o,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]=o}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=Jo(e,t);e.params[a]=dt(i)}bindParam(t,e){const a=Jo(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:o}=t,n=Jo(e,t),r=i||0,c=s||0,l=o||n.length;e.params[a].splice(r,0,...n.slice(c,l))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i;e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},cn=class extends en{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 o=t.params[s];if(!o)throw new n("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new n("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new n("没有找到调用方法".concat(e));await r[e](o)}},ln=class extends en{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Jo(t,this.model);t.params[e]=s}},dn=class extends en{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:o}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:n}=this.model,{message:r}=this.model;if(o){const e=t.params[o];e.title&&(n=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:n||"消息",desc:r};let l=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,l=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,l=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const d=await ibiz.modal.confirm(c);t.setLastReturn(l[d?0:1])}},hn=class extends en{async exec(t){const e=await Ja(this.model);e&&await e.exec(this.model,t)}},pn=class extends en{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];console.log("逻辑节点".concat(i,"操作参数值:"),s)}},un=class extends en{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},mn=class extends en{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=Jo(t,this.model);t.params[e]=dt(s)}},gn=class extends en{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=Jo(t,this.model),c=s||0,l=o||0,d=n||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},fn=class extends en{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s;t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},wn=class extends en{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},En=class extends en{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,n);c.ok&&(t.params[o]=c.data)}},yn=class extends en{async exec(t){const{errorInfo:e}=this.model;throw new n(e)}},In=class extends en{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 o=t.params[s];if(!o)throw new n("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new n("没有找到事件参数对象".concat(i));await o.evt.emit(e,r)}},vn=class extends en{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=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 n("没有找到传入参数".concat(s));const c=await vs(e,i,t.context,r,t.params);o&&(t.params[o]=c)}},Dn=class extends en{async exec(t){console.log(t),je.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Cn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:o,params:n,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]=o;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]=n;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]={}}}},An=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 on(t);break;case"END":a=new nn(t);break;case"DEACTION":a=new an(t);break;case"DEUIACTION":a=new sn(t);break;case"PREPAREJSPARAM":a=new rn(t);break;case"RESETPARAM":a=new un(t);break;case"COPYPARAM":a=new mn(t);break;case"BINDPARAM":a=new ln(t);break;case"VIEWCTRLINVOKE":a=new cn(t);break;case"MSGBOX":a=new dn(t);break;case"DEBUGPARAM":a=new pn(t);break;case"APPENDPARAM":a=new gn(t);break;case"SORTPARAM":a=new fn(t);break;case"RENEWPARAM":a=new wn(t);break;case"DEDATASET":a=new En(t);break;case"THROWEXCEPTION":a=new yn(t);break;case"VIEWCTRLFIREEVENT":a=new In(t);break;case"DELOGIC":a=new vn(t);break;case"PFPLUGIN":a=new hn(t);break;case"RAWJSCODE":a=new Dn(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 Cn(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 qo(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}}},bn=new Map;async function Pn(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new n("找不到实体".concat(e,"的界面逻辑").concat(t));bn.has(s)||bn.set(s,new An(s));const o=bn.get(s);return await o.exec(a),null}var Tn=t("UIActionUtil",class{static async exec(t,e,a){const i=await Ie(t,a);if(!i)throw new n("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await qa(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const o=await this.exec(t,e,a);if(o.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(o.refresh)switch(o.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")}}}),xn=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:o,uilogicAttachMode:n}=t;if("REPLACE"===n){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Pn(s,o,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 Pn(s,o,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 Tn.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const o=ge(t.appDataEntityId),n=(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=o&&a.length>0?a.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=o?[{[n]:t.srfkey||t[n]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(o&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||o,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const l=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,d=ie(c,l?ne(c,a):a[0]||{},i,e);Object.assign(r,d);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:ie(h,l?ne(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:o,cmlanguageRes:n,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=o,s=n;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})}}}),Nn=t("BackendUIActionProvider",class extends xn{async execAction(t,e){const{context:i,params:s,data:o,event:n}=e,r={},c=t.appDataEntityId,l=t.appDEMethodId;if(!c||!l)throw new a(t,"未配置实体或实体行为");const{resultContext:d,resultParams:h,resultData:p}=await this.handleParams(t,i,o,s),u={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(qs.TAG,m,d,h,{event:n});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===p.length&&p.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));p.forEach((t=>{t.srfactionparam=e}))}}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),f=p.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,u))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await g.deService.exec(c,l,d,w?f:f[0],u);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:d,nextParams:u}),r}}),Sn=t("SysUIActionProvider",class extends xn{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)||{}}}),Ln=t("FrontUIActionProvider",class extends xn{async execAction(t,e){const{context:s,params:o,data:n,event:r,noWaitRoute:c}=e;let l={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=v.fill(t.htmlPageUrl,s,null==n?void 0:n[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:d}=await this.handleParams(t,s,n,o),h=await ibiz.commands.execute(qs.TAG,e,i,d,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(l.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(l.data=h.data,l.nextContext=i,l.nextParams={...o,...d});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":l=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":l=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return l}doOther(t,e){const{scriptCode:i}=t,{context:s,params:o,data:n,event:r,view:c}=e;if(i){return je.execScriptFn({context:s,params:o,data:n,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:o,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),l=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!l)throw new n("没有找到实体打印项");{let t="";if(!o||!o[c.codeName.toLowerCase()])throw new n("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(o[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:l.codeName,...r}});if(!e.ok)throw new n("打印失败");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 i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),s=null==(a=i.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let o="DataImport";if(s&&s.enableCustomized&&(o="DataImport2"),s){const t=ibiz.overlay.createModal(o,{dismiss:()=>t.dismiss(),appDataEntity:i,dataImport:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new n("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=o.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new n("没有找到实体导出项");{const t="/".concat(null==(i=o.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 n("导出请求失败");{let t="".concat(o.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)}}}}),Rn=t("WFWithdrawUIActionProvider",class extends xn{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}}}),On=class extends xn{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function Mn(){const t=new Ln;Ha("FRONT",(()=>t));const e=new Nn;Ha("BACKEND",(()=>e));const a=new Sn;Ha("SYS",(()=>a));const i=new Rn;Ha("DEUIACTION_WFWithdraw",(()=>i));const s=new On;Ha("SYS_Logout",(()=>s))}var _n=t("ToolbarController",class extends Oo{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new mo,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 n("没有找到界面行为模型".concat(i));const o=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;o&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],o=this.getEventArgs();o.params=Object.assign(a,o.params),await Tn.execAndResolved(i,{...o,data:s,event:e},t.appId)}finally{o&&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 uo(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 Bi&&(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)}}),Vn=t("ContextMenuController",class extends _n{}),Fn=(t("DashboardController",class extends Oo{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=yo(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 Ka(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 ma(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 Oi(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}})),kn=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 Fn}onDataChange(t){let e=t.data[0];e&&e instanceof Bi&&(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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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 Tn.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)}}),Wn=(t("ContainerPortletController",class extends kn{}),t("ViewPortletController",class extends kn{}),t("MenuPortletController",class extends kn{}),t("ChartPortletController",class extends kn{}),t("ActionBarPortletController",class extends kn{}),t("HtmlPortletController",class extends kn{}),t("ListPortletController",class extends kn{}),t("RawItemPortletController",class extends kn{}),t("DataViewControlService",class extends Gi{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 _s(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new _s(e,e);this.dataUIMap.set(e,i)}))}})),Un=t("DataViewControlController",class extends Mo{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 Wn(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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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 Bi&&(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 mo,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 uo(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 Tn.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 o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};Tn.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 Tn.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,o=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:n}=t;if(t.capLanguageRes&&(n=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:n,key:t.appDEFieldId};o&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),Bn=t("ExpBarControlController",class extends Oo{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&&wo(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:o,navigateContexts:n,navigateParams:r,appDataEntityId:c}=t,l={deName:c?ge(c):void 0,navFilter:o,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:n,navParams:r},d={context:a,params:i,data:e},{resultContext:h,resultParams:p}=re(l,d),u=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:u,params:{...p}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new n("多节点视图由子类实现")}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())}}),zn=(t("CalendarExpBarController",class extends Bn{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 Bn{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,o=this.getNodeModel(t._nodeId);if(!o)throw new n("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(o,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:o.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 Bn{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:o,params:n}=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,o),c=ie(s,e,i,n);return{context:Object.assign(o.clone(),r),params:c}}}return{context:o,params:n}}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 o=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:o.context,params:o.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends Oo{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 Bi,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await ma(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,a=void 0){await Promise.all(t.map((async t=>{const i=await Va(t);if(!i)return;e.providers[t.id]=i;const s=await i.createController(t,e,a);if(e.details[t.id]=s,"FORMITEM"===t.detailType&&e.formItems.push(s),"MDCTRL"===t.detailType&&e.formMDCtrls.push(s),Pe(t))return;const o=be(t);o.length&&await this.initDetailControllers(o,e,s)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Eo(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)}})),Gn=class extends zi{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:o,createDV:n,updateDVT:r,updateDV:c,valueFormat:l}=s,d="create"===i?o:r,h="create"===i?n:c,p=s.id.toLowerCase(),u=Co({name:p,valueType:d,defaultValue:h,valueFormat:l},{data:t,context:e,params:a});void 0!==u&&(t[p]=u)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},jn=t("SearchFormService",class extends Gn{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 _s(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}}),Kn=(t("SearchFormController",class extends zn{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Oi(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 jn(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,o="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],o=e,!0))),i&&i.length>0){const n=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(n.push(t),s(t))})),n.length<i.length&&(t[o]=n)}};(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 n("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new n("没有找到保存的搜索条件");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)})}})),Xn=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Xn||{})),Hn=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Hn||{})),Yn=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 Kn(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=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){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),qn=t("FormButtonState",class extends Kn{constructor(){super(...arguments),this.loading=!1}}),Qn=(t("FormButtonController",class extends Yn{createState(){var t;return new qn(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 Tn.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 Kn{constructor(){super(...arguments),this.showMask=!1}})),Jn=(t("FormDRUIPartController",class extends Yn{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Qn(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 Kn{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),$n=t("FormGroupPanelController",class extends Yn{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 Jn(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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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 Tn.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Zn=t("FormItemState",class extends Kn{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)})}}),tr=(t("FormItemController",class extends Yn{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new Zn(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 Oa(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ca(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Io(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...vo(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"})}setDefaultValue(t,e=this.data){const{createDVT:a,createDV:i,updateDVT:s,updateDV:o}=this.model,n=t?a:s,r=t?i:o,c=Co({name:this.name,valueType:n,defaultValue:r,valueFormat:this.model.valueFormat},{data:e,context:this.context,params:this.params});void 0!==c&&(e[this.name]=c)}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 Yn{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}})),er=(t("FormMDCtrlMDController",class extends tr{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 Sa(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 Kn{}),ar=(t("FormMDCtrlFormController",class extends tr{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new er(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 Sa(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 n("没有找到对应".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 tr{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=dt(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 Jn{})),ir=(t("FormPageController",class extends $n{createState(){var t;return new ar(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Kn{})),sr=(t("FormRawItemController",class extends Yn{createState(){var t;return new ir(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Kn{})),or=(t("FormTabPageController",class extends Yn{createState(){var t;return new sr(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPanelState",class extends Kn{})),nr=(t("FormTabPanelController",class extends Yn{createState(){var t;return new or(null==(t=this.parent)?void 0:t.state)}}),t("EditFormService",class extends Gn{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 Bi?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return o=this.handleResponse(o),o}async update(t,e){var a;const i=e instanceof Bi?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return o=this.handleResponse(o),o}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 o=await this.exec(s,t,e instanceof Bi?e.getOrigin():e);return o=this.handleResponse(o),o}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 Bi?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let o="";o=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(o,t,e,a instanceof Bi?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 o;o=s?new _s(i,s,{isOriginField:!0,dataType:a.dataType}):new _s(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,o)}}),{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}})),rr=(t("EditFormController",class extends zn{constructor(){super(...arguments),this.oldData=new Bi}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new nr(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=dt(this.context),e=dt(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=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(!fe(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=dt(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 n("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],o=0===s.srfuf;let r;try{r=o?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(o?"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(o?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(this.data.$origin,o?"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 Bi,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 n("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:o,scriptCode:r,showBusyIndicator:c}=a,l=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),o&&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==l?void 0:l.length)&&await Promise.all(l.map((e=>this.setDataValue(e,t[e])))),await P(2e3)}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new n("请检查表单填写!");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 n("请检查表单填写!");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 Bi(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})}})),cr=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}}))}}),lr=t("GridService",class extends Gi{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 o;if(s){const n=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));o=new _s(i,n,{isOriginField:!0,dataType:r.dataType})}else o=new _s(i,i);this.dataUIMap.set(i,o)}))}}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}}),dr={string:25,number:6,integer:9,date:5};var hr=t("GridController",class extends Mo{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 lr(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 To(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 o={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[],r=[];return s.forEach((t=>{n.push({appId:e.model.appId,appDEFieldId:o[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:o[t.key],id:t.key,valueType:"SIMPLE",dataType:dr[t.type]})})),{degridColumns:n,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=dt(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 o=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==o&&0!==o){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(o,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 ma(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new cr(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(),o=ibiz.hub.getApp(this.context.srfappid),n=await o.deService.exec(e,i,this.context,void 0,s);n.data.length&&([this.state.remoteAggResult]=n.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 n("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let o;Object.assign(i,s);try{o=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=o.data;T(r,s),this.state.items.unshift(r);const c=new cr(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 n("行数据不存在");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 n("行数据校验不通过,保存取消");let i;const s=ge(this.model.appDataEntityId),o=this.context.clone();o[s]=t.srfkey;try{i=e?await this.service.create(o,t):await this.service.update(o,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 ma(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await Wa(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(){r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,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)||Eo(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 ma(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 n("当前表格不支持行编辑,无法切换开启行编辑");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 n("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=dt(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 n("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:o,customCode:r,scriptCode:c}=i,l=o.map((t=>t.id));let d;if(r&&c)d=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);d=a.data}d&&(null==l?void 0:l.length)&&await Promise.all(l.map((e=>this.setRowValue(t,e,d[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=dt(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 o=(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:o}=t.params,n="customPage"===i?{page:0,offset:(a-1)*e,size:(o-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:n})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new n("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await Po(s,o,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:o,updateDV:n,updateDVT:r}=i.editItem,c=e?o:r,l=e?s:n,d=Co({name:i.fieldName,valueType:c,defaultValue:l,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==d&&(a[i.fieldName]=d)})),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}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:(this.state.columnStates=[],this.initColumnStates())}}),pr=t("GridFieldColumnController",class extends rr{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}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 mo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new uo(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.model.codeName];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:o}=le(i);let n={};s&&t&&(n=ie(s,t,a,e));const r=Object.assign(e.clone(),n);let c={};o&&t&&(c=ie(o,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:o}=this.model;if(!o)return;const n=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...n}),c=dt(this.params),{context:l,params:d}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(qs.TAG,o,l,d,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await Tn.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:o}=this.model;if(rt(a)||"NONE"===a)return;const n=e||this.model.id;let r;if(t=t.filter((t=>!rt(t[n]))),"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[n])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[n])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[n])));break;case"MIN":r=Math.min(...t.map((t=>t[n])));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&&o&&(c+=o),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Do.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(d.isDate(this.dataType)){const t=ft(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 Tn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),ur=(t("GridUAColumnController",class extends rr{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 mo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new uo(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 Tn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends pr{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}get fieldName(){return this.model.dataItemName}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 Oa(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ca(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Io(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...vo(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 n("".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 rr{}),t("ListService",class extends Gi{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 _s(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new _s(e,e);this.dataUIMap.set(e,i)}))}})),mr=(t("ListController",class extends Mo{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 ur(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),o=await s.codeList.get(e,this.context,this.params),n=[];o.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),n.push(e.value)}));const r=a.filter((e=>-1===n.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends Oo{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 o=await za(t);if(!o)return;e.providers[t.id]=o;const n=await o.createController(t,e,a);e.panelItems[t.id]=n,(null==(i=t.panelItems)?void 0:i.length)&&!n.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,n),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,n)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new n("未获取到面板数据");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 Ws(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)}})),gr=(t("ViewLayoutPanelController",class extends mr{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)})}})),fr=(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 gr(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=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 Oo{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"]),wr=t("SearchBarFilterController",class{constructor(t,e){var a;let i;this.model=t,this.searchBar=e,this.noEditor=!1,t.appDEFieldId&&(i=ye(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?fr.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 Oa(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Er=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=await this.app.net.post("".concat(this.themeUrl,"/fetch_default"),{app_view_tag:this.viewTag,sort:"create_time,asc"});return t.ok&&(t.data=this.convertBackDataToFront(t.data)),t}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag});return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag})}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:t,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{id:t,theme_model:JSON.stringify(e),app_view_tag:this.viewTag,show:e.show})}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.name&&(e.caption=t.name),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={appId:t.appId,app_view_tag:this.viewTag,id:t.id};return t.caption&&(e.name=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}))}},yr={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"]},Ir={};Object.keys(yr).forEach((t=>{yr[t].forEach((e=>{if(fr.includes(e))return;const a="".concat(t,"_").concat(e);Ir[a]||("date"!==t||["IN","NOTIN"].includes(e)?Ir[a]={appId:"",editorType:"TEXTBOX",id:a}:Ir[a]={appId:"",editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends Oo{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.enableFilter=!0===this.model.enableFilter}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.initFilterState()}initFilterState(){this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){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 Er(this.model,this.view.model.codeName),await this.service.init(this.context)),await this.initByEntitySchema(),await this.initSearchBarFilters(),await this.initSearBarGroups()}async initByEntitySchema(){var t;this.enableFilter=!0;const e=await To(this.appDataEntity.id,this.context);if(!e)return;const a=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})}));const o={};null==(a=e.appDataEntity.appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[];return s.forEach((t=>{const e=yr[t.type];e?e.forEach((e=>{const a=Ir["".concat(t.type,"_").concat(e)];n.push({appId:"",appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:"",valueOP:e},editor:a})})):ibiz.log.error("未支持的类型",t.type)})),n}(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.push(...i),this.searchBarFilters=a}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){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 wr(t,this);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.model.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 n("无效的condtype:".concat(t.condtype))}getOriginFilterNodes(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}async initSearBarGroups(){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={...t,saved:!1,show:!0,searchGroupData:{},order:100*(e+1)};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 a})));const t=await this.service.fetch();t.ok&&t.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.id===t.id));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({appId:this.context.srfappid,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)}))}}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.id,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.id===e.data.id));t&&(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 Oo{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&&wo(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:o}=t,n={deName:ge(o),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:l}=re(n,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...l}}}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 vr=t("TreeService",class extends Gi{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 ma(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=ve(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,n)];break;case"DE":r=await this.getDENodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{var a;if(l&&(!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 Ms(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:o,parentFilter:n,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,l={...a.params},d={...a.context,...(null==e?void 0:e._context)||{}};let h,p,u,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&&(u=ge(t.appDataEntityId)),p=h._value}const{resultContext:g,resultParams:f}=re({deName:u,navFilter:n?"n_".concat(n.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:o,navContexts:s},{derValue:p,context:d,params:l,data:m});return Object.assign(d,g),Object.assign(l,f),{context:d,params:l,navContext:g,navParams:f}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:l}=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 d=await this.app.deService.exec(o,s,n,r);if(d.data.length){return d.data.map((e=>new Os(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:l})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,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,o);if(c.length){return c.map((e=>new Rs(t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}}),Dr=t("TreeController",class extends Mo{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(),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 Vn(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async initService(){this.service=new vr(this.model),await this.service.init(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(),o=this.parseTreeNodeData(e),n=await Tn.exec(t,{...s,...o,event:a},i);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){return{data:[{...t,...t._deData||{}}],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,o=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:o})}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 o=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,o.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,o.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,o,n;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),l="inner"===i?e:e._parent,d=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(o=e._parent)?void 0:o._id)!==(null==(n=t._parent)?void 0:n._id)){const e=this.findDropNodeRS(l._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=l._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const p=t._parent._children;if(p.splice(p.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=l._children.indexOf(e);"next"===i&&(a+=1),l._children.splice(a,0,t)}("inner"===i||d)&&(t._parent=l,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([l]));const{sortAppDEFieldId:u,sortDir:m,allowOrder:g}=h;if(!0===g){if(!u)throw new a(h,"缺少配置排序属性");const e=u.toLowerCase(),i="ASC"===m,s=[...l._children];i||s.reverse();const o=t=>t+(100-t%100),n=t=>t[e]||0;let c;s.forEach(((a,i)=>{const l=a._deData;void 0===c?a===t&&(c=0===i?100:o(n(s[i-1]._deData)),l[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=n(l)&&(l[e]=o(c),r.push(a)),c=n(l))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:d})}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),o=this.context.clone();o[s]=i.srfkey;const n=await e.deService.exec(a.appDataEntityId,"update",o,i);n.data&&(t._deData=n.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if(!t._deData)throw new n("不是实体树节点数据");t._text=e,t._deData[i.textAppDEFieldId]=e,await this.updateDeNodeData([t])}}),Cr=t("WizardPanelService",class extends zi{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}}),Ar=(t("WizardPanelController",class extends Oo{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()),o=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),n=null==o?void 0:o.stepTag;this.stepTags[s]=n})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Cr(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 Sa(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 n("找不到".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 n("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new n("找不到标识为".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 n("没有上一个表单");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 n("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new n("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends Gi{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 _s(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new _s(e,e);this.dataUIMap.set(e,i)}))}})),br=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Pr=(t("MDCtrlController",class extends Mo{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 Ar(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 br(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 br(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 Tn.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 mo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new uo(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 br(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 br(e,this))}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}}),t("KanbanService",class extends Wn{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}})),Tr=(t("KanbanController",class extends Un{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new Pr(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 n("".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},o=t.uiactionId;await Tn.execAndResolved(o,{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 n("看板部件必须开启分组");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 o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=o}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:o}=t,n=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],l=this.state.groups.find((t=>t.key===a)),d=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=l.children[s];return e[n]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),p=[...d.children],u=[...d.children],m=l.children[s];t.from!==t.to?(m[n]=t.to,u.splice(o,0,m)):(u.splice(s,1),u.splice(o,0,m));const g=l.children.splice(s,1);let f;d.children.splice(o,0,...g),e||(p.reverse(),u.reverse());let w,E=[];u.forEach(((t,e)=>{void 0===f?t!==p[e]&&(f=p[e]?p[e][r]||100:0===e?100:h(p[e-1][r]),t[r]=f,c.push(t)):(f>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),f=w,w=0,E=[]),t[r]=h(f),c.push(t)):(0===E.length&&(w=f),E.push(t)),f=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 vr{})),xr=t("TreeGridExRowState",class{constructor(t,e){this.uaColStates={},this.data=t,Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)}))}}),Nr=t("TreeGridExController",class extends Dr{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={}}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new Tr(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 gi(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 xr(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))}))}}),Sr=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(){}}),Lr=(t("TreeGridExFieldColumnController",class extends Sr{}),t("TreeGridExUAColumnController",class extends Sr{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 mo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new uo(t.id,this.treeGrid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await Tn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}}),t("TreeGridController",class extends hr{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 lr{}),t("MEditViewPanelService",class extends Gi{})),Rr=(t("MEditViewPanelController",class extends Mo{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new Lr(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 n("编辑视图面板部件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 Gi{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:o,appDEDataSetId:n,customCond:r}=s,c=t.clone(),l={...e};if(r){const a=je.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=le(a);i&&Object.assign(c,ie(i,e,t)),s&&Object.assign(l,ie(i,e,t))}}const d=await a.deService.exec(o,n,c,l);d.data&&i.push(...d.data.map((t=>new ks(t,s))))})))}return new u(i,200)}})),Or=(t("MapController",class extends Mo{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new Rr(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 zi{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}})),Mr=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},_r=class extends Mr{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)}},Vr=class extends Mr{},Fr=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new _r(t);case"USER2":return new Vr(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},kr=(t("ReportPanelController",class extends Oo{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=Fr.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new Or(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 vr{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 ma(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=ve(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,n)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{if(l&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new zs(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:l}=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 d=await this.app.deService.exec(o,s,n,r);if(d.data.length){return d.data.map((e=>new Gs(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:l})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,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,o);if(c.length){return c.map((e=>new js(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}})),Wr=(t("GanttController",class extends Nr{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new kr(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 o=this.getNodeModel(s._nodeId);if(o){const i=a?this.transformNodeDataItem(o,e):e;if(Object.keys(i).length>0){const e=ge(o.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(o.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}})),Ur=class{constructor(){this.convert=new eo,this.controller=new Wr,this.appMap=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new io,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){const a=this.calcAppViewId(t);this.view2appMap.set(a,e)}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 n("视图[".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 n("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new n("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new Zs(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Oi(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()):[]}reset(){this.appMap.clear(),this.configCache=void 0}},Br=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),o=this.viewEngines.get(s);if(o)return o(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),zr=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:o}=this.view;if(!1===o.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 n("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),o=await s.deService.exec(t,"get",a,i),{data:r}=o;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Gr=(t("MDViewEngine",class extends zr{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.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:o}=t,n=(t.context||this.view.context).clone(),r=t.params||this.view.params;n[((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:n,params:r,data:s,event:o,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:o,event:n,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=dt(this.view.params);r&&(c.srfcopymode=r);const l=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:o,event:n,view:this.view}));if(-1===l)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!l.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 da,this.text=new la,this.hbs=new ee,this.rawValue=new ua,this.action=Tn,this.error=new Ot,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)}}),jr=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new n("Method not implemented.")}destroy(){}},Kr=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)}},Xr=class extends jr{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)}},Hr=class extends jr{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Pn(e,i,t)}},Yr=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()),ut(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)}},qr=class extends Yr{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Qr=class extends Yr{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Jr=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)}},$r=class{constructor(){this.executorFactory=new Kr,this.triggerFactory=new Jr}createViewScheduler(t){return new Qr(t)}createControlScheduler(t){return new qr(t)}},Zr=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 n("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},tc=class extends Zr{},ec=class extends Zr{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new n("预定义逻辑类型".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)}},ac=class extends Zr{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 n("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},ic=class extends jr{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,...o}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new n("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const d=c.navigateContexts||[],h=Object.assign(i,ie(d,r[0],s,i));let p={};const u=c.navigateParams;return H(u)&&(p=ie(u,r[0],s,i)),ibiz.commands.execute(qs.TAG,l,h,p,o)}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:o}=e,r=o[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,l=null==c?void 0:c.find((t=>t.refMode===r));if(!l)throw new n("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return l}async executeNewDataAppUILogic(t,e){const{context:s,params:o,...n}=e,{data:r,view:c}=e,{enableWizardAdd:l,enableBatchAdd:d,batchAddOnly:h,newDataAppView:p}=t;let u;if(l){if(u=await this.getWizardNewViewRef(t,e),!u)return{ok:!1}}else if(d){const e=ge(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(u=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!u)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(u=p,!u||!u.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},g={};const f=(null==r?void 0:r[0])||{},w=u.navigateContexts;H(w)&&(m=ie(w,f,o,s)),m=Object.assign(s,m);const E=u.navigateParams;if(H(E)&&(g=ie(E,f,o,s)),o.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const y=await ibiz.commands.execute(qs.TAG,u.refAppViewId,m,g,n);return d&&y.data&&await this.doBatchAdd(t,y.data,s,u),y}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:o}=t,{context:r,params:c,...l}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const d=await ibiz.commands.execute(qs.TAG,s.refAppViewId,r,c,{...l,openMode:"POPUPMODAL"});if(!d.ok)return;const h=null==(i=d.data)?void 0:i[0];if(!h)throw new n("请选中一条数据");const p=h.srfkey,u=null==o?void 0:o.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===p.toUpperCase()}));if(!u)throw new n("没有找到与索引类型".concat(p,"相关的实体的编辑视图"));return u}async doBatchAdd(t,e,i,s){var o;if(null==e?void 0:e.length){const n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),r=n.minorAppDERSs,c=s.refMode.toLowerCase();if(!r)throw new a(n,"实体没有从关系集合!");let l;null==r||r.forEach((t=>{const e=ge(t.majorAppDataEntityId);c===e&&(l=t.parentAppDEFieldId)}));const d=null==(o=s.navigateParams)?void 0:o.find((t=>"keymapping"===t.key));let h=[];if(d){const t=d.value.split(";"),a={};for(const e of t){const[t,i]=e.split(":");t&&i&&(a[t]=i)}h=e.map((t=>{const e={[l]:t.srfkey};for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)){const s=a[i];Object.prototype.hasOwnProperty.call(t,i)&&(e[s]=t[i])}return e}))}else h=e.map((t=>({[l]:t.srfkey})));const p=ibiz.hub.getApp(i.srfappid).deService;await p.exec(n.id,"Create",i,h)}}},sc=class extends Zr{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>sa[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},oc=class extends Zr{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>na[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},nc=class extends jr{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");Tn.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}})}}}));
|