@ibiz-template/runtime 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/index.esm.js +112 -39
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  5. package/out/controller/common/control/md-control.controller.js +25 -26
  6. package/out/engine/md-view.engine.d.ts +2 -0
  7. package/out/engine/md-view.engine.d.ts.map +1 -1
  8. package/out/engine/md-view.engine.js +4 -3
  9. package/out/interface/controller/controller/control/i-calendar-exp-bar.controller.d.ts +15 -0
  10. package/out/interface/controller/controller/control/i-calendar-exp-bar.controller.d.ts.map +1 -0
  11. package/out/interface/controller/controller/control/i-calendar-exp-bar.controller.js +1 -0
  12. package/out/interface/controller/controller/control/i-calendar.controller.d.ts +24 -0
  13. package/out/interface/controller/controller/control/i-calendar.controller.d.ts.map +1 -0
  14. package/out/interface/controller/controller/control/i-calendar.controller.js +1 -0
  15. package/out/interface/controller/controller/control/i-tree-exp-bar.controller.d.ts +1 -1
  16. package/out/interface/controller/controller/control/i-tree-exp-bar.controller.d.ts.map +1 -1
  17. package/out/interface/controller/controller/control/i-tree.controller.d.ts +0 -10
  18. package/out/interface/controller/controller/control/i-tree.controller.d.ts.map +1 -1
  19. package/out/interface/controller/controller/control/index.d.ts +2 -0
  20. package/out/interface/controller/controller/control/index.d.ts.map +1 -1
  21. package/out/interface/controller/controller/control/index.js +2 -0
  22. package/out/interface/controller/event/control/i-calendar-exp-bar.event.d.ts +11 -0
  23. package/out/interface/controller/event/control/i-calendar-exp-bar.event.d.ts.map +1 -0
  24. package/out/interface/controller/event/control/i-calendar-exp-bar.event.js +1 -0
  25. package/out/interface/controller/event/control/i-calendar.event.d.ts +11 -0
  26. package/out/interface/controller/event/control/i-calendar.event.d.ts.map +1 -0
  27. package/out/interface/controller/event/control/i-calendar.event.js +1 -0
  28. package/out/interface/controller/event/control/i-tree.event.d.ts +19 -1
  29. package/out/interface/controller/event/control/i-tree.event.d.ts.map +1 -1
  30. package/out/interface/controller/event/control/index.d.ts +2 -0
  31. package/out/interface/controller/event/control/index.d.ts.map +1 -1
  32. package/out/interface/controller/event/control/index.js +2 -0
  33. package/out/interface/controller/event/view/i-calendar-exp-view.event.d.ts +11 -0
  34. package/out/interface/controller/event/view/i-calendar-exp-view.event.d.ts.map +1 -0
  35. package/out/interface/controller/event/view/i-calendar-exp-view.event.js +1 -0
  36. package/out/interface/controller/event/view/i-calendar-view.event.d.ts +12 -0
  37. package/out/interface/controller/event/view/i-calendar-view.event.d.ts.map +1 -0
  38. package/out/interface/controller/event/view/i-calendar-view.event.js +1 -0
  39. package/out/interface/controller/event/view/index.d.ts +2 -0
  40. package/out/interface/controller/event/view/index.d.ts.map +1 -1
  41. package/out/interface/controller/event/view/index.js +2 -0
  42. package/out/interface/controller/state/control/i-calendar-exp-bar.state.d.ts +11 -0
  43. package/out/interface/controller/state/control/i-calendar-exp-bar.state.d.ts.map +1 -0
  44. package/out/interface/controller/state/control/i-calendar-exp-bar.state.js +1 -0
  45. package/out/interface/controller/state/control/i-calendar.state.d.ts +162 -0
  46. package/out/interface/controller/state/control/i-calendar.state.d.ts.map +1 -0
  47. package/out/interface/controller/state/control/i-calendar.state.js +1 -0
  48. package/out/interface/controller/state/control/i-grid.state.d.ts +52 -0
  49. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  50. package/out/interface/controller/state/control/i-tree.state.d.ts +9 -2
  51. package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
  52. package/out/interface/controller/state/control/index.d.ts +2 -0
  53. package/out/interface/controller/state/control/index.d.ts.map +1 -1
  54. package/out/interface/controller/state/control/index.js +2 -0
  55. package/out/interface/controller/state/view/i-calendar-exp-view.state.d.ts +11 -0
  56. package/out/interface/controller/state/view/i-calendar-exp-view.state.d.ts.map +1 -0
  57. package/out/interface/controller/state/view/i-calendar-exp-view.state.js +1 -0
  58. package/out/interface/controller/state/view/i-calendar-view.state.d.ts +11 -0
  59. package/out/interface/controller/state/view/i-calendar-view.state.d.ts.map +1 -0
  60. package/out/interface/controller/state/view/i-calendar-view.state.js +1 -0
  61. package/out/interface/controller/state/view/index.d.ts +2 -0
  62. package/out/interface/controller/state/view/index.d.ts.map +1 -1
  63. package/out/interface/controller/state/view/index.js +2 -0
  64. package/out/model/layout/layout.d.ts.map +1 -1
  65. package/out/model/layout/layout.js +8 -2
  66. package/out/service/vo/calendar-item-data/calendar-item-data.d.ts +30 -0
  67. package/out/service/vo/calendar-item-data/calendar-item-data.d.ts.map +1 -0
  68. package/out/service/vo/calendar-item-data/calendar-item-data.js +76 -0
  69. package/out/service/vo/calendar-item-data/index.d.ts +2 -0
  70. package/out/service/vo/calendar-item-data/index.d.ts.map +1 -0
  71. package/out/service/vo/calendar-item-data/index.js +1 -0
  72. package/out/service/vo/index.d.ts +1 -0
  73. package/out/service/vo/index.d.ts.map +1 -1
  74. package/out/service/vo/index.js +1 -0
  75. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  76. package/out/utils/open-redirect-view/open-redirect-view.js +18 -16
  77. package/package.json +6 -6
  78. package/src/controller/common/control/md-control.controller.ts +28 -29
  79. package/src/engine/md-view.engine.ts +6 -3
  80. package/src/interface/controller/controller/control/i-calendar-exp-bar.controller.ts +19 -0
  81. package/src/interface/controller/controller/control/i-calendar.controller.ts +25 -0
  82. package/src/interface/controller/controller/control/i-tree-exp-bar.controller.ts +5 -1
  83. package/src/interface/controller/controller/control/i-tree.controller.ts +0 -11
  84. package/src/interface/controller/controller/control/index.ts +2 -0
  85. package/src/interface/controller/event/control/i-calendar-exp-bar.event.ts +10 -0
  86. package/src/interface/controller/event/control/i-calendar.event.ts +11 -0
  87. package/src/interface/controller/event/control/i-tree.event.ts +14 -1
  88. package/src/interface/controller/event/control/index.ts +2 -0
  89. package/src/interface/controller/event/view/i-calendar-exp-view.event.ts +11 -0
  90. package/src/interface/controller/event/view/i-calendar-view.event.ts +12 -0
  91. package/src/interface/controller/event/view/index.ts +2 -0
  92. package/src/interface/controller/state/control/i-calendar-exp-bar.state.ts +10 -0
  93. package/src/interface/controller/state/control/i-calendar.state.ts +172 -0
  94. package/src/interface/controller/state/control/i-grid.state.ts +58 -0
  95. package/src/interface/controller/state/control/i-tree.state.ts +10 -2
  96. package/src/interface/controller/state/control/index.ts +2 -0
  97. package/src/interface/controller/state/view/i-calendar-exp-view.state.ts +10 -0
  98. package/src/interface/controller/state/view/i-calendar-view.state.ts +10 -0
  99. package/src/interface/controller/state/view/index.ts +2 -0
  100. package/src/model/layout/layout.ts +6 -2
  101. package/src/service/vo/calendar-item-data/calendar-item-data.ts +94 -0
  102. package/src/service/vo/calendar-item-data/index.ts +1 -0
  103. package/src/service/vo/index.ts +1 -0
  104. package/src/utils/open-redirect-view/open-redirect-view.ts +18 -16
@@ -1,2 +1,2 @@
1
- System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda"],(function(e){"use strict";var t,s,i,a,n,r,o,c,l,h,d,u,p,E,g,m,f,w,I,D,A,P,y,v,T,_,b,C,V,L;return{setters:[function(e){t=e.RuntimeError,s=e.RuntimeModelError,i=e.ModelError,a=e.IBizContext,n=e.HttpResponse,r=e.HttpError,o=e.Net,c=e.StringUtil,l=e.NOOP,h=e.isElementSame},function(e){d=e.isEmpty,u=e.isFunction},function(e){p=e.notNilEmpty,E=e.isNilOrEmpty,g=e.AsyncSeriesHook,m=e.QXEvent,f=e.createUUID,w=e.isArray,I=e.clearAll,D=e.ascSort,A=e.descSort},function(e){P=e.default},function(e){y=e.isNotNil,v=e.isNil,T=e.mergeRight,_=e.isEmpty,b=e.clone,C=e.equals,V=e.where,L=e.mergeLeft}],execute:function(){e({calcContentAlignStyle:function(e){const{valignSelf:t,halignSelf:s}=e,i={};if(t||s){switch(Object.assign(i,{display:"flex"}),t){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(s){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:$,calcDynaClass:function(e,t){return Ee.execScriptFn({data:t},e,{singleRowReturn:!0})},calcGridLayoutPos:function(e){const{layout:t,colXS:s,colXSOffset:i,colSM:a,colSMOffset:n,colMD:r,colMDOffset:o,colLG:c,colLGOffset:l}=e,h=(e,s)=>({span:(e&&-1!==e?e:"TABLE_24COL"===t?24:12)*("TABLE_24COL"===t?1:2),offset:s&&-1!==s?s:void 0});return{xs:h(s,i),sm:h(a,n),md:h(r,o),lg:h(c,l)}},calcLayoutHeightWidth:function(e){const{width:t,height:s,widthMode:i,heightMode:a}=e,n={width:"",height:""};"FULL"===i?n.width="100%":t&&t>0&&(n.width="".concat(t,"PERCENTAGE"===i?"%":"px"));"FULL"===a?n.height="100%":s&&s>0&&(n.height="".concat(s,"PERCENTAGE"===a?"%":"px"));return n},calcMainStateOPPrivsStrs:q,calcNavParams:function(e,t){const{deName:s,navFilter:i,pickupDEFName:a,navContexts:n,navParams:r}=e,{context:o,params:c,data:l,derValue:h}=t,d={},u={},p=h||l.srfkey;p&&(s&&(d[s]=p),i&&(u[i]=p),a&&(u["n_".concat(a.toLowerCase(),"_eq")]=p));const E=z(n,o,c,l),g=z(r,o,c,l);return Object.assign(d,E),Object.assign(u,g),{resultContext:d,resultParams:u}},calcResPath:Ke,calcRouteContext:function(e){let t=[];t=t.sort(((e,t)=>t.length-e.length));const[s]=t;if(s){const e={};return s.forEach((([t,s])=>{e[t]=s})),e}return{}},compare:ce,compareNumber:le,contains:he,convertNavData:z,convertNavDataByArray:G,convertNavDataByObject:j,convertObjectToNavParams:X,execDELogic:Dt,execDELogicAction:At,execDELogicById:async function(e,s,i,a,n){const r=await async function(e,t,s){const i=await ibiz.hub.getAppDataEntity(t,s);return Q(e,i)}(e,s,i.srfappid);if(!r)throw new t("".concat(s,"找不到实体逻辑").concat(e));return Dt(r,i,a,n)},execFieldLogics:Pt,execUILogic:ds,filterFieldLogics:J,filterValueRules:function(e,t){return e.filter((e=>{const{checkMode:s}=e,i=e.deformItemName||e.degridEditItemName;return 2!==s&&i===t}))},findChildFormDetails:function(e){let t;switch(e.detailType){case"TABPANEL":t=e.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":t=e.deformDetails}return t||[]},findDELogic:Q,findEditItem:function(e,t){var s;return null==(s=e.degridEditItems)?void 0:s.find((e=>e.codeName===t))},findFieldById:Z,findModelChild:H,formatMultiData:K,generateRules:function(e,s,i){const a=[];return e.forEach((e=>{const{valueRuleType:n}=e,r=e.sysValueRule,o=e.defvalueRule;if("SYSVALUERULE"===n&&r)"REG"===r.ruleType?a.push({pattern:new RegExp(r.regExCode),message:r.ruleInfo,trigger:"change blur"}):"SCRIPT"===r.ruleType&&a.push({validator:(e,t,s,i)=>{if(!t)return!0;try{Ee.execScriptFn({rule:e,value:t,callback:s,source:i},r.scriptCode)}catch(e){return console.error(e),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&o){const e=i||s;a.push({validator:(s,i,a,n)=>{if(E(n[e]))return!0;const{isPast:r,infoMessage:c}=ge(e,n,o.groupCond);return r||a(new t(c||o.ruleInfo)),!0},trigger:"change blur"})}})),a},getAppViewRef:function(e,t){var s,i;let a=e.appViewRefs||[];(null==(i=null==(s=e.viewLayoutPanel)?void 0:s.appViewRefs)?void 0:i.length)&&(a=a.concat(e.viewLayoutPanel.appViewRefs));return a.find((e=>e.name===t||e.id===t))},getChildNodeRSs:function(e,t){const s=t.parentId||te(e).id;return e.detreeNodeRSs.filter((e=>{return e.parentDETreeNodeId===s&&(i=e.searchMode,a=t.hasQuery,3===i||(a?1===i:2===i));var i,a}))},getControl:function(e,t){var s,i;let a=e.controls||[];(null==(i=null==(s=e.viewLayoutPanel)?void 0:s.controls)?void 0:i.length)&&(a=a.concat(e.viewLayoutPanel.controls));return a.find((e=>e.name===t||e.codeName===t||e.id===t))},getControlProvider:kt,getControlsByView:se,getDeACMode:async function(e,t,s){var i;const a=await ibiz.hub.getAppDataEntity(t,s);return null==(i=a.appDEACModes)?void 0:i.find((t=>t.id===e))},getEditorProvider:async function(e){let t;const{editorType:s,editorStyle:i}=e;if(i&&"DEFAULT"!==i){t=zt("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到编辑器类型:[".concat(s,"]的编辑器样式:[").concat(i,"]对应的适配器"),e)}t||(t=zt(s));t||ibiz.log.error("找不到编辑器类型".concat(s,"对应的适配器"));return t},getFormDetailProvider:async function(e){let t;const{detailType:s}=e;t||(i=s,t=ibiz.register.get("".concat(Gt,"_").concat(i)));var i;t||ibiz.log.error("找不到表单成员类型".concat(s,"对应的适配器"));return t},getGridColumnProvider:async function(e){let t;const{columnType:s,enableRowEdit:i}=e,a=i?"".concat(s,"_EDIT"):s;t||(t=function(e){return ibiz.register.get("".concat(jt,"_").concat(e))}(a));t||ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"));return t},getMatchResPath:Xe,getOriginData:function(e){let t=Array.isArray(e)?e[0]:e;t&&t instanceof _t&&(t=t.getOrigin());return t},getPanelItemProvider:async function(e){var t;let s;const{itemType:i}=e;if("CONTAINER"===i){const t=e.predefinedType||"DEFAULT";s=Kt("CONTAINER_".concat(t)),s||ibiz.log.error("找不到面板容器预置类型为".concat(t,"的适配器"))}if("RAWITEM"===i){const i=(null==(t=e.rawItem)?void 0:t.predefinedType)||"DEFAULT";s=Kt("RAWITEM_".concat(i)),s||ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器"))}s||(s=Kt(i));s||ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"));return s},getPortletProvider:async function(e){let t;const{portletType:s}=e;t||(i=s,t=ibiz.register.get("".concat(Jt,"_").concat(i)));var i;t||ibiz.log.error("找不到门户部件成员类型".concat(s,"对应的适配器"));return t},getRootNode:te,getTreeNode:function(e,t){return e.detreeNodes.find((e=>e.id===t))},getUIActionById:ee,getUIActionProvider:qt,getViewEngines:ae,getViewLogics:ie,getViewProvider:async function(e){let t;const{viewType:s,viewStyle:i}=e;if(i&&"DEFAULT"!==i){t=Qt("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到视图类型:[".concat(s,"]的视图样式:[").concat(i,"]对应的适配器"),e)}t||(t=Qt(s));t||(t=Qt("DEFAULT"));return t},getWFContext:function(e){const t={};e.param09&&(t.srfprocessinstanceid=e.param09);return t},getWFSubmitViewId:function(e,t){var s;const{type:i,sequenceFlowView:a,sequenceFlowMobView:n}=t,r=(null==(s=e.viewLayoutPanel)?void 0:s.appViewRefs)||e.appViewRefs,o=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:a),c=r.find((e=>e.name===o));return null==c?void 0:c.refAppViewId},hasDeCodeName:function(e,t){const s=$(t);return y(e[s])},install:function(){const{ibiz:e}=window;e.util=new St,e.hub=new Wt,e.register=new U,e.config=new k,e.auth=new Lt,e.engine=new Nt,Le(),ws(),ibiz.scheduler=new Ts,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("TIMER",((e,t)=>new Vs(e,t))),ibiz.scheduler.triggerFactory.register("CUSTOM",((e,t)=>new bs(e,t))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((e,t)=>new Rs(e,t))),ibiz.scheduler.executorFactory.register("SCRIPT",((e,t)=>new Ds(e,t))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((e,t)=>new As(e,t))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((e,t)=>new As(e,t))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((e,t)=>new Ls(e,t)))},installCommand:Le,isValueChange:function(e,t){if((v(e)||""===e)&&(v(t)||""===t))return!1;return e!==t},matchMainState:Y,openRedirectView:ne,parseUserParams:function(e){const t={},s={},i={};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const n=e[a];if(-1!==a.indexOf(".")){const e=a.split(".");switch(e[0]){case"SRFNAVPARAM":Object.assign(t,{[e[1]]:n});break;case"SRFNAVCTX":Object.assign(s,{[e[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:t,navigateParams:s,other:i}},presetUIActionProvider:ws,registerControlProvider:function(e,t){ibiz.register.register("".concat(Bt,"_").concat(e),t)},registerEditorProvider:function(e,t){ibiz.register.register("".concat(Ut,"_").concat(e),t)},registerFormDetailProvider:function(e,t){ibiz.register.register("".concat(Gt,"_").concat(e),t)},registerGridColumnProvider:function(e,t){ibiz.register.register("".concat(jt,"_").concat(e),t)},registerPanelItemProvider:function(e,t){ibiz.register.register("".concat(Xt,"_").concat(e.toUpperCase()),t)},registerPortletProvider:function(e,t){ibiz.register.register("".concat(Jt,"_").concat(e),t)},registerUIActionProvider:Yt,registerViewProvider:function(e,t){ibiz.register.register("".concat($t,"_").concat(e),t)},strContain:de,testCond:oe,toLocalOpenWFRedirectView:re,verifyDeRules:ge,verifyFormGroupLogic:function e(t,a){if(function(e){return"GROUP"===e.logicType}(a)){const i=a.defdlogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!e(t,s)))}else if("OR"===a.groupOP){n=void 0!==a.defdlogics.find((s=>e(t,s)))}return a.notMode?!n:n}if(function(e){return"SINGLE"===e.logicType}(a))return oe(t[a.defdname.toLowerCase()],a.condOP,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))},verifyPanelGroupLogic:function e(t,a){if(function(e){return"GROUP"===e.logicType}(a)){const i=a.panelItemLogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!e(t,s)))}else if("OR"===a.groupOP){n=void 0!==a.panelItemLogics.find((s=>e(t,s)))}return a.notMode?!n:n}if(function(e){return"SINGLE"===e.logicType}(a))return oe(t[a.dstModelField.toLowerCase()],a.condOp,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))}});var R,M,O=Object.create,W=Object.defineProperty,N=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,S=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,F=(R={"../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"(e,t){function s(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var s,i="",a=0,n=-1,r=0,o=0;o<=e.length;++o){if(o<e.length)s=e.charCodeAt(o);else{if(47===s)break;s=47}if(47===s){if(n===o-1||1===r);else if(n!==o-1&&2===r){if(i.length<2||2!==a||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",a=0):a=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),n=o,r=0;continue}}else if(2===i.length||1===i.length){i="",a=0,n=o,r=0;continue}t&&(i.length>0?i+="/..":i="..",a=2)}else i.length>0?i+="/"+e.slice(n+1,o):i=e.slice(n+1,o),a=o-n-1;n=o,r=0}else 46===s&&-1!==r?++r:r=-1}return i}var a={resolve:function(){for(var e,t="",a=!1,n=arguments.length-1;n>=-1&&!a;n--){var r;n>=0?r=arguments[n]:(void 0===e&&(e=process.cwd()),r=e),s(r),0!==r.length&&(t=r+"/"+t,a=47===r.charCodeAt(0))}return t=i(t,!a),a?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(s(e),0===e.length)return".";var t=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&a&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return s(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];s(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":a.normalize(e)},relative:function(e,t){if(s(e),s(t),e===t)return"";if((e=a.resolve(e))===(t=a.resolve(t)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var n=e.length,r=n-i,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var c=t.length-o,l=r<c?r:c,h=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===t.charCodeAt(o+d))return t.slice(o+d+1);if(0===d)return t.slice(o+d)}else r>l&&(47===e.charCodeAt(i+d)?h=d:0===d&&(h=0));break}var u=e.charCodeAt(i+d);if(u!==t.charCodeAt(o+d))break;47===u&&(h=d)}var p="";for(d=i+h+1;d<=n;++d)d!==n&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+t.slice(o+h):(o+=h,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(s(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,a=-1,n=!0,r=e.length-1;r>=1;--r)if(47===(t=e.charCodeAt(r))){if(!n){a=r;break}}else n=!1;return-1===a?i?"/":".":i&&1===a?"//":e.slice(0,a)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');s(e);var i,a=0,n=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!r){a=i+1;break}}else-1===c&&(r=!1,c=i+1),o>=0&&(l===t.charCodeAt(o)?-1==--o&&(n=i):(o=-1,n=c))}return a===n?n=c:-1===n&&(n=e.length),e.slice(a,n)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){a=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(a,n)},extname:function(e){s(e);for(var t=-1,i=0,a=-1,n=!0,r=0,o=e.length-1;o>=0;--o){var c=e.charCodeAt(o);if(47!==c)-1===a&&(n=!1,a=o+1),46===c?-1===t?t=o:1!==r&&(r=1):-1!==t&&(r=-1);else if(!n){i=o+1;break}}return-1===t||-1===a||0===r||1===r&&t===a-1&&t===i+1?"":e.slice(t,a)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var s=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return s?s===t.root?s+i:s+e+i:i}("/",e)},parse:function(e){s(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,a=e.charCodeAt(0),n=47===a;n?(t.root="/",i=1):i=0;for(var r=-1,o=0,c=-1,l=!0,h=e.length-1,d=0;h>=i;--h)if(47!==(a=e.charCodeAt(h)))-1===c&&(l=!1,c=h+1),46===a?-1===r?r=h:1!==d&&(d=1):-1!==r&&(d=-1);else if(!l){o=h+1;break}return-1===r||-1===c||0===d||1===d&&r===c-1&&r===o+1?-1!==c&&(t.base=t.name=0===o&&n?e.slice(1,c):e.slice(o,c)):(0===o&&n?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(o,r),t.base=e.slice(o,c)),t.ext=e.slice(r,c)),o>0?t.dir=e.slice(0,o-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,t.exports=a}},function(){return M||(0,R[x(R)[0]])((M={exports:{}}).exports,M),M.exports}),k=class{constructor(){this.view={enableDataInfoBar:!0},this.grid={editShowMode:"cell",editSaveMode:"cell-blur"},this.appMenu={enableEcho:!1},this.codeList={timeout:36e5}}},U=e("RegisterCenter",class{constructor(){this.providers=new Map}register(e,t){this.providers.set(e,t)}unRegister(e){this.providers.delete(e)}get(e,...t){const s=this.providers.get(e);if(s)return s(...t)}});function z(e,...t){return!e||d(e)?{}:"[object Array]"===Object.prototype.toString.call(e)?G(e,...t):"[object Object]"===Object.prototype.toString.call(e)?j(e,...t):{}}function G(e,...t){const s={};for(const i of e)if(p(i.value)&&!i.rawValue){const e=t.find((e=>!E(e)&&(e[i.value]||Object.prototype.hasOwnProperty.call(e,i.value))));e&&(s[i.key.toLowerCase()]=e[i.value])}else s[i.key.toLowerCase()]=i.value||null;return s}function j(e,...t){const s={},i=/^%(.+)%$/;for(const a in e)if(p(e[a])&&i.test(e[a])){const i=e[a].substring(1,e[a].length-1),n=t.find((e=>Object.prototype.hasOwnProperty.call(e,i)));n&&(s[a.toLowerCase()]=n[i])}else s[a.toLowerCase()]=e[a]||null;return s}function X(e){const t=[],s=/^%(.+)%$/;for(const i in e){let a=!0,n=e[i];p(e[i])&&s.test(e[i])&&(a=!1,n=e[i].substring(1,e[i].length-1)),t.push({key:i.toLowerCase(),rawValue:a,value:n})}return t}function K(e,t){const s={};if(!e)return s;const i=Array.isArray(e)?e:X(e),a=t[0];return i.forEach((e=>{const{rawValue:i,value:n}=e;!i&&n&&Object.prototype.hasOwnProperty.call(a,n)&&(s[n]=t.map((e=>e[n])).join(";"))})),s}function H(e,t){if(e){const s=e.find((e=>e.id===t));if(s)return s}return null}function Y(e,t){const{mainStateAppDEFieldIds:s,demainStates:i}=e;if(s&&i){const e=[];return s.forEach((s=>{e.push(t[s])})),i.find((t=>{const{stateValue:s,state2Value:i,state3Value:a}=t;let n=!0;const r=[s,i,a];for(let t=0;t<e.length;t++)if("".concat(e[t])!=="".concat(r[t])){n=!1;break}return n}))}}function q(e,t){const s=ibiz.hub.getApp().model,{demainStateOPPrivs:i,opprivAllowMode:a}=e,n=(null==i?void 0:i.map((e=>e.name)))||[];let r=[];if(a)r=n;else{r=[...s.deopprivs,...t.deopprivs].filter((e=>!n.includes(e.name))).map((e=>e.name))}return r}function $(e){return e.split(".").pop()}function Q(e,t){var s;return null==(s=t.appDELogics)?void 0:s.find((t=>t.id===e))}function J(e,t){var s,i;const a=[];return null==(s=e.appDEFields)||s.forEach((e=>{"compute"===t&&e.computeAppDEFLogicId?a.push(e.computeAppDEFLogicId):"change"===t&&e.onChangeAppDEFLogicId?a.push(e.onChangeAppDEFLogicId):"default"===t&&e.defaultValueAppDEFLogicId&&a.push(e.defaultValueAppDEFLogicId)})),(null==(i=e.appDELogics)?void 0:i.filter((e=>a.includes(e.id))))||[]}function Z(e,t){var s;return null==(s=e.appDEFields)?void 0:s.find((e=>e.id===t))}async function ee(e){const[,,t]=e.split("@");return ibiz.hub.getApp(t).getUIAction(e)}function te(e){return e.detreeNodes.find((e=>e.rootNode))}function se(e){const{viewLayoutPanel:t}=e,s=e.controls||[];return t&&s.push(...t.controls||[]),s}function ie(e){const{viewLayoutPanel:t}=e,s=e.appViewLogics||[];return t&&s.push(...t.appViewLogics||[]),s}function ae(e){const{viewLayoutPanel:t}=e,s=e.appViewEngines||[];return t&&s.push(...t.appViewEngines||[]),s}async function ne(e,t,i={},a=[]){return async function(e,t,i={},a=[]){const n=e.appViewNavContexts||[],r=z(n,t,i);t=Object.assign(t.clone(),r);const o=e.appViewNavParams||[],c=z(o,t,i);Object.assign(i,c);const l=e.appDataEntityId,h=$(l);let d=a[0]||{};t[h]=d[h]||t[h]||i[h];const u=e.getDataAppDEActionId,g=ibiz.hub.getApp(e.appId),m=await g.deService.getService(l);ibiz.loading.showRedirect();try{const e=await m.exec(u||"get",t,i);if(e.ok){d=e.data;let s=d.linkurl;if(s)return t.srfprocessinstanceid&&(s+=";srfprocessinstanceid=".concat(t.srfprocessinstanceid)),ibiz.env.dev&&-1!==s.indexOf("appredirectview?")&&(s=s.slice(s.indexOf("appredirectview?"))),s.startsWith("http://")||s.startsWith("https://")?new Promise((e=>{const t=window.open(s,"_blank");t&&(t.callback=()=>{e({ok:!0,data:[]})})})):s.startsWith("appredirectview?")?(await re(t,s),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(l,e.appId),w=await async function(e,t,s,i){let a="";const n=t.typeAppDEFieldId;if(n){const{codeName:t}=Z(e,n),s=i[t.toLowerCase()];if(p(s))return s}const r="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),o=s.srfwf;if(p(o))return p(s.wf)?"".concat(r,":").concat(o.toUpperCase(),":").concat(s.wf.toUpperCase()):"".concat(r,":").concat(o.toUpperCase());let c="";if(e.indexTypeAppDEFieldId){const{codeName:t}=Z(e,e.indexTypeAppDEFieldId);c=i[t.toLowerCase()]}if(E(c)&&e.formTypeAppDEFieldId){const{codeName:t}=Z(e,e.formTypeAppDEFieldId);c=i[t.toLowerCase()]}a=p(c)?"".concat(r,":").concat(c):"".concat(r);return a}(f,e,i,d),I=w.split(":"),D=2===I.length?w:I.slice(0,2).join(":"),A="".concat(f.name.toUpperCase(),":").concat(w),P=e.redirectAppViewRefs,y=null==P?void 0:P.find((e=>e.name===A||e.name===w||e.name===D));if(!y)throw ibiz.log.error("重定向视图引用有:",null==P?void 0:P.map((({refAppViewId:e,name:t,realTitle:s})=>({viewId:e,tag:t,title:s})))),new s(e,"未找到重定向标识[".concat(w,"]或[").concat(A,"]或[").concat(D,"]对应视图"));{const e=y.refAppViewId;if(!e)throw new s(y,"未配置实际引用视图");{const s=await ibiz.commands.execute(be.TAG,e,t,i,{data:[d]});if(s)return s}}return{ok:!0,data:[]}}(e,t,i,a)}async function re(e,s){const i=s.lastIndexOf("?"),a=decodeURIComponent(s.substring(i+1,s.length)),n=P.parse(a,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new t("重定向参数缺少实体名称");const o=ibiz.hub.getApp(e.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!o)throw new t("未找到指定实体的codeName: ".concat(r));n[o.toLowerCase()]=n[r.toLowerCase()];const c="".concat(o).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(c);if(delete n.srfdename,"undo"!==n.srfwf){const e=n.processDefinitionKey.split("-")[3],t=e.substring(0,e.lastIndexOf("v")),s=e.substring(e.lastIndexOf("v"));n.wf=t,n.wfVersion=s}n.srfprocessinstanceid&&(e.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),await ibiz.commands.execute(be.TAG,l.id,e,n)}function oe(e,s,i){if(Object.is(s,"IN"))return he(e,i);if(Object.is(s,"NOTIN"))return!he(e,i);switch(s){case"EQ":return"".concat(e)==="".concat(i);case"NOTEQ":return"".concat(e)!=="".concat(i);case"LT":return ce(e,i)<0;case"LTANDEQ":return ce(e,i)<=0;case"GT":return ce(e,i)>0;case"GTANDEQ":return ce(e,i)>=0;case"ISNULL":return E(e);case"ISNOTNULL":return p(e);case"TESTNULL":return v(e);case"IN":return he(e,i);case"NOTIN":return!he(e,i);case"LIKE":return de(e,i);case"LEFTLIKE":return de(e,i,"start");case"RIGHTLIKE":return de(e,i,"end");default:throw new t("值操作:".concat(s,",暂未支持"))}}function ce(e,s){const i=Number(e),a=Number(s);if(!Number.isNaN(i)&&!Number.isNaN(a))return le(i,a);const n=new Date(e).getTime(),r=new Date(s).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r))return le(n,r);throw new t("".concat(e," 和 ").concat(s," 无法比较大小"))}function le(e,t){return Number.isNaN(e)&&(e=0),Number.isNaN(t)&&(t=0),e>t?1:e<t?-1:0}function he(e,s){if(!s||"string"!=typeof s)throw new t("范围比较的条件值不存或者不是字符串");if(e){return s.split(",").includes("".concat(e))}return!1}function de(e,t,s){if(!e||!t)return!1;const i="".concat(e).toUpperCase(),a="".concat(t).toUpperCase(),n=i.indexOf(a);switch(s){case"start":return 0===n;case"end":return n+a.length===i.length;default:return-1!==n}}var ue={singleRowReturn:!1},pe=e("ScriptFunction",class{constructor(e,t,s=ue){this.argKeys=[],this.options=s;const i=this.formatCode(t,s);this.calcArgKeys(e,s),this.scriptFn=new Function(...this.argKeys,i)}formatCode(e,t){let s=e;return t.singleRowReturn&&(s="return (".concat(s,")")),s}calcArgKeys(e,t){const s=t.presetParams?Object.keys(t.presetParams):[];s.push(...e),s.push("document","el","selector"),this.argKeys=Array.from(new Set(s))}convertArgs(e){const{presetParams:t}=this.options,s=t?T(t,e):e;s.document=document,s.selector=e=>document.getElementsByClassName(e);const i=[];return this.argKeys.forEach((e=>{i.push(s[e])})),i}exec(e){const t=this.convertArgs(e);return this.scriptFn(...t)}}),Ee=e("ScriptFactory",class{static createScriptFn(e,t,s){return new pe(e,t,s)}static execScriptFn(e,t,s){return this.createScriptFn(Object.keys(e),t,s).exec(e)}});function ge(e,s,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(e){return"GROUP"===e.condType}(i)){const t=i.conds;t&&t.length>0&&(a.isPast=function(e,t,s="AND",i=!1){if(!((null==e?void 0:e.length)>0))return!1;let a="AND"===s;for(let i=0,n=e.length;i<n;i++){const n=t(e[i],i);if("AND"===s){if(!n){a=!1;break}}else if("OR"===s&&n){a=!0;break}}return i?!a:a}(t,(t=>{const{isPast:i,infoMessage:n}=ge(e,s,t);return a.infoMessage=n,i}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{e=null==i?void 0:i.defname.toLowerCase();try{if(function(e){return"SIMPLE"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){Object.is(n,"CURTIME")&&(i="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){i=r[i=i?i.toLowerCase():""]?r[i]:i}(v(a)||_(a))&&(a="内容必须符合值规则");const c=oe(e,s,i);if(!c&&o)throw new t(a);return!c}(s[e],i.condOp,i.paramValue,i.ruleInfo,i.paramType,s,i.keyCond);else if(function(e){return"VALUERANGE2"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){E(r)&&(r="值必须符合值范围规则");if(E(e)){if(o)throw new t("值为空");return r="值为空",!0}if(me(e,/^-?\d*\.?\d+$/,"",o))return!0;const c=Number.parseFloat(e);if(null!==s)if(i){if(c<s){if(o)throw new t(r);return!0}}else if(c<=s){if(o)throw new t(r);return!0}if(null!=a)if(n){if(c>a){if(o)throw new t(r);return!0}}else if(c>=a){if(o)throw new t(r);return!0}return r="",!1}(s[e],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(e){return"REGEX"===e.condType}(i))a.isPast=!me(s[e],i.regExCode,i.ruleInfo,i.keyCond);else if(function(e){return"STRINGLENGTH"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){E(r)&&(r="内容长度必须符合范围规则");if(E(e)){if(o)throw new t("值为空");return r="值为空",!0}const c=e.length;if(null!==s)if(i){if(c<s){if(o)throw new t(r);return!0}}else if(c<=s){if(o)throw new t(r);return!0}if(null!==a)if(n){if(c>a){if(o)throw new t(r);return!0}}else if(c>=a){if(o)throw new t(r);return!0}return r="",!1}(s[e],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(e){return"SYSVALUERULE"===e.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:n,regExCode:r,scriptCode:o,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===n)a.isPast=!me(s[e],r,a.infoMessage,i.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:r}=function(e,s,i,a,n){E(a)&&(a="值必须符合脚本规则");const r=s;let o="",c=!0;const l=e=>{c=!1,(null==e?void 0:e.length)>0?e.forEach((e=>{(null==e?void 0:e.message)&&(o+=e.message)})):(null==e?void 0:e.message)&&(o=e.message)};try{const t=Ee.execScriptFn({value:e,data:r},i);"boolean"==typeof t&&(c=t)}catch(e){ibiz.log.error(e),l(e)}if(a="",!c&&n)throw new t(a);return{isPast:c,infoMessage:o||a}}(s[e],s,o,a.infoMessage,i.keyCond);a.isPast=n,a.infoMessage=r||a.infoMessage}}}catch(e){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function me(e,s,i,a){E(i)&&(i="值必须符合正则规则");if(E(e)){if(a)throw new t("值为空");return i="值为空",!0}if(!new RegExp(s).test(e)){if(a)throw new t(i);return!0}return i="",!1}var fe=e("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(e,t){this.cache.set(e,t)}get(e){return this.cache.get(e)}fill(e){const{viewLayoutPanel:t}=e;if(!t||!0===t.useDefaultLayout){const t=this.calcLayoutTag(e);if(this.cache.has(t)){const s=b(this.cache.get(t));e.viewLayoutPanel=s,e.appCounterRefs&&(s.appCounterRefs=e.appCounterRefs,delete e.appCounterRefs),e.appViewEngines&&(s.appViewEngines=e.appViewEngines,delete e.appViewEngines),e.appViewLogics&&(s.appViewLogics=e.appViewLogics,delete e.appViewLogics),e.appViewRefs&&(s.appViewRefs=e.appViewRefs,delete e.appViewRefs),e.controls&&(s.controls=e.controls,delete e.controls)}}return e}calcLayoutTag(e){const{viewType:t,viewStyle:s}=e;return"APPINDEXVIEW"===t?this.calcIndexViewLayoutTag(e):"".concat(t,"_").concat(s)}calcIndexViewLayoutTag(e){const{viewType:t,viewStyle:s,blankMode:i,mainMenuAlign:a}=e;let n="";return i?n="BLANK_MODE":a&&(n=a.toUpperCase()),""!==n?"".concat(t,"_").concat(s,"_").concat(n):"".concat(t,"_").concat(s)}});var we=e("ControlType",(e=>(e.APP_MENU="APPMENU",e.GRID="GRID",e.FORM="FORM",e.SEARCHFORM="SEARCHFORM",e.TOOLBAR="TOOLBAR",e.DRBAR="DRBAR",e.VIEWPANEL="VIEWPANEL",e.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",e.DATAVIEW="DATAVIEW",e.TREEGRID="TREEGRID",e.WF_EXPBAR="WFEXPBAR",e.TREEVIEW="TREEVIEW",e.TREE_EXP_BAR="TREEEXPBAR",e.TAB_VIEWPANEL="TABVIEWPANEL",e.DRTAB="DRTAB",e.CHART="CHART",e.REPORT_PANEL="REPORTPANEL",e.LIST="LIST",e.MOB_MDCTRL="MOBMDCTRL",e.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",e.WIZARD_PANEL="WIZARDPANEL",e.UPDATE_PANEL="UPDATEPANEL",e.SEARCHBAR="SEARCHBAR",e.DASHBOARD="DASHBOARD",e.CALENDAR="CALENDAR",e.PANEL="PANEL",e.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",e.MAP="MAP",e.GANTT="GANTT",e.TREE_GRIDEX="TREEGRIDEX",e.KANBAN="KANBAN",e.CALENDAR_EXPBAR="CALENDAREXPBAR",e.CHART_EXPBAR="CHARTEXPBAR",e.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",e.GANTT_EXPBAR="GANTTEXPBAR",e.GRID_EXPBAR="GRIDEXPBAR",e.LIST_EXPBAR="LISTEXPBAR",e.MAP_EXPBAR="MAPEXPBAR",e.STATE_WIZARD_PANEL="STATEWIZARDPANEL",e.TAB_EXP_PANEL="TABEXPPANEL",e.CUSTOM="CUSTOM",e.CAPTIONBAR="CAPTIONBAR",e))(we||{})),Ie=e("ViewType",(e=>(e.APP_INDEX_VIEW="APPINDEXVIEW",e.DE_GRID_VIEW="DEGRIDVIEW",e.DE_EDIT_VIEW="DEEDITVIEW",e.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",e.APP_ERROR_VIEW="APPERRORVIEW",e.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",e.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",e.APP_LOGIN_VIEW="APPLOGINVIEW",e.APP_LOGOUT_VIEW="APPLOGOUTVIEW",e.APP_PANEL_VIEW="APPPANELVIEW",e.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",e.APP_PORTAL_VIEW="APPPORTALVIEW",e.APP_REDIRECT_VIEW="APPREDIRECTVIEW",e.APP_START_VIEW="APPSTARTVIEW",e.APP_WELCOME_VIEW="APPWELCOMEVIEW",e.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",e.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",e.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",e.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",e.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",e.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",e.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",e.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",e.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",e.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",e.DE_CALENDAR_VIEW="DECALENDARVIEW",e.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",e.DE_CHART_VIEW="DECHARTVIEW",e.DE_CHART_VIEW9="DECHARTVIEW9",e.DE_CUSTOM_VIEW="DECUSTOMVIEW",e.DE_DATA_VIEW="DEDATAVIEW",e.DE_DATA_VIEW9="DEDATAVIEW9",e.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",e.DE_EDIT_VIEW2="DEEDITVIEW2",e.DE_EDIT_VIEW3="DEEDITVIEW3",e.DE_EDIT_VIEW4="DEEDITVIEW4",e.DE_EDIT_VIEW9="DEEDITVIEW9",e.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",e.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",e.DE_GANTT_VIEW="DEGANTTVIEW",e.DE_GANTT_VIEW9="DEGANTTVIEW9",e.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",e.DE_GRID_VIEW2="DEGRIDVIEW2",e.DE_GRID_VIEW4="DEGRIDVIEW4",e.DE_GRID_VIEW8="DEGRIDVIEW8",e.DE_GRID_VIEW9="DEGRIDVIEW9",e.DE_HTML_VIEW="DEHTMLVIEW",e.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",e.DE_INDEX_VIEW="DEINDEXVIEW",e.DE_KANBAN_VIEW="DEKANBANVIEW",e.DE_KANBAN_VIEW9="DEKANBANVIEW9",e.DE_LIST_EXP_VIEW="DELISTEXPVIEW",e.DE_LIST_VIEW="DELISTVIEW",e.DE_LIST_VIEW9="DELISTVIEW9",e.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",e.DE_MAP_VIEW="DEMAPVIEW",e.DE_MAP_VIEW9="DEMAPVIEW9",e.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",e.DE_MEDITVIEW9="DEMEDITVIEW9",e.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",e.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",e.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",e.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",e.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",e.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",e.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",e.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",e.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",e.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",e.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",e.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",e.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",e.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",e.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",e.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",e.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",e.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",e.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",e.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",e.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",e.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",e.DE_MOB_MDVIEW="DEMOBMDVIEW",e.DE_MOB_MDVIEW9="DEMOBMDVIEW9",e.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",e.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",e.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",e.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",e.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",e.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",e.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",e.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",e.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",e.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",e.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",e.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",e.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",e.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",e.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",e.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",e.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",e.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",e.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",e.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",e.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",e.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",e.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",e.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",e.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",e.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",e.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",e.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",e.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",e.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",e.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",e.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",e.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",e.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",e.DE_MPICKUP_VIEW="DEMPICKUPVIEW",e.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",e.DE_OPT_VIEW="DEOPTVIEW",e.DE_PANEL_VIEW="DEPANELVIEW",e.DE_PANEL_VIEW9="DEPANELVIEW9",e.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",e.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",e.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",e.DE_PICKUP_VIEW="DEPICKUPVIEW",e.DE_PICKUP_VIEW2="DEPICKUPVIEW2",e.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",e.DE_PORTAL_VIEW="DEPORTALVIEW",e.DE_PORTAL_VIEW9="DEPORTALVIEW9",e.DE_REDIRECT_VIEW="DEREDIRECTVIEW",e.DE_REPORT_VIEW="DEREPORTVIEW",e.DE_TAB_EXP_VIEW="DETABEXPVIEW",e.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",e.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",e.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",e.DE_TREE_EXP_VIEW="DETREEEXPVIEW",e.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",e.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",e.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",e.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",e.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",e.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",e.DE_TREE_VIEW="DETREEVIEW",e.DE_TREE_VIEW9="DETREEVIEW9",e.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",e.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",e.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",e.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",e.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",e.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",e.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",e.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",e.DE_WF_EDIT_VIEW="DEWFEDITVIEW",e.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",e.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",e.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",e.DE_WF_EXP_VIEW="DEWFEXPVIEW",e.DE_WF_GRID_VIEW="DEWFGRIDVIEW",e.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",e.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",e.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",e.DE_WF_START_VIEW="DEWFSTARTVIEW",e.DE_WIZARD_VIEW="DEWIZARDVIEW",e))(Ie||{})),De=e("ViewMode",(e=>(e.ROUTE="ROUTE",e.MODAL="MODAL",e.DRAWER="DRAWER",e.EMBED="EMBED",e.POPOVER="POPOVER",e))(De||{})),Ae=e("SysUIActionTag",(e=>(e.NEW="New",e.EDIT="Edit",e.REFRESH="Refresh",e.EXIT="Exit",e.SAVE_AND_EXIT="SaveAndExit",e.SAVE_AND_NEW="SaveAndNew",e.SAVE="Save",e.SAVE_ROW="SaveRow",e.REMOVE="Remove",e.REMOVE_AND_EXIT="RemoveAndExit",e.NEW_ROW="NewRow",e.TOGGLE_FILTER="ToggleFilter",e.IMPORT="Import",e.EXPORT_EXCEL="ExportExcel",e.SAVE_AND_START="SaveAndStart",e.VIEW_WF_STEP="ViewWFStep",e.NO="No",e.YES="Yes",e.CANCEL="Cancel",e.OK="Ok",e.SEARCH="Search",e.FINISH="Finish",e.NEXT_STEP="NextStep",e.PREV_STEP="PrevStep",e.ADD_SELECTION="AddSelection",e.REMOVE_SELECTION="RemoveSelection",e.REMOVE_ALL="RemoveAll",e.ADD_ALL="AddAll",e.LOGOUT="Logout",e.LOGIN="Login",e.CANCEL_CHANGES="CancelChanges",e.COPY="Copy",e.VIEW="View",e.TOGGLE_ROW_EDIT="ToggleRowEdit",e.LOAD_MORE="LoadMore",e))(Ae||{})),Pe=e("StudioViewEvents",class{});Pe.onViewMounted="onMounted",Pe.onViewDestroyed="onDestroyed";var ye=e("StudioPanelEvents",class{});ye.onClick="onClick",ye.onChange="onChange",ye.onEnter="onEnter",ye.onLeave="onLeave";var ve=e("StudioControlEvents",class{});ve.onBeforeLoad="onBeforeLoad",ve.onLoadSuccess="onLoadSuccess",ve.onLoadError="onLoadError",ve.onBeforeLoadDraft="onBeforeLoadDraft",ve.onLoadDraftSuccess="onLoadDraftSuccess",ve.onLoadDraftError="onLoadDraftError",ve.onBeforeSave="onBeforeSave",ve.onSaveSuccess="onSaveSuccess",ve.onSaveError="onSaveError",ve.onBeforeRemove="onBeforeRemove",ve.onRemoveSuccess="onRemoveSuccess",ve.onRemoveError="onRemoveError",ve.CLICK="onClick";var Te=e("Modal",class{constructor(e){this.mode="EMBED",this.viewUsage=4,this.hooks={shouldDismiss:new g,beforeDismiss:new g},this._dismiss=e=>{ibiz.log.error("外部关闭能力未注册",e)},e.mode&&(this.mode=e.mode),e.routeDepth&&(this.routeDepth=e.routeDepth),e.viewUsage&&(this.viewUsage=e.viewUsage),e.dismiss&&(this._dismiss=e.dismiss)}injectDismiss(e){this._dismiss=e}async dismiss(e={ok:!1,data:[]}){const t={allowClose:!0};return await this.hooks.shouldDismiss.call(t),t.allowClose?(await this.hooks.beforeDismiss.call(e),this._dismiss(e),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});var _e=class e{constructor(){ibiz.commands.register(e.TAG,this.exec.bind(this))}async exec(e,s,a={},n={}){const r=await ibiz.hub.config.view.get(e);if(!r)throw new t("应用视图[".concat(e,"]不存在"));if(s.srfkey&&r.appDataEntityId){s[$(r.appDataEntityId)]=s.srfkey,s.srfkey=void 0}if(r.redirectView){return ne(await ibiz.hub.getAppView(e),s,a,n.data)}const{openMode:o="INDEXVIEWTAB"}=r;switch(n.openMode||o){case"INDEXVIEWTAB":return n.noWaitRoute?void this.openIndexViewTab(r,s,a):this.openIndexViewTab(r,s,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,s,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,n.event,s,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,s,a);case"USER":return this.openUserCustom(r,s,a);default:return this.openIndexViewTab(r,s,a)}}openIndexViewTab(e,t,s={}){return ibiz.openView.root(e,t,s)}async openModal(e,t,s={}){return ibiz.openView.modal(e,t,s)}async openPopover(e,t,s,i={}){return ibiz.openView.popover(e,t,s,i)}async openDrawer(e,t,s={}){return ibiz.openView.drawer(e,t,s)}async openUserCustom(e,t,s={}){return ibiz.openView.custom(e,t,s)}};_e.TAG="ibiz.app-view.open";var be=e("OpenAppViewCommand",_e),Ce=class e{constructor(){ibiz.commands.register(e.TAG,this.exec.bind(this))}async exec(e,s,a={},n={}){const r=ibiz.hub.getApp(s.srfappid).getAppFunc(e);if(!r)throw new t("找不到叫".concat(e,"的应用功能"));const{navigateContexts:o,navigateParams:c,appFuncType:l}=r,h=s.clone();Object.assign(h,z(o,s,a));const d=z(c,s,a);switch(l){case"APPVIEW":return this.openAppView(r,h,d,n);case"OPENHTMLPAGE":return this.openHtmlPage(r);case"PDTAPPFUNC":return this.openPdAppFunc(r,h,d);case"JAVASCRIPT":return this.executeJavaScript(r,h,d);case"CUSTOM":return this.custom(r,h,d);default:throw new i(r,"未支持的应用功能类型: ".concat(l))}}async openAppView(e,s,i,a){if(!e.appViewId)throw new t("应用视图[".concat(e.appViewId,"]不存在"));return ibiz.commands.execute(be.TAG,e.appViewId,s,i,a)}openHtmlPage(e){const t=e.htmlPageUrl;window.open(t,"_blank")}openPdAppFunc(e,s,i){throw ibiz.log.warn("openPdAppFunc",e,s,i),new t("未实现")}executeJavaScript(e,s,i){throw ibiz.log.warn("executeJavaScript",e,s,i),new t("未实现")}custom(e,s,i){throw ibiz.log.warn("custom",e,s,i),new t("未实现")}};Ce.TAG="ibiz.app-func.exec";var Ve=e("AppFuncCommand",Ce);function Le(){new Ve,new be}var Re=e("AppCounter",class{constructor(e){this.model=e,this.destroyed=!1,this.context=a.create(),this.params={},this.evt=new m,this.data={}}get isDestroyed(){return this.destroyed}async init(e,t){this.setParams(e,t),this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new s(this.model,"未找到获取计数器行为!");this.action=i,this.interval(),await this.load()}setParams(e,t){e&&(this.context=b(e)),t&&(this.params=b(t))}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(){const e=ibiz.hub.getApp(this.context.srfappid),t=await e.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return t.ok&&(this.data=t.data,this.evt.emit("change",this.data)),this.data}refresh(e,t){return this.setParams(e,t),this.load()}onChange(e,t=!0){this.evt.on("change",e),t&&p(this.data)&&e(this.data)}offChange(e){this.evt.off("change",e)}getCounter(e){return this.data[e.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),Me=class{constructor(){this.psModelGroupCondBase=null}parse(e){if(e instanceof Array){const t=this.createPSModelGroupCond();t.parse(e),this.psModelGroupCondBase=t}}testSingleCond(e,t,s){try{if("ISNULL"===e)return null==t;if("ISNOTNULL"===e)return null!=t;if("EQ"===e||"ABSEQ"===e||"GT"===e||"GTANDEQ"===e||"LT"===e||"LTANDEQ"===e||"NOTEQ"===e){let i=-1;if(t==s?i=0:t>s&&(i=1),"EQ"===e||"ABSEQ"===e)return 0===i;if("GT"===e)return i>0;if("GTANDEQ"===e)return i>=0;if("LT"===e)return i<0;if("LTANDEQ"===e)return i<=0;if("NOTEQ"===e)return 0!==i}if("LIKE"===e)return null!=t&&null!=s&&-1!==t.toString().toUpperCase().indexOf(s.toString().toUpperCase());if("LEFTLIKE"===e)return null!=t&&null!=s&&0===t.toString().toUpperCase().indexOf(s.toString().toUpperCase())}catch(e){ibiz.log.error(e)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Oe=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(e){this.strCondOp=e}},We=class extends Oe{parse(e){const t=e.length;let s=!0,i=!1,a=!1;for(let n=0;n<t;n++)if(s){const t=e[n];this.setCondOp(t),s=!1,i=!0}else if(i){const t=e[n];this.setParam(t),i=!1,a=!0}else if(a){const t=e[n];if(t instanceof Object&&!(t instanceof Array)){const e=t;null!=e.type&&this.setValueType(e.type.toString()),null!=e.value&&this.setValue(e.value.toString())}else this.setValue(t);break}}getValueType(){return this.strValueType}setValueType(e){this.strValueType=e}getValue(){return this.strValue}setValue(e){this.strValue=e}getParamType(){return this.strParamType}setParamType(e){this.strParamType=e}getParam(){return this.strParam}setParam(e){this.strParam=e}},Ne=class e extends Oe{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(s){const i=s.length;let a=!0,n=!0,r=!1;for(let o=0;o<i;o++){if(a&&n){if("!"===s[o]){this.setNotMode(!0),a=!1;continue}}if(n){const e=s[o];this.setCondOp(e),n=!1,a=!1,r=!0}else if(r){const i=s[o];if(!(i instanceof Array))throw new t("值必须为数组");i.forEach((t=>{if(t.length>0){const s=t[0].toString();if("!"===s||"OR"===s||"AND"===s){const s=new e;s.parse(t),this.childCondList.push(s)}else{const e=new We;e.parse(t),this.childCondList.push(e)}}}))}}}setNotMode(e){this.bNotMode=e}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},xe=class extends Ne{},Se=class extends We{},Be=class e extends Me{test(e,t){return this.testCond(this.getPSModelGroupCondBase(),e,t)}testCond(t,s,i){if(t instanceof Ne){const e=t.getChildPSModelCondBases();if(null==e||_(e))return!t.isNotMode();const a="AND"===t.getCondOp();let n=a;for(let t=0;t<e.length;t++){const r=e[t];if(this.testCond(r,s,i)){if(!a){n=!0;break}}else if(a){n=!1;break}}return t.isNotMode()?!n:n}if(t instanceof We){_(t.getParam())&&ibiz.log.warn("没有指定属性名称",t);const a=s[t.getParam().toLowerCase()];let n=null;const r=t.getValueType(),o=t.getValue();return null==r||_(r)?n=t.getValue():(_(o)&&ibiz.log.warn("没有指定上下文参数名称"),e.PARAMTYPE_WEBCONTEXT===r?n=i.data[o.toLowerCase()]:e.PARAMTYPE_DATACONTEXT===r&&(n=i.getValue(o.toLowerCase()))),this.testSingleCond(t.getCondOp(),a,n)}return ibiz.log.warn("无法识别的条件对象",t),!1}createPSModelSingleCond(){return new Se}createPSModelGroupCond(){return new xe}};Be.PARAMTYPE_DATACONTEXT="DATACONTEXT",Be.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Fe=e("PSDEDQCondEngine",Be);e("DEDQCondUtil",class{static getCond(e){if(this.map.has(e))return this.map.get(e);const t=e.dedqgroupConditions;if(t){const s=new Fe;return s.parse(["OR",this.calcCond(t)]),this.map.set(e,s),s}return null}static calcCond(e){const t=[];return e.forEach((e=>{const s=[];if("GROUP"===e.condType){const t=e;t.notMode&&s.push("!"),s.push(e.condOp);const i=t.dedqconditions;if(i){const e=this.calcCond(i);s.push(e)}}else{if("SINGLE"!==e.condType)throw new i(e,"暂未支持的查询条件类型: ".concat(e.condType));{const t=e;s.push(t.fieldName),t.condValue||s.push("")}}t.push(s)})),t}}).map=new WeakMap;var ke=e("DynamicCodeListCache",class{constructor(e){this.cache=new Map,this.isPredefined=!1,this.codeList=e}async init(){return this.initPromise=(async()=>{const{predefinedType:e}=this.codeList;if(e){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(e))throw new i(this.codeList,"预定义类型".concat(e,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(e){const t={},{valueAppDEFieldId:s,textAppDEFieldId:i}=this.codeList,a=s?e[s]:e.srfkey;return t.id=a,t.value=a,t.text=i?e[i]:e.srfmajortext,Object.freeze(t)}async load(e={},t={}){const i=ibiz.hub.getApp(e.srfappid);if(this.isPredefined){t.size||(t.size=1e4);const e=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),t);return Object.freeze(e.data.items)}const{appDataEntityId:a,appDEDataSetId:n}=this.codeList;if(!a)throw new s(this.codeList,"未配置应用实体");if(!n)throw new s(this.codeList,"未配置数据集");const r=await i.deService.exec(a,n,e,{},t);let o=[];return r.data.length&&(o=r.data.map((e=>this.convertData(e)))),o}async get(e={},t={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(e,t);const s=JSON.stringify(e)+JSON.stringify(t);if(this.cache.has(s)){const e=this.cache.get(s);if(e.expirationTime>(new Date).getTime())return e.promise?e.promise:e.items;this.cache.delete(s)}const i=this.load(e,t),{cacheTimeout:a}=this.codeList,n=-1===a||v(a)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,r={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(s,r);const o=await i;return r.items=o,delete r.promise,o}});function Ue(e,s){if(null!=s){const{srfkey:e}=s;if(!v(e)&&!_(e))return!0}throw new t("执行「".concat(e,"」不存在「srfkey」无法处理"))}function ze(e,s){const{srfsessionid:i}=s;if(!v(i)&&!_(i))return!0;throw new t("执行「".concat(e,"」不存在「srfsessionid」无法处理"))}var Ge=e("DECache",class{constructor(){this.cacheMap=new Map}forceAdd(e,t){const s=this.getCacheByTag(e).get(t.srfkey);s&&(s.assign(t),ibiz.log.warn("forceAdd",t.srfkey,t))}forceUpdate(e,t){this.getCacheByTag(e).set(t.srfkey,b(t)),ibiz.log.warn("forceUpdate",t.srfkey,t)}forceDelete(e,t){this.getCacheByTag(e).delete(t),ibiz.log.warn("forceDelete",t)}add(e,t){try{ze("add",e),(v(t.srfkey)||_(t.srfkey))&&(t.srfkey=f()),t.srftempdate=(new Date).getTime();return this.getCacheByTag(e).set(t.srfkey,b(t)),ibiz.log.warn("add",t.srfkey,t),t}catch(e){return ibiz.log.error(e),null}}get(e,t){try{ze("get",e);const s=this.getCacheByTag(e).get(t);return ibiz.log.warn("get",t,s),b(s)}catch(e){return ibiz.log.error(e),null}}update(e,t){try{ze("update",e),Ue("update",t),t.srftempdate=(new Date).getTime();const s=this.getCacheByTag(e),i=s.get(t.srfkey);if(i)return i.assign(t),s.set(t.srfkey,i),ibiz.log.warn("update",t.srfkey,t),b(i);throw new Error("数据不存在,无法更新!")}catch(e){return ibiz.log.error(e),null}}delete(e,t){try{ze("delete",e);const s=this.getCacheByTag(e),i=t;if(s.has(i)){const e=s.get(i);return e.srftempdate=(new Date).getTime(),s.delete(i),ibiz.log.warn("delete",i),e}return null}catch(e){return ibiz.log.error(e),null}}createBatch(e,t){try{ze("add",e);const s=this.getCacheByTag(e);for(let e=0;e<t.length;e++){const i=t[e];(v(i.srfkey)||_(i.srfkey))&&(i.srfkey=f()),i.srftempdate=(new Date).getTime();const a=b(i);s.set(i.srfkey,a),t[e]=a,ibiz.log.warn("add",i.srfkey,i)}return t}catch(e){ibiz.log.error(e)}return[]}updateBatch(e,t){try{ze("update",e);const s=this.getCacheByTag(e);for(let e=0;e<t.length;e++){const i=t[e];Ue("update",i),i.srftempdate=(new Date).getTime();const a=s.get(i.srfkey);if(!a)throw new Error("数据[".concat(i.srfdename,"-").concat(i.srfmajortext,"(").concat(i.srfkey,")]不存在,无法更新!"));a.assign(i),s.set(i.srfkey,a),ibiz.log.warn("update",i.srfkey,i),t[e]=b(a)}return t}catch(e){return ibiz.log.error(e),null}}deleteBatch(e,t){try{ze("delete",e)}catch(e){return ibiz.log.error(e),t}const s=this.getCacheByTag(e),i=[];for(let e=0;e<t.length;e++){const a=t[e];s.has(a)||i.push(a)}if(i.length>0)throw new Error("未找到以下数据「".concat(i.join("、"),"」,无法删除!"));for(let e=0;e<t.length;e++){const i=t[e];s.delete(i),ibiz.log.warn("delete",i)}return[]}checkData(e,t){return-1!==this.getList(e).findIndex((e=>e.srfkey===t))}getList(e){try{ze("getList",e);const t=this.getCacheByTag(e);if(!t)return[];const s=t.values();return Array.from(s)}catch(e){return ibiz.log.error(e),[]}}generatePred(e={}){const t={};e.srfkey&&(t.srfkey=C(e.srfkey)),delete e.srfkey;for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const i=e[s];t[s]=C(i)}return V(t)}clear(e){const t=e.srfsessionid;this.cacheMap.size>0&&this.cacheMap.delete(t)}getCacheByTag(e){const t=e.srfsessionid;return this.cacheMap.has(t)||this.cacheMap.set(t,new Map),this.cacheMap.get(t)}}),je=new RegExp("(?<=\\$\\{)(.*?)(?=\\})","g");function Xe(e,t){const s=(t.requestPaths||[]).map((e=>({path:e,keys:e.match(je)||[]}))).filter((t=>{const{keys:s}=t;return 0===s.length||s.every(((t,i)=>i===s.length-1||null!=e[t]))})).sort(((e,t)=>t.keys.length-e.keys.length));if(s.length>0)return s[0]}function Ke(e,t){const s=Xe(e,t);if(s){if(s.keys.length>0){let{path:t}=s;return s.keys.forEach(((i,a)=>{t=a===s.keys.length-1?t.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):t.replace("${".concat(i,"}"),e[i])})),t}return s.path}return""}var He=e("SearchFilter",class{constructor(e,t){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=e,t){if(v(t.page)||_(t.page)||(this.page=t.page),v(t.size)||_(t.size)||(this.size=t.size),v(t.query)||_(t.query)||(this.query=t.query),!v(t.sort)&&!_(t.sort)){const e=t.sort.split(",");e.length>=1&&([this.sortField]=e),e.length>=2&&(this.sortMode=e[1].toUpperCase())}v(t.srfparentkey)||_(t.srfparentkey)||(this.srfparentkey=t.srfparentkey),v(t.srfparentdename)||_(t.srfparentdename)||(this.srfparentdename=t.srfparentdename),this.data={...t},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(e){return this.data[e]?this.data[e]:this.context[e]}}),Ye=e("CodeListService",class{constructor(e){this.appModel=e,this.allCodeLists=new Map,this.cache=new Map}getStatic(e){const t=e.codeName;if(this.cache.has(t))return this.cache.get(t);const s=e.codeItems;let i=[];return(null==s?void 0:s.length)&&(i=this.formatStaticItems(s,e.codeItemValueNumber)),this.cache.set(t,Object.freeze(i)),i}setCodeList(e){const{id:t,codeName:s}=e;this.allCodeLists.set(t,e),this.allCodeLists.set(s,e)}getCodeList(e){return this.allCodeLists.get(e)}formatStaticItems(e,t){return e.map((e=>{var s;const i={text:e.text,value:t?Number(e.value):e.value,color:e.color,id:e.codeName};return(null==(s=e.codeItems)?void 0:s.length)&&(i.children=this.formatStaticItems(e.codeItems,t)),Object.freeze(i)}))}async getDynamicCodeList(e,t={},s={}){let i;const a=e.codeName;return this.cache.has(a)?i=this.cache.get(a):(i=new ke(e),this.cache.set(a,i),await i.init()),i.get(t,s)}async get(e,s,i){const a=this.allCodeLists.get(e);if(!a)throw new t("找不到".concat(e,"代码表"));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,s,i):[]}}),qe=e("CounterService",class{static async getCounter(e,t,s){const i=e.id;if(this.counterMap.has(i)){const e=this.counterMap.get(i);if(!1===e.isDestroyed)return e;this.counterMap.delete(i)}const a=new Re(e);return await a.init(t,s),this.counterMap.set(i,a),a}static async getCounterByRef(e,t,i){const{appCounter:a}=e;if(!a)throw new s(e,"未配置应用计数器!");return this.getCounter(a,t,i)}});qe.counterMap=new Map;var $e=e("WorkFlowService",class{constructor(e){this.model=e,this.commonBaseUrl="",this.app=ibiz.hub.getApp(e.appId);const t=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(t.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(e,t){return t.srfprocessinstanceid&&(e.srfprocessinstanceid=t.srfprocessinstanceid),e}async getWFStep(e){const{processDefinitionKey:t,taskDefinitionKey:s}=e;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(t,"/usertasks/").concat(s))}async getWFLink(e,t){const s=e[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=e;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(s,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(t,e)})}async getWFHistory(e){const t=e[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(t,"/process-instances/alls/history"))}async getWFProcessDiagram(e){const t=e[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(t,"/process-instances/alls/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(){return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions2"))}async wfStart(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/process-instances"),{...t,activedata:this.getActiveData(s,e)})}async wfSubmit(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId),{...t,activedata:this.getActiveData(s,e)})}async wfWithdraw(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/withdraw"),{...t,activedata:this.getActiveData(s,e)})}async wfReassign(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/transfer"),{...t,activedata:this.getActiveData(s,e)})}async wfAddStepBefore(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/beforesign"),{...t,activedata:this.getActiveData(s,e)})}async wfSendBack(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/sendback"),{...t,activedata:this.getActiveData(s,e)})}async wfSendCopy(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/sendcopy"),{...t,activedata:this.getActiveData(s,e)})}async exec(e,s,i={},a={}){switch(e){case"wfstart":return this.wfStart(s,i,a);case"wfsubmit":return this.wfSubmit(s,i,a);case"reassign":return this.wfReassign(s,i,a);case"addstepbefore":return this.wfAddStepBefore(s,i,a);case"sendback":return this.wfSendBack(s,i,a);case"sendcopy":return this.wfSendCopy(s,i,a);default:throw new t("「".concat(e,"」未实现"))}}}),Qe=e("Srfuf",(e=>(e[e.CREATE=0]="CREATE",e[e.UPDATE=1]="UPDATE",e))(Qe||{})),Je=e("AppDataEntity",class e{get srfuf(){return this.srfkey?1:0}constructor(t,s){let i;Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:t}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:b(s instanceof e?s._data:s)}),Object.defineProperty(this,"srfdeid",{get:()=>t.id}),Object.defineProperty(this,"srfdecodename",{get:()=>t.codeName});const a=H(t.appDEFields||[],t.keyAppDEFieldId);if(a){const e=a.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfile",{get:()=>e}),Object.defineProperty(this,"srfkey",{set(t){i=t,this._data[e]=t},get(){return this._data[e]||i}})}else ibiz.log.warn("实体[".concat(t.codeName,"]未配置主键字段"));const n=H(t.appDEFields||[],t.majorAppDEFieldId);if(n){const e=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfile",{get:()=>e}),Object.defineProperty(this,"srfmajortext",{set(t){this._data[e]=t},get(){return this._data[e]}})}else ibiz.log.warn("实体[".concat(t.codeName,"]未配置主文本字段"));this.defineProperties()}defineProperties(){var e;const{_data:t}=this,s={},i=Object.keys(t);i.forEach((e=>{s[e]={enumerable:!0,set(s){t[e]=s},get:()=>t[e]}})),null==(e=this._entity.appDEFields)||e.forEach((e=>{const a=e.codeName.toLowerCase();i.includes(a)||(s[a]={enumerable:!0,set(e){t[a]=e},get:()=>t[a]})})),Object.defineProperties(this,s)}clone(){return new e(this._entity,this._data)}assign(t){return t instanceof e?Object.assign(this._data,t._data):Object.assign(this._data,t),this}}),Ze=e("MethodDto",class e{constructor(e,t){this.entity=e,this.dto=t,this.dtoMap=new Map,t?(this.app=ibiz.hub.getApp(e.appId),this.fields=t.appDEMethodDTOFields||[]):this.fields=[]}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async get(e,t){const s={};for(let a=0;a<this.fields.length;a++){const n=this.fields[a],r=n.codeName.toLowerCase();switch(n.type){case"SIMPLE":{const e=t[r];E(e)?s[r]=null:s[r]=e;break}case"DTOS":{const t=await this.getFieldDto(n),i=(await this.app.deService.getService(n.refAppDataEntityId)).local.getList(e);if(i){const a=[];for(let s=0;s<i.length;s++)a.push(await t.get(e,i[s]));s[r]=a}break}default:throw new i(n,"未支持的应用实体方法输入属性类型: ".concat(n.type))}}return s}async sets(e,t){const s=await this.app.deService.getService(this.entity.id);return s.local.clear(e),Promise.all(t.map((async t=>{const i=this.fields.filter((e=>"DTOS"===e.type)).map((async s=>{const i=s.codeName.toLowerCase(),a=await this.getFieldDto(s),n=t[i];n&&await a.sets(e,n)}));for(let e=0;e<i.length;e++)await i[e];const a=new Je(this.entity,t);return this.isLocalMode&&await s.local.add(e,a),a})))}async getFieldDto(t){if(this.dtoMap.has(t.codeName))return this.dtoMap.get(t.codeName);const s=await ibiz.hub.getAppDataEntity(t.refAppDataEntityId,this.entity.appId),i=H(s.appDEMethodDTOs||[],t.refAppDEMethodDTOId),a=new e(s,i);return this.dtoMap.set(t.codeName,a),a}}),et=class{constructor(e,t){this.entity=e,this.method=t,this.app=ibiz.hub.getApp(e.appId),this.input=new class{constructor(e,t){if(this.entity=e,this.input=t,t){const s=H(e.appDEMethodDTOs||[],t.appDEMethodDTOId);s&&(this.dto=new Ze(e,s))}}async handle(e,t){return this.dto?this.dto.get(e,t):t}}(e,t.appDEMethodInput),this.result=new class{constructor(e,t){if(this.entity=e,this.output=t,t){const s=H(e.appDEMethodDTOs||[],t.appDEMethodDTOId);s&&(this.dto=new Ze(e,s))}}async handle(e,t){return this.dto?(await this.dto.sets(e,[t]))[0]:new Je(this.entity,t)}}(e,t.appDEMethodReturn)}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async request(e,t,i,a){const{actionType:n,requestMethod:r}=this.method;if("REMOTE"===n){const t=this.method.codeName.toLowerCase();let n=null;switch(r){case"POST":n=await this.app.net.post("".concat(e,"/").concat(t),i,a);break;case"GET":n=await this.app.net.get("".concat(e,"/").concat(t),i,a);break;case"PUT":n=await this.app.net.put("".concat(e,"/").concat(t),i,a);break;case"DELETE":n=await this.app.net.delete("".concat(e,"/").concat(t),i,a);break;default:throw new s(this.method,r?"未支持的请求方式: ".concat(r):"未配置请求方式")}return n}throw new s(this.method,"未支持的行为类型[".concat(n,"]"))}calcPath(e){const t="/".concat(this.entity.codeName2.toLowerCase());return Ke(e,this.entity)+t}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(e){return new Je(this.entity,e)}},tt=class{},st=class extends tt{constructor(e){super(),this.model=e,this.srcParam=e.srcLogicParamId,this.dstParam=e.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(e,t,a){const n=e.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const e=null!=a[this.value]?a[this.value]:t[this.value];return oe(n[this.dstField],this.op,e)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const t=e.params[this.srcParam];return oe(n[this.dstField],this.op,t[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return oe(n[this.dstField],this.op,this.value)}}},it=class e extends tt{constructor(t){super(),this.model=t;const s=t.conds||[];this.conds=s.map((t=>"SINGLE"===t.logicType?new st(t):new e(t)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(e,t,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(e,t,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},at=class{constructor(e){var t;this.model=e,this.links=null==(t=e.links||[])?void 0:t.map((e=>new class{constructor(e){this.model=e,this.srcNode=null,this.dstNode=null,this.groupCond=null;const t=this.model.delogicLinkGroupCond;t&&(this.groupCond=new it(t))}async exec(e){const{defaultLink:t}=this.model;return!(!t&&this.groupCond)||this.groupCond.test(e,e.context,e.data||{})}}(e)))}},nt=class extends at{async exec(e){const{dstAppDataEntityId:t,dstAppDEActionId:i,dstDELogicParamId:a,retDELogicParamId:n}=this.model;if(!t)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=e.params[a],o=ibiz.hub.getApp(e.context.srfappid),c=await o.deService.exec(t,i,e.context,r,e.viewParams);c.ok&&(e.params[n]=c.data)}},rt=class extends at{async exec(e){}},ot=class extends at{async exec(e){e.isEndNode=!0;const{returnParamId:t,returnType:s,rawValue:a}=this.model;switch(s){case"NONEVALUE":e.result=void 0;break;case"NULLVALUE":e.result=null;break;case"SRCVALUE":e.result=a;break;case"LOGICPARAM":e.result=e.params[t];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(s))}}};function ct(e,t){const{srcDELogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=t;let o;switch(t.srcValueType||(t.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=e.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=e.viewParams;break;case"APPDATA":o=e.context;break;case"ENVPARAM":o=b(ibiz.env);break;default:throw new i(t,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}var lt=class extends at{async exec(e){const t=this.model.delogicNodeParams;(null==t?void 0:t.length)&&await Promise.all(t.map((t=>{switch(t.paramAction){case"SETPARAMVALUE":return this.setParamValue(t,e);case"RESETPARAM":return this.resetParam(t,e);case"COPYPARAM":return this.copyParam(t,e);case"BINDPARAM":return this.bindParam(t,e);case"RENEWPARAM":return this.renewParam(t,e);case"APPENDPARAM":return this.appendParam(t,e);case"SORTPARAM":return this.sortParam(t,e);default:throw new i(t,"暂未支持逻辑处理参数操作".concat(t.paramAction))}})))}copyParam(e,t){const{dstDELogicParamId:s}=e,i=ct(t,e);t.params[s]=b(i)}bindParam(e,t){const s=ct(t,e);t.params[e.dstDELogicParamId]=s}setParamValue(e,t){const{dstFieldName:s,dstDELogicParamId:i}=e,a=null==s?void 0:s.toLowerCase(),n=ct(t,e);a?t.params[i][a]=n:t.params[i]=n}resetParam(e,t){const{dstDELogicParamId:s}=e;t.resetParam(s)}renewParam(e,t){const{dstDELogicParamId:s}=e;t.renewParam(s)}appendParam(e,t){const{dstDELogicParamId:s,dstIndex:i,srcIndex:a,srcSize:n}=e,r=ct(t,e),o=i||0,c=a||0,l=n||r.length;t.params[s].splice(o,0,...r.slice(c,l))}sortParam(e,t){const{dstDELogicParamId:s,dstFieldName:i,dstSortDir:a}=e,n=i.toLowerCase();t.params[s].sort(((e,t)=>"ASC"===a?e[n]-t[n]:t[n]-e[n]))}},ht=class extends at{async exec(e){const{dstAppDEDataSetId:t,dstAppDataEntityId:s,dstDELogicParamId:i,retDELogicParamId:a}=this.model,n=e.params[i],r=ibiz.hub.getApp(e.context.srfappid),o=await r.deService.exec(s,t,e.context,n,e.viewParams);o.ok&&(e.params[a]=o.data)}},dt=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ct(e,this.model);e.params[t]=a}},ut=class extends at{async exec(e){const{dstDELogicParamId:t}=this.model;if(!t)throw new s(this.model,"缺少目标参数对象配置");e.resetParam(t)}},pt=class extends at{async exec(e){const{dstDELogicParamId:t}=this.model;if(!t)throw new s(this.model,"缺少目标参数对象配置");e.renewParam(t)}},Et=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ct(e,this.model);e.params[t]=b(a)}},gt=class extends at{async exec(e){const{dstDELogicParamId:t,dstSortDir:i,dstFieldName:a}=this.model;if(!t||!a)throw new s(this.model,"缺少目标参数对象或目标属性配置");const n=a.toLowerCase();e.params[t].sort(((e,t)=>"ASC"===i?e[n]-t[n]:t[n]-e[n]))}},mt=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i,dstIndex:a,srcIndex:n,srcSize:r}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const o=ct(e,this.model),c=a||0,l=n||0,h=r||o.length;e.params[t].splice(c,0,...o.slice(l,h))}},ft=class extends at{async exec(e){const{errorCode:t,errorInfo:s}=this.model;throw new r({response:{status:t,statusText:s}})}},wt=class{constructor(e){var t,a;if(this.model=e,this.nodes=new Map,this.params=new Map,!(null==(t=e.delogicNodes)?void 0:t.length))throw new s(e,"实体逻辑没有配置逻辑节点");e.delogicNodes.forEach((e=>{const{logicNodeType:t}=e;let s;switch(t){case"BEGIN":s=new rt(e);break;case"END":s=new ot(e);break;case"DEACTION":s=new nt(e);break;case"PREPAREPARAM":s=new lt(e);break;case"DEDATASET":s=new ht(e);break;case"THROWEXCEPTION":s=new ft(e);break;case"BINDPARAM":s=new dt(e);break;case"RESETPARAM":s=new ut(e);break;case"COPYPARAM":s=new Et(e);break;case"RENEWPARAM":s=new pt(e);break;case"APPENDPARAM":s=new mt(e);break;case"SORTPARAM":s=new gt(e);break;default:throw new i(e,"未支持的逻辑节点类型: ".concat(t))}this.nodes.set(e.id,s)})),null==(a=e.delogicParams)||a.forEach((e=>{this.params.set(e.id,new class{constructor(e){this.model=e}calc(e){const t=this.model.id,s=this.model;if(s.default)e.params[t]=e.data||{};else if(s.appGlobalParam)e.params[t]=b(ibiz.env);else if(s.entityListParam)e.params[t]=[];else{if(s.entityPageParam)throw new i(s,"未支持的逻辑参数类型: 分页查询结果");if(s.entityParam)e.params[t]={};else{if(s.lastReturnParam)throw new i(s,"未支持的逻辑参数类型: 上次调用返回");if(s.appContextParam)e.params[t]=e.context;else if(s.simpleListParam)e.params[t]=[];else if(s.simpleParam)e.params[t]={};else if(s.cloneParam)e.params[t]=b(e.data||{});else{if(s.envParam)throw new i(s,"未支持的逻辑参数类型: 系统环境变量");if(s.fileListParam)throw new i(s,"未支持的逻辑参数类型: 文件对象列表变量");if(s.fileParam)throw new i(s,"未支持的逻辑参数类型: 文件对象变量");if(s.filterParam)throw new i(s,"未支持的逻辑参数类型: 过滤器对象变量");if(s.lastParam)throw new i(s,"未支持的逻辑参数类型: 最后数据变量");if(s.originEntity)throw new i(s,"未支持的逻辑参数类型: 原始数据对象");if(s.sessionParam)throw new i(s,"未支持的逻辑参数类型: 操作会话变量")}}}}renew(e){const t=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)e.params[t]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");e.params[t]={}}}}(e))})),this.nodes.forEach((e=>{e.links.forEach((t=>{t.srcNode=e,this.nodes.has(t.model.thenId)&&(t.dstNode=this.nodes.get(t.model.thenId))}))}))}initLogicParams(e){this.params.forEach((t=>{t.model.default&&(e.defaultParamName=t.model.id),t.calc(e)}))}async exec(e,t,i){const a=new class{constructor(e,t,s,i){this.deLogicParams=e,this.context=t,this.data=s,this.viewParams=i,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}resetParam(e){var t;null==(t=this.deLogicParams.get(e))||t.calc(this)}renewParam(e){var t;null==(t=this.deLogicParams.get(e))||t.renew(this)}}(this.params,e,t,i);this.initLogicParams(a);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new s(this.model,"未设置起始节点");{const e=this.nodes.get(n);await this.deepExec(e,a)}return a.isEndNode?a.result:a.params[a.defaultParamName]?a.params[a.defaultParamName]:null}async deepExec(e,t){await e.exec(t);const{links:s}=e;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(t)&&a.dstNode&&(await this.deepExec(a.dstNode,t),!1===e.model.parallelOutput))break}}},It=new Map;async function Dt(e,t,s,i){It.has(e)||It.set(e,new wt(e));return It.get(e).exec(t,s,i)}async function At(e,t,s,i){try{const a=await Dt(e,t,s,i);return new n(a)}catch(e){if(e instanceof r)return new n(e,500);throw e}}async function Pt(e,t,s,i,a){const n=J(e,t);if(n.length){(await Promise.all(n.map((e=>Dt(e,s,i,a))))).forEach((e=>{Object.assign(i,e)}))}}var yt=class extends et{async exec(e,t,i){if("DELOGIC"===this.method.actionType){const a=Q(this.method.appDELogicId,this.entity);if(!a)throw new s(this.method,"缺少实体处理逻辑");return At(a,e,t,i)}let a;switch(this.isLocalMode||(t=await this.input.handle(e,t)),["READ","GETDRAFT"].includes(this.method.actionMode)||await Pt(this.entity,"change",e,t,i),this.method.codeName){case"Create":a=await this.create(e,t,i);break;case"Get":a=await this.get(e,i);break;case"GetDraft":a=await this.getDraft(e,i);break;case"Remove":a=await this.remove(e,i);break;case"Update":a=await this.update(e,t,i);break;case"CreateTemp":a=await this.createTemp(e,t);break;case"GetTemp":a=await this.getTemp(e,t);break;case"GetDraftTemp":a=await this.getDraftTemp(e,i);break;case"RemoveTemp":a=await this.removeTemp(e,t);break;case"UpdateTemp":a=await this.updateTemp(e,t);break;default:{let s=this.calcPath(e);this.method.needResourceKey&&(s="".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]||t[this.entity.keyAppDEFieldId]));const n=await this.request(s,e,t,i);n.data=await this.result.handle(e,n.data),a=n}}return await Pt(this.entity,"compute",e,a.data,i),a}async create(e,t,s){if(this.isLocalMode)return this.createTemp(e,this.createEntity(t));const i=this.calcPath(e),a=await this.app.net.post(i,t,s);return a.data=await this.result.handle(e,a.data),a}async remove(e,t){if(this.isLocalMode)return this.removeTemp(e,t);const s=this.calcPath(e);return await this.app.net.delete("".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]),t)}async update(e,t,s={}){if(this.isLocalMode)return this.updateTemp(e,this.createEntity(t));const i=this.calcPath(e),a=await this.app.net.put("".concat(i,"/").concat(e[this.entity.codeName.toLowerCase()]),t,s);return a.data=await this.result.handle(e,a.data),a}async get(e,t={}){if(this.isLocalMode)return this.getTemp(e,t);const s=this.calcPath(e),i=await this.app.net.get("".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]),t);return i.data=await this.result.handle(e,i.data),i}async getDraft(e,t){if(this.isLocalMode)return this.getDraftTemp(e,t);const s=this.calcPath(e),i=await this.app.net.get("".concat(s,"/getdraft"),t);return i.data=await this.result.handle(e,i.data),i}async createTemp(e,t){try{const s=await this.getService(),i=await s.local.add(e,this.createEntity(t));return new n(i)}catch(e){return new n(e,500)}}async getDraftTemp(e,t){try{const e=this.createEntity({});return e?new n(e):new n(e,500)}catch(e){return new n(e,500)}}async removeTemp(e,t){try{let t=null;!t&&e&&(t=e[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.delete(e,t);return s?new n(s):new n(s,500)}catch(e){return new n(e,500)}}async updateTemp(e,t){try{const s=(await this.getService()).local.update(e,this.createEntity(t));return s?new n(s):new n(s,500)}catch(e){return new n(e,500)}}async getTemp(e,t){try{let t=null;!t&&e&&(t=e[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.get(e,t);return s?new n(s):new n(s,500)}catch(e){return new n(e,500)}}async removeBatchTemp(e,t){return new n(!0)}},vt=class extends et{async exec(e,t,s){if(this.isLocalMode){const s=await this.searchLocal(null,new He(e,t));return new n(s,200)}let a;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":a=await this.fetchCodeListSet(e,s);break;case"REMOTE":{const i=this.calcPath(e);a=await this.request(i,e,t,s)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const r=a.data||[];return a.data=r.map((e=>this.createEntity(e))),a.data.length&&await Promise.all(a.data.map((t=>Pt(this.entity,"compute",e,t,s)))),a}async selectLocal(e,t={}){let s=(await this.getService()).local.getList(e);s=D(s,"srfordervalue");const i={},a={},n={},r={};t.srfkey&&(i.srfkey=C(t.srfkey),delete t.srfkey);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const s=t[e];null==s?(a[e]=C(null),n[e]=C(void 0),r[e]=C("")):i[e]=C(s)}if(!_(i)){const e=V(i),t=V(a),o=V(n),c=V(r);s=s.filter((s=>{if(_(a)){if(e(s))return!0}else if(e(s)&&(t(s)||o(s)||c(s)))return!0;return!1}))}return s.map((e=>e.clone()))}async searchLocal(e,t,s=this.entity.quickSearchAppDEFieldIds){const i=await this.getService();let a=[];e?(a=i.local.getList(t.context),a.length>0&&(a=a.filter((s=>e.test(s,t))))):(a=await this.selectLocal(t.context),a.length>0&&t.query&&""!==t.query&&s&&(a=a.filter((e=>{const i=new RegExp(t.query);for(let t=0;t<s.length;t+=1){const a=e[s[t]];if(i.test(a))return!0}return!1})))),v(t.sortField)||_(t.sortField)||(a="DESC"===t.sortMode?A(a,t.sortField):D(a,t.sortField));const{page:n,size:r}=t,o=n*r,c=(n+1)*r-1;return a.slice(o,c).map((e=>b(e)))}async fetchCodeListSet(e,t){const{appCodeListId:i}=this.method;if(!i)throw new s(this.method,"没有指定数据来源代码表");const a=await this.app.codeList.get(i,e,t),{keyAppDEFieldId:r,majorAppDEFieldId:o}=this.entity,c=a.map((e=>({[r]:e.value,[o]:e.text})));return new n(c,200)}},Tt=e("DEService",class{constructor(e){this.model=e,this.methodMap=new Map,this.local=new Ge,this.wf=new $e(e),this.file=new class{constructor(e){this.model=e}exportData(e,t,s,i){const a=Ke(s,this.model),n="".concat(a,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(t.toLowerCase(),"/?srfexporttag=").concat(e.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}}(e)}getMethod(e){if(this.methodMap.has(e))return this.methodMap.get(e);const t=H(this.model.appDEMethods,e);let s=null;switch(t.methodType){case"DEACTION":s=new yt(this.model,t);break;case"FETCH":case"FETCHTEMP":s=new vt(this.model,t);break;default:throw new i(t,"未支持的服务方法类型: ".concat(t.methodType))}return this.methodMap.set(e,s),s}exec(e,s,i={},a={}){const n=this.getMethod(e);if(n)return n.exec(s,i,a);throw new t("".concat(this.model.codeName,"未支持「").concat(e,"」方法"))}}),_t=e("ControlVO",class e{get srfuf(){return v(this.$origin.srfuf)?this.srfkey?1:0:this.$origin.srfuf}get srfkey(){return this.$origin.srfkey}get srfmajortext(){return this.$origin.srfmajortext}get srfdeid(){return this.$origin.srfdeid}get srfdecodename(){return this.$origin.srfdecodename}get srfkeyfile(){return this.$origin.srfkeyfile}get srfmajorfile(){return this.$origin.srfmajorfile}constructor(e={},t=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:e||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:t||new Map}),this.$dataUIMap.forEach(((e,t)=>{const s=e.dataKey;this.linkProperty(t,s,e.isOriginField)})),Object.keys(e).forEach((e=>{Object.prototype.hasOwnProperty.call(this,e)||this.linkProperty(e,e)}))}linkProperty(e,t,s=!0){"srfuf"!==e&&(s||Object.prototype.hasOwnProperty.call(this.$origin,e)?Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get(){return this.$origin[t]},set(e){this.$origin[t]=e}}):Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(t){this.$origin=t instanceof e?t.getOrigin():t}}),bt=e("ControlService",class{constructor(e){this.dataUIMap=new Map,this.model=e}async init(e){this.app=ibiz.hub.getApp(null==e?void 0:e.srfappid),this.initUIDataMap()}initUIDataMap(){}async exec(e,t,s={},i={}){return await this.app.deService.exec(this.model.appDataEntityId,e,t,s,i)}handleResponse(e){return e}toUIData(e){return new _t(e,this.dataUIMap)}}),Ct=(e("MDControlService",class extends bt{async fetch(e,t={}){var s;const i=(null==(s=this.model.fetchControlAction)?void 0:s.appDEMethodId)||"fetchdefault";let a=await this.exec(i,e,t);return a=this.handleResponse(a),a}async get(e,t={}){var s;const i=(null==(s=this.model.getControlAction)?void 0:s.appDEMethodId)||"get";let a=await this.exec(i,e,void 0,t);return a=this.handleResponse(a),a}async getDraft(e,t={}){var s;const i=(null==(s=this.model.getDraftControlAction)?void 0:s.appDEMethodId)||"getdraft";let a=await this.exec(i,e,void 0,t);return a=this.handleResponse(a),a}async remove(e,t={}){var s;const i=(null==(s=this.model.removeControlAction)?void 0:s.appDEMethodId)||"remove";return await this.exec(i,e,void 0,t)}async create(e,t){var s;const i=(null==(s=this.model.createControlAction)?void 0:s.appDEMethodId)||"create";let a=await this.exec(i,e,t.getOrigin());return a=this.handleResponse(a),a}async update(e,t){var s;const i=(null==(s=this.model.updateControlAction)?void 0:s.appDEMethodId)||"update";let a=await this.exec(i,e,t.getOrigin());return a=this.handleResponse(a),a}async exportData(e,s,i={}){throw new t("未实现")}handleResponse(e){const t=super.handleResponse(e);return t.headers&&(t.headers["x-page"]&&(t.page=Number(t.headers["x-page"])),t.headers["x-per-page"]&&(t.size=Number(t.headers["x-per-page"])),t.headers["x-total"]&&(t.total=Number(t.headers["x-total"]))),t.ok&&(w(t.data)?t.data=t.data.map((e=>this.toUIData(e))):t.data=this.toUIData(t.data)),t}}),e("DeAuthorityService",class{constructor(e){this.entityModel=e}async calcByDataAccessAction(e,t){if(t.srfopprivs&&!t.srfopprivs.includes(e))return!1;return!!await this.calcByDeMainState(e,t)}async calcByDeMainState(e,t){let s=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),s;ibiz.log.debug("操作标识".concat(e,"主状态计算开始"),t,i);const a=Y(i,t);if(a){ibiz.log.debug("匹配主状态",a);const t=q(a,i);ibiz.log.debug("允许的主状态权限集合",t),s=t.includes(e)}else ibiz.log.debug("没匹配主状态,返回false"),s=!1;return ibiz.log.debug("操作标识".concat(e,"权限计算结束:").concat(s)),s}})),Vt=e("AuthorityService",class{constructor(e){this.appModel=e,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(e,t){this.constructorCache.set(e,t)}async getService(e){if(!this.cache.has(e)){const s=await ibiz.hub.getAppDataEntity(e,this.appModel.appId);if(!s)throw new t("未找到应用实体[".concat(e,"]"));const i=this.constructorCache.get(e);let a;a=i?await i(s):new Ct(s),this.cache.set(e,a)}return this.cache.get(e)}async init(e=ibiz.appData){if(!e)throw new t("没有appData数据");e.unires&&(this.resCodes=e.unires),!0===e.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0)}calcByResCode(e){return!this.enablePermission||this.resCodes.includes(e)}async calcByDataAccessAction(e,t,s){if(this.enablePermission){const t=await ibiz.hub.getApp(this.appModel.appId),i=await t.getOPPriv(e,s);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(t&&s){return(await this.getService(s)).calcByDataAccessAction(e,t)}return!0}}),Lt=e("AuthService",class{async v7login(e,t){return await ibiz.net.post("/v7/login",{loginname:e,password:t},{},{})}async v7logout(){return await ibiz.net.get("/v7/logout",{})}}),Rt=e("TreeNodeData",class{constructor(e,t,s){this.leaf=!1,this.leaf=!0===s.leaf,this.parent=t,this.parent&&(this.context={...this.parent.context}),s.navContext&&(this.context=Object.assign(this.context||{},s.navContext)),s.navParams&&(this.params={...s.navParams}),this.nodeId=e.id}}),Mt=(e("TreeCodeListNodeData",class extends Rt{constructor(e,t,s){super(e,t,s);const{data:i}=s;if(this.deData=i,this.text=i.text,this.value=i.value,this.id=t?"".concat(t.id,":").concat(e.id,"@").concat(this.value):e.id+this.value,this.id=this.id.toLowerCase(),e.appDataEntityId){const t=$(e.appDataEntityId);this.context=Object.assign(this.context||{},{[t]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text}}),e("TreeDataSetNodeData",class extends Rt{constructor(e,t,s){super(e,t,s);const{data:i}=s;if(this.deData=i,this.text=i.srfmajortext,this.value=i.srfkey,this.id=t?"".concat(t.id,":").concat(e.id,"@").concat(i.srfkey):e.id+i.srfkey,this.id=this.id.toLowerCase(),e.appDataEntityId){const t=$(e.appDataEntityId);this.context=Object.assign(this.context||{},{[t]:i.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext}}),e("TreeStaticNodeData",class extends Rt{constructor(e,t,s){var i,a;super(e,t,s);const n="root"===e.nodeValue?void 0:e.nodeValue;if(this.id=t?"".concat(t.id,":").concat(e.id):e.id,this.id=this.id.toLowerCase(),this.text=e.text,this.value=n,t&&s.parentValueLevel){let e=t;for(let t=1;t<s.parentValueLevel;t++)e=null==e?void 0:e.parent;(null==e?void 0:e.deData)&&(this.deData=e.deData),this.value=n||(null==e?void 0:e.value)}this.srfkey=(null==(i=this.deData)?void 0:i.srfkey)||this.value,this.srfmajortext=(null==(a=this.deData)?void 0:a.srfmajortext)||this.text}}),e("UIMapField",class{constructor(e,t,s={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=e,this.dataKey=t,v(s.isOriginField)||(this.isOriginField=s.isOriginField)}}),e("DEServiceUtil",class{constructor(e){this.appModel=e,this.cache=new Map,this.constructorCache=new Map}register(e,t){this.constructorCache.set(e,t)}async getService(e){if(!this.cache.has(e)){const s=await ibiz.hub.getAppDataEntity(e,this.appModel.appId);if(!s)throw new t("未找到应用实体[".concat(e,"]"));const i=this.constructorCache.get(e);let a;a=i?await i(s):new Tt(s),this.cache.set(e,a)}return this.cache.get(e)}clearTempCache(e){this.cache.forEach((t=>{t.local.clear(e)}))}async exec(e,t,s,i,a){return(await this.getService(e)).exec(t,s,i,a)}})),Ot=e("Application",class{constructor(e){this.model=e,this.deName2DeCodeName=new Map,this.net=new o({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(e.appId)}),this.deService=new Mt(e),this.codeList=new Ye(e),this.authority=new Vt(e)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle()}async loadAppModelStyle(){await this.net.get("".concat(ibiz.env.remoteModelUrl,"/PSSYSAPP.json.css")).then((e=>{const t=document.createElement("style");if(t.setAttribute("type","text/css"),e.request&&e.request.responseURL){const s=new URL(e.request.responseURL);t.id=s.pathname}t.innerHTML=e.data,document.head.appendChild(t)})).catch((e=>{ibiz.log.error("应用[".concat(this.appId,"]模型全局样式加载失败:").concat(e.message))}))}getAppFunc(e){return(this.model.appFuncs||[]).find((t=>t.id===e))||null}async getUIAction(e){const[,t]=e.split("@");if(t){const s=(await ibiz.hub.getAppDataEntity(t,this.model.appId)).appDEUIActions.find((t=>t.id===e));if(s)return s}return this.model.appDEUIActions.find((t=>t.id===e))}async getOPPriv(e,t){var s,i;let a=null==(s=this.model.deopprivs)?void 0:s.find((t=>t.name===e));if(!a&&t){a=null==(i=(await ibiz.hub.getAppDataEntity(t,this.model.appId)).deopprivs)?void 0:i.find((t=>t.name===e))}return a}async getDEUILogic(e,t){return(await ibiz.hub.getAppDataEntity(t,this.model.appId)).appDEUILogics.find((t=>t.id===e))}}),Wt=class{constructor(){this.convert=new class{constructor(){this.appMenu=new class{parse(e){return e}}}},this.appMap=new Map,this.apps=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new class{constructor(){this.view=new class{constructor(){this.viewConfigs=new Map}set(e,t){this.viewConfigs.set(e,t)}async get(e){if(!this.viewConfigs.has(e)){const s=await ibiz.hub.getAppView(e);if(!s)throw new t("视图[".concat(e,"]不存在"));this.set(s.id,{id:s.id,codeName:s.codeName,openMode:s.openMode,width:s.width,height:s.height,appDataEntityId:s.appDataEntityId,redirectView:s.redirectView})}return this.viewConfigs.get(e)}}}},this.defaultAppIndexViewName="Index"}calcAppViewId(e){let t="";if(-1!==e.indexOf(".")){const s=e.split(".");t=s[s.length-1]}else t=e.toLowerCase();return t}registerModelLoaderProvider(e){this.modelLoaderProvider=e}registerApp(e){this.apps.set(e.codeName,e)}registerAppView(e){this.views.set(e.codeName,e)}registerAppDataEntity(e,t=ibiz.env.appId){this.dataEntities.has(t)||this.dataEntities.set(t,new Map);this.dataEntities.get(t).set(e.id,e)}setAppView(e,t=ibiz.env.appId){const s=this.calcAppViewId(e);this.view2appMap.set(s,t)}hasAppView(e){const t=this.calcAppViewId(e);return this.view2appMap.has(t)}async getAppView(e){const s=this.calcAppViewId(e),i=this.view2appMap.get(s)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(s))return this.views.get(s);if(this.modelLoaderProvider){const e=await this.modelLoaderProvider.getAppView(i,s);return this.registerAppView(e),e}throw new t("视图[".concat(s,"]不存在"))}async getAppDataEntity(e,s=ibiz.env.appId){if(this.dataEntities.has(s)){const t=this.dataEntities.get(s);if(t.has(e))return t.get(e)}if(this.modelLoaderProvider){let t;return t=-1!==e.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(s,e):await this.modelLoaderProvider.getAppDataEntityByCodeName(s,e),this.registerAppDataEntity(t,s),t}throw new t("未找到应用实体[".concat(e,"]"))}async createApp(e){if(this.appMap.has(e))return this.appMap.get(e);let s;if(this.apps.has(e))s=this.apps.get(e);else{if(!this.modelLoaderProvider)throw new t("未找到应用[".concat(e,"]模型"));s=await this.modelLoaderProvider.getApp(e),this.registerApp(s)}const i=new Ot(s);return this.appMap.set(e,i),await i.init(),i}async getAppAsync(e=ibiz.env.appId){return this.createApp(e)}getApp(e){let t=null;return t=e?e instanceof Object?e.id:e:ibiz.env.appId,this.appMap.get(t)}},Nt=e("EngineFactory",class{constructor(){this.viewEngines=new Map}register(e,t){this.viewEngines.set(e,t)}unRegister(e){this.viewEngines.delete(e)}getEngine(e,...t){const{engineType:s,engineCat:i}=e,a="".concat(i,"_").concat(s),n=this.viewEngines.get(a);if(n)return n(...t);ibiz.log.error("没有".concat(a,"对应的引擎"),e)}}),xt=e("ViewEngineBase",class{constructor(e){this.view=e,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:e}=this.view;e.push("captionbar","toolbar")}async onMounted(){var e,t;const{model:s,childNames:i}=this.view;ibiz.log.debug("".concat(s.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_header;t&&(t.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_footer;e&&(e.state.visible=!1)}}}async onDestroyed(){}async call(e,t){if("GetData"===e)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var e,t,s,i;let a=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_captionbar;t&&(t.state.visible=!1)}else a=!0;if(ibiz.env.isMob){if(this.leftToolbar)a=!0;else{const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.lefttoolbar;e&&(e.state.visible=!1)}if(this.rightToolbar)a=!0;else{const e=null==(s=this.viewLayoutPanel)?void 0:s.panelItems.righttoolbar;e&&(e.state.visible=!1)}}else if(this.toolbar)a=!0;else{const e=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;e&&(e.state.visible=!1)}return a}calcViewFooterVisible(){let e=!1;return this.footerToolbar&&(e=!0),e}async loadEntityData(){const{appDataEntityId:e}=this.view.model,{evt:s,context:i,params:a}=this.view;if(!e)throw new t("该视图没有实体,无法加载实体数据");const n=ibiz.hub.getApp(i.srfappid),r=await n.deService.exec(e,"get",i,a),{data:o}=r;o&&(this.view.state.srfactiveviewdata=o,s.emit("onDataChange",{actionType:"LOAD",data:[o]}),o.srfkey&&s.emit("onViewInfoChange",{dataInfo:o.srfmajortext||""}))}}),St=(e("MDViewEngine",class extends xt{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:e}=this.view;e.push(this.xdataControlName,"searchform","searchbar")}async onMounted(){await super.onMounted();const{model:e}=this.view;this.xdataControl.evt.on("onActive",(async e=>{await this.openData(e)})),this.xdataControl.evt.on("onSelectionChange",(async e=>{var t;null==(t=this.toolbar)||t.calcButtonState(e.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"SAVE"})}));const t=this.viewLayoutPanel.panelItems.view_searchform;if(t){const s=!!this.searchForm;t.state.keepAlive=s,t.state.visible=s&&!!e.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.refresh()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.refresh()})),!this.view.state.noLoadDefault&&e.loadDefault&&this.load()}async call(e,t){return"ToggleFilter"===e?(this.toggleFilter(),null):"Edit"===e||"View"===e?(this.openData(t),null):"New"===e?(this.newData(t),null):"Remove"===e?(await this.remove(t),null):"Import"===e?(await this.importData(),null):"Refresh"===e?(await this.refresh(),null):"ExportExcel"===e?(await this.exportData(t),null):"Copy"===e?(this.copy(t),null):"load"===e?(this.load(t),null):super.call(e,t)}getData(){return this.xdataControl.getData()}async openData(e){var t,i;const{data:a,event:n}=e,r=this.view.context.clone();r[((null==(t=a[0].srfdecodename)?void 0:t.toLowerCase())||$(this.xdataControl.model.appDataEntityId)).toLowerCase()]=a[0].srfkey;if(-1===await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:r,params:this.view.params,data:a,event:n,view:this.view})))throw new s(this.view.model,"缺少opendata的视图逻辑")}async newData(e){var t,i,a;const{data:n,event:r,copyMode:o}=e;if(!(null==(i=null==(t=this.view.model.viewLayoutPanel)?void 0:t.appViewLogics)?void 0:i.find((e=>"newdata"===e.id))))throw new s(this.view.model,"缺少newdata的视图逻辑");const c=this.view.context.clone();o&&(c.srfcopymode=!0);if(-1===await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("newdata",{context:c,params:this.view.params,data:n,event:r,view:this.view})))throw new s(this.view.model,"缺少newdata的视图逻辑")}async remove(e){await this.xdataControl.remove(e)}async load(e={}){await this.xdataControl.load({isInitialLoad:!0,...e})}async refresh(){await this.xdataControl.refresh()}getSearchParams(){const e={};if(this.searchForm){const t=this.searchForm.getData()[0];Object.assign(e,t)}if(this.searchBar){const t={query:this.searchBar.state.query};Object.assign(e,t)}return e}async importData(){await this.xdataControl.importData()}async exportData(e){await this.xdataControl.exportData(e)}async copy(e){this.newData(Object.assign(e,{copyMode:!0}))}calcViewHeaderVisible(){let e=super.calcViewHeaderVisible();if(this.searchBar)e=!0;else{const e=this.viewLayoutPanel.panelItems.view_searchbar;e&&(e.state.visible=!1)}return e}toggleFilter(){if(this.searchForm){const e=this.viewLayoutPanel.panelItems.view_searchform;e&&(e.state.visible=!e.state.visible)}}}),class{constructor(){this.layoutPanel=new fe}}),Bt=e("CONTROL_PROVIDER_PREFIX","CONTROL");function Ft(e){return ibiz.register.get("".concat(Bt,"_").concat(e))}async function kt(e){let t;const{controlType:s,controlStyle:i}=e;if(i&&"DEFAULT"!==i){t=Ft("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到部件类型:[".concat(s,"]的部件样式:[").concat(i,"]对应的适配器"),e)}return t||(t=Ft(s)),t||ibiz.log.error("找不到部件类型".concat(s,"对应的适配器")),t}var Ut=e("EDITOR_PROVIDER_PREFIX","EDITOR");function zt(e){return ibiz.register.get("".concat(Ut,"_").concat(e))}var Gt=e("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");var jt=e("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");var Xt=e("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Kt(e){return ibiz.register.get("".concat(Xt,"_").concat(e.toUpperCase()))}var Ht=e("UIACTION_PROVIDER_PREFIX","UIACTION");function Yt(e,t){ibiz.register.register("".concat(Ht,"_").concat(e),t)}async function qt(e){let s;const{uiactionMode:i}=e;var a;if(s||(a=i,s=ibiz.register.get("".concat(Ht,"_").concat(a))),!s)throw new t("找不界面行为模式".concat(i,"对应的适配器"));return s}var $t=e("VIEW_PROVIDER_PREFIX","VIEW");function Qt(e){return ibiz.register.get("".concat($t,"_").concat(e))}var Jt=e("PORTLET_PROVIDER_PREFIX","PORTLET");var Zt=class{},es=class extends Zt{constructor(e){super(),this.model=e,this.srcParam=e.srcLogicParamId,this.dstParam=e.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(e,t,a){const n=e.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const e=null!=a[this.value]?a[this.value]:t[this.value];return oe(n[this.dstField],this.op,e)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const t=e.params[this.srcParam];return oe(n[this.dstField],this.op,t[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return oe(n[this.dstField],this.op,this.value)}}},ts=class e extends Zt{constructor(t){super(),this.model=t;const s=t.deuilogicLinkConds||[];this.conds=s.map((t=>"SINGLE"===t.logicType?new es(t):new e(t)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(e,t,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(e,t,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},ss=class{constructor(e){this.model=e,this.links=(e.deuilogicLinks||[]).map((e=>new class{constructor(e){this.model=e,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:t,deuilogicLinkGroupCond:s}=this.model;0===t&&s&&(this.groupCond=new ts(s))}async exec(e){const{linkMode:t}=this.model,{context:s,data:a}=e;switch(t||0){case 0:return!this.groupCond||this.groupCond.test(e,s,a&&a.length>0?a[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(t))}}}(e)))}},is=class extends ss{async exec(e){const{dstAppDataEntityId:t,dstAppDEActionId:i,dstDEUILogicParamId:a,retDEUILogicParamId:n}=this.model;if(!t)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=e.params[a],o=ibiz.hub.getApp(e.context.srfappid),c=await o.deService.exec(t,i,e.context,r,e.viewParams);c.ok&&(e.params[n]=c.data)}},as=class extends ss{async exec(e){const{dstAppDEUIActionId:t,dstDEUILogicParamId:i}=this.model,{data:a,parameters:n}=e;if(!t)throw new s(this.model,"未配置界面行为");let r=[a];if(i){const t=e.params[i];r=t instanceof Array?t:[t]}await us.execAndResolved(t,{...n,data:r})}},ns=class extends ss{async exec(e){}},rs=class extends ss{async exec(e){e.isEndNode=!0;const{returnType:t,rawValue:s,returnParamId:a}=this.model;switch(t){case"NONEVALUE":e.result=void 0;break;case"NULLVALUE":e.result=null;break;case"SRCVALUE":e.result=s;break;case"LOGICPARAM":e.result=e.params[a];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(t))}}};var os=class extends ss{async exec(e){const t=this.model.deuilogicNodeParams;(null==t?void 0:t.length)&&await Promise.all(t.map((t=>{if("SETPARAMVALUE"===t.paramAction)return this.setParamValue(t,e);throw new i(t,"暂未支持逻辑处理参数操作".concat(t.paramAction))})))}setParamValue(e,t){const{dstFieldName:s,dstDEUILogicParamId:a}=e,n=null==s?void 0:s.toLowerCase(),r=function(e,t){const{srcDEUILogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=t;let o;switch(t.srcValueType||(t.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=e.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=e.viewParams;break;case"APPDATA":o=e.context;break;case"ENVPARAM":o=b(ibiz.env);break;default:throw new i(t,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}(t,e);n?t.params[a][n]=r:t.params[a]=r}},cs=class extends ss{async exec(e){e.isEndNode=!0;const{invokeMethod:i,invokeCtrlId:a,invokeParamId:n}=this.model;if(!a)throw new s(this.model,"没有配置界面对象");if(!n)throw new s(this.model,"没有配置操作参数");if(!i)throw new s(this.model,"没有配置调用方法");const r=e.params[n];if(!r)throw new t("没有找到操作参数".concat(n));const o=e.params[a];if(!o)throw new t("没有找到界面对象".concat(a));if(!o[i]||!u(o[i]))throw new t("没有找到调用方法".concat(i));await o[i](r)}},ls=class{constructor(e){var a;if(this.model=e,this.nodes=new Map,this.params=new Map,!(null==(a=e.deuilogicNodes)?void 0:a.length))throw new s(e,"界面逻辑没有配置逻辑节点");e.deuilogicNodes.forEach((e=>{const{logicNodeType:t}=e;let s;switch(t){case"BEGIN":s=new ns(e);break;case"END":s=new rs(e);break;case"DEACTION":s=new is(e);break;case"DEUIACTION":s=new as(e);break;case"PREPAREJSPARAM":s=new os(e);break;case"RESETPARAM":case"COPYPARAM":case"BINDPARAM":case"VIEWCTRLINVOKE":s=new cs(e);break;default:throw new i(e,"未支持的逻辑节点类型: ".concat(t))}this.nodes.set(e.id,s)})),e.deuilogicParams.forEach((e=>{this.params.set(e.id,new class{constructor(e){this.model=e}calc(e){const s=this.model.id,a=this.model,{context:n,viewParams:r,data:o,parameters:c}=e,l=ibiz.hub.getApp(n.srfappid);if(a.default)e.params[s]=o&&o.length>0?o[0]:{};else if(a.activeContainerParam)e.params[s]=c.ctrl||c.view;else if(a.activeCtrlParam)e.params[s]=c.ctrl;else if(a.ctrlParam){const i=c.view.getController(a.codeName.toLowerCase());if(!i)throw new t("没找到".concat(a.codeName,"指定部件对象"));e.params[s]=i}else if(a.activeViewParam)e.params[s]=c.view;else if(a.appGlobalParam)e.params[s]=ibiz.env;else if(a.applicationParam)e.params[s]=l;else if(a.entityListParam)e.params[s]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)e.params[s]={};else{if(a.lastReturnParam)throw new i(a,"未支持的逻辑参数类型: 上次调用返回");if(a.navContextParam)e.params[s]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)e.params[s]=[];else if(a.simpleParam)e.params[s]={};else if(a.viewNavDataParam)e.params[s]=r;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}}}renew(e){const t=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)e.params[t]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");e.params[t]={}}}}(e))})),this.nodes.forEach((e=>{e.links.forEach((t=>{t.srcNode=e,this.nodes.has(t.model.dstDEUILogicNodeId)&&(t.dstNode=this.nodes.get(t.model.dstDEUILogicNodeId))}))}))}initLogicParams(e){this.params.forEach((t=>{t.model.default&&(e.defaultParamName=t.model.id),t.calc(e)}))}async exec(e){const t=new class{constructor(e,t){this.deLogicParams=e,this.parameters=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get context(){return this.parameters.context}get data(){return this.parameters.data}get viewParams(){return this.parameters.params}resetParam(e){var t;null==(t=this.deLogicParams.get(e))||t.calc(this)}renewParam(e){var t;null==(t=this.deLogicParams.get(e))||t.renew(this)}}(this.params,e);this.initLogicParams(t);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new s(this.model,"未设置起始节点");{const e=this.nodes.get(i);await this.deepExec(e,t)}return t.isEndNode?t.result:t.params[t.defaultParamName]?t.params[t.defaultParamName]:null}async deepExec(e,t){await e.exec(t);const{links:s}=e;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(t)&&a.dstNode&&(await this.deepExec(a.dstNode,t),!1===e.model.parallelOutput))break}}},hs=new Map;async function ds(e,s,i){const a=ibiz.hub.getApp(i.context.srfappid),n=await a.getDEUILogic(e,s);if(!n)throw new t("找不到实体".concat(s,"的界面逻辑").concat(e));hs.has(n)||hs.set(n,new ls(n));const r=hs.get(n);return await r.exec(i),null}var us=e("UIActionUtil",class{static async exec(e,s){const i=await ee(e);if(!i)throw new t("没找到".concat(e,"的界面行为模型"));return(await qt(i)).exec(i,s)}static async execAndResolved(e,t){const s=await this.exec(e,t);s.closeView?t.view.closeView():s.refresh&&await t.view.callUIAction("Refresh")}}),ps=class{async exec(e,t){const{context:i,params:a,data:n}=t,r={refresh:e.reloadData,closeView:e.closeEditView},{appDEUILogicId:o,appDataEntityId:c,uilogicAttachMode:l}=e;if("REPLACE"===l){if(!o)throw new s(e,"没有配置实体界面逻辑");return await ds(o,c,t),r}if(!await this.isConfirm(e))return this.returnError(r);const h=await this.execAction(e,t);if(Object.assign(r,h),!0===r.cancel)return this.returnError(r);const d=await this.doNextAction(e,{...t,context:r.nextContext||i,data:r.data||n,params:r.nextParams||a});if(d&&(Object.assign(r,d),!0===d.cancel))return this.returnError(r);if("AFTER"===e.uilogicAttachMode){if(!o)throw new s(e,"没有配置实体界面逻辑");await ds(o,c,t)}return r}returnError(e){return Object.assign(e,{refresh:!1,closeView:!1})}async isConfirm(e){return!e.enableConfirm||!e.confirmMsg||ibiz.modal.confirm({title:e.confirmMsg})}async doNextAction(e,t){const s=e.nextId;if(s)return us.exec(s,t)}async handleParams(e,t,s,i){let a=[];const n=$(e.appDataEntityId);switch(e.actionTarget){case"NONE":a=[];break;case"SINGLEDATA":a=[s[0]];break;case"MULTIDATA":a=s;break;case"MULTIKEY":a=n&&s.length>0?s.map((e=>({[n]:e.srfkey||e[n]}))):[{}];break;case"SINGLEKEY":{const e=s[0]||{};a=n?[{[n]:e.srfkey||e[n]}]:[{}]}}const r=t.clone(),o=[...e.navigateContexts||[]];if(n&&"NONE"!==e.actionTarget){const{valueItem:t,paramItem:s}=e,i=s||n,a=t||"srfkey";o.unshift({key:i,value:a,rawValue:!1})}const c=["MULTIKEY","MULTIDATA"].includes(e.actionTarget)&&s.length>0,l=z(o,t,i,c?K(o,s):s[0]||{});Object.assign(r,l);const h=e.navigateParams;return{resultContext:r,resultData:a,resultParams:z(h,r,i,c?K(h,s):s[0]||{})}}},Es=e("BackendUIActionProvider",class extends ps{async execAction(e,t){const{context:i,params:a,data:n,event:r}=t,o={},c=e.appDataEntityId,l=e.appDEMethodId;if(!c||!l)throw new s(e,"未配置实体或实体行为");const{resultContext:h,resultParams:d,resultData:u}=await this.handleParams(e,i,n,a),p={...a,...d},E=e.frontAppViewId;if(E){const e=await ibiz.commands.execute(be.TAG,E,h,d,{event:r});if(!(null==e?void 0:e.ok))return o.cancel=!0,o;(null==e?void 0:e.ok)&&e.data&&(0===u.length&&u.push({}),u.forEach((t=>{t.srfactionparam=e.data})))}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),m=u.map((e=>{var t;return(null==(t=e.getOrigin)?void 0:t.call(e))||e||{}})),f=["MULTIKEY","MULTIDATA"].includes(e.actionTarget),I=await g.deService.exec(c,l,h,f?m:m[0],p);return I.ok&&e.successMsg&&ibiz.message.success(e.successMsg),Object.assign(o,{data:w(I.data)?I.data:[I.data],nextContext:h,nextParams:p}),o}}),gs=e("SysUIActionProvider",class extends ps{async execAction(e,t){const{view:s}=t,i=e.uiactionTag;if("Exit"===i)return{closeView:!0};return await s.callUIAction(i,t)||{}}}),ms=e("FrontUIActionProvider",class extends ps{async execAction(e,t){const{context:a,params:n,data:r,event:o,noWaitRoute:l}=t;let h={};switch(e.frontProcessType){case"OPENHTMLPAGE":{const t=c.fill(e.htmlPageUrl,a,null==r?void 0:r[0]);window.open(t,"_blank");break}case"TOP":case"WIZARD":{const t=e.frontAppViewId;if(!t)throw new s(e,"未配置打开视图");const{resultContext:i,resultParams:c}=await this.handleParams(e,a,r,n),d=await ibiz.commands.execute(be.TAG,t,i,c,{event:o,noWaitRoute:l});(null==d?void 0:d.ok)||(h.cancel=!0),(null==d?void 0:d.ok)&&d.data&&(h.data=d.data,h.nextContext=i,h.nextParams={...n,...c});break}case"OTHER":h=this.doOther(e,t);break;default:throw new i(e,"未支持的前台处理模式[".concat(e.frontProcessType,"]"))}return h}doOther(e,t){const{scriptCode:i}=e,{context:a,params:n,data:r,event:o}=t;if(i){return Ee.execScriptFn({context:a,params:n,data:r,el:null==o?void 0:o.target},i)||{}}throw new s(e,"自定义类型缺少配置脚本代码")}}),fs=e("WFWithdrawUIActionProvider",class extends ps{async execAction(e,t){const{view:s}=t;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&s&&(await s.call("WFWithdraw",t),i=!0),{refresh:!1,closeView:i}}});function ws(){const e=new ms;Yt("FRONT",(()=>e));const t=new Es;Yt("BACKEND",(()=>t));const s=new gs;Yt("SYS",(()=>s));const i=new fs;Yt("DEUIACTION_WFWithdraw",(()=>i))}var Is=class{constructor(e,t){this.logic=e,this.scheduler=t,this.type=e.logicType}execute(e){throw new t("Method not implemented.")}destroy(){}},Ds=class extends Is{constructor(){super(...arguments),this.isRowReturn=!1}convertScriptArgs(e){throw new t("未设置脚本执行参数转换方法")}init(e,t){this.convertScriptArgs=t;let s=this.logic.scriptCode;this.isRowReturn&&(s="return (".concat(s,")")),this.scriptFn=Ee.createScriptFn(e,s,{singleRowReturn:this.isRowReturn})}execute(e){const t=this.convertScriptArgs(e);return this.scriptFn.exec(t)}},As=class extends Is{execute(e){const{appDEUILogicId:t,appDataEntityId:i}=this.logic;if(!t)throw new s(this.logic,"没有配置实体界面逻辑");ds(t,i,e)}},Ps=class{constructor(e){this.triggers=new Map,this.executors=new Map,this.logics=e,e.forEach((e=>{try{const t=this.createExecutor(e);this.executors.set(e.id,t);const s=this.createTrigger(e);this.triggers.set(e.id,s),s.bindExecutor(t)}catch(e){ibiz.log.error(e.message)}}))}destroy(){this.triggers.forEach((e=>e.destroy())),this.executors.forEach((e=>e.destroy()))}getExecuteParams(e){let t={};return this.defaultParamsCb&&(t=this.defaultParamsCb()),L(e,t)}createTrigger(e){return ibiz.scheduler.triggerFactory.createTrigger(e,this)}createExecutor(e){return ibiz.scheduler.executorFactory.createExecutor(e,this)}getMatchTriggers(e){const t=[];return this.triggers.forEach((s=>{s.match(e)&&t.push(s)})),t}triggerAndExecute(e,t={}){const s=this.getMatchTriggers(e);if(s.length>0){const e=this.getExecuteParams(t);return s.map((t=>t.execute(e)))}}triggerItemDynaLogic(e,t,s){const i={itemName:e,triggerType:t},a=this.triggerAndExecute(i,s);if(null==a?void 0:a.length)return a.pop()}triggerItemVisible(e,t){return this.triggerItemDynaLogic(e,"ITEMVISIBLE",t)}triggerItemEnable(e,t){return this.triggerItemDynaLogic(e,"ITEMENABLE",t)}triggerItemBlank(e,t){return this.triggerItemDynaLogic(e,"ITEMBLANK",t)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((e=>e.start()))}triggerCustom(e,t){const s=this.triggers.get(e);if(!s)return-1;const i=this.getExecuteParams(t);return s.execute(i)}},ys=class extends Ps{constructor(e){super(e.filter((e=>"APPVIEWENGINE"!==e.triggerType)))}},vs=class extends Ps{constructor(e){e.forEach((e=>{e.triggerType=e.logicTrigger})),super(e)}triggerViewEvent(e){const t={eventName:e.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(t,e)}},Ts=class{constructor(){this.executorFactory=new class{constructor(){this.constructorMap=new Map}register(e,t){this.constructorMap.set(e,t)}createExecutor(e,t){const s=this.constructorMap.get(e.logicType);if(!s)throw new i(e,"逻辑类型 ".concat(e.logicType," 暂未支持!"));return s(e,t)}},this.triggerFactory=new class{constructor(){this.constructorMap=new Map}register(e,t){this.constructorMap.set(e,t)}createTrigger(e,t){const s=this.constructorMap.get(e.triggerType);if(!s)throw new i(e,"触发器类型 ".concat(e.triggerType," 暂未支持!"));return s(e,t)}}}createViewScheduler(e){return new vs(e)}createControlScheduler(e){return new ys(e)}},_s=class{constructor(e,t){this.logic=e,this.scheduler=t,this.type=e.triggerType}bindExecutor(e){this.executor=e}match(e){return e.triggerType===this.type}execute(e){if(this.executor)return this.executor.execute(e);throw new t("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},bs=class extends _s{},Cs=class extends _s{bindExecutor(e){if(super.bindExecutor(e),"SCRIPT"!==this.executor.type)throw new t("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"));this.executor.isRowReturn=!0,this.executor.init(["context","viewparams","data","env"],(e=>{const{context:t,params:s,data:i}=e;return{context:t,params:s,data:(null==i?void 0:i[0])||{},env:ibiz.env}}))}match(e){return super.match(e)&&e.itemName===this.logic.itemName}execute(e){const s=this.executor.execute(e);if("boolean"==typeof s)return s;throw new t("".concat(this.logic.id,"逻辑返回值不是布尔值"))}},Vs=class extends _s{constructor(){super(...arguments),this.timer=null}start(){this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new t("定时器缺少默认参数回调");const e=this.scheduler.defaultParamsCb();this.executor.execute(e)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Ls=class extends Is{execute(e){return"opendata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,e):"newdata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,e):void 0}async executeOpenDataAppUILogic(e,i){const{context:a,params:n,...r}=i,{data:o}=i;if(!(null==o?void 0:o[0]))throw new t("opendata没有可操作数据!");const c=e.openDataAppView;if(!c)throw new s(e,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new s(e,"opendata视图逻辑的默认打开视图没有实际引用视图");const h=c.navigateContexts||[],d=Object.assign(a,z(h,a,n,o[0]));let u={};const E=c.navigateParams;p(E)&&(u=z(E,n,a,o[0])),await ibiz.commands.execute(be.TAG,l,d,u,r)}async executeNewDataAppUILogic(e,t){const{context:a,params:n,...r}=t,{data:o}=t,{enableWizardAdd:c,enableBatchAdd:l,batchAddOnly:h,newDataAppView:d}=e;let u;if(c){if(u=await this.getWizardNewViewRef(e,t),!u)return}else{if(l)throw new i(e,"enableBatchAdd暂未支持");if(h)throw new i(e,"batchAddOnly暂未支持");if(u=d,!u||!u.refAppViewId)throw new s(e,"newdata视图逻辑没有配置默认新建数据视图")}let E={},g={};const m=(null==o?void 0:o[0])||{},f=u.navigateContexts;p(f)&&(E=z(f,a,n,m)),E=Object.assign(a,E);const w=u.navigateParams;p(w)&&(g=z(w,n,a,m)),a.srfcopymode&&(m.srfkey=void 0,g=Object.assign(g,m.$origin)),await ibiz.commands.execute(be.TAG,u.refAppViewId,E,g,r)}async getWizardNewViewRef(e,i){var a;const{wizardAppView:n,newDataAppViews:r}=e,{context:o,params:c,...l}=i;if(!n||!n.refAppViewId)throw new s(e,"缺少默认索引实体选择视图");const h=await ibiz.commands.execute(be.TAG,n.refAppViewId,o,c,{...l,openMode:"POPUPMODAL"});if(!h.ok)return;const d=null==(a=h.data)?void 0:a[0];if(!d)throw new t("请选中一条数据");const u=d.srfkey,p=null==r?void 0:r.find((e=>e.refMode===u));if(!p)throw new t("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}},Rs=class extends _s{constructor(e,t){super(e,t),this.logic=e,this.scheduler=t,this.listenEventNames=[];const s=e.eventNames.split(",");this.listenEventNames=s.map((e=>Pe[e]||e))}match(e){return super.match(e)&&this.listenEventNames.includes(e.eventName)}};var Ms=((e,t,s)=>(s=null!=e?O(S(e)):{},((e,t,s,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of x(t))B.call(e,a)||a===s||W(e,a,{get:()=>t[a],enumerable:!(i=N(t,a))||i.enumerable});return e})(!t&&e&&e.__esModule?s:W(s,"default",{value:e,enumerable:!0}),e)))(F(),1),Os=(e("PluginStaticResource",class{constructor(e){this.styleElementMap=new Map,this.url=new URL(e);const t=Ms.default.dirname(this.url.pathname);this.baseDir=t}dir(e){return Ms.default.resolve(this.baseDir,e)}async loadStyle(e){const t=e.map((e=>{const t=this.dir(e);return!this.styleElementMap.has(t)&&(this.styleElementMap.set(t,null),new Promise(((e,s)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i.onload=e,i.onerror=s,document.head.appendChild(i)})))}));try{await Promise.all(t)}catch(e){ibiz.log.error(e)}}}),e("RemotePluginItem",class{constructor(e,t,s){this.tag=e,this.repo=t,this.config=s}}),e("FormNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Os||{}))),Ws=e("GridNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Ws||{})),Ns=e("PanelNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Ns||{})),xs=e("Counter",class{constructor(e){this.callback=e,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(e){if("Used"!==this.state){if(0===this.count)throw new t("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(e?e():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Ss=e("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new xs(l)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Bs=e("CTXState",class{}),Fs=e("CTX",class{constructor(e){this.parent=e,this.evt=new m,this.controllersMap=new Map,this.state=new Bs}async init(e){this.view=e,this.registerController(e.model.name,e)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null}async setState(e){Object.assign(this.state,e)}startLoading(){this.view.startLoading()}endLoading(){this.view.endLoading()}registerController(e,t){this.controllersMap.set(e,t),this.evt.emit("onRegister",e,t)}getController(e,t=!1){return this.controllersMap.has(e)?this.controllersMap.get(e):this.parent&&t?this.parent.getController(e):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),ks=e("ActivityCounter",class extends xs{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(e){"Unused"!==this.state||this.registration.has(e)||(this.registration.set(e,!1),this.increment())}attend(e){this.registration.has(e)&&!1===this.registration.get(e)&&(this.registration.set(e,!0),this.decrement())}}),Us=(e("UIActionButtonState",class{constructor(e,t,s){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.isInit=!1,this.name=e,this.uiActionId=s,this.appId=t}async init(){if(!this.uiActionId)return void(this.isInit=!0);const e=await ee(this.uiActionId);if([,this.appDeName]=this.uiActionId.split("@"),!e)return;const{dataAccessAction:t,noPrivDisplayMode:s,actionTarget:i,uiactionMode:a,uiactionTag:n}=e;this.dataAccessAction=t,1===s?this.noPermissionHidden=!1:6===s&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===a&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0),this.isInit=!0}async calcPermission(e,t){if(!this.dataAccessAction)return;const s=await ibiz.hub.getApp(this.appId);this.appDeName&&t&&!t.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(t,"不一致")),this.permitted=await s.authority.calcByDataAccessAction(this.dataAccessAction,e,t)}async update(e,t){this.isInit||await this.init(),await this.calcPermission(e,t),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&!e):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),e("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((e=>e.visible))})}addState(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t}),this.children.push(t)}setLoading(e){this.children.forEach((t=>{t.setLoading?t.setLoading(e):t.loading=!!e&&t.name===e}))}async update(e,t){await Promise.all(this.children.map((s=>s.update(e,t))))}}),e("QXEventEx",class extends m{constructor(){super(...arguments),this.anyEventFns=[]}onAll(e){this.anyEventFns.includes(e)||this.anyEventFns.push(e)}emit(e,...t){super.emit(e,...t),this.anyEventFns.forEach((s=>{s(e,...t)}))}async asyncEmit(e,...t){const s=super.asyncEmit(e,...t),i=this.anyEventFns.map((s=>s(e,...t))),a=Promise.all(i),n=await s,r=await a;return n.concat(...r)}reset(){super.reset(),I(this.anyEventFns)}})),zs=e("ControllerEvent",class{constructor(e){this.getBaseArgs=e,this.evt=new Us}async emit(e,t){await this.evt.asyncEmit(e,{...this.getBaseArgs(),eventName:e,...t||{}})}on(e,t){this.evt.on(e,t)}onAll(e){this.evt.onAll(e)}destroy(){this.getBaseArgs=void 0,this.evt.reset()}});var Gs="__self",js=e("BaseController",class{constructor(e,t,s,i){this.model=e,this.context=t,this.params=s,this.ctx=i,this.state={},this.name="",this.evt=new zs(this.getEventArgs.bind(this)),this.mountCounter=new ks(this.mounted.bind(this)),this.childNames=[],this.name=e.name||e.id,this.initState()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Gs),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",(e=>{this.childNames.includes(e)&&this.mountCounter.enroll(e)})),this.ctx.evt.on("onRegister",((e,t)=>{this.childNames.includes(e)&&t.evt.on("onMounted",(()=>{this.mountCounter.attend(e)}))}))}async mountSelf(){this.mountCounter.registration.get(Gs)||this.mountCounter.attend(Gs)}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(),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(e){}getController(e,t=!1){return this.ctx.getController(e,t)}getTopView(){return this.ctx.getTopView()}listenNewController(e){this.ctx.evt.on("onRegister",e)}}),Xs=e("ViewController",class extends js{constructor(e,t,s,i){super(ibiz.util.layoutPanel.fill(e),a.create({},t),s||{},new Fs(i)),this.modal=new Te({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Ss,this.isCloseView=!1,this._isActive=!0,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var e;return null==(e=this.ctx.parent)?void 0:e.view}get isActive(){return this._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const e=ae(this.model);if(e.length)e.forEach((e=>{const t=ibiz.engine.getEngine(e,this);t&&this.engines.push(t)}));else{const e=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType},this);e&&this.engines.push(e)}}async initCounters(){const e=this.model.viewLayoutPanel,{appCounterRefs:t}=e;if(t&&t.length>0)try{await Promise.all(t.map((async e=>{const t=await qe.getCounterByRef(e,this.context);this.counters[e.id]=t})))}catch(e){console.error(e)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async e=>{await this._evt.emit("onCloseView",{...e})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const e=this.model.viewLayoutPanel;this.childNames.push(e.name);const t=await kt(e);this.providers[e.name]=t;const s=se(this.model);s&&await Promise.all(s.map((async e=>{const t=await kt(e);this.providers[e.name||e.id]=t}))),await this.initCounters();const i=ie(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.evt.onAll(((e,t)=>{this.scheduler.triggerViewEvent(t)}))),this.engines.length&&await Promise.all(this.engines.map((e=>e.onCreated())))}async onMounted(){var e;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((e=>e.onMounted()))),null==(e=this.scheduler)||e.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((e=>e.onDestroyed()))),this.ctx.destroy(),this.context.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){this.context.srfappid=this.model.appId,"ROUTE"===this.modal.mode&&(this.context.srfsessionid=f());const e=this.model.appViewNavContexts;let t={};p(e)&&(t=z(e,this.context,this.params)),Object.assign(this.context,t);const s=this.model.appViewNavParams;let i={};p(s)&&(i=z(s,this.context,this.params)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(e,t){let s;for(const i of this.engines)if(s=await i.call(e,t),void 0!==s)break;return s}async callUIAction(e,s){const i=this.call(e,s);if(void 0===i)throw new t("没有引擎支持预置界面行为".concat(e));return i}async closeView(e={ok:!1,data:[]}){await this.modal.dismiss(e)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(e){this.layoutPanel=e,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}}),Ks=(e("MobViewController",class extends Xs{}),e("EditorController",class{constructor(e,t){this.placeHolder="",this.editorParams={},this.model=e,this.parent=t,this.context=t.context,this.params=t.params}get readonly(){return!!this.model.readOnly}async init(){await this.onInit()}async onInit(){this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((e=>{this.editorParams[e.toLowerCase()]=this.model.editorParams[e]}))}handlePublicParams(e,t,s){const{navigateContexts:i,navigateParams:a}=this.model;let n={};i&&e&&(n=z(i,t,s,e));const r=Object.assign(t.clone(),n);let o={};a&&e&&(o=z(a,t,s,e));return{context:r,params:{...s,...o}}}toObj(e){if(!e)return;return new Function("return (".concat(e,");"))()}toBoolean(e){return Object.is("true",e)}})),Hs=(e("CodeListEditorController",class extends Ks{async loadCodeList(e){const{context:t,params:i}=this.handlePublicParams(e,this.context,this.params);if(this.model.appCodeListId){const e=await ibiz.hub.getApp(this.context.srfappid);let s=[];return s=await e.codeList.get(this.model.appCodeListId,t,i),s}throw new s(this.model,"请配置代码表")}}),e("ControlController",class extends js{constructor(e,t,s,i){super(e,t,s,i),this.providers={},this.registerToCtx();const a=ibiz.util.layoutPanel.get("".concat(e.controlType,"_DEFAULT"));a&&(this.controlPanel=a)}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.isLoading=!1}async onCreated(){var e;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const e=await kt(this.controlPanel);this.providers[this.controlPanel.name]=e}(null==(e=this.model.controlLogics)?void 0:e.length)&&(this.scheduler=ibiz.scheduler.createControlScheduler(this.model.controlLogics),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy()}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()}handlerAbilityParams(e){return{context:this.context.clone(),params:{...this.params},data:(null==e?void 0:e.data)||this.getData()||[]}}setLayoutPanel(e){this.layoutPanel=e,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}}));e("MDControlController",class extends Hs{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}setSort(e,t){this.state.sortQuery="".concat(e,",").concat(t)}async getFetchParams(e){const{curPage:t,size:s,sortQuery:i,noSort:a}=this.state,n={...this.params};return s&&(n.page=t-1,n.size=s),!a&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),e&&Object.assign(n,e),n}async load(e={}){const t=!0===e.isInitialLoad,s=!0===e.isLoadMore;t?this.state.curPage=1:s&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(e),a=await this.getFetchParams(null==e?void 0:e.params);let n;await this.startLoading();try{n=await this.service.fetch(i,a),"number"==typeof n.total&&(this.state.total=n.total)}finally{await this.endLoading()}return s?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(e,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:t}),this.state.items}async afterLoad(e,t){return t}async refresh(){await this.load({isInitialLoad:!1})}async remove(e){const{context:s,params:i,data:a}=this.handlerAbilityParams(e);if(!(null==a?void 0:a.length))throw new t("未选中数据");if(await ibiz.modal.confirm({title:"数据删除",desc:"确认删除数据?"})){await this.startLoading();try{const e=$(this.model.appDataEntityId);await Promise.allSettled(a.map((async t=>{if(0!==t.srfuf){const a=s.clone();a[e]=t.srfkey,await this.service.remove(a,i)}this.afterRemove(a)}))),ibiz.notification.success({desc:"数据[".concat(a.map((e=>e.srfmajortext)).join("、"),"]删除成功!")}),this.refresh()}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}}afterRemove(e){const t=this.state.items.findIndex((t=>t.srfkey===e.srfkey));this.state.items.splice(t,1)}getData(){return this.state.selectedData||[]}setActive(e){return this._evt.emit("onActive",{data:[e]})}setSelection(e){const{selectedData:t}=this.state;h(t,e)||(this.state.selectedData=e,this._evt.emit("onSelectionChange",{data:e}))}async onRowClick(e){const{selectedData:t}=this.state,s=t.filter((t=>t.srfkey!==e.srfkey));s.length===t.length?this.setSelection(this.state.singleSelect?[e]:t.concat([e])):this.setSelection(s),1===this.state.mdctrlActiveMode&&await this.setActive(e)}async onDbRowClick(e){2===this.state.mdctrlActiveMode&&await this.setActive(e)}async importData(){}async exportData(e){}})}}}));
1
+ System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda"],(function(t){"use strict";var e,s,i,a,n,r,o,c,l,d,h,u,p,E,g,m,f,w,I,D,A,P,y,v,T,_,b,C,V,L;return{setters:[function(t){e=t.RuntimeError,s=t.RuntimeModelError,i=t.ModelError,a=t.IBizContext,n=t.HttpResponse,r=t.HttpError,o=t.Net,c=t.StringUtil,l=t.NOOP,d=t.isElementSame},function(t){h=t.isEmpty,u=t.isFunction},function(t){p=t.notNilEmpty,E=t.isNilOrEmpty,g=t.AsyncSeriesHook,m=t.QXEvent,f=t.createUUID,w=t.isArray,I=t.clearAll,D=t.ascSort,A=t.descSort},function(t){P=t.default},function(t){y=t.isNotNil,v=t.isNil,T=t.mergeRight,_=t.isEmpty,b=t.clone,C=t.equals,V=t.where,L=t.mergeLeft}],execute:function(){t({calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:s}=t,i={};if(e||s){switch(Object.assign(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(s){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:$,calcDynaClass:function(t,e){return Et.execScriptFn({data:e},t,{singleRowReturn:!0})},calcGridLayoutPos:function(t){const{layout:e,colXS:s,colXSOffset:i,colSM:a,colSMOffset:n,colMD:r,colMDOffset:o,colLG:c,colLGOffset:l}=t,d=(t,s)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:s&&-1!==s?s:void 0});return{xs:d(s,i),sm:d(a,n),md:d(r,o),lg:d(c,l)}},calcLayoutHeightWidth:function(t){const{width:e,height:s,widthMode:i,heightMode:a}=t,n={width:"",height:""};"FULL"===i?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px"));"FULL"===a?n.height="100%":s&&s>0&&(n.height=s>0&&s<=1?"".concat(100*s,"%"):"".concat(s,"PERCENTAGE"===a?"%":"px"));return n},calcMainStateOPPrivsStrs:q,calcNavParams:function(t,e){const{deName:s,navFilter:i,pickupDEFName:a,navContexts:n,navParams:r}=t,{context:o,params:c,data:l,derValue:d}=e,h={},u={},p=d||l.srfkey;p&&(s&&(h[s]=p),i&&(u[i]=p),a&&(u["n_".concat(a.toLowerCase(),"_eq")]=p));const E=z(n,o,c,l),g=z(r,o,c,l);return Object.assign(h,E),Object.assign(u,g),{resultContext:h,resultParams:u}},calcResPath:Kt,calcRouteContext:function(t){let e=[];e=e.sort(((t,e)=>e.length-t.length));const[s]=e;if(s){const t={};return s.forEach((([e,s])=>{t[e]=s})),t}return{}},compare:ct,compareNumber:lt,contains:dt,convertNavData:z,convertNavDataByArray:G,convertNavDataByObject:j,convertObjectToNavParams:X,execDELogic:De,execDELogicAction:Ae,execDELogicById:async function(t,s,i,a,n){const r=await async function(t,e,s){const i=await ibiz.hub.getAppDataEntity(e,s);return Q(t,i)}(t,s,i.srfappid);if(!r)throw new e("".concat(s,"找不到实体逻辑").concat(t));return De(r,i,a,n)},execFieldLogics:Pe,execUILogic:hs,filterFieldLogics:J,filterValueRules:function(t,e){return t.filter((t=>{const{checkMode:s}=t,i=t.deformItemName||t.degridEditItemName;return 2!==s&&i===e}))},findChildFormDetails:function(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]},findDELogic:Q,findEditItem:function(t,e){var s;return null==(s=t.degridEditItems)?void 0:s.find((t=>t.codeName===e))},findFieldById:Z,findModelChild:H,formatMultiData:K,generateRules:function(t,s,i){const a=[];return t.forEach((t=>{const{valueRuleType:n}=t,r=t.sysValueRule,o=t.defvalueRule;if("SYSVALUERULE"===n&&r)"REG"===r.ruleType?a.push({pattern:new RegExp(r.regExCode),message:r.ruleInfo,trigger:"change blur"}):"SCRIPT"===r.ruleType&&a.push({validator:(t,e,s,i)=>{if(!e)return!0;try{Et.execScriptFn({rule:t,value:e,callback:s,source:i},r.scriptCode)}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&o){const t=i||s;a.push({validator:(s,i,a,n)=>{if(E(n[t]))return!0;const{isPast:r,infoMessage:c}=gt(t,n,o.groupCond);return r||a(new e(c||o.ruleInfo)),!0},trigger:"change blur"})}})),a},getAppViewRef:function(t,e){var s,i;let a=t.appViewRefs||[];(null==(i=null==(s=t.viewLayoutPanel)?void 0:s.appViewRefs)?void 0:i.length)&&(a=a.concat(t.viewLayoutPanel.appViewRefs));return a.find((t=>t.name===e||t.id===e))},getChildNodeRSs:function(t,e){const s=e.parentId||et(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===s&&(i=t.searchMode,a=e.hasQuery,3===i||(a?1===i:2===i));var i,a}))},getControl:function(t,e){var s,i;let a=t.controls||[];(null==(i=null==(s=t.viewLayoutPanel)?void 0:s.controls)?void 0:i.length)&&(a=a.concat(t.viewLayoutPanel.controls));return a.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlProvider:ke,getControlsByView:st,getDeACMode:async function(t,e,s){var i;const a=await ibiz.hub.getAppDataEntity(e,s);return null==(i=a.appDEACModes)?void 0:i.find((e=>e.id===t))},getEditorProvider:async function(t){let e;const{editorType:s,editorStyle:i}=t;if(i&&"DEFAULT"!==i){e=ze("".concat(s,"_").concat(i)),e||ibiz.log.error("找不到编辑器类型:[".concat(s,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}e||(e=ze(s));e||ibiz.log.error("找不到编辑器类型".concat(s,"对应的适配器"));return e},getFormDetailProvider:async function(t){let e;const{detailType:s}=t;e||(i=s,e=ibiz.register.get("".concat(Ge,"_").concat(i)));var i;e||ibiz.log.error("找不到表单成员类型".concat(s,"对应的适配器"));return e},getGridColumnProvider:async function(t){let e;const{columnType:s,enableRowEdit:i}=t,a=i?"".concat(s,"_EDIT"):s;e||(e=function(t){return ibiz.register.get("".concat(je,"_").concat(t))}(a));e||ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"));return e},getMatchResPath:Xt,getOriginData:function(t){let e=Array.isArray(t)?t[0]:t;e&&e instanceof _e&&(e=e.getOrigin());return e},getPanelItemProvider:async function(t){var e;let s;const{itemType:i}=t;if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT";s=Ke("CONTAINER_".concat(e)),s||ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器"))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT";s=Ke("RAWITEM_".concat(i)),s||ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器"))}s||(s=Ke(i));s||ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"));return s},getPortletProvider:async function(t){let e;const{portletType:s}=t;e||(i=s,e=ibiz.register.get("".concat(Je,"_").concat(i)));var i;e||ibiz.log.error("找不到门户部件成员类型".concat(s,"对应的适配器"));return e},getRootNode:et,getTreeNode:function(t,e){return t.detreeNodes.find((t=>t.id===e))},getUIActionById:tt,getUIActionProvider:qe,getViewEngines:at,getViewLogics:it,getViewProvider:async function(t){let e;const{viewType:s,viewStyle:i}=t;if(i&&"DEFAULT"!==i){e=Qe("".concat(s,"_").concat(i)),e||ibiz.log.error("找不到视图类型:[".concat(s,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=Qe(s));e||(e=Qe("DEFAULT"));return e},getWFContext:function(t){const e={};t.param09&&(e.srfprocessinstanceid=t.param09);return e},getWFSubmitViewId:function(t,e){var s;const{type:i,sequenceFlowView:a,sequenceFlowMobView:n}=e,r=(null==(s=t.viewLayoutPanel)?void 0:s.appViewRefs)||t.appViewRefs,o=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:a),c=r.find((t=>t.name===o));return null==c?void 0:c.refAppViewId},hasDeCodeName:function(t,e){const s=$(e);return y(t[s])},install:function(){const{ibiz:t}=window;t.util=new Se,t.hub=new We,t.register=new U,t.config=new k,t.auth=new Le,t.engine=new Ne,Lt(),ws(),ibiz.scheduler=new Ts,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Cs(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Cs(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Cs(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Vs(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new bs(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new Rs(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Ds(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new As(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new As(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Ls(t,e)))},installCommand:Lt,isValueChange:function(t,e){if((v(t)||""===t)&&(v(e)||""===e))return!1;return t!==e},matchMainState:Y,openRedirectView:nt,parseUserParams:function(t){const e={},s={},i={};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const n=t[a];if(-1!==a.indexOf(".")){const t=a.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(e,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(s,{[t[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:e,navigateParams:s,other:i}},presetUIActionProvider:ws,registerControlProvider:function(t,e){ibiz.register.register("".concat(Fe,"_").concat(t),e)},registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ue,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Ge,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(je,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Xe,"_").concat(t.toUpperCase()),e)},registerPortletProvider:function(t,e){ibiz.register.register("".concat(Je,"_").concat(t),e)},registerUIActionProvider:Ye,registerViewProvider:function(t,e){ibiz.register.register("".concat($e,"_").concat(t),e)},strContain:ht,testCond:ot,toLocalOpenWFRedirectView:rt,verifyDeRules:gt,verifyFormGroupLogic:function t(e,a){if(function(t){return"GROUP"===t.logicType}(a)){const i=a.defdlogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!t(e,s)))}else if("OR"===a.groupOP){n=void 0!==a.defdlogics.find((s=>t(e,s)))}return a.notMode?!n:n}if(function(t){return"SINGLE"===t.logicType}(a))return ot(e[a.defdname.toLowerCase()],a.condOP,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))},verifyPanelGroupLogic:function t(e,a){if(function(t){return"GROUP"===t.logicType}(a)){const i=a.panelItemLogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!t(e,s)))}else if("OR"===a.groupOP){n=void 0!==a.panelItemLogics.find((s=>t(e,s)))}return a.notMode?!n:n}if(function(t){return"SINGLE"===t.logicType}(a))return ot(e[a.dstModelField.toLowerCase()],a.condOp,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))}});var R,M,O=Object.create,W=Object.defineProperty,N=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,S=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,B=(R={"../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"(t,e){function s(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function i(t,e){for(var s,i="",a=0,n=-1,r=0,o=0;o<=t.length;++o){if(o<t.length)s=t.charCodeAt(o);else{if(47===s)break;s=47}if(47===s){if(n===o-1||1===r);else if(n!==o-1&&2===r){if(i.length<2||2!==a||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",a=0):a=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),n=o,r=0;continue}}else if(2===i.length||1===i.length){i="",a=0,n=o,r=0;continue}e&&(i.length>0?i+="/..":i="..",a=2)}else i.length>0?i+="/"+t.slice(n+1,o):i=t.slice(n+1,o),a=o-n-1;n=o,r=0}else 46===s&&-1!==r?++r:r=-1}return i}var a={resolve:function(){for(var t,e="",a=!1,n=arguments.length-1;n>=-1&&!a;n--){var r;n>=0?r=arguments[n]:(void 0===t&&(t=process.cwd()),r=t),s(r),0!==r.length&&(e=r+"/"+e,a=47===r.charCodeAt(0))}return e=i(e,!a),a?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(s(t),0===t.length)return".";var e=47===t.charCodeAt(0),a=47===t.charCodeAt(t.length-1);return 0!==(t=i(t,!e)).length||e||(t="."),t.length>0&&a&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return s(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var i=arguments[e];s(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":a.normalize(t)},relative:function(t,e){if(s(t),s(e),t===e)return"";if((t=a.resolve(t))===(e=a.resolve(e)))return"";for(var i=1;i<t.length&&47===t.charCodeAt(i);++i);for(var n=t.length,r=n-i,o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var c=e.length-o,l=r<c?r:c,d=-1,h=0;h<=l;++h){if(h===l){if(c>l){if(47===e.charCodeAt(o+h))return e.slice(o+h+1);if(0===h)return e.slice(o+h)}else r>l&&(47===t.charCodeAt(i+h)?d=h:0===h&&(d=0));break}var u=t.charCodeAt(i+h);if(u!==e.charCodeAt(o+h))break;47===u&&(d=h)}var p="";for(h=i+d+1;h<=n;++h)h!==n&&47!==t.charCodeAt(h)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(o+d):(o+=d,47===e.charCodeAt(o)&&++o,e.slice(o))},_makeLong:function(t){return t},dirname:function(t){if(s(t),0===t.length)return".";for(var e=t.charCodeAt(0),i=47===e,a=-1,n=!0,r=t.length-1;r>=1;--r)if(47===(e=t.charCodeAt(r))){if(!n){a=r;break}}else n=!1;return-1===a?i?"/":".":i&&1===a?"//":t.slice(0,a)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');s(t);var i,a=0,n=-1,r=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var o=e.length-1,c=-1;for(i=t.length-1;i>=0;--i){var l=t.charCodeAt(i);if(47===l){if(!r){a=i+1;break}}else-1===c&&(r=!1,c=i+1),o>=0&&(l===e.charCodeAt(o)?-1==--o&&(n=i):(o=-1,n=c))}return a===n?n=c:-1===n&&(n=t.length),t.slice(a,n)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!r){a=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":t.slice(a,n)},extname:function(t){s(t);for(var e=-1,i=0,a=-1,n=!0,r=0,o=t.length-1;o>=0;--o){var c=t.charCodeAt(o);if(47!==c)-1===a&&(n=!1,a=o+1),46===c?-1===e?e=o:1!==r&&(r=1):-1!==e&&(r=-1);else if(!n){i=o+1;break}}return-1===e||-1===a||0===r||1===r&&e===a-1&&e===i+1?"":t.slice(e,a)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var s=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return s?s===e.root?s+i:s+t+i:i}("/",t)},parse:function(t){s(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var i,a=t.charCodeAt(0),n=47===a;n?(e.root="/",i=1):i=0;for(var r=-1,o=0,c=-1,l=!0,d=t.length-1,h=0;d>=i;--d)if(47!==(a=t.charCodeAt(d)))-1===c&&(l=!1,c=d+1),46===a?-1===r?r=d:1!==h&&(h=1):-1!==r&&(h=-1);else if(!l){o=d+1;break}return-1===r||-1===c||0===h||1===h&&r===c-1&&r===o+1?-1!==c&&(e.base=e.name=0===o&&n?t.slice(1,c):t.slice(o,c)):(0===o&&n?(e.name=t.slice(1,r),e.base=t.slice(1,c)):(e.name=t.slice(o,r),e.base=t.slice(o,c)),e.ext=t.slice(r,c)),o>0?e.dir=t.slice(0,o-1):n&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,e.exports=a}},function(){return M||(0,R[x(R)[0]])((M={exports:{}}).exports,M),M.exports}),k=class{constructor(){this.view={enableDataInfoBar:!0},this.grid={editShowMode:"cell",editSaveMode:"cell-blur"},this.appMenu={enableEcho:!1},this.codeList={timeout:36e5}}},U=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 s=this.providers.get(t);if(s)return s(...e)}});function z(t,...e){return!t||h(t)?{}:"[object Array]"===Object.prototype.toString.call(t)?G(t,...e):"[object Object]"===Object.prototype.toString.call(t)?j(t,...e):{}}function G(t,...e){const s={};for(const i of t)if(p(i.value)&&!i.rawValue){const t=e.find((t=>!E(t)&&(t[i.value]||Object.prototype.hasOwnProperty.call(t,i.value))));t&&(s[i.key.toLowerCase()]=t[i.value])}else s[i.key.toLowerCase()]=i.value||null;return s}function j(t,...e){const s={},i=/^%(.+)%$/;for(const a in t)if(p(t[a])&&i.test(t[a])){const i=t[a].substring(1,t[a].length-1),n=e.find((t=>Object.prototype.hasOwnProperty.call(t,i)));n&&(s[a.toLowerCase()]=n[i])}else s[a.toLowerCase()]=t[a]||null;return s}function X(t){const e=[],s=/^%(.+)%$/;for(const i in t){let a=!0,n=t[i];p(t[i])&&s.test(t[i])&&(a=!1,n=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:a,value:n})}return e}function K(t,e){const s={};if(!t)return s;const i=Array.isArray(t)?t:X(t),a=e[0];return i.forEach((t=>{const{rawValue:i,value:n}=t;!i&&n&&Object.prototype.hasOwnProperty.call(a,n)&&(s[n]=e.map((t=>t[n])).join(";"))})),s}function H(t,e){if(t){const s=t.find((t=>t.id===e));if(s)return s}return null}function Y(t,e){const{mainStateAppDEFieldIds:s,demainStates:i}=t;if(s&&i){const t=[];return s.forEach((s=>{t.push(e[s])})),i.find((e=>{const{stateValue:s,state2Value:i,state3Value:a}=e;let n=!0;const r=[s,i,a];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(r[e])){n=!1;break}return n}))}}function q(t,e){const s=ibiz.hub.getApp().model,{demainStateOPPrivs:i,opprivAllowMode:a}=t,n=(null==i?void 0:i.map((t=>t.name)))||[];let r=[];if(a)r=n;else{r=[...s.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return r}function $(t){return t.split(".").pop()}function Q(t,e){var s;return null==(s=e.appDELogics)?void 0:s.find((e=>e.id===t))}function J(t,e){var s,i;const a=[];return null==(s=t.appDEFields)||s.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?a.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?a.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&a.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>a.includes(t.id))))||[]}function Z(t,e){var s;return null==(s=t.appDEFields)?void 0:s.find((t=>t.id===e))}async function tt(t){const[,,e]=t.split("@");return ibiz.hub.getApp(e).getUIAction(t)}function et(t){return t.detreeNodes.find((t=>t.rootNode))}function st(t){const{viewLayoutPanel:e}=t,s=t.controls||[];return e&&s.push(...e.controls||[]),s}function it(t){const{viewLayoutPanel:e}=t,s=t.appViewLogics||[];return e&&s.push(...e.appViewLogics||[]),s}function at(t){const{viewLayoutPanel:e}=t,s=t.appViewEngines||[];return e&&s.push(...e.appViewEngines||[]),s}async function nt(t,e,i={},a=[]){return async function(t,e,i={},a=[]){const n=t.appViewNavContexts||[],r=z(n,e,i);e=Object.assign(e.clone(),r);const o=t.appViewNavParams||[],c=z(o,e,i);Object.assign(i,c);const l=t.appDataEntityId,d=$(l);let h=a[0]||{};e[d]=h[d]||e[d]||i[d];const u=t.getDataAppDEActionId,g=ibiz.hub.getApp(t.appId),m=await g.deService.getService(l);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,i);if(t.ok){h=t.data;let s=h.linkurl;if(s)return e.srfprocessinstanceid&&(s+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==s.indexOf("appredirectview?")&&(s=s.slice(s.indexOf("appredirectview?"))),s.startsWith("http://")||s.startsWith("https://")?new Promise((t=>{const e=window.open(s,"_blank");e&&(e.callback=()=>{t({ok:!0,data:[]})})})):s.startsWith("appredirectview?")?(await rt(e,s),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(l,t.appId),w=await async function(t,e,s,i){let a="";const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=s.srfwf;if(p(r))return p(s.wf)?"".concat(n,":").concat(r.toUpperCase(),":").concat(s.wf.toUpperCase()):"".concat(n,":").concat(r.toUpperCase());let o="";const c=e.typeAppDEFieldId;if(c){const{codeName:e}=Z(t,c),s=i[e.toLowerCase()];p(s)&&(o=s)}if(E(o)&&t.indexTypeAppDEFieldId){const{codeName:e}=Z(t,t.indexTypeAppDEFieldId);o=i[e.toLowerCase()]}if(E(o)&&t.formTypeAppDEFieldId){const{codeName:e}=Z(t,t.formTypeAppDEFieldId);o=i[e.toLowerCase()]}a=p(o)?"".concat(n,":").concat(o.toUpperCase()):"".concat(n);return a}(f,t,i,h),I=w.split(":"),D=2===I.length?w:I.slice(0,2).join(":"),A="".concat(f.name.toUpperCase(),":").concat(w),P=t.redirectAppViewRefs,y=null==P?void 0:P.find((t=>t.name===A||t.name===w||t.name===D));if(!y)throw ibiz.log.error("重定向视图引用有:",null==P?void 0:P.map((({refAppViewId:t,name:e,realTitle:s})=>({viewId:t,tag:e,title:s})))),new s(t,"未找到重定向标识[".concat(w,"]或[").concat(A,"]或工作流[").concat(D,"]对应视图"));{const t=y.refAppViewId;if(!t)throw new s(y,"未配置实际引用视图");{const s=await ibiz.commands.execute(bt.TAG,t,e,i,{data:[h]});if(s)return s}}return{ok:!0,data:[]}}(t,e,i,a)}async function rt(t,s){const i=s.lastIndexOf("?"),a=decodeURIComponent(s.substring(i+1,s.length)),n=P.parse(a,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new e("重定向参数缺少实体名称");const o=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!o)throw new e("未找到指定实体的codeName: ".concat(r));n[o.toLowerCase()]=n[r.toLowerCase()];const c="".concat(o).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(c);if(delete n.srfdename,"undo"!==n.srfwf){const t=n.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),s=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=s}n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),await ibiz.commands.execute(bt.TAG,l.id,t,n)}function ot(t,s,i){if(Object.is(s,"IN"))return dt(t,i);if(Object.is(s,"NOTIN"))return!dt(t,i);switch(s){case"EQ":return"".concat(t)==="".concat(i);case"NOTEQ":return"".concat(t)!=="".concat(i);case"LT":return ct(t,i)<0;case"LTANDEQ":return ct(t,i)<=0;case"GT":return ct(t,i)>0;case"GTANDEQ":return ct(t,i)>=0;case"ISNULL":return E(t);case"ISNOTNULL":return p(t);case"TESTNULL":return v(t);case"IN":return dt(t,i);case"NOTIN":return!dt(t,i);case"LIKE":return ht(t,i);case"LEFTLIKE":return ht(t,i,"start");case"RIGHTLIKE":return ht(t,i,"end");default:throw new e("值操作:".concat(s,",暂未支持"))}}function ct(t,s){const i=Number(t),a=Number(s);if(!Number.isNaN(i)&&!Number.isNaN(a))return lt(i,a);const n=new Date(t).getTime(),r=new Date(s).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r))return lt(n,r);throw new e("".concat(t," 和 ").concat(s," 无法比较大小"))}function lt(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function dt(t,s){if(!s||"string"!=typeof s)throw new e("范围比较的条件值不存或者不是字符串");if(t){return s.split(",").includes("".concat(t))}return!1}function ht(t,e,s){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),a="".concat(e).toUpperCase(),n=i.indexOf(a);switch(s){case"start":return 0===n;case"end":return n+a.length===i.length;default:return-1!==n}}var ut={singleRowReturn:!1},pt=t("ScriptFunction",class{constructor(t,e,s=ut){this.argKeys=[],this.options=s;const i=this.formatCode(e,s);this.calcArgKeys(t,s),this.scriptFn=new Function(...this.argKeys,i)}formatCode(t,e){let s=t;return e.singleRowReturn&&(s="return (".concat(s,")")),s}calcArgKeys(t,e){const s=e.presetParams?Object.keys(e.presetParams):[];s.push(...t),s.push("document","el","selector"),this.argKeys=Array.from(new Set(s))}convertArgs(t){const{presetParams:e}=this.options,s=e?T(e,t):t;s.document=document,s.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{i.push(s[t])})),i}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),Et=t("ScriptFactory",class{static createScriptFn(t,e,s){return new pt(t,e,s)}static execScriptFn(t,e,s){return this.createScriptFn(Object.keys(t),e,s).exec(t)}});function gt(t,s,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(t){return"GROUP"===t.condType}(i)){const e=i.conds;e&&e.length>0&&(a.isPast=function(t,e,s="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let a="AND"===s;for(let i=0,n=t.length;i<n;i++){const n=e(t[i],i);if("AND"===s){if(!n){a=!1;break}}else if("OR"===s&&n){a=!0;break}}return i?!a:a}(e,(e=>{const{isPast:i,infoMessage:n}=gt(t,s,e);return a.infoMessage=n,i}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{t=null==i?void 0:i.defname.toLowerCase();try{if(function(t){return"SIMPLE"===t.condType}(i))a.isPast=!function(t,s,i,a,n,r,o){Object.is(n,"CURTIME")&&(i="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){i=r[i=i?i.toLowerCase():""]?r[i]:i}(v(a)||_(a))&&(a="内容必须符合值规则");const c=ot(t,s,i);if(!c&&o)throw new e(a);return!c}(s[t],i.condOp,i.paramValue,i.ruleInfo,i.paramType,s,i.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(i))a.isPast=!function(t,s,i,a,n,r,o){E(r)&&(r="值必须符合值范围规则");if(E(t)){if(o)throw new e("值为空");return r="值为空",!0}if(mt(t,/^-?\d*\.?\d+$/,"",o))return!0;const c=Number.parseFloat(t);if(null!==s)if(i){if(c<s){if(o)throw new e(r);return!0}}else if(c<=s){if(o)throw new e(r);return!0}if(null!=a)if(n){if(c>a){if(o)throw new e(r);return!0}}else if(c>=a){if(o)throw new e(r);return!0}return r="",!1}(s[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"REGEX"===t.condType}(i))a.isPast=!mt(s[t],i.regExCode,i.ruleInfo,i.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(i))a.isPast=!function(t,s,i,a,n,r,o){E(r)&&(r="内容长度必须符合范围规则");if(E(t)){if(o)throw new e("值为空");return r="值为空",!0}const c=t.length;if(null!==s)if(i){if(c<s){if(o)throw new e(r);return!0}}else if(c<=s){if(o)throw new e(r);return!0}if(null!==a)if(n){if(c>a){if(o)throw new e(r);return!0}}else if(c>=a){if(o)throw new e(r);return!0}return r="",!1}(s[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:n,regExCode:r,scriptCode:o,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===n)a.isPast=!mt(s[t],r,a.infoMessage,i.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:r}=function(t,s,i,a,n){E(a)&&(a="值必须符合脚本规则");const r=s;let o="",c=!0;const l=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(o+=t.message)})):(null==t?void 0:t.message)&&(o=t.message)};try{const e=Et.execScriptFn({value:t,data:r},i);"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),l(t)}if(a="",!c&&n)throw new e(a);return{isPast:c,infoMessage:o||a}}(s[t],s,o,a.infoMessage,i.keyCond);a.isPast=n,a.infoMessage=r||a.infoMessage}}}catch(t){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function mt(t,s,i,a){E(i)&&(i="值必须符合正则规则");if(E(t)){if(a)throw new e("值为空");return i="值为空",!0}if(!new RegExp(s).test(t)){if(a)throw new e(i);return!0}return i="",!1}var ft=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 s=b(this.cache.get(e));t.viewLayoutPanel=s,t.appCounterRefs&&(s.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(s.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(s.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(s.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(s.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:s}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(s)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:s,blankMode:i,mainMenuAlign:a}=t;let n="";return i?n="BLANK_MODE":a&&(n=a.toUpperCase()),""!==n?"".concat(e,"_").concat(s,"_").concat(n):"".concat(e,"_").concat(s)}});var wt=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))(wt||{})),It=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))(It||{})),Dt=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Dt||{})),At=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.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.LOAD_MORE="LoadMore",t))(At||{})),Pt=t("StudioViewEvents",class{});Pt.onViewMounted="onMounted",Pt.onViewDestroyed="onDestroyed";var yt=t("StudioPanelEvents",class{});yt.onClick="onClick",yt.onChange="onChange",yt.onEnter="onEnter",yt.onLeave="onLeave";var vt=t("StudioControlEvents",class{});vt.onBeforeLoad="onBeforeLoad",vt.onLoadSuccess="onLoadSuccess",vt.onLoadError="onLoadError",vt.onBeforeLoadDraft="onBeforeLoadDraft",vt.onLoadDraftSuccess="onLoadDraftSuccess",vt.onLoadDraftError="onLoadDraftError",vt.onBeforeSave="onBeforeSave",vt.onSaveSuccess="onSaveSuccess",vt.onSaveError="onSaveError",vt.onBeforeRemove="onBeforeRemove",vt.onRemoveSuccess="onRemoveSuccess",vt.onRemoveError="onRemoveError",vt.CLICK="onClick";var Tt=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.hooks={shouldDismiss:new g,beforeDismiss:new g},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 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()}});var _t=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,s,a={},n={}){const r=await ibiz.hub.config.view.get(t);if(!r)throw new e("应用视图[".concat(t,"]不存在"));if(s.srfkey&&r.appDataEntityId){s[$(r.appDataEntityId)]=s.srfkey,s.srfkey=void 0}if(r.redirectView){return nt(await ibiz.hub.getAppView(t),s,a,n.data)}const{openMode:o="INDEXVIEWTAB"}=r;switch(n.openMode||o){case"INDEXVIEWTAB":return n.noWaitRoute?void this.openIndexViewTab(r,s,a):this.openIndexViewTab(r,s,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,s,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,n.event,s,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,s,a);case"USER":return this.openUserCustom(r,s,a);default:return this.openIndexViewTab(r,s,a)}}openIndexViewTab(t,e,s={}){return ibiz.openView.root(t,e,s)}async openModal(t,e,s={}){return ibiz.openView.modal(t,e,s)}async openPopover(t,e,s,i={}){return ibiz.openView.popover(t,e,s,i)}async openDrawer(t,e,s={}){return ibiz.openView.drawer(t,e,s)}async openUserCustom(t,e,s={}){return ibiz.openView.custom(t,e,s)}};_t.TAG="ibiz.app-view.open";var bt=t("OpenAppViewCommand",_t),Ct=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,s,a={},n={}){const r=ibiz.hub.getApp(s.srfappid).getAppFunc(t);if(!r)throw new e("找不到叫".concat(t,"的应用功能"));const{navigateContexts:o,navigateParams:c,appFuncType:l}=r,d=s.clone();Object.assign(d,z(o,s,a));const h=z(c,s,a);switch(l){case"APPVIEW":return this.openAppView(r,d,h,n);case"OPENHTMLPAGE":return this.openHtmlPage(r);case"PDTAPPFUNC":return this.openPdAppFunc(r,d,h);case"JAVASCRIPT":return this.executeJavaScript(r,d,h);case"CUSTOM":return this.custom(r,d,h);default:throw new i(r,"未支持的应用功能类型: ".concat(l))}}async openAppView(t,s,i,a){if(!t.appViewId)throw new e("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(bt.TAG,t.appViewId,s,i,a)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,s,i){throw ibiz.log.warn("openPdAppFunc",t,s,i),new e("未实现")}executeJavaScript(t,s,i){throw ibiz.log.warn("executeJavaScript",t,s,i),new e("未实现")}custom(t,s,i){throw ibiz.log.warn("custom",t,s,i),new e("未实现")}};Ct.TAG="ibiz.app-func.exec";var Vt=t("AppFuncCommand",Ct);function Lt(){new Vt,new bt}var Rt=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=a.create(),this.params={},this.evt=new m,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new s(this.model,"未找到获取计数器行为!");this.action=i,this.interval(),await this.load()}setParams(t,e){t&&(this.context=b(t)),e&&(this.params=b(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(){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}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&p(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()}}),Mt=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,s){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==s?i=0:e>s&&(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!=s&&-1!==e.toString().toUpperCase().indexOf(s.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=s&&0===e.toString().toUpperCase().indexOf(s.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Ot=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Wt=class extends Ot{parse(t){const e=t.length;let s=!0,i=!1,a=!1;for(let n=0;n<e;n++)if(s){const e=t[n];this.setCondOp(e),s=!1,i=!0}else if(i){const e=t[n];this.setParam(e),i=!1,a=!0}else if(a){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},Nt=class t extends Ot{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(s){const i=s.length;let a=!0,n=!0,r=!1;for(let o=0;o<i;o++){if(a&&n){if("!"===s[o]){this.setNotMode(!0),a=!1;continue}}if(n){const t=s[o];this.setCondOp(t),n=!1,a=!1,r=!0}else if(r){const i=s[o];if(!(i instanceof Array))throw new e("值必须为数组");i.forEach((e=>{if(e.length>0){const s=e[0].toString();if("!"===s||"OR"===s||"AND"===s){const s=new t;s.parse(e),this.childCondList.push(s)}else{const t=new Wt;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},xt=class extends Nt{},St=class extends Wt{},Ft=class t extends Mt{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,s,i){if(e instanceof Nt){const t=e.getChildPSModelCondBases();if(null==t||_(t))return!e.isNotMode();const a="AND"===e.getCondOp();let n=a;for(let e=0;e<t.length;e++){const r=t[e];if(this.testCond(r,s,i)){if(!a){n=!0;break}}else if(a){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Wt){_(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const a=s[e.getParam().toLowerCase()];let n=null;const r=e.getValueType(),o=e.getValue();return null==r||_(r)?n=e.getValue():(_(o)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===r?n=i.data[o.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===r&&(n=i.getValue(o.toLowerCase()))),this.testSingleCond(e.getCondOp(),a,n)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new St}createPSModelGroupCond(){return new xt}};Ft.PARAMTYPE_DATACONTEXT="DATACONTEXT",Ft.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Bt=t("PSDEDQCondEngine",Ft);t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const s=new Bt;return s.parse(["OR",this.calcCond(e)]),this.map.set(t,s),s}return null}static calcCond(t){const e=[];return t.forEach((t=>{const s=[];if("GROUP"===t.condType){const e=t;e.notMode&&s.push("!"),s.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);s.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;s.push(e.fieldName),e.condValue||s.push("")}}e.push(s)})),e}}).map=new WeakMap;var kt=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:s,textAppDEFieldId:i}=this.codeList,a=s?t[s]:t.srfkey;return e.id=a,e.value=a,e.text=i?t[i]:t.srfmajortext,Object.freeze(e)}async load(t={},e={}){const i=ibiz.hub.getApp(t.srfappid);if(this.isPredefined){e.size||(e.size=1e4);const t=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),e);return Object.freeze(t.data.items)}const{appDataEntityId:a,appDEDataSetId:n}=this.codeList;if(!a)throw new s(this.codeList,"未配置应用实体");if(!n)throw new s(this.codeList,"未配置数据集");const r=await i.deService.exec(a,n,t,{},e);let o=[];return r.data.length&&(o=r.data.map((t=>this.convertData(t)))),o}async get(t={},e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const s=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(s)){const t=this.cache.get(s);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(s)}const i=this.load(t,e),{cacheTimeout:a}=this.codeList,n=-1===a||v(a)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,r={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(s,r);const o=await i;return r.items=o,delete r.promise,o}});function Ut(t,s){if(null!=s){const{srfkey:t}=s;if(!v(t)&&!_(t))return!0}throw new e("执行「".concat(t,"」不存在「srfkey」无法处理"))}function zt(t,s){const{srfsessionid:i}=s;if(!v(i)&&!_(i))return!0;throw new e("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Gt=t("DECache",class{constructor(){this.cacheMap=new Map}forceAdd(t,e){const s=this.getCacheByTag(t).get(e.srfkey);s&&(s.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.getCacheByTag(t).set(e.srfkey,b(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.getCacheByTag(t).delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){try{zt("add",t),(v(e.srfkey)||_(e.srfkey))&&(e.srfkey=f()),e.srftempdate=(new Date).getTime();return this.getCacheByTag(t).set(e.srfkey,b(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{zt("get",t);const s=this.getCacheByTag(t).get(e);return ibiz.log.warn("get",e,s),b(s)}catch(t){return ibiz.log.error(t),null}}update(t,e){try{zt("update",t),Ut("update",e),e.srftempdate=(new Date).getTime();const s=this.getCacheByTag(t),i=s.get(e.srfkey);if(i)return i.assign(e),s.set(e.srfkey,i),ibiz.log.warn("update",e.srfkey,e),b(i);throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{zt("delete",t);const s=this.getCacheByTag(t),i=e;if(s.has(i)){const t=s.get(i);return t.srftempdate=(new Date).getTime(),s.delete(i),ibiz.log.warn("delete",i),t}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{zt("add",t);const s=this.getCacheByTag(t);for(let t=0;t<e.length;t++){const i=e[t];(v(i.srfkey)||_(i.srfkey))&&(i.srfkey=f()),i.srftempdate=(new Date).getTime();const a=b(i);s.set(i.srfkey,a),e[t]=a,ibiz.log.warn("add",i.srfkey,i)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{zt("update",t);const s=this.getCacheByTag(t);for(let t=0;t<e.length;t++){const i=e[t];Ut("update",i),i.srftempdate=(new Date).getTime();const a=s.get(i.srfkey);if(!a)throw new Error("数据[".concat(i.srfdename,"-").concat(i.srfmajortext,"(").concat(i.srfkey,")]不存在,无法更新!"));a.assign(i),s.set(i.srfkey,a),ibiz.log.warn("update",i.srfkey,i),e[t]=b(a)}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{zt("delete",t)}catch(t){return ibiz.log.error(t),e}const s=this.getCacheByTag(t),i=[];for(let t=0;t<e.length;t++){const a=e[t];s.has(a)||i.push(a)}if(i.length>0)throw new Error("未找到以下数据「".concat(i.join("、"),"」,无法删除!"));for(let t=0;t<e.length;t++){const i=e[t];s.delete(i),ibiz.log.warn("delete",i)}return[]}checkData(t,e){return-1!==this.getList(t).findIndex((t=>t.srfkey===e))}getList(t){try{zt("getList",t);const e=this.getCacheByTag(t);if(!e)return[];const s=e.values();return Array.from(s)}catch(t){return ibiz.log.error(t),[]}}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=C(t.srfkey)),delete t.srfkey;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const i=t[s];e[s]=C(i)}return V(e)}clear(t){const e=t.srfsessionid;this.cacheMap.size>0&&this.cacheMap.delete(e)}getCacheByTag(t){const e=t.srfsessionid;return this.cacheMap.has(e)||this.cacheMap.set(e,new Map),this.cacheMap.get(e)}}),jt=new RegExp("(?<=\\$\\{)(.*?)(?=\\})","g");function Xt(t,e){const s=(e.requestPaths||[]).map((t=>({path:t,keys:t.match(jt)||[]}))).filter((e=>{const{keys:s}=e;return 0===s.length||s.every(((e,i)=>i===s.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(s.length>0)return s[0]}function Kt(t,e){const s=Xt(t,e);if(s){if(s.keys.length>0){let{path:e}=s;return s.keys.forEach(((i,a)=>{e=a===s.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return s.path}return""}var Ht=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(v(e.page)||_(e.page)||(this.page=e.page),v(e.size)||_(e.size)||(this.size=e.size),v(e.query)||_(e.query)||(this.query=e.query),!v(e.sort)&&!_(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}v(e.srfparentkey)||_(e.srfparentkey)||(this.srfparentkey=e.srfparentkey),v(e.srfparentdename)||_(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]}}),Yt=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 s=t.codeItems;let i=[];return(null==s?void 0:s.length)&&(i=this.formatStaticItems(s,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:s}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(s,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var s;const i={text:t.text,value:e?Number(t.value):t.value,color:t.color,id:t.codeName};return(null==(s=t.codeItems)?void 0:s.length)&&(i.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(i)}))}async getDynamicCodeList(t,e={},s={}){let i;const a=t.codeName;return this.cache.has(a)?i=this.cache.get(a):(i=new kt(t),this.cache.set(a,i),await i.init()),i.get(e,s)}async get(t,s,i){const a=this.allCodeLists.get(t);if(!a)throw new e("找不到".concat(t,"代码表"));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,s,i):[]}}),qt=t("CounterService",class{static async getCounter(t,e,s){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 a=new Rt(t);return await a.init(e,s),this.counterMap.set(i,a),a}static async getCounterByRef(t,e,i){const{appCounter:a}=t;if(!a)throw new s(t,"未配置应用计数器!");return this.getCounter(a,e,i)}});qt.counterMap=new Map;var $t=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}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:s}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(s))}async getWFLink(t,e){const s=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(s,"/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/alls/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/alls/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(){return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions2"))}async wfStart(t,e,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(s,t)})}async wfSubmit(t,e,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(s,t)})}async wfWithdraw(t,e,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(s,t)})}async wfReassign(t,e,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(s,t)})}async wfAddStepBefore(t,e,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(s,t)})}async wfSendBack(t,e,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(s,t)})}async wfSendCopy(t,e,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(s,t)})}async exec(t,s,i={},a={}){switch(t){case"wfstart":return this.wfStart(s,i,a);case"wfsubmit":return this.wfSubmit(s,i,a);case"reassign":return this.wfReassign(s,i,a);case"addstepbefore":return this.wfAddStepBefore(s,i,a);case"sendback":return this.wfSendBack(s,i,a);case"sendcopy":return this.wfSendCopy(s,i,a);default:throw new e("「".concat(t,"」未实现"))}}}),Qt=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(Qt||{})),Jt=t("AppDataEntity",class t{get srfuf(){return this.srfkey?1:0}constructor(e,s){let i;Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:b(s instanceof t?s._data:s)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const a=H(e.appDEFields||[],e.keyAppDEFieldId);if(a){const t=a.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfile",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){i=e,this._data[t]=e},get(){return this._data[t]||i}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const n=H(e.appDEFields||[],e.majorAppDEFieldId);if(n){const t=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfile",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));this.defineProperties()}defineProperties(){var t;const{_data:e}=this,s={},i=Object.keys(e);i.forEach((t=>{s[t]={enumerable:!0,set(s){e[t]=s},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const a=t.codeName.toLowerCase();i.includes(a)||(s[a]={enumerable:!0,set(t){e[a]=t},get:()=>e[a]})})),Object.defineProperties(this,s)}clone(){return new t(this._entity,this._data)}assign(e){return e instanceof t?Object.assign(this._data,e._data):Object.assign(this._data,e),this}}),Zt=t("MethodDto",class t{constructor(t,e){this.entity=t,this.dto=e,this.dtoMap=new Map,e?(this.app=ibiz.hub.getApp(t.appId),this.fields=e.appDEMethodDTOFields||[]):this.fields=[]}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async get(t,e){const s={};for(let a=0;a<this.fields.length;a++){const n=this.fields[a],r=n.codeName.toLowerCase();switch(n.type){case"SIMPLE":{const t=e[r];E(t)?s[r]=null:s[r]=t;break}case"DTOS":{const e=await this.getFieldDto(n),i=(await this.app.deService.getService(n.refAppDataEntityId)).local.getList(t);if(i){const a=[];for(let s=0;s<i.length;s++)a.push(await e.get(t,i[s]));s[r]=a}break}default:throw new i(n,"未支持的应用实体方法输入属性类型: ".concat(n.type))}}return s}async sets(t,e){const s=await this.app.deService.getService(this.entity.id);return s.local.clear(t),Promise.all(e.map((async e=>{const i=this.fields.filter((t=>"DTOS"===t.type)).map((async s=>{const i=s.codeName.toLowerCase(),a=await this.getFieldDto(s),n=e[i];n&&await a.sets(t,n)}));for(let t=0;t<i.length;t++)await i[t];const a=new Jt(this.entity,e);return this.isLocalMode&&await s.local.add(t,a),a})))}async getFieldDto(e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const s=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=H(s.appDEMethodDTOs||[],e.refAppDEMethodDTOId),a=new t(s,i);return this.dtoMap.set(e.codeName,a),a}}),te=class{constructor(t,e){this.entity=t,this.method=e,this.app=ibiz.hub.getApp(t.appId),this.input=new class{constructor(t,e){if(this.entity=t,this.input=e,e){const s=H(t.appDEMethodDTOs||[],e.appDEMethodDTOId);s&&(this.dto=new Zt(t,s))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}(t,e.appDEMethodInput),this.result=new class{constructor(t,e){if(this.entity=t,this.output=e,e){const s=H(t.appDEMethodDTOs||[],e.appDEMethodDTOId);s&&(this.dto=new Zt(t,s))}}async handle(t,e){return this.dto?(await this.dto.sets(t,[e]))[0]:new Jt(this.entity,e)}}(t,e.appDEMethodReturn)}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async request(t,e,i,a){const{actionType:n,requestMethod:r}=this.method;if("REMOTE"===n){const e=this.method.codeName.toLowerCase();let n=null;switch(r){case"POST":n=await this.app.net.post("".concat(t,"/").concat(e),i,a);break;case"GET":n=await this.app.net.get("".concat(t,"/").concat(e),i,a);break;case"PUT":n=await this.app.net.put("".concat(t,"/").concat(e),i,a);break;case"DELETE":n=await this.app.net.delete("".concat(t,"/").concat(e),i,a);break;default:throw new s(this.method,r?"未支持的请求方式: ".concat(r):"未配置请求方式")}return n}throw new s(this.method,"未支持的行为类型[".concat(n,"]"))}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Kt(t,this.entity)+e}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(t){return new Jt(this.entity,t)}},ee=class{},se=class extends ee{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,a){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=a[this.value]?a[this.value]:e[this.value];return ot(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return ot(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return ot(n[this.dstField],this.op,this.value)}}},ie=class t extends ee{constructor(e){super(),this.model=e;const s=e.conds||[];this.conds=s.map((e=>"SINGLE"===e.logicType?new se(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(t,e,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},ae=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new ie(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data||{})}}(t)))}},ne=class extends ae{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:a,retDELogicParamId:n}=this.model;if(!e)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=t.params[a],o=ibiz.hub.getApp(t.context.srfappid),c=await o.deService.exec(e,i,t.context,r,t.viewParams);c.ok&&(t.params[n]=c.data)}},re=class extends ae{async exec(t){}},oe=class extends ae{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:s,rawValue:a}=this.model;switch(s){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=a;break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(s))}}};function ce(t,e){const{srcDELogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=e;let o;switch(e.srcValueType||(e.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=t.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=t.viewParams;break;case"APPDATA":o=t.context;break;case"ENVPARAM":o=b(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}var le=class extends ae{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:s}=t,i=ce(e,t);e.params[s]=b(i)}bindParam(t,e){const s=ce(e,t);e.params[t.dstDELogicParamId]=s}setParamValue(t,e){const{dstFieldName:s,dstDELogicParamId:i}=t,a=null==s?void 0:s.toLowerCase(),n=ce(e,t);a?e.params[i][a]=n:e.params[i]=n}resetParam(t,e){const{dstDELogicParamId:s}=t;e.resetParam(s)}renewParam(t,e){const{dstDELogicParamId:s}=t;e.renewParam(s)}appendParam(t,e){const{dstDELogicParamId:s,dstIndex:i,srcIndex:a,srcSize:n}=t,r=ce(e,t),o=i||0,c=a||0,l=n||r.length;e.params[s].splice(o,0,...r.slice(c,l))}sortParam(t,e){const{dstDELogicParamId:s,dstFieldName:i,dstSortDir:a}=t,n=i.toLowerCase();e.params[s].sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n]))}},de=class extends ae{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:s,dstDELogicParamId:i,retDELogicParamId:a}=this.model,n=t.params[i],r=ibiz.hub.getApp(t.context.srfappid),o=await r.deService.exec(s,e,t.context,n,t.viewParams);o.ok&&(t.params[a]=o.data)}},he=class extends ae{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ce(t,this.model);t.params[e]=a}},ue=class extends ae{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new s(this.model,"缺少目标参数对象配置");t.resetParam(e)}},pe=class extends ae{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new s(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Ee=class extends ae{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ce(t,this.model);t.params[e]=b(a)}},ge=class extends ae{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:a}=this.model;if(!e||!a)throw new s(this.model,"缺少目标参数对象或目标属性配置");const n=a.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[n]-e[n]:e[n]-t[n]))}},me=class extends ae{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:a,srcIndex:n,srcSize:r}=this.model;if(!e||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const o=ce(t,this.model),c=a||0,l=n||0,d=r||o.length;t.params[e].splice(c,0,...o.slice(l,d))}},fe=class extends ae{async exec(t){const{errorCode:e,errorInfo:s}=this.model;throw new r({response:{status:e,statusText:s}})}},we=class{constructor(t){var e,a;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.delogicNodes)?void 0:e.length))throw new s(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let s;switch(e){case"BEGIN":s=new re(t);break;case"END":s=new oe(t);break;case"DEACTION":s=new ne(t);break;case"PREPAREPARAM":s=new le(t);break;case"DEDATASET":s=new de(t);break;case"THROWEXCEPTION":s=new fe(t);break;case"BINDPARAM":s=new he(t);break;case"RESETPARAM":s=new ue(t);break;case"COPYPARAM":s=new Ee(t);break;case"RENEWPARAM":s=new pe(t);break;case"APPENDPARAM":s=new me(t);break;case"SORTPARAM":s=new ge(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,s)})),null==(a=t.delogicParams)||a.forEach((t=>{this.params.set(t.id,new class{constructor(t){this.model=t}calc(t){const e=this.model.id,s=this.model;if(s.default)t.params[e]=t.data||{};else if(s.appGlobalParam)t.params[e]=b(ibiz.env);else if(s.entityListParam)t.params[e]=[];else{if(s.entityPageParam)throw new i(s,"未支持的逻辑参数类型: 分页查询结果");if(s.entityParam)t.params[e]={};else{if(s.lastReturnParam)throw new i(s,"未支持的逻辑参数类型: 上次调用返回");if(s.appContextParam)t.params[e]=t.context;else if(s.simpleListParam)t.params[e]=[];else if(s.simpleParam)t.params[e]={};else if(s.cloneParam)t.params[e]=b(t.data||{});else{if(s.envParam)throw new i(s,"未支持的逻辑参数类型: 系统环境变量");if(s.fileListParam)throw new i(s,"未支持的逻辑参数类型: 文件对象列表变量");if(s.fileParam)throw new i(s,"未支持的逻辑参数类型: 文件对象变量");if(s.filterParam)throw new i(s,"未支持的逻辑参数类型: 过滤器对象变量");if(s.lastParam)throw new i(s,"未支持的逻辑参数类型: 最后数据变量");if(s.originEntity)throw new i(s,"未支持的逻辑参数类型: 原始数据对象");if(s.sessionParam)throw new i(s,"未支持的逻辑参数类型: 操作会话变量")}}}}renew(t){const e=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)t.params[e]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}}(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){const a=new class{constructor(t,e,s,i){this.deLogicParams=t,this.context=e,this.data=s,this.viewParams=i,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}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)}}(this.params,t,e,i);this.initLogicParams(a);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new s(this.model,"未设置起始节点");{const t=this.nodes.get(n);await this.deepExec(t,a)}return a.isEndNode?a.result:a.params[a.defaultParamName]?a.params[a.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:s}=t;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(e)&&a.dstNode&&(await this.deepExec(a.dstNode,e),!1===t.model.parallelOutput))break}}},Ie=new Map;async function De(t,e,s,i){Ie.has(t)||Ie.set(t,new we(t));return Ie.get(t).exec(e,s,i)}async function Ae(t,e,s,i){try{const a=await De(t,e,s,i);return new n(a)}catch(t){if(t instanceof r)return new n(t,500);throw t}}async function Pe(t,e,s,i,a){const n=J(t,e);if(n.length){(await Promise.all(n.map((t=>De(t,s,i,a))))).forEach((t=>{Object.assign(i,t)}))}}var ye=class extends te{async exec(t,e,i){if("DELOGIC"===this.method.actionType){const a=Q(this.method.appDELogicId,this.entity);if(!a)throw new s(this.method,"缺少实体处理逻辑");return Ae(a,t,e,i)}let a;switch(this.isLocalMode||(e=await this.input.handle(t,e)),["READ","GETDRAFT"].includes(this.method.actionMode)||await Pe(this.entity,"change",t,e,i),this.method.codeName){case"Create":a=await this.create(t,e,i);break;case"Get":a=await this.get(t,i);break;case"GetDraft":a=await this.getDraft(t,i);break;case"Remove":a=await this.remove(t,i);break;case"Update":a=await this.update(t,e,i);break;case"CreateTemp":a=await this.createTemp(t,e);break;case"GetTemp":a=await this.getTemp(t,e);break;case"GetDraftTemp":a=await this.getDraftTemp(t,i);break;case"RemoveTemp":a=await this.removeTemp(t,e);break;case"UpdateTemp":a=await this.updateTemp(t,e);break;default:{let s=this.calcPath(t);this.method.needResourceKey&&(s="".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]||e[this.entity.keyAppDEFieldId]));const n=await this.request(s,t,e,i);n.data=await this.result.handle(t,n.data),a=n}}return await Pe(this.entity,"compute",t,a.data,i),a}async create(t,e,s){if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),a=await this.app.net.post(i,e,s);return a.data=await this.result.handle(t,a.data),a}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const s=this.calcPath(t);return await this.app.net.delete("".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,s={}){if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),a=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,s);return a.data=await this.result.handle(t,a.data),a}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const s=this.calcPath(t),i=await this.app.net.get("".concat(s,"/").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 s=this.calcPath(t),i=await this.app.net.get("".concat(s,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const s=await this.getService(),i=await s.local.add(t,this.createEntity(e));return new n(i)}catch(t){return new n(t,500)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new n(t):new n(t,500)}catch(t){return new n(t,500)}}async removeTemp(t,e){try{let e=null;!e&&t&&(e=t[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.delete(t,e);return s?new n(s):new n(s,500)}catch(t){return new n(t,500)}}async updateTemp(t,e){try{const s=(await this.getService()).local.update(t,this.createEntity(e));return s?new n(s):new n(s,500)}catch(t){return new n(t,500)}}async getTemp(t,e){try{let e=null;!e&&t&&(e=t[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.get(t,e);return s?new n(s):new n(s,500)}catch(t){return new n(t,500)}}async removeBatchTemp(t,e){return new n(!0)}},ve=class extends te{async exec(t,e,s){if(this.isLocalMode){const s=await this.searchLocal(null,new Ht(t,e));return new n(s,200)}let a;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":a=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);a=await this.request(i,t,e,s)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const r=a.data||[];return a.data=r.map((t=>this.createEntity(t))),a.data.length&&await Promise.all(a.data.map((e=>Pe(this.entity,"compute",t,e,s)))),a}async selectLocal(t,e={}){let s=(await this.getService()).local.getList(t);s=D(s,"srfordervalue");const i={},a={},n={},r={};e.srfkey&&(i.srfkey=C(e.srfkey),delete e.srfkey);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const s=e[t];null==s?(a[t]=C(null),n[t]=C(void 0),r[t]=C("")):i[t]=C(s)}if(!_(i)){const t=V(i),e=V(a),o=V(n),c=V(r);s=s.filter((s=>{if(_(a)){if(t(s))return!0}else if(t(s)&&(e(s)||o(s)||c(s)))return!0;return!1}))}return s.map((t=>t.clone()))}async searchLocal(t,e,s=this.entity.quickSearchAppDEFieldIds){const i=await this.getService();let a=[];t?(a=i.local.getList(e.context),a.length>0&&(a=a.filter((s=>t.test(s,e))))):(a=await this.selectLocal(e.context),a.length>0&&e.query&&""!==e.query&&s&&(a=a.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<s.length;e+=1){const a=t[s[e]];if(i.test(a))return!0}return!1})))),v(e.sortField)||_(e.sortField)||(a="DESC"===e.sortMode?A(a,e.sortField):D(a,e.sortField));const{page:n,size:r}=e,o=n*r,c=(n+1)*r-1;return a.slice(o,c).map((t=>b(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new s(this.method,"没有指定数据来源代码表");const a=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:r,majorAppDEFieldId:o}=this.entity,c=a.map((t=>({[r]:t.value,[o]:t.text})));return new n(c,200)}},Te=t("DEService",class{constructor(t){this.model=t,this.methodMap=new Map,this.local=new Gt,this.wf=new $t(t),this.file=new class{constructor(t){this.model=t}exportData(t,e,s,i){const a=Kt(s,this.model),n="".concat(a,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}}(t)}getMethod(t){if(this.methodMap.has(t))return this.methodMap.get(t);const e=H(this.model.appDEMethods,t);let s=null;switch(e.methodType){case"DEACTION":s=new ye(this.model,e);break;case"FETCH":case"FETCHTEMP":s=new ve(this.model,e);break;default:throw new i(e,"未支持的服务方法类型: ".concat(e.methodType))}return this.methodMap.set(t,s),s}exec(t,s,i={},a={}){const n=this.getMethod(t);if(n)return n.exec(s,i,a);throw new e("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}}),_e=t("ControlVO",class t{get srfuf(){return v(this.$origin.srfuf)?this.srfkey?1:0:this.$origin.srfuf}get srfkey(){return this.$origin.srfkey}get srfmajortext(){return this.$origin.srfmajortext}get srfdeid(){return this.$origin.srfdeid}get srfdecodename(){return this.$origin.srfdecodename}get srfkeyfile(){return this.$origin.srfkeyfile}get srfmajorfile(){return this.$origin.srfmajorfile}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}),this.$dataUIMap.forEach(((t,e)=>{const s=t.dataKey;this.linkProperty(e,s,t.isOriginField)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,s=!0){"srfuf"!==t&&(s||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}}),be=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(null==t?void 0:t.srfappid),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,s={},i={}){return await this.app.deService.exec(this.model.appDataEntityId,t,e,s,i)}handleResponse(t){return t}toUIData(t){return new _e(t,this.dataUIMap)}}),Ce=(t("MDControlService",class extends be{async fetch(t,e={}){var s;const i=(null==(s=this.model.fetchControlAction)?void 0:s.appDEMethodId)||"fetchdefault";let a=await this.exec(i,t,e);return a=this.handleResponse(a),a}async get(t,e={}){var s;const i=(null==(s=this.model.getControlAction)?void 0:s.appDEMethodId)||"get";let a=await this.exec(i,t,void 0,e);return a=this.handleResponse(a),a}async getDraft(t,e={}){var s;const i=(null==(s=this.model.getDraftControlAction)?void 0:s.appDEMethodId)||"getdraft";let a=await this.exec(i,t,void 0,e);return a=this.handleResponse(a),a}async remove(t,e={}){var s;const i=(null==(s=this.model.removeControlAction)?void 0:s.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var s;const i=(null==(s=this.model.createControlAction)?void 0:s.appDEMethodId)||"create";let a=await this.exec(i,t,e.getOrigin());return a=this.handleResponse(a),a}async update(t,e){var s;const i=(null==(s=this.model.updateControlAction)?void 0:s.appDEMethodId)||"update";let a=await this.exec(i,t,e.getOrigin());return a=this.handleResponse(a),a}async exportData(t,s,i={}){throw new e("未实现")}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&&(w(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),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 s=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),s;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const a=Y(i,e);if(a){ibiz.log.debug("匹配主状态",a);const e=q(a,i);ibiz.log.debug("允许的主状态权限集合",e),s=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),s=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(s)),s}})),Ve=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 s=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!s)throw new e("未找到应用实体[".concat(t,"]"));const i=this.constructorCache.get(t);let a;a=i?await i(s):new Ce(s),this.cache.set(t,a)}return this.cache.get(t)}async init(t=ibiz.appData){if(!t)throw new e("没有appData数据");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,s){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,s);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&s){return(await this.getService(s)).calcByDataAccessAction(t,e)}return!0}}),Le=t("AuthService",class{async v7login(t,e){return await ibiz.net.post("/v7/login",{loginname:t,password:e},{},{})}async v7logout(){return await ibiz.net.get("/v7/logout",{})}}),Re=t("TreeNodeData",class{constructor(t,e,s){this.leaf=!1,this.leaf=!0===s.leaf,this.parent=e,this.parent&&(this.context={...this.parent.context}),s.navContext&&(this.context=Object.assign(this.context||{},s.navContext)),s.navParams&&(this.params={...s.navParams}),this.nodeId=t.id}}),Me=(t("TreeCodeListNodeData",class extends Re{constructor(t,e,s){super(t,e,s);const{data:i}=s;if(this.deData=i,this.text=i.text,this.value=i.value,this.id=e?"".concat(e.id,":").concat(t.id,"@").concat(this.value):t.id+this.value,this.id=this.id.toLowerCase(),t.appDataEntityId){const e=$(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text}}),t("TreeDataSetNodeData",class extends Re{constructor(t,e,s){super(t,e,s);const{data:i}=s;if(this.deData=i,this.text=i.srfmajortext,this.value=i.srfkey,this.id=e?"".concat(e.id,":").concat(t.id,"@").concat(i.srfkey):t.id+i.srfkey,this.id=this.id.toLowerCase(),t.appDataEntityId){const e=$(t.appDataEntityId);this.context=Object.assign(this.context||{},{[e]:i.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext}}),t("TreeStaticNodeData",class extends Re{constructor(t,e,s){var i,a;super(t,e,s);const n="root"===t.nodeValue?void 0:t.nodeValue;if(this.id=e?"".concat(e.id,":").concat(t.id):t.id,this.id=this.id.toLowerCase(),this.text=t.text,this.value=n,e&&s.parentValueLevel){let t=e;for(let e=1;e<s.parentValueLevel;e++)t=null==t?void 0:t.parent;(null==t?void 0:t.deData)&&(this.deData=t.deData),this.value=n||(null==t?void 0:t.value)}this.srfkey=(null==(i=this.deData)?void 0:i.srfkey)||this.value,this.srfmajortext=(null==(a=this.deData)?void 0:a.srfmajortext)||this.text}}),t("UIMapField",class{constructor(t,e,s={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,v(s.isOriginField)||(this.isOriginField=s.isOriginField)}}),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}}),t("DEServiceUtil",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const s=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!s)throw new e("未找到应用实体[".concat(t,"]"));const i=this.constructorCache.get(t);let a;a=i?await i(s):new Te(s),this.cache.set(t,a)}return this.cache.get(t)}clearTempCache(t){this.cache.forEach((e=>{e.local.clear(t)}))}async exec(t,e,s,i,a){return(await this.getService(t)).exec(e,s,i,a)}})),Oe=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new o({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.deService=new Me(t),this.codeList=new Yt(t),this.authority=new Ve(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle()}async loadAppModelStyle(){await this.net.get("".concat(ibiz.env.remoteModelUrl,"/PSSYSAPP.json.css")).then((t=>{const e=document.createElement("style");if(e.setAttribute("type","text/css"),t.request&&t.request.responseURL){const s=new URL(t.request.responseURL);e.id=s.pathname}e.innerHTML=t.data,document.head.appendChild(e)})).catch((t=>{ibiz.log.error("应用[".concat(this.appId,"]模型全局样式加载失败:").concat(t.message))}))}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const s=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(s)return s}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var s,i;let a=null==(s=this.model.deopprivs)?void 0:s.find((e=>e.name===t));if(!a&&e){a=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return a}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}}),We=class{constructor(){this.convert=new class{constructor(){this.appMenu=new class{parse(t){return t}}}},this.appMap=new Map,this.apps=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new class{constructor(){this.view=new class{constructor(){this.viewConfigs=new Map}set(t,e){this.viewConfigs.set(t,e)}async get(t){if(!this.viewConfigs.has(t)){const s=await ibiz.hub.getAppView(t);if(!s)throw new e("视图[".concat(t,"]不存在"));this.set(s.id,{id:s.id,codeName:s.codeName,openMode:s.openMode,width:s.width,height:s.height,appDataEntityId:s.appDataEntityId,redirectView:s.redirectView})}return this.viewConfigs.get(t)}}}},this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const s=t.split(".");e=s[s.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerApp(t){this.apps.set(t.codeName,t)}registerAppView(t){this.views.set(t.codeName,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 s=this.calcAppViewId(t);this.view2appMap.set(s,e)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppView(t){const s=this.calcAppViewId(t),i=this.view2appMap.get(s)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(s))return this.views.get(s);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(i,s);return this.registerAppView(t),t}throw new e("视图[".concat(s,"]不存在"))}async getAppDataEntity(t,s=ibiz.env.appId){if(this.dataEntities.has(s)){const e=this.dataEntities.get(s);if(e.has(t))return e.get(t)}if(this.modelLoaderProvider){let e;return e=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(s,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(s,t),this.registerAppDataEntity(e,s),e}throw new e("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);let s;if(this.apps.has(t))s=this.apps.get(t);else{if(!this.modelLoaderProvider)throw new e("未找到应用[".concat(t,"]模型"));s=await this.modelLoaderProvider.getApp(t),this.registerApp(s)}const i=new Oe(s);return this.appMap.set(t,i),await i.init(),i}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)}},Ne=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:s,engineCat:i}=t,a="".concat(i,"_").concat(s),n=this.viewEngines.get(a);if(n)return n(...e);ibiz.log.error("没有".concat(a,"对应的引擎"),t)}}),xe=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:s,childNames:i}=this.view;ibiz.log.debug("".concat(s.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,s,i;let a=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else a=!0;if(ibiz.env.isMob){if(this.leftToolbar)a=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)a=!0;else{const t=null==(s=this.viewLayoutPanel)?void 0:s.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)a=!0;else{const t=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;t&&(t.state.visible=!1)}return a}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:s,context:i,params:a}=this.view;if(!t)throw new e("该视图没有实体,无法加载实体数据");const n=ibiz.hub.getApp(i.srfappid),r=await n.deService.exec(t,"get",i,a),{data:o}=r;o&&(this.view.state.srfactiveviewdata=o,s.emit("onDataChange",{actionType:"LOAD",data:[o]}),o.srfkey&&s.emit("onViewInfoChange",{dataInfo:o.srfmajortext||""}))}}),Se=(t("MDViewEngine",class extends xe{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")}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",(async t=>{await this.openData(t)})),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 s=!!this.searchForm;e.state.keepAlive=s,e.state.visible=s&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.refresh()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.refresh()})),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?(this.openData(e),null):"New"===t?(this.newData(e),null):"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):"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,s;const{data:i,event:a}=t,n=(t.context||this.view.context).clone(),r=t.params||this.view.params;n[((null==(e=i[0].srfdecodename)?void 0:e.toLowerCase())||$(this.xdataControl.model.appDataEntityId)).toLowerCase()]=i[0].srfkey;-1===await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("opendata",{context:n,params:r,data:i,event:a,view:this.view}))&&ibiz.log.warn("视图[".concat(this.view.model.codeName,"],未配置编辑打开视图"))}async newData(t){var e,i,a;const{data:n,event:r,copyMode:o}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new s(this.view.model,"缺少newdata的视图逻辑");const c=this.view.context.clone();o&&(c.srfcopymode=!0);if(-1===await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("newdata",{context:c,params:this.view.params,data:n,event:r,view:this.view})))throw new s(this.view.model,"缺少newdata的视图逻辑")}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}getSearchParams(){const t={};if(this.searchForm){const e=this.searchForm.getData()[0];Object.assign(t,e)}if(this.searchBar){const e={query:this.searchBar.state.query};Object.assign(t,e)}return 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)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 ft}}),Fe=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Be(t){return ibiz.register.get("".concat(Fe,"_").concat(t))}async function ke(t){let e;const{controlType:s,controlStyle:i}=t;if(i&&"DEFAULT"!==i){e=Be("".concat(s,"_").concat(i)),e||ibiz.log.error("找不到部件类型:[".concat(s,"]的部件样式:[").concat(i,"]对应的适配器"),t)}return e||(e=Be(s)),e||ibiz.log.error("找不到部件类型".concat(s,"对应的适配器")),e}var Ue=t("EDITOR_PROVIDER_PREFIX","EDITOR");function ze(t){return ibiz.register.get("".concat(Ue,"_").concat(t))}var Ge=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");var je=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");var Xe=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Ke(t){return ibiz.register.get("".concat(Xe,"_").concat(t.toUpperCase()))}var He=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Ye(t,e){ibiz.register.register("".concat(He,"_").concat(t),e)}async function qe(t){let s;const{uiactionMode:i}=t;var a;if(s||(a=i,s=ibiz.register.get("".concat(He,"_").concat(a))),!s)throw new e("找不界面行为模式".concat(i,"对应的适配器"));return s}var $e=t("VIEW_PROVIDER_PREFIX","VIEW");function Qe(t){return ibiz.register.get("".concat($e,"_").concat(t))}var Je=t("PORTLET_PROVIDER_PREFIX","PORTLET");var Ze=class{},ts=class extends Ze{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,a){const n=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=a[this.value]?a[this.value]:e[this.value];return ot(n[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return ot(n[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return ot(n[this.dstField],this.op,this.value)}}},es=class t extends Ze{constructor(e){super(),this.model=e;const s=e.deuilogicLinkConds||[];this.conds=s.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 a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(t,e,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},ss=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:s}=this.model;0===e&&s&&(this.groupCond=new es(s))}async exec(t){const{linkMode:e}=this.model,{context:s,data:a}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,s,a&&a.length>0?a[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))}}}(t)))}},is=class extends ss{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:a,retDEUILogicParamId:n}=this.model;if(!e)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=t.params[a],o=ibiz.hub.getApp(t.context.srfappid),c=await o.deService.exec(e,i,t.context,r,t.viewParams);c.ok&&(t.params[n]=c.data)}},as=class extends ss{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:a,parameters:n}=t;if(!e)throw new s(this.model,"未配置界面行为");let r=[a];if(i){const e=t.params[i];r=e instanceof Array?e:[e]}await us.execAndResolved(e,{...n,data:r})}},ns=class extends ss{async exec(t){}},rs=class extends ss{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:s,returnParamId:a}=this.model;switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=s;break;case"LOGICPARAM":t.result=t.params[a];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}};var os=class extends ss{async exec(t){const e=this.model.deuilogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{if("SETPARAMVALUE"===e.paramAction)return this.setParamValue(e,t);throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))})))}setParamValue(t,e){const{dstFieldName:s,dstDEUILogicParamId:a}=t,n=null==s?void 0:s.toLowerCase(),r=function(t,e){const{srcDEUILogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=e;let o;switch(e.srcValueType||(e.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=t.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=t.viewParams;break;case"APPDATA":o=t.context;break;case"ENVPARAM":o=b(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}(e,t);n?e.params[a][n]=r:e.params[a]=r}},cs=class extends ss{async exec(t){t.isEndNode=!0;const{invokeMethod:i,invokeCtrlId:a,invokeParamId:n}=this.model;if(!a)throw new s(this.model,"没有配置界面对象");if(!n)throw new s(this.model,"没有配置操作参数");if(!i)throw new s(this.model,"没有配置调用方法");const r=t.params[n];if(!r)throw new e("没有找到操作参数".concat(n));const o=t.params[a];if(!o)throw new e("没有找到界面对象".concat(a));if(!o[i]||!u(o[i]))throw new e("没有找到调用方法".concat(i));await o[i](r)}},ls=class{constructor(t){var a;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(a=t.deuilogicNodes)?void 0:a.length))throw new s(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let s;switch(e){case"BEGIN":s=new ns(t);break;case"END":s=new rs(t);break;case"DEACTION":s=new is(t);break;case"DEUIACTION":s=new as(t);break;case"PREPAREJSPARAM":s=new os(t);break;case"RESETPARAM":case"COPYPARAM":case"BINDPARAM":case"VIEWCTRLINVOKE":s=new cs(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,s)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new class{constructor(t){this.model=t}calc(t){const s=this.model.id,a=this.model,{context:n,viewParams:r,data:o,parameters:c}=t,l=ibiz.hub.getApp(n.srfappid);if(a.default)t.params[s]=o&&o.length>0?o[0]:{};else if(a.activeContainerParam)t.params[s]=c.ctrl||c.view;else if(a.activeCtrlParam)t.params[s]=c.ctrl;else if(a.ctrlParam){const i=c.view.getController(a.codeName.toLowerCase());if(!i)throw new e("没找到".concat(a.codeName,"指定部件对象"));t.params[s]=i}else if(a.activeViewParam)t.params[s]=c.view;else if(a.appGlobalParam)t.params[s]=ibiz.env;else if(a.applicationParam)t.params[s]=l;else if(a.entityListParam)t.params[s]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[s]={};else{if(a.lastReturnParam)throw new i(a,"未支持的逻辑参数类型: 上次调用返回");if(a.navContextParam)t.params[s]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[s]=[];else if(a.simpleParam)t.params[s]={};else if(a.viewNavDataParam)t.params[s]=r;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}}}renew(t){const e=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)t.params[e]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}}(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 class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get context(){return this.parameters.context}get data(){return this.parameters.data}get viewParams(){return 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)}}(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new s(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:s}=t;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(e)&&a.dstNode&&(await this.deepExec(a.dstNode,e),!1===t.model.parallelOutput))break}}},ds=new Map;async function hs(t,s,i){const a=ibiz.hub.getApp(i.context.srfappid),n=await a.getDEUILogic(t,s);if(!n)throw new e("找不到实体".concat(s,"的界面逻辑").concat(t));ds.has(n)||ds.set(n,new ls(n));const r=ds.get(n);return await r.exec(i),null}var us=t("UIActionUtil",class{static async exec(t,s){const i=await tt(t);if(!i)throw new e("没找到".concat(t,"的界面行为模型"));return(await qe(i)).exec(i,s)}static async execAndResolved(t,e){const s=await this.exec(t,e);s.closeView?e.view.closeView():s.refresh&&await e.view.callUIAction("Refresh")}}),ps=class{async exec(t,e){const{context:i,params:a,data:n}=e,r={refresh:t.reloadData,closeView:t.closeEditView},{appDEUILogicId:o,appDataEntityId:c,uilogicAttachMode:l}=t;if("REPLACE"===l){if(!o)throw new s(t,"没有配置实体界面逻辑");return await hs(o,c,e),r}if(!await this.isConfirm(t))return this.returnError(r);const d=await this.execAction(t,e);if(Object.assign(r,d),!0===r.cancel)return this.returnError(r);const h=await this.doNextAction(t,{...e,context:r.nextContext||i,data:r.data||n,params:r.nextParams||a});if(h&&(Object.assign(r,h),!0===h.cancel))return this.returnError(r);if("AFTER"===t.uilogicAttachMode){if(!o)throw new s(t,"没有配置实体界面逻辑");await hs(o,c,e)}return r}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t){return!t.enableConfirm||!t.confirmMsg||ibiz.modal.confirm({title:t.confirmMsg})}async doNextAction(t,e){const s=t.nextId;if(s)return us.exec(s,e)}async handleParams(t,e,s,i){let a=[];const n=$(t.appDataEntityId);switch(t.actionTarget){case"NONE":a=[];break;case"SINGLEDATA":a=[s[0]];break;case"MULTIDATA":a=s;break;case"MULTIKEY":a=n&&s.length>0?s.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=s[0]||{};a=n?[{[n]:t.srfkey||t[n]}]:[{}]}}const r=e.clone(),o=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:s}=t,i=s||n,a=e||"srfkey";o.unshift({key:i,value:a,rawValue:!1})}const c=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&s.length>0,l=z(o,e,i,c?K(o,s):s[0]||{});Object.assign(r,l);const d=t.navigateParams;return{resultContext:r,resultData:a,resultParams:z(d,r,i,c?K(d,s):s[0]||{})}}},Es=t("BackendUIActionProvider",class extends ps{async execAction(t,e){const{context:i,params:a,data:n,event:r}=e,o={},c=t.appDataEntityId,l=t.appDEMethodId;if(!c||!l)throw new s(t,"未配置实体或实体行为");const{resultContext:d,resultParams:h,resultData:u}=await this.handleParams(t,i,n,a),p={...a,...h},E=t.frontAppViewId;if(E){const t=await ibiz.commands.execute(bt.TAG,E,d,h,{event:r});if(!(null==t?void 0:t.ok))return o.cancel=!0,o;(null==t?void 0:t.ok)&&t.data&&(0===u.length&&u.push({}),u.forEach((e=>{e.srfactionparam=t.data})))}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),m=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})),f=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),I=await g.deService.exec(c,l,d,f?m:m[0],p);return I.ok&&t.successMsg&&ibiz.message.success(t.successMsg),Object.assign(o,{data:w(I.data)?I.data:[I.data],nextContext:d,nextParams:p}),o}}),gs=t("SysUIActionProvider",class extends ps{async execAction(t,e){const{view:s}=e,i=t.uiactionTag;if("Exit"===i)return{closeView:!0};return await s.callUIAction(i,e)||{}}}),ms=t("FrontUIActionProvider",class extends ps{async execAction(t,e){const{context:a,params:n,data:r,event:o,noWaitRoute:l}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=c.fill(t.htmlPageUrl,a,null==r?void 0:r[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new s(t,"未配置打开视图");const{resultContext:i,resultParams:c}=await this.handleParams(t,a,r,n),h=await ibiz.commands.execute(bt.TAG,e,i,c,{event:o,noWaitRoute:l});(null==h?void 0:h.ok)||(d.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(d.data=h.data,d.nextContext=i,d.nextParams={...n,...c});break}case"OTHER":d=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return d}doOther(t,e){const{scriptCode:i}=t,{context:a,params:n,data:r,event:o}=e;if(i){return Et.execScriptFn({context:a,params:n,data:r,el:null==o?void 0:o.target},i)||{}}throw new s(t,"自定义类型缺少配置脚本代码")}}),fs=t("WFWithdrawUIActionProvider",class extends ps{async execAction(t,e){const{view:s}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&s&&(await s.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}});function ws(){const t=new ms;Ye("FRONT",(()=>t));const e=new Es;Ye("BACKEND",(()=>e));const s=new gs;Ye("SYS",(()=>s));const i=new fs;Ye("DEUIACTION_WFWithdraw",(()=>i))}var Is=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new e("Method not implemented.")}destroy(){}},Ds=class extends Is{constructor(){super(...arguments),this.isRowReturn=!1}convertScriptArgs(t){throw new e("未设置脚本执行参数转换方法")}init(t,e){this.convertScriptArgs=e;let s=this.logic.scriptCode;this.isRowReturn&&(s="return (".concat(s,")")),this.scriptFn=Et.createScriptFn(t,s,{singleRowReturn:this.isRowReturn})}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},As=class extends Is{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new s(this.logic,"没有配置实体界面逻辑");hs(e,i,t)}},Ps=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const s=this.createTrigger(t);this.triggers.set(t.id,s),s.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()),L(t,e)}createTrigger(t){return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((s=>{s.match(t)&&e.push(s)})),e}triggerAndExecute(t,e={}){const s=this.getMatchTriggers(t);if(s.length>0){const t=this.getExecuteParams(e);return s.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,s){const i={itemName:t,triggerType:e},a=this.triggerAndExecute(i,s);if(null==a?void 0:a.length)return a.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 s=this.triggers.get(t);if(!s)return-1;const i=this.getExecuteParams(e);return s.execute(i)}},ys=class extends Ps{constructor(t){super(t.filter((t=>"APPVIEWENGINE"!==t.triggerType)))}},vs=class extends Ps{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Ts=class{constructor(){this.executorFactory=new class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const s=this.constructorMap.get(t.logicType);if(!s)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return s(t,e)}},this.triggerFactory=new class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const s=this.constructorMap.get(t.triggerType);if(!s)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return s(t,e)}}}createViewScheduler(t){return new vs(t)}createControlScheduler(t){return new ys(t)}},_s=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new e("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},bs=class extends _s{},Cs=class extends _s{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new e("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"));this.executor.isRowReturn=!0,this.executor.init(["context","viewparams","data","env"],(t=>{const{context:e,params:s,data:i}=t;return{context:e,params:s,data:(null==i?void 0:i[0])||{},env:ibiz.env}}))}match(t){return super.match(t)&&t.itemName===this.logic.itemName}execute(t){const s=this.executor.execute(t);if("boolean"==typeof s)return s;throw new e("".concat(this.logic.id,"逻辑返回值不是布尔值"))}},Vs=class extends _s{constructor(){super(...arguments),this.timer=null}start(){this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new e("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Ls=class extends Is{execute(t){return"opendata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):"newdata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t):void 0}async executeOpenDataAppUILogic(t,i){const{context:a,params:n,...r}=i,{data:o}=i;if(!(null==o?void 0:o[0]))throw new e("opendata没有可操作数据!");const c=t.openDataAppView;if(!c)throw new s(t,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new s(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const d=c.navigateContexts||[],h=Object.assign(a,z(d,a,n,o[0]));let u={};const E=c.navigateParams;p(E)&&(u=z(E,n,a,o[0])),await ibiz.commands.execute(bt.TAG,l,h,u,r)}async executeNewDataAppUILogic(t,e){const{context:a,params:n,...r}=e,{data:o}=e,{enableWizardAdd:c,enableBatchAdd:l,batchAddOnly:d,newDataAppView:h}=t;let u;if(c){if(u=await this.getWizardNewViewRef(t,e),!u)return}else{if(l)throw new i(t,"enableBatchAdd暂未支持");if(d)throw new i(t,"batchAddOnly暂未支持");if(u=h,!u||!u.refAppViewId)throw new s(t,"newdata视图逻辑没有配置默认新建数据视图")}let E={},g={};const m=(null==o?void 0:o[0])||{},f=u.navigateContexts;p(f)&&(E=z(f,a,n,m)),E=Object.assign(a,E);const w=u.navigateParams;p(w)&&(g=z(w,n,a,m)),a.srfcopymode&&(m.srfkey=void 0,g=Object.assign(g,m.$origin)),await ibiz.commands.execute(bt.TAG,u.refAppViewId,E,g,r)}async getWizardNewViewRef(t,i){var a;const{wizardAppView:n,newDataAppViews:r}=t,{context:o,params:c,...l}=i;if(!n||!n.refAppViewId)throw new s(t,"缺少默认索引实体选择视图");const d=await ibiz.commands.execute(bt.TAG,n.refAppViewId,o,c,{...l,openMode:"POPUPMODAL"});if(!d.ok)return;const h=null==(a=d.data)?void 0:a[0];if(!h)throw new e("请选中一条数据");const u=h.srfkey,p=null==r?void 0:r.find((t=>t.refMode===u));if(!p)throw new e("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}},Rs=class extends _s{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const s=t.eventNames.split(",");this.listenEventNames=s.map((t=>Pt[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}};var Ms=((t,e,s)=>(s=null!=t?O(S(t)):{},((t,e,s,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let a of x(e))F.call(t,a)||a===s||W(t,a,{get:()=>e[a],enumerable:!(i=N(e,a))||i.enumerable});return t})(!e&&t&&t.__esModule?s:W(s,"default",{value:t,enumerable:!0}),t)))(B(),1),Os=(t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t);const e=Ms.default.dirname(this.url.pathname);this.baseDir=e}dir(t){return Ms.default.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,s)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=s,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,s){this.tag=t,this.repo=e,this.config=s}}),t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Os||{}))),Ws=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ws||{})),Ns=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ns||{})),xs=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 e("错误的调用!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}}),Ss=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new xs(l)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Fs=t("CTXState",class{}),Bs=t("CTX",class{constructor(t){this.parent=t,this.evt=new m,this.controllersMap=new Map,this.state=new Fs}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){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}}),ks=t("ActivityCounter",class extends xs{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())}}),Us=(t("UIActionButtonState",class{constructor(t,e,s){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=s,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await tt(this.uiActionId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:s,actionTarget:i,uiactionMode:a,uiactionTag:n}=t;this.dataAccessAction=e,1===s?this.noPermissionHidden=!1:6===s&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===a&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const s=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 s.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.disabled=!0,this.visible=!this.noPermissionHidden)}}),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((s=>s.update(t,e))))}}),t("QXEventEx",class extends m{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((s=>{s(t,...e)}))}async asyncEmit(t,...e){const s=super.asyncEmit(t,...e),i=this.anyEventFns.map((s=>s(t,...e))),a=Promise.all(i),n=await s,r=await a;return n.concat(...r)}reset(){super.reset(),I(this.anyEventFns)}})),zs=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.evt=new Us}async emit(t,e){await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.evt.on(t,e)}onAll(t){this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset()}});var Gs="__self",js=t("BaseController",class{constructor(t,e,s,i){this.model=t,this.context=e,this.params=s,this.ctx=i,this.state={},this.name="",this.evt=new zs(this.getEventArgs.bind(this)),this.mountCounter=new ks(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Gs),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(Gs)||this.mountCounter.attend(Gs)}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(),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),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)}}),Xs=t("ViewController",class extends js{constructor(t,e,s,i){super(ibiz.util.layoutPanel.fill(t),a.create({},e),s||{},new Bs(i)),this.modal=new Tt({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Ss,this.isCloseView=!1,this._isActive=!0,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._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=at(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e&&this.engines.push(e)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType},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 qt.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{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 ke(t);this.providers[t.name]=e;const s=st(this.model);s&&await Promise.all(s.map((async t=>{const e=await ke(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=it(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),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.context.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){this.context.srfappid=this.model.appId,"ROUTE"===this.modal.mode&&(this.context.srfsessionid=f());const t=this.model.appViewNavContexts;let e={};p(t)&&(e=z(t,this.context,this.params)),Object.assign(this.context,e);const s=this.model.appViewNavParams;let i={};p(s)&&(i=z(s,this.context,this.params)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let s;for(const i of this.engines)if(s=await i.call(t,e),void 0!==s)break;return s}async callUIAction(t,s){const i=this.call(t,s);if(void 0===i)throw new e("没有引擎支持预置界面行为".concat(t));return i}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){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)}))}}),Ks=(t("MobViewController",class extends Xs{}),t("EditorController",class{constructor(t,e){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(){this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t.toLowerCase()]=this.model.editorParams[t]}))}handlePublicParams(t,e,s){const{navigateContexts:i,navigateParams:a}=this.model;let n={};i&&t&&(n=z(i,e,s,t));const r=Object.assign(e.clone(),n);let o={};a&&t&&(o=z(a,e,s,t));return{context:r,params:{...s,...o}}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}})),Hs=(t("CodeListEditorController",class extends Ks{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 s=[];return s=await t.codeList.get(this.model.appCodeListId,e,i),s}throw new s(this.model,"请配置代码表")}}),t("ControlController",class extends js{constructor(t,e,s,i){super(t,e,s,i),this.providers={},this.registerToCtx();const a=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));a&&(this.controlPanel=a)}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await ke(this.controlPanel);this.providers[this.controlPanel.name]=t}(null==(t=this.model.controlLogics)?void 0:t.length)&&(this.scheduler=ibiz.scheduler.createControlScheduler(this.model.controlLogics),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy()}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()}handlerAbilityParams(t){return{context:this.context.clone(),params:{...this.params},data:(null==t?void 0:t.data)||this.getData()||[]}}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)}))}}));t("MDControlController",class extends Hs{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=[]}setSort(t,e){this.state.sortQuery="".concat(t,",").concat(e)}async getFetchParams(t){const{curPage:e,size:s,sortQuery:i,noSort:a}=this.state,n={...this.params};return s&&(n.page=e-1,n.size=s),!a&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){await this.startLoading();try{const e=!0===t.isInitialLoad,s=!0===t.isLoadMore;e?this.state.curPage=1:s&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.params),n=await this.service.fetch(i,a);"number"==typeof n.total&&(this.state.total=n.total),s?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}finally{await this.endLoading()}return this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:s,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new e("未选中数据");if(await ibiz.modal.confirm({title:"数据删除",desc:"确认删除数据?"})){await this.startLoading();try{const t=$(this.model.appDataEntityId);await Promise.allSettled(a.map((async e=>{if(0!==e.srfuf){const a=s.clone();a[t]=e.srfkey,await this.service.remove(a,i)}this.afterRemove(a)}))),ibiz.notification.success({desc:"数据[".concat(a.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),this.refresh()}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));this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){const{selectedData:e}=this.state;d(e,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}))}async onRowClick(t){const{selectedData:e}=this.state,s=e.filter((e=>e.srfkey!==t.srfkey));s.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(s),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){}async exportData(t){}})}}}));
2
2
  //# sourceMappingURL=index.system.min.js.map