@ibiz-template/runtime 0.5.3-beta.1 → 0.5.3-beta.10

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 (188) hide show
  1. package/dist/index.esm.js +1855 -648
  2. package/dist/index.system.min.js +1 -1
  3. package/out/app-hub.d.ts +12 -2
  4. package/out/app-hub.d.ts.map +1 -1
  5. package/out/app-hub.js +22 -2
  6. package/out/application.js +1 -1
  7. package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
  8. package/out/command/app/open-app-view/open-app-view.js +8 -1
  9. package/out/controller/common/editor/editor.controller.d.ts +24 -0
  10. package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
  11. package/out/controller/common/editor/editor.controller.js +50 -0
  12. package/out/controller/common/view/view.controller.d.ts.map +1 -1
  13. package/out/controller/common/view/view.controller.js +3 -2
  14. package/out/controller/constant/control/index.d.ts +1 -0
  15. package/out/controller/constant/control/index.d.ts.map +1 -1
  16. package/out/controller/constant/control/index.js +1 -0
  17. package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.d.ts +5 -0
  18. package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.d.ts.map +1 -0
  19. package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.js +6 -0
  20. package/out/controller/control/chart/chart.controller.js +1 -1
  21. package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
  22. package/out/controller/control/form/form/form.controller.js +4 -1
  23. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
  24. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +4 -0
  25. package/out/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.d.ts +8 -0
  26. package/out/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.d.ts.map +1 -1
  27. package/out/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.js +10 -0
  28. package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.d.ts +8 -0
  29. package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.d.ts.map +1 -1
  30. package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.js +15 -0
  31. package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.d.ts +7 -0
  32. package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.d.ts.map +1 -1
  33. package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.js +10 -0
  34. package/out/controller/control/grid/grid/grid.service.d.ts.map +1 -1
  35. package/out/controller/control/grid/grid/grid.service.js +1 -10
  36. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +7 -0
  37. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
  38. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +11 -2
  39. package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.d.ts +0 -7
  40. package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.d.ts.map +1 -1
  41. package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.js +0 -9
  42. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.d.ts +1 -0
  43. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.d.ts.map +1 -1
  44. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.js +1 -0
  45. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.d.ts +10 -0
  46. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.d.ts.map +1 -1
  47. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.js +12 -0
  48. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts +34 -0
  49. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts.map +1 -1
  50. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.js +68 -0
  51. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.d.ts +205 -0
  52. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.d.ts.map +1 -0
  53. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.js +345 -0
  54. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts +3 -0
  55. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts.map +1 -1
  56. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.js +14 -1
  57. package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts +16 -8
  58. package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts.map +1 -1
  59. package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.js +26 -12
  60. package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts +59 -0
  61. package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts.map +1 -1
  62. package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +238 -1
  63. package/out/de-logic/utils/handle-src-val.d.ts +15 -0
  64. package/out/de-logic/utils/handle-src-val.d.ts.map +1 -1
  65. package/out/de-logic/utils/handle-src-val.js +10 -1
  66. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +4 -3
  67. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  68. package/out/interface/controller/controller/control/i-tree-grid-ex.controller.d.ts +23 -1
  69. package/out/interface/controller/controller/control/i-tree-grid-ex.controller.d.ts.map +1 -1
  70. package/out/interface/controller/event/control/i-tree-grid-ex.event.d.ts +17 -0
  71. package/out/interface/controller/event/control/i-tree-grid-ex.event.d.ts.map +1 -1
  72. package/out/interface/controller/state/control/i-tree-grid-ex.state.d.ts +60 -2
  73. package/out/interface/controller/state/control/i-tree-grid-ex.state.d.ts.map +1 -1
  74. package/out/interface/provider/i-async-action.provider.d.ts +3 -2
  75. package/out/interface/provider/i-async-action.provider.d.ts.map +1 -1
  76. package/out/interface/service/i-transaction/i-transaction.d.ts +83 -0
  77. package/out/interface/service/i-transaction/i-transaction.d.ts.map +1 -0
  78. package/out/interface/service/i-transaction/i-transaction.js +1 -0
  79. package/out/interface/service/index.d.ts +1 -0
  80. package/out/interface/service/index.d.ts.map +1 -1
  81. package/out/interface/service/service/i-app-de.service.d.ts +9 -3
  82. package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
  83. package/out/plugin/index.d.ts +1 -1
  84. package/out/plugin/index.d.ts.map +1 -1
  85. package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts +46 -0
  86. package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts.map +1 -1
  87. package/out/register/helper/app-menu-item-register.d.ts.map +1 -1
  88. package/out/register/helper/app-menu-item-register.js +1 -6
  89. package/out/register/helper/panel-item-register.d.ts.map +1 -1
  90. package/out/register/helper/panel-item-register.js +36 -30
  91. package/out/service/dto/method.dto.d.ts +1 -12
  92. package/out/service/dto/method.dto.d.ts.map +1 -1
  93. package/out/service/dto/method.dto.js +8 -20
  94. package/out/service/mqtt/mqtt.service.js +2 -2
  95. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
  96. package/out/service/service/auth/v7-auth.service.js +2 -0
  97. package/out/service/service/entity/de.service.d.ts +1 -2
  98. package/out/service/service/entity/de.service.d.ts.map +1 -1
  99. package/out/service/service/entity/de.service.js +5 -2
  100. package/out/service/service/entity/method/de-action.d.ts +13 -1
  101. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  102. package/out/service/service/entity/method/de-action.js +167 -59
  103. package/out/service/service/entity/method/fetch.d.ts.map +1 -1
  104. package/out/service/service/entity/method/fetch.js +24 -21
  105. package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
  106. package/out/service/service/entity/method/method-renturn.js +6 -0
  107. package/out/service/utils/de-cache/de-cache.d.ts +11 -1
  108. package/out/service/utils/de-cache/de-cache.d.ts.map +1 -1
  109. package/out/service/utils/de-cache/de-cache.js +122 -18
  110. package/out/service/utils/de-dq-cond/ps-model-cond-engine-base.d.ts.map +1 -1
  111. package/out/service/utils/de-dq-cond/ps-model-cond-engine-base.js +4 -0
  112. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts +1 -1
  113. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
  114. package/out/service/utils/dynamic-code-list/dynamic-code-list.js +25 -26
  115. package/out/service/utils/res-path/res-path.d.ts +2 -2
  116. package/out/service/utils/res-path/res-path.d.ts.map +1 -1
  117. package/out/service/utils/res-path/res-path.js +1 -1
  118. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +6 -0
  119. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  120. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +93 -41
  121. package/out/ui-action/provider/front-ui-action-provider.d.ts +1 -1
  122. package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
  123. package/out/ui-action/provider/front-ui-action-provider.js +5 -1
  124. package/out/ui-logic/ui-logic-node/debug-param-node/debug-param-node.js +1 -1
  125. package/out/ui-logic/ui-logic-node/raw-js-code-node/raw-js-code-node.d.ts.map +1 -1
  126. package/out/ui-logic/ui-logic-node/raw-js-code-node/raw-js-code-node.js +0 -1
  127. package/out/utils/script/script-function.js +1 -1
  128. package/out/utils/ui-domain/transaction.d.ts +66 -0
  129. package/out/utils/ui-domain/transaction.d.ts.map +1 -0
  130. package/out/utils/ui-domain/transaction.js +94 -0
  131. package/out/utils/ui-domain/ui-domain.d.ts +50 -6
  132. package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
  133. package/out/utils/ui-domain/ui-domain.js +68 -9
  134. package/package.json +5 -5
  135. package/src/app-hub.ts +27 -2
  136. package/src/application.ts +1 -1
  137. package/src/command/app/open-app-view/open-app-view.ts +8 -1
  138. package/src/controller/common/editor/editor.controller.ts +54 -0
  139. package/src/controller/common/view/view.controller.ts +3 -2
  140. package/src/controller/constant/control/index.ts +1 -0
  141. package/src/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.ts +5 -0
  142. package/src/controller/control/chart/chart.controller.ts +1 -1
  143. package/src/controller/control/form/form/form.controller.ts +11 -1
  144. package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +4 -0
  145. package/src/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.ts +14 -0
  146. package/src/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.ts +16 -0
  147. package/src/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.ts +9 -1
  148. package/src/controller/control/grid/grid/grid.service.ts +1 -11
  149. package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +12 -2
  150. package/src/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.ts +0 -10
  151. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/index.ts +1 -0
  152. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.ts +22 -0
  153. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.ts +88 -2
  154. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.ts +522 -0
  155. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.ts +18 -1
  156. package/src/controller/control/tree-grid-ex/tree-grid-ex-row.state.ts +43 -12
  157. package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +296 -1
  158. package/src/de-logic/utils/handle-src-val.ts +29 -1
  159. package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +4 -3
  160. package/src/interface/controller/controller/control/i-tree-grid-ex.controller.ts +27 -2
  161. package/src/interface/controller/event/control/i-tree-grid-ex.event.ts +15 -1
  162. package/src/interface/controller/state/control/i-tree-grid-ex.state.ts +64 -2
  163. package/src/interface/provider/i-async-action.provider.ts +3 -2
  164. package/src/interface/service/i-transaction/i-transaction.ts +88 -0
  165. package/src/interface/service/index.ts +4 -0
  166. package/src/interface/service/service/i-app-de.service.ts +10 -3
  167. package/src/plugin/index.ts +4 -1
  168. package/src/plugin/remote-plugin-item/remote-plugin-item.ts +43 -0
  169. package/src/register/helper/app-menu-item-register.ts +1 -5
  170. package/src/register/helper/panel-item-register.ts +43 -37
  171. package/src/service/dto/method.dto.ts +7 -20
  172. package/src/service/mqtt/mqtt.service.ts +2 -2
  173. package/src/service/service/auth/v7-auth.service.ts +2 -0
  174. package/src/service/service/entity/de.service.ts +7 -9
  175. package/src/service/service/entity/method/de-action.ts +186 -64
  176. package/src/service/service/entity/method/fetch.ts +28 -29
  177. package/src/service/service/entity/method/method-renturn.ts +6 -0
  178. package/src/service/utils/de-cache/de-cache.ts +128 -19
  179. package/src/service/utils/de-dq-cond/ps-model-cond-engine-base.ts +4 -0
  180. package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +24 -32
  181. package/src/service/utils/res-path/res-path.ts +2 -2
  182. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +111 -46
  183. package/src/ui-action/provider/front-ui-action-provider.ts +10 -1
  184. package/src/ui-logic/ui-logic-node/debug-param-node/debug-param-node.ts +1 -1
  185. package/src/ui-logic/ui-logic-node/raw-js-code-node/raw-js-code-node.ts +0 -1
  186. package/src/utils/script/script-function.ts +1 -1
  187. package/src/utils/ui-domain/transaction.ts +100 -0
  188. package/src/utils/ui-domain/ui-domain.ts +73 -9
@@ -1 +1 @@
1
- System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var a,i,s,o,n,r,c,l,d,h,p,u,m,g,f,w,E,I,y,v,D,C,A,b,P,T,x,N,S,L,R,O,M,_,V,F,k,W,U,B,z,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,ot,nt,rt,ct,lt,dt,ht,pt,ut,mt,gt,ft,wt,Et;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,o=t.NoticeError,n=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,l=t.IBizContext,d=t.DataTypes,h=t.clone,p=t.CoreConst,u=t.HttpResponse,m=t.updateKeyDefine,g=t.Net,f=t.getToken,w=t.NOOP,E=t.IBizParams,I=t.isElementSame,y=t.findRecursiveChild,v=t.StringUtil,D=t.debounceAndAsyncMerge,C=t.isOverlap,A=t.BitMask,b=t.mergeInLeft,P=t.awaitTimeout,T=t.mergeDefaultInLeft,x=t.plus,N=t.toNumberOrNil},function(t){S=t.isEmpty,L=t.isString,R=t.isArray,O=t.isObject,M=t.isNil,_=t.debounce,V=t.camelCase,F=t.eq,k=t.gt,W=t.gte,U=t.findIndex,B=t.lt,z=t.lte,G=t.upperFirst,j=t.snakeCase,K=t.kebabCase,X=t.isFunction},function(t){H=t.notNilEmpty,Y=t.isNilOrEmpty,q=t.AsyncSeriesHook,Q=t.createUUID,J=t.QXEvent,$=t.isArray,Z=t.getCookie,tt=t.setCookie,et=t.clearCookie,at=t.descSort,it=t.ascSort,st=t.clearAll,ot=t.isNumber},function(t){nt=t.default},function(t){rt=t.isNil,ct=t.mergeRight,lt=t.isEmpty,dt=t.clone,ht=t.equals,pt=t.where,ut=t.mergeLeft,mt=t.isNotNil,gt=t.mergeDeepRight},function(t){ft=t.default},function(t){wt=t.default},function(t){Et=t.default}],execute:function(){t({asyncImportData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(bo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const o=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(n=o.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(n!==i)return;const s=a.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED");var n},calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t;let i;if(e||a){switch(i={display:"flex"},e){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(a){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:ge,calcDynaClass:pe,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:o,colMD:n,colMDOffset:r,colLG:c,colLGOffset:l}=t,d=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:d(a,i),sm:d(s,o),md:d(n,r),lg:d(c,l)}},calcLayoutHeightWidth:he,calcMainStateOPPrivsStrs:me,calcNavParams:re,calcResPath:Si,compare:ke,compareNumber:We,contains:Ue,convertNavData:ie,convertNavDataByArray:oe,convertObjectToNavParams:ae,execDELogic:vs,execDELogicAction:Cs,execDELogicById:Ds,execFieldLogics:bs,execUILogic:Tn,exportData:To,fieldValueToBoolean:Ri,filterFieldLogics:Ee,filterValueRules:ca,findChildFormDetails:be,findDELogic:we,findEditItem:Ae,findFieldById:Ie,findModelChild:ce,formatMultiData:ne,generateEditorRules:Do,generateRules:vo,getAllPanelField:Oe,getAppCounterProvider:Ta,getAppMenuItemProvider:Ei,getAppViewRef:function(t,e){var a,i;let s=t.appViewRefs||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(a=t,ibiz.register.get("".concat(ti,"_").concat(a)));var a;if(e)return e;throw new n("找不异步操作类型".concat(t,"对应的适配器"))},getChildNodeRSs:Ce,getControl:function(t,e){var a,i;let s=t.controls||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.controls));return s.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlPanel:de,getControlProvider:Sa,getControlsByView:Te,getDEMethodProvider:pi,getDERedirectToView:Ve,getDeACMode:async function(t,e,a){var i;const s=await ibiz.hub.getAppDataEntity(e,a);return null==(i=s.appDEACModes)?void 0:i.find((e=>e.id===t))},getDefaultValue:Ao,getEditorProvider:Oa,getEntitySchema:xo,getFormDetailProvider:Va,getGridColumnProvider:Wa,getMatchResPath:Ni,getOriginData:yo,getPFPlugin:function(t,e){const i=ibiz.hub.getApp(e);if(!i)throw new a(i,"未找到应用");const{model:s}=i;if(!s.appPFPluginRefs)throw new a(s,"应用未配置插件");const o=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!o)throw new Error("未找到插件".concat(t));return o},getPanelItemProvider:za,getPlatformProvider:ci,getPlatformType:si,getPortletProvider:Ka,getRootNode:ve,getTreeGridExColumnProvider:gi,getTreeNode:De,getUIActionById:ye,getUIActionItemsByActionLevel:function(t,e){const a=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const i=t;i.actionLevel===e&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),a},getUIActionProvider:qa,getUILogicNodeProvider:Ja,getViewEngines:Ne,getViewLogics:xe,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Za(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Za("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=Za(a));e||(e=Za("DEFAULT"));return e},getWFContext:Qe,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:o}=e,n=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?o:s),c=null==n?void 0:n.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:ma,hasDeCodeName:fe,hasSubRoute:Eo,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(Po);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));return(await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}})).data},install:function(){const{ibiz:t}=window;t.util=new Xr,t.hub=new Gr,t.register=new Lt,t.config=new St,t.auth=new Yi,t.asyncAction=new qi,t.engine=new jr,t.uiDomainManager=new pa,Zs(),_n(),Ls(),Di(),ibiz.scheduler=new ec,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new sc(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new sc(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new sc(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new oc(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new ic(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new rc(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new cc(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new qr(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Qr(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Qr(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new nc(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new lc(t,e))),function(){const t=new ai;ni("Browser",(()=>t))}(),t.platform=ci()},installCommand:Zs,isDataContainer:Se,isFormDataContainer:Pe,isValueChange:Io,matchMainState:ue,openRedirectView:Me,parseUserParams:le,presetAppCounterProvider:Di,presetDEMethodProvider:Ls,presetUIActionProvider:_n,registerAppCounterProvider:ba,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(fi,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ti,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(xa,"_").concat(t),e)},registerDEMethodProvider:di,registerEditorProvider:function(t,e){ibiz.register.register("".concat(La,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Ma,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Fa,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Ua,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ni,registerPortletProvider:function(t,e){ibiz.register.register("".concat(Ga,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(ui,"_").concat(t),e)},registerUIActionProvider:Ha,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(Qa,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat($a,"_").concat(t),e)},strContain:Be,testCond:Fe,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await _e(t,e,a);await ibiz.commands.execute(Qs.TAG,i.viewId,i.context,i.params,i.opts)},verifyDeRules:Ke,verifyFormGroupLogic:He,verifyPanelGroupLogic:Ye});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function It(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var yt={exports:{}};!function(t,e){t.exports=function(t,e,a){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var a;1===e.length&&e[0].length>0&&(e=e[0]),a=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](a)||(a=e[i]);return a};a.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},a.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}}}(yt);var vt=It(yt.exports),Dt={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Dt);var Ct=It(Dt.exports),At={exports:{}};!function(t,e){var a,i;t.exports=(a="month",i="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var o=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):o.bind(this)(t,e)};var n=s.startOf;s.startOf=function(t,e){var s=this.$utils(),o=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return o?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return n.bind(this)(t,e)}})}(At);var bt=It(At.exports),Pt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var o=e.prototype;o.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var o=s(this).startOf(i).add(1,i).date(e),n=s(this).endOf(a);if(o.isBefore(n))return 1}var r=s(this).startOf(i).date(e).startOf(a).subtract(1,"millisecond"),c=this.diff(r,a,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},o.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Pt);var Tt=It(Pt.exports),xt={exports:{}};!function(t,e){var a;t.exports=(a="day",function(t,e,i){var s=function(t){return t.add(4-t.isoWeekday(),a)},o=e.prototype;o.isoWeekYear=function(){return s(this).year()},o.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,o,n,r=s(this),c=(e=this.isoWeekYear(),n=4-(o=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),o.isoWeekday()>4&&(n+=7),o.add(n,a));return r.diff(c,"week")+1},o.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var n=o.startOf;o.startOf=function(t,e){var a=this.$utils(),i=!!a.u(e)||e;return"isoweek"===a.p(t)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(t,e)}})}(xt);var Nt=It(xt.exports),St=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0}}},Lt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Rt=t("DefaultErrorHandler",class{handle(t){return t instanceof a||t instanceof i?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error("没有注册无权限错误处理器"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof o?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof n&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Ot=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error("没有找到能处理该错误的处理器",t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),Mt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};Mt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var _t=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Vt=class extends _t{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const a=t.filter((t=>!!t)).length===t.length;return Mt.handleJudgmentExecute(this,a,e)}},Ft=class extends _t{constructor(t){super(t,"camelCase")}onExecute(t){return t?V(t):""}},kt=class extends _t{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Wt=class extends _t{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ut=class extends _t{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Bt=class extends _t{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return Mt.handleJudgmentExecute(this,i,a)}},zt=class extends _t{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=R(t)?!F(U(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),Mt.handleJudgmentExecute(this,s,i)}},Gt=class extends _t{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},jt=class extends _t{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Kt=class extends _t{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Xt=class extends _t{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=B(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ht=class extends _t{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=z(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Yt=class extends _t{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},qt=class extends _t{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return Mt.handleJudgmentExecute(this,a,e)}},Qt=class extends _t{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const i=t.find((t=>!!t));if(a.fn){const t=(null==(e=a.data)?void 0:e.root)||{};return i?a.fn(t):a.inverse(t)}return i||""}},Jt=class extends _t{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},$t=class extends _t{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},Zt=class extends _t{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},te=class extends _t{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var ee=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var a;return this.hsb=t.default||t,this.p=null,a=this.hsb,new Vt(a),new Ft(a),new kt(a),new Wt(a),new Ut(a),new Bt(a),new Gt(a),new jt(a),new Kt(a),new Xt(a),new Ht(a),new Yt(a),new qt(a),new Qt(a),new Jt(a),new $t(a),new Zt(a),new te(a),new zt(a),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function ae(t){const e=[],a=/^%(.+)%$/;for(const i in t){let s=!0,o=t[i];H(t[i])&&a.test(t[i])&&(s=!1,o=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:o})}return e}function ie(t,...e){if(!t||S(t))return{};return oe(Array.isArray(t)?t:ae(t),...e)}function se(t,e){const a=t.find((t=>!Y(t)&&(t[e]||Object.prototype.hasOwnProperty.call(t,e))));return{find:!!a,value:null==a?void 0:a[e]}}function oe(t,...e){const a=/\$\{[^}]*\}/g,i={};for(const s of t)if(s.rawValue)i[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(a);if(null!==t){let a=s.value;t.forEach((t=>{const{find:i,value:s}=se(e,t.slice(2,-1).toLowerCase());i&&(a=a.replace(t,"".concat(s)))})),i[s.key.toLowerCase()]=a}else{const{find:t,value:a}=se(e,s.value.toLowerCase());t&&(i[s.key.toLowerCase()]=a)}}return i}function ne(t,e){const a={};if(!t)return a;const i=Array.isArray(t)?t:ae(t),s=e[0];return i.forEach((t=>{const{rawValue:i,value:o}=t;!i&&o&&Object.prototype.hasOwnProperty.call(s,o)&&(a[o]=e.map((t=>t[o])).join(";"))})),a}function re(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:o,navParams:n}=t,{context:r,params:c,data:l,derValue:d}=e,h={},p={},u=d||l.srfkey;u&&(a&&(h[a]=u),i&&(p[i]=u),s&&(p["n_".concat(s.toLowerCase(),"_eq")]=u));const m=ie(o,l,c,r),g=ie(n,l,c,r);return Object.assign(h,m),Object.assign(p,g),{resultContext:h,resultParams:p}}function ce(t,e){if(t&&e){const a=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(a)return a}return null}function le(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const o=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:o});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:o});break;default:Object.assign(i,{key:o})}}}return{navigateContexts:e,navigateParams:a,other:i}}function de(t){let e;if(t.controlRenders){const a=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==a?void 0:a.layoutPanel}return e}function he(t){const{width:e,height:a,widthMode:i,heightMode:s}=t,o={width:"",height:""};return"FULL"===i?o.width="100%":e&&e>0&&(o.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?o.height="100%":a&&a>0&&(o.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),o}function pe(t,e){const a=[],i=je.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return L(i)?a.push(i):R(i)?a.push(...i):O(i)&&Object.keys(i).forEach((t=>{i[t]&&a.push(t)})),a}function ue(t,e){const{mainStateAppDEFieldIds:a,demainStates:i}=t;if(a&&i){const t=[];return a.forEach((a=>{t.push(e[a])})),i.find((e=>{const{stateValue:a,state2Value:i,state3Value:s}=e;let o=!0;const n=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(n[e])){o=!1;break}return o}))}}function me(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,o=(null==i?void 0:i.map((t=>t.name)))||[];let n=[];if(s)n=o;else{n=[...a.deopprivs,...e.deopprivs].filter((t=>!o.includes(t.name))).map((t=>t.name))}return n}function ge(t){return t.split(".").pop()}function fe(t,e){const a=ge(e);return H(t[a])}function we(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function Ee(t,e){var a,i;const s=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>s.includes(t.id))))||[]}function Ie(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function ye(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function ve(t){return t.detreeNodes.find((t=>t.rootNode))}function De(t,e){return t.detreeNodes.find((t=>t.id===e))}function Ce(t,e){const a=e.parentId||ve(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(i=t.searchMode,s=e.hasQuery,3===i||(s?1===i:2===i));var i,s}))}function Ae(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function be(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Pe(t){return"MDCTRL"===t.detailType}function Te(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function xe(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Ne(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn("未支持的引擎分类:".concat(t.engineType)),!1)))}function Se(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Le=["panelItems","panelTabPages","rootPanelItems"];function Re(t){let e=[];for(const a of Le)if(t[a]){e=t[a];break}const a=[];return e.length&&(a.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Se(t)||a.push(...Re(t))}))),a}function Oe(t){return Re(t)}async function Me(t,e,a={},i={}){return async function(t,e,a={},i={}){let s;try{s=await Ve(t,e,a,i)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const a=window.open(t,"_blank");a&&(a.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Qs.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,a,i)}async function _e(t,e,a={}){const i=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(i+1,e.length)),o=nt.parse(s,{delimiter:";"}),r=o.srfdename||"";if(!r)throw new n("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new n("未找到指定实体的codeName: ".concat(r));o[c.toLowerCase()]=o[r.toLowerCase()];const l="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),d=await ibiz.hub.getAppView(l);if(delete o.srfdename,"undo"!==o.srfwf){const t=o.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));o.wf=e,o.wfVersion=a}return o.srfprocessinstanceid&&(t.srfprocessinstanceid=o.srfprocessinstanceid,delete o.srfprocessinstanceid),{context:t,params:o,opts:a,viewId:d.id}}async function Ve(t,e,i={},s={}){var o;const r=ie(t.appViewNavContexts||[],i,e);e=Object.assign(e.clone(),r);const c=ie(t.appViewNavParams||[],i,e);Object.assign(i,c);const l=t.appDataEntityId,d=ge(l);let h=(null==(o=s.data)?void 0:o[0])||{};e[d]=h[d]||e[d]||i[d];const p=t.getDataAppDEActionId,u=ibiz.hub.getApp(t.appId),m=await u.deService.getService(e,l);ibiz.loading.showRedirect();try{const t=await m.exec(p||"get",e,i);if(t.ok){h=t.data;let a=h.linkurl;if(a){if(e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://"))return{type:"url",url:a};if(a.startsWith("appredirectview?")){return{type:"view",...await _e(e,a,s)}}throw new n("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(l,t.appId),f=await async function(t,e,a,i){let s="";const o=e.typeAppDEFieldId;if(o){const{codeName:a}=Ie(t,o),s=i[a.toLowerCase()];if(H(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(o,"]值为空"),i)}const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(H(r))return H(a.wf)?"".concat(n,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(n,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=Ie(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(Y(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Ie(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=H(c)?"".concat(n,":").concat(c.toString().toUpperCase()):"".concat(n);return s}(g,t,i,h);let w="";if(!f.startsWith("view://")){const o=f.split(":"),n=2===o.length?f:o.slice(0,2).join(":"),r="".concat(g.name.toUpperCase(),":").concat(f),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const l=c.find((t=>{const e=t.name||t.id;return e===r||e===f||e===n}));if(l){if(w=l.refAppViewId,w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(l,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(f,"]或[").concat(r,"]或工作流[").concat(n,"]对应视图"))}{const t=new URL(f);t.searchParams.size>0&&t.searchParams.forEach(((t,e)=>{i[e]=t}));const e=t.pathname.replace("//","").split("/"),[a,s]=e;w=s||a}if(w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(t,"标识[".concat(f,"]未匹配到实际引用视图"))}function Fe(t,e,a){if(Object.is(e,"IN"))return Ue(t,a);if(Object.is(e,"NOTIN"))return!Ue(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return ke(t,a)<0;case"LTANDEQ":return ke(t,a)<=0;case"GT":return ke(t,a)>0;case"GTANDEQ":return ke(t,a)>=0;case"ISNULL":return Y(t);case"ISNOTNULL":return H(t);case"TESTNULL":return rt(t);case"IN":return Ue(t,a);case"NOTIN":return!Ue(t,a);case"LIKE":return Be(t,a);case"LEFTLIKE":return Be(t,a,"start");case"RIGHTLIKE":return Be(t,a,"end");default:throw new n("值操作:".concat(e,",暂未支持"))}}function ke(t,e){const a=Number(t),i=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(i))return We(a,i);const s=new Date(t).getTime(),o=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(o))return We(s,o);throw new n("".concat(t," 和 ").concat(e," 无法比较大小"))}function We(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Ue(t,e){if(!e||"string"!=typeof e)throw new n("范围比较的条件值不存或者不是字符串");if(t){return e.split(",").includes("".concat(t))}return!1}function Be(t,e,a){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),o=i.indexOf(s);switch(a){case"start":return 0===o;case"end":return o+s.length===i.length;default:return-1!==o}}var ze={singleRowReturn:!1,isAsync:!0},Ge=t("ScriptFunction",class{constructor(t,e,a=ze){this.argKeys=[],this.options=a;const i=this.formatCode(e,a);this.calcArgKeys(t,a);const s=new Function(...this.argKeys,i);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw console.log("报错脚本",i),t}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?ct(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),i.push(a[t])})),i}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),je=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Ge(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function Ke(t,e,a){const i={isPast:!0,infoMessage:a.ruleInfo};if(function(t){return"GROUP"===t.condType}(a)){const s=a.conds;s&&s.length>0&&(i.isPast=function(t,e,a="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===a;for(let i=0,o=t.length;i<o;i++){const o=e(t[i],i);if("AND"===a){if(!o){s=!1;break}}else if("OR"===a&&o){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:o}=Ke(t,e,a);return i.infoMessage=o,s}),a.condOp,!!a.notMode),!i.isPast&&("AND"===a.condOp&&a.notMode||"OR"===a.condOp&&!a.notMode)&&(i.infoMessage=a.ruleInfo))}else{t=(null==a?void 0:a.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(a))i.isPast=!function(t,e,a,i,s,o,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=o[a=a?a.toLowerCase():""]?o[a]:a}(rt(i)||lt(i))&&(i="内容必须符合值规则");const c=Fe(t,e,a);if(!c&&r)throw new n(i);return!c}(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(a))i.isPast=!function(t,e,a,i,s,o,r){Y(o)&&(o="值必须符合值范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!0}if(Xe(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(a){if(c<e){if(r)throw new n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!=i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"REGEX"===t.condType}(a))i.isPast=!Xe(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(a))i.isPast=!function(t,e,a,i,s,o,r){Y(o)&&(o="内容长度必须符合范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!==i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(a)&&(null==a?void 0:a.sysValueRule)){const{ruleType:s,regExCode:o,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Xe(e[t],o,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:o}=function(t,e,a,i,s){Y(i)&&(i="值必须符合脚本规则");const o=e;let r="",c=!0;const l=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=je.execScriptFn({value:t,data:o},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),l(t)}if(i="",!c&&s)throw new n(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=o||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=a.notMode?!i.isPast:i.isPast}return i}function Xe(t,e,a,i){Y(a)&&(a="值必须符合正则规则");if(Y(t)){if(i)throw new n("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new n(a);return!0}return a="",!1}function He(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.defdlogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!He(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>He(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Fe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}function Ye(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.panelItemLogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!Ye(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>Ye(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Fe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}var qe=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=dt(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:i,mainMenuAlign:s}=t;let o="";i?o="BLANK_MODE":s&&(o=s.toUpperCase());let n="";return n=""!==o?"".concat(e,"_").concat(a,"_").concat(o):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(n)&&(n+="_NO_NAV"),n}});function Qe(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Je=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))(Je||{})),$e=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))($e||{})),Ze=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Ze||{})),ta=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(ta||{})),ea=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(ea||{})),aa=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(aa||{})),ia=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(ia||{})),sa=t("StudioViewEvents",class{});sa.onViewMounted="onMounted",sa.onViewDestroyed="onDestroyed";var oa=t("StudioPanelEvents",class{});oa.onClick="onClick",oa.onChange="onChange",oa.onEnter="onEnter",oa.onLeave="onLeave";var na=t("StudioControlEvents",class{});na.onBeforeLoad="onBeforeLoad",na.onLoadSuccess="onLoadSuccess",na.onLoadError="onLoadError",na.onBeforeLoadDraft="onBeforeLoadDraft",na.onLoadDraftSuccess="onLoadDraftSuccess",na.onLoadDraftError="onLoadDraftError",na.onBeforeSave="onBeforeSave",na.onSaveSuccess="onSaveSuccess",na.onSaveError="onSaveError",na.onBeforeRemove="onBeforeRemove",na.onRemoveSuccess="onRemoveSuccess",na.onRemoveError="onRemoveError",na.CLICK="onClick";var ra=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new q,beforeDismiss:new q},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ca(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var la=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),da=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=dt(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let a=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];a+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}a+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=a,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),ha=t("UIDomain",class{constructor(t){this.rsMap=new Map,this.id=t||Q()}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),pa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ha(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error("无效的界面域标识[".concat(t,"]"))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),ua=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}});async function ma(t,e=!0){const a=await Promise.allSettled(t),i=[],s=[];if(a.forEach((t=>{"fulfilled"===t.status?i.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return i}var ga=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){let i=-1;if(e==a?i=0:e>a&&(i=1),"EQ"===t||"ABSEQ"===t)return 0===i;if("GT"===t)return i>0;if("GTANDEQ"===t)return i>=0;if("LT"===t)return i<0;if("LTANDEQ"===t)return i<=0;if("NOTEQ"===t)return 0!==i}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},fa=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},wa=class extends fa{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let o=0;o<e;o++)if(a){const e=t[o];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[o];this.setParam(e),i=!1,s=!0}else if(s){const e=t[o];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},Ea=class t extends fa{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,o=!1;for(let r=0;r<a;r++){if(i&&s){if("!"===e[r]){this.setNotMode(!0),i=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,i=!1,o=!0}else if(o){const a=e[r];if(!(a instanceof Array))throw new n("值必须为数组");a.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new wa;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Ia=class extends Ea{},ya=class extends wa{},va=class t extends ga{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof Ea){const t=e.getChildPSModelCondBases();if(null==t||lt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let o=s;for(let e=0;e<t.length;e++){const n=t[e];if(this.testCond(n,a,i)){if(!s){o=!0;break}}else if(s){o=!1;break}}return e.isNotMode()?!o:o}if(e instanceof wa){lt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let o=null;const n=e.getValueType(),r=e.getValue();return null==n||lt(n)?o=e.getValue():(lt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===n?o=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===n&&(o=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,o)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new ya}createPSModelGroupCond(){return new Ia}};va.PARAMTYPE_DATACONTEXT="DATACONTEXT",va.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Da=t("PSDEDQCondEngine",va);async function Ca(t,e){var a;const i=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(i)return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode);ibiz.log.error("未匹配到插件[".concat(t,"]模型"))}var Aa=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function ba(t,e){ibiz.register.register("".concat(Aa,"_").concat(t),e)}function Pa(t){return ibiz.register.get("".concat(Aa,"_").concat(t))}async function Ta(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Pa(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Pa(a),e)return e;throw new n("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Pa(i),e)return e;throw new n("找不系统计数器类型".concat(i,"对应的适配器"))}var xa=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Na(t){return ibiz.register.get("".concat(xa,"_").concat(t))}async function Sa(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=Na(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Na("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=Na(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var La=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Ra(t){return ibiz.register.get("".concat(La,"_").concat(t))}async function Oa(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:o,appId:n}=t;if(o){const t=await Ca(o,n);if(t&&(e=Ra(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Ra("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let o="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(o+="_".concat(i)),e=Ra(o),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=Ra(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var Ma=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function _a(t){return ibiz.register.get("".concat(Ma,"_").concat(t))}async function Va(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=_a(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=_a(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var Fa=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function ka(t){return ibiz.register.get("".concat(Fa,"_").concat(t))}async function Wa(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(e=ka(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const n=i?"".concat(a,"_EDIT"):a;if(e=ka(n),e)return e;ibiz.log.error("找不到表格列类型".concat(n,"对应的适配器"))}var Ua=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Ba(t){return ibiz.register.get("".concat(Ua,"_").concat(t.toUpperCase()))}async function za(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Ca(s,o);if(t&&(a=Ba(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=Ba(i),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器,注册key为").concat(i))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT",s="RAWITEM_".concat(i);if(a=Ba(s),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器,注册key为").concat(s))}if("FIELD"===i){const{editor:e}=t;if(e&&e.predefinedType){if(a=Ba("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}if(a=Ba(i),a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var Ga=t("PORTLET_PROVIDER_PREFIX","PORTLET");function ja(t){return ibiz.register.get("".concat(Ga,"_").concat(t))}async function Ka(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=ja(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=ja(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var Xa=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Ha(t,e){ibiz.register.register("".concat(Xa,"_").concat(t),e)}function Ya(t){return ibiz.register.get("".concat(Xa,"_").concat(t))}async function qa(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:o}=t;if(i){const t=await Ca(i,s);if(t&&(e=Ya(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=Ya("".concat(a,"_").concat(o)),e)return e;if(e=Ya(a),e)return e;throw new n("找不界面行为模式".concat(a,"对应的适配器"))}var Qa=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function Ja(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Ca(a,i);if(s){if(e=ibiz.register.get("".concat(Qa,"_").concat(s)),e)return e;throw new n("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var $a=t("VIEW_PROVIDER_PREFIX","VIEW");function Za(t){return ibiz.register.get("".concat($a,"_").concat(t))}var ti=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var ei=t("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new n("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new n("文件流数据不存在")}}),ai=t("BrowserPlatformProvider",class extends ei{});var ii=window.navigator.userAgent.toLowerCase();function si(){return/Android|Adr/i.test(ii)?"Android":/iPhone|iPod|iPad/i.test(ii)?"IOS":/MicroMessenger/i.test(ii)?"WeChat":/DingTalk/i.test(ii)?"DingTalk":/miniProgram/i.test(ii)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var oi=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ni(t,e){ibiz.register.register("".concat(oi,"_").concat(t),e)}function ri(t){return ibiz.register.get("".concat(oi,"_").concat(t))}function ci(){const t=ri(si());return t||ri("Browser")}var li=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function di(t,e){ibiz.register.register("".concat(li,"_").concat(t),e)}function hi(t){return ibiz.register.get("".concat(li,"_").concat(t))}async function pi(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Ca(i,s);if(t&&(e=hi(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=hi(a),e)return e;throw new n("找不实体行为方法类型为".concat(a,"的适配器"))}var ui=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function mi(t){return ibiz.register.get("".concat(ui,"_").concat(t))}async function gi(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Ca(s,i);if(t&&(e=mi(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=mi(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var fi=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function wi(t){return ibiz.register.get("".concat(fi,"_").concat(t))}async function Ei(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Ca(a,i);if(t&&(e=wi(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}if(e=wi(s),e)return e;ibiz.log.error("找不到应用菜单项类型".concat(s,"对应的适配器"))}var Ii=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=l.create(),this.params={},this.evt=new J,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=dt(t)),e&&(this.params=dt(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new n("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&H(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),yi=t("AppDECounter",class extends Ii{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new a(this.model,"未找到获取计数器行为!");this.action=i,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),vi=t("AppDECounterProvider",class{createCounter(t){return new yi(t)}});function Di(){ba("DEDR",(()=>new vi))}var Ci=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Da;return 1===e.length?a.parse(this.calcCond(e)[0]):e.length>1&&a.parse(["AND",this.calcCond(e)][0]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);a.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.condOp),a.push(e.fieldName),e.condValue?e.vartypeId?a.push({type:e.vartypeId,value:e.condValue}):a.push(e.condValue):a.push("")}}e.push(a)})),e}});Ci.map=new WeakMap;var Ai=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(t))throw new i(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:i,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:o,iconPathAppDEFieldId:n,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:l}=this.codeList,d=a?t[a]:t.srfkey;if(e.id=d,e.value=d,e.text=i?t[i]:t.srfmajortext,(s||o||n||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),o&&(e.sysImage.cssClassX=t[o]),n&&(e.sysImage.imagePath=t[n]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Ri(t[c])),l&&t[l])try{e.data=je.execSingleLine(t[l])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:o,minorSortAppDEFieldId:n,minorSortDir:r,pvalueAppDEFieldId:c,customCond:l}=this.codeList,d={...e};if(n&&r&&Object.assign(d,{sort:"".concat(n.toLowerCase(),",").concat(r.toLowerCase())}),l){const e=ie(je.execSingleLine(l),d,t);Object.assign(d,e)}if(d.size||(d.size=1e4),this.isPredefined){const t=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),d);return Object.freeze(t.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!o)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,o,t,void 0,d);let p=[];return h.data.length&&h.data.forEach((t=>{if(c){const t=this.prepareTreeData(h.data);t&&(p=t)}else p.push(this.convertData(t))})),Object.freeze(p)}prepareTreeData(t,e){const{pvalueAppDEFieldId:a}=this.codeList;let i=[];if(i=t.filter((t=>e?t[a]===e:!t[a])),0!==i.length)return i.map((e=>{const a=this.convertData(e);return a.children=this.prepareTreeData(t,a.value),a}))}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const i=this.load(t,e),{cacheTimeout:s}=this.codeList,o=-1===s||rt(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,n={expirationTime:(new Date).getTime()+o,promise:i};this.cache.set(a,n);const r=await i;return n.items=r,delete n.promise,r}});function bi(t,e){if(null!=e){const{srfkey:t}=e;if(!rt(t)&&!lt(t))return!0}throw new n("执行「".concat(t,"」不存在「srfkey」无法处理"))}function Pi(t,e){const{srfsessionid:a}=e;if(!rt(a)&&!lt(a))return!0;throw new n("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var Ti=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const a=this.cacheMap.get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,dt(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new n("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{return Pi("add",t),(rt(e.srfkey)||lt(e.srfkey))&&(e.srfkey=Q()),e.srftempdate=(new Date).getTime(),this.cacheMap.set(e.srfkey,dt(e)),ibiz.log.warn("add",e.srfkey,e),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Pi("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),dt(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new n("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Pi("update",t),bi("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i)return i.assign(e),this.cacheMap.set(a,i),ibiz.log.warn("update",a,e),dt(i);throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Pi("delete",t);const a=e;if(this.cacheMap.has(a)){const t=this.cacheMap.get(a);return t.srftempdate=(new Date).getTime(),this.cacheMap.delete(a),ibiz.log.warn("delete",a),t}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Pi("add",t);for(let t=0;t<e.length;t++){const a=e[t];(rt(a.srfkey)||lt(a.srfkey))&&(a.srfkey=Q()),a.srftempdate=(new Date).getTime();const i=dt(a);this.cacheMap.set(a.srfkey,i),e[t]=i,ibiz.log.warn("add",a.srfkey,a)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Pi("update",t);for(let t=0;t<e.length;t++){const a=e[t];bi("update",a),a.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a.srfkey);if(!i)throw new Error("数据[".concat(a.srfdename,"-").concat(a.srfmajortext,"(").concat(a.srfkey,")]不存在,无法更新!"));i.assign(a),this.cacheMap.set(a.srfkey,i),ibiz.log.warn("update",a.srfkey,a),e[t]=dt(i)}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Pi("delete",t)}catch(t){return ibiz.log.error(t),e}const a=[];for(let t=0;t<e.length;t++){const i=e[t];this.cacheMap.has(i)||a.push(i)}if(a.length>0)throw new Error("未找到以下数据「".concat(a.join("、"),"」,无法删除!"));for(let t=0;t<e.length;t++){const a=e[t];this.cacheMap.delete(a),ibiz.log.warn("delete",a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ht(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];e[a]=ht(i)}return pt(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>ce(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>rt(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}}),xi=/\$\{(.*?)\}/g;function Ni(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(xi);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,i)=>i===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function Si(t,e){const a=Ni(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((i,s)=>{e=s===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return a.path}return""}var Li=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(rt(e.page)||lt(e.page)||(this.page=e.page),rt(e.size)||lt(e.size)||(this.size=e.size),rt(e.query)||lt(e.query)||(this.query=e.query),!rt(e.sort)&&!lt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Ri(t){return[1,"1",!0,"true"].includes(t)}var Oi=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let i=[];return(null==a?void 0:a.length)&&(i=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var a;let i=t.text;t.textLanguageRes&&(i=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const o={text:i,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?je.execSingleLine(t.data):void 0,sysImage:t.sysImage};return(null==(a=t.codeItems)?void 0:a.length)&&(o.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(o)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new Ai(t),this.cache.set(s,i),await i.init()),i.get(e,a)}async get(t,e,a){const i=this.allCodeLists.get(t);if(!i)throw new n("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),Mi=t("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),_i=t("CounterService",class{static async getCounter(t,e,a){const i=t.id;if(this.counterMap.has(i)){const t=this.counterMap.get(i);if(!1===t.isDestroyed)return t;this.counterMap.delete(i)}const s=(await Ta(t)).createCounter(t);return await s.init(e,a),this.counterMap.set(i,s),s}static async getCounterByRef(t,e,i){const{appCounter:s}=t;if(!s)throw new a(t,"未配置应用计数器!");return this.getCounter(s,e,i)}});_i.counterMap=new Map;var Vi=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},i={}){switch(t){case"wfstart":return this.wfStart(e,a,i);case"wfsubmit":return this.wfSubmit(e,a,i);case"reassign":return this.wfReassign(e,a,i);case"addstepbefore":return this.wfAddStepBefore(e,a,i);case"addstepafter":return this.wfAddStepAfter(e,a,i);case"sendback":return this.wfSendBack(e,a,i);case"sendcopy":return this.wfSendCopy(e,a,i);default:throw new n("「".concat(t,"」未实现"))}}}),Fi=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Si(a,this.model),o="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(o,{method:"post",data:i,responseType:"blob"})}},ki=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(ki||{})),Wi=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:dt(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=ce(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const s=ce(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:rt(this.srfkey)?Q():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:a}=this,i={};Object.keys(e).forEach((t=>{i[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();i[s]={enumerable:!0,set(i){e[s]=a(i,t.stdDataType)},get:()=>e[s]},e[s]=a(e[s],t.stdDataType)})),Object.defineProperties(this,i)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return a=e instanceof t?e._data:e,Object.keys(a).forEach((t=>{void 0===a[t]&&delete a[t]})),Object.assign(this._data,a),this}convertVal(t,e){if(null==t)return t;if(rt(e))return t;if(d.isNumber(e)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),Ui=t("MethodDto",class{constructor(t,e,a,i,s){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.inSelfLoop=s,this.dtoMap=new Map,this.isCalcRs=!1,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,a)=>{e[a+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((a=>{const i=parseInt(a,10);e[i-1]=t[i]})),e}async get(t,e,s=!1){const o={},n=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],l=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[l]&&(o[l]=0===e[l].length?null:this.convertArrayToListMap(e[l]));else{if(void 0!==e[l]&&!1===s)break;if(!c.refAppDataEntityId)break;const i=n.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),d=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=i.find((t=>t.majorAppDataEntityId===this.entity.id));let p;if(h&&h.nestedAppDEDataSetId){const a=dt(t);a[this.entity.codeName.toLowerCase()]=e.srfkey;const i={};h.parentAppDEFieldId&&(i[h.parentAppDEFieldId]=e.srfkey),p=await d.exec(h.nestedAppDEDataSetId,a,i)}else{if(r.entity.id===this.entity.id)throw new a(c,"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!");p=await d.exec("FetchDefault",t)}if(p.ok){const e=p.data,a=[];for(let i=0;i<e.length;i++)a.push(await r.get(t,e[i],!0));o[l]=a}}break;default:throw new i(c,"未支持的应用实体方法输入属性类型: ".concat(c.type))}}return{...e,...o}}async sets(t,e){return this.isLocalMode&&!this.inSelfLoop&&this.service.local.clear(),await this.calcRs(t),Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const i=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[i])e[i]=this.convertListMapToArray(e[i]);else{if(!a.refAppDataEntityId)return;const s=await this.getFieldDto(t,a),o=e[i];if(o){const i=e[this.entity.keyAppDEFieldId];a.refPickupAppDEFieldId&&o.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await s.sets(t,o)}else await s.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[t];const i=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,i),i})))}async calcRs(t,e=0){if(this.isCalcRs||e>10)return;this.isCalcRs=!0,e+=1;const a=ibiz.uiDomainManager.get(t.srfsessionid),i=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<i.length;s++){const o=i[s];if(!o.refAppDataEntityId)continue;if(0===a.getDERConfig(o.refAppDataEntityId).length){const i=await this.getFieldDto(t,o);i.entity.minorAppDERSs&&a.setDERConfig(o.refAppDataEntityId,i.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await i.calcRs(t,e)}}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=ce(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=this.entity.codeName===a.codeName,o=await this.app.deService.getService(t,a.id);o.isLocalMode=!0;const n=o.createMethodDto(i,{isLocalMode:!0,inSelfLoop:s});return this.dtoMap.set(e.codeName,n),n}}),Bi=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ti(e),this.configCache=new Mi(e.appId,"PSAppDataEntity",e.codeName),this.wf=new Vi(e),this.file=new Fi(e)}async getMethod(t,e=!1){const a=e?"ac-".concat(t):t;if(this.methodMap.has(a))return this.methodMap.get(a);const s=ce(this.model.appDEMethods,t),o=await pi(s);if(!o)throw new i(s,"未支持的服务方法类型: ".concat(s.methodType));const n=o.create(this,this.model,s,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(a,n),n}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new n("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new n("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),o=this.calcSsePath(e);return new Promise(((e,n)=>{s.net.sse("/".concat(o),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),onmessage:e=>{if(e.data){const a=JSON.parse(e.data);t(a)}},onclose:()=>{e()},onerror:t=>{n(t)}})}))}aiChatHistory(t,e={},a={}){const i=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return i.net.post(s,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],i="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return Si(t,this.model)+i}newEntity(t){return t instanceof Wi?t.clone():new Wi(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new Ui(this,this.model,null==e?void 0:e.isLocalMode,t,null==e?void 0:e.inSelfLoop)}}),zi=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],Gi=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:rt(this.srfkey)?Q():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a){const i=!a||a.isOriginField;zi.includes(t)||(i||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=dt(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),ji=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,i){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,i)}handleResponse(t){return h(t)}toUIData(t){return new Gi(t,this.dataUIMap)}}),Ki=t("MDControlService",class extends ji{async fetch(t,e={}){var a;const i=(null==(a=this.model.fetchControlAction)?void 0:a.appDEMethodId)||"fetchdefault";let s=await this.exec(i,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var a;const i=(null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;const i=(null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;const i=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var a;const i=(null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,a={}){throw new n("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&($(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),Xi=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const s=ue(i,e);if(s){ibiz.log.debug("匹配主状态",s);const e=me(s,i);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),Hi=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new n("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new Xi(e),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),Yi=t("V7AuthService",class{get isAnonymous(){return"1"===Z(p.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error("未找到匿名登录配置用户名或密码"),!1;const a=await this.login(t,e);if(a){tt(p.IS_ANONYMOUS,"1",0,!0);const t=Z(p.TOKEN),e=Z(p.TOKEN_EXPIRES),a=Z(p.TOKEN_REMEMBER);tt(p.TOKEN,t,0,!0),tt(p.TOKEN_EXPIRES,e,0,!0),tt(p.TOKEN_REMEMBER,a,0,!0)}return a}async login(t,e,a){try{const i=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:s}=i;if(s&&s.token){a&&tt(p.TOKEN_REMEMBER,"1",7,!0),tt(p.TOKEN,s.token,a?7:0,!0);const t=(new Date).getTime()+1e3*(s.expirein||7199);tt(p.TOKEN_EXPIRES,"".concat(t),a?7:0,!0),et(p.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),et(p.TOKEN),et(p.TOKEN_EXPIRES),et(p.TOKEN_REMEMBER),et(p.IS_ANONYMOUS),!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=Z(p.TOKEN),e=Z(p.TOKEN_EXPIRES),a=Z(p.TOKEN_REMEMBER);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=await ibiz.net.get("/uaa/refreshtoken2");if(t.ok){tt(p.TOKEN,t.data.token,a?7:0,!0);const e=(new Date).getTime()+1e3*(t.data.expirein||7199);tt(p.TOKEN_EXPIRES,"".concat(e),a?7:0,!0)}this.extendLogin()}),t)}}getAuthInfo(){const t=Z(p.TOKEN),e=!!Z(p.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}}),qi=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return rt(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),Qi=t("MethodInput",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodInput;if(s){const a=ce(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),Ji=t("MethodReturn",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodReturn;if(s){const a=ce(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){return(await this.dto.sets(t,[e]))[0]}return Y(e)&&(e={}),new Wi(this.entity,e)}}),$i=t("Method",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i,this.app=ibiz.hub.getApp(e.appId),this.input=new Qi(t,e,a),this.result=new Ji(t,e,a)}async request(t,e,i,s){const{actionType:o,requestMethod:n}=this.method;if("REMOTE"===o){const e=this.method.codeName.toLowerCase();let o=null;switch(n){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,n?"未支持的请求方式: ".concat(n):"未配置请求方式")}return o}throw new a(this.method,"未支持的行为类型[".concat(o,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Si(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),Zi=class{constructor(t,e,a,i){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:R(a)?a:[a],params:i}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},ts=class{},es=class extends ts{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const o=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return Fe(o[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Fe(o[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o[this.dstField],this.op,this.value)}}},as=class t extends ts{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new es(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},is=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new as(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},ss=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new is(t)))}},os=class extends ss{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},ns=class extends ss{async exec(t){}},rs=class extends ss{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function cs(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM";let r,c=s;switch(n){case"SRCDLPARAM":r=t.params[a],t.isEntityParam(a)&&(c=null==c?void 0:c.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);case"WEBCONTEXT":case"VIEWPARAM":r=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":r=t.parameters.context;break;case"ENVPARAM":r=dt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}if(r&&c)try{r=Array.isArray(r)?r[Number(c)]:je.execScriptFn({srcValue:r},"srcValue.".concat(c),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(c,"报错,源参数:"),r),t}return r}var ls=class extends ss{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,i=cs(e,t);e.params[a]=dt(i)}bindParam(t,e){const a=cs(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:i}=t;let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const o=cs(e,t);s?e.params[i][s]=o:e.params[i]=o}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:i,srcIndex:s,srcSize:o}=t,n=cs(e,t),r=i||0,c=s||0,l=o||n.length;e.params[a].splice(r,0,...n.slice(c,l))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},ds=class extends ss{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,o=t.params[i],n=ibiz.hub.getApp(t.context.srfappid),r=await n.deService.exec(a,e,t.context,o);r.ok&&(t.params[s]=r.data)}},hs=class extends ss{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=cs(t,this.model);t.params[e]=s}},ps=class extends ss{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},us=class extends ss{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},ms=class extends ss{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=cs(t,this.model);t.params[e]=dt(s)}},gs=class extends ss{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},fs=class extends ss{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=cs(t,this.model),c=s||0,l=o||0,d=n||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},ws=class extends ss{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},Es=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=dt(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=dt(t.data||{});else{if(a.envParam)throw new i(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new i(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new i(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new i(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new i(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new i(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new i(a,"未支持的逻辑参数类型: 操作会话变量")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},Is=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new a(t,"脚本代码模式没有配置脚本代码");this.scriptFn=je.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new ns(t);break;case"END":a=new rs(t);break;case"DEACTION":a=new os(t);break;case"PREPAREPARAM":a=new ls(t);break;case"DEDATASET":a=new ds(t);break;case"THROWEXCEPTION":a=new ws(t);break;case"BINDPARAM":a=new hs(t);break;case"RESETPARAM":a=new ps(t);break;case"COPYPARAM":a=new ms(t);break;case"RENEWPARAM":a=new us(t);break;case"APPENDPARAM":a=new fs(t);break;case"SORTPARAM":a=new gs(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new Es(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,i){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:i});const s=new Zi(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:o}=this.model;if(!o||!this.nodes.has(o))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(o);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},ys=new Map;async function vs(t,e,a={},i={}){ys.has(t)||ys.set(t,new Is(t));return ys.get(t).exec(e,a,i)}async function Ds(t,e,a,i,s){const o=await async function(t,e,a){return we(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!o)throw new n("".concat(e,"找不到实体逻辑").concat(t));return vs(o,a,i,s)}async function Cs(t,e,a,i){const o=dt(e),n=a?dt(a):a,r=i?dt(i):i;try{const e=await vs(t,o,n,r);return new u(e)}catch(t){if(t instanceof s)return new u(t,500);throw t}}async function As(t,e,a,i,s){const o=Ee(t,e);if(o.length){(await Promise.all(o.map((t=>vs(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function bs(t,e,a,i,s={}){if(i){if(!R(i))return As(t,e,a,i,s);await Promise.all(i.map((i=>As(t,e,a,i,s))))}}var Ps=t("DEActionMethod",class extends $i{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){if(e&&await bs(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const s=we(this.method.appDELogicId,this.entity);if(!s)throw new a(this.method,"缺少实体处理逻辑");return Cs(s,t,e,i)}let s;switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await bs(this.entity,"change",t,e,i),this.method.codeName){case"Create":s=await this.create(t,e,i||{});break;case"Get":s=await this.get(t,i);break;case"GetDraft":s=await this.getDraft(t,i);break;case"Remove":s=await this.remove(t,i);break;case"Update":s=await this.update(t,e,i);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,i);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);if(this.method.needResourceKey){let i=t[this.entity.codeName.toLowerCase()];M(i)&&(i=R(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),a="".concat(a,"/").concat(i)}const o=await this.request(a,t,e,i);o.data=await this.result.handle(t,o.data),s=o}}return s.data&&await bs(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new n("create行为没有传data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.post(i,e,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new n("update行为没有传data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e);return i.data=await this.result.handle(t,i.data),i}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,a)),new u(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new u(t):new u(t,500)}catch(t){return new u(t,500)}}async removeTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.delete(t,a);return i?new u(i):new u(i,500)}catch(t){throw new s(t)}}async updateTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,a)),i?new u(i):new u(i,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.get(t,a);return i?new u(i):new u(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new u(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{if(a.parentAppDEFieldId){const{majorDECodeName:i,parentAppDEFieldId:s}=a,o=i.toLowerCase(),n=s.toLowerCase(),r=t[o];r&&r!==e.srfkey&&(e[n]=r)}})),e}}),Ts=class{create(t,e,a,i){return new Ps(t,e,a,i.localMode)}},xs=t("FetchMethod",class extends $i{async exec(t,e,a){const s=e&&!R(e)?e:a||{};if(this.isLocalMode){const e=Ci.getCond(this.method),a=await this.searchLocal(e,new Li(t,s));return new u(a,200)}let o;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);o=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const n=o.data||[];return o.data=n.map((t=>this.createEntity(t))),o.data&&await bs(this.entity,"compute",t,o.data,s),o}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=this.service.local.getList();t?i.length>0&&(i=i.filter((a=>t.test(a,e)))):i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const s=t[a[e]];if(i.test(s))return!0}return!1}))),rt(e.sortField)||lt(e.sortField)||(i="DESC"===e.sortMode?at(i,e.sortField):it(i,e.sortField));const{page:s,size:o}=e,n=s*o,r=(s+1)*o-1;return i.slice(n,r).map((t=>dt(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new a(this.method,"没有指定数据来源代码表");const s=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:o,majorAppDEFieldId:n}=this.entity,r=s.map((t=>({[o]:t.value,[n]:t.text})));return new u(r,200)}}),Ns=t("AcFetchMethod",class extends xs{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Ss=class{create(t,e,a,i){return i.acMode?new Ns(t,e,a,i.localMode):new xs(t,e,a,i.localMode)}};function Ls(){const t=new Ts;di("DEACTION",(()=>t));const e=new Ss;di("FETCH",(()=>e)),di("FETCHTEMP",(()=>e))}var Rs=t("TreeNodeData",class{constructor(t,e,a){this._uuid=Q(),this._leaf=!1,this._leaf=!0===a.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._parent&&(this._context={...this._parent._context}),a.navContext&&(this._context=Object.assign(this._context||{},a.navContext)),a.navParams&&(this._params={...a.navParams}),this._nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath)),Object.values(a).length>0?a:void 0}}),Os=t("TreeCodeListNodeData",class extends Rs{constructor(t,e,a){super(t,e,a);const{data:i}=a;this._text=i.text,this._value=i.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=ge(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),Ms=t("TreeDataSetNodeData",class extends Rs{constructor(t,e,a){var i,s;super(t,e,a);const{data:o}=a;this._deData=o,this._text=t.textAppDEFieldId?o[t.textAppDEFieldId]:o.srfmajortext,this._value=t.idAppDEFieldId?o[t.idAppDEFieldId]:o.srfkey;const n="".concat(t.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(n):n},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=ge(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:o.srfkey})}this._icon=this.calcIcon(t),this._textHtml=this.calcTextHtml(t),t.leafFlagAppDEFieldId&&(this._leaf=Ri(o[t.leafFlagAppDEFieldId]));const r=new Map;r.set("srfkey","srfkey"),r.set("srfmajortext","srfmajortext"),null==(i=t.detreeNodeDataItems)||i.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();r.set(e,a),t.defaultValue&&rt(o[a])&&(o[a]=t.defaultValue)}));const c=new Map;return null==(s=t.detreeNodeColumns)||s.forEach((t=>{const e=t.detreeColumnId,a=t.dataItemName;e&&a?c.set(e,r.get(a)):ibiz.log.error("模型异常缺少detreeColumnId或者dataItemName",t)})),new Proxy(this,{set:(t,e,a)=>(c.has(e)?t._deData[c.get(e)]=a:r.has(e)?t._deData[r.get(e)]=a:Object.prototype.hasOwnProperty.call(t._deData,e)?t._deData[e]=a:t[e]=a,!0),get:(t,e,a)=>void 0!==t[e]?t[e]:c.has(e)?t._deData[c.get(e)]:r.has(e)?t._deData[r.get(e)]:void 0!==t._deData[e]?t._deData[e]:void 0,ownKeys(t){const e=[...new Set([...Object.keys(t),...r.keys(),...Object.keys(t._deData)])];return m(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:i}=t;a&&this._deData[a]&&(e.imagePath=this._deData[a]),e&&(this._icon=e);const s=null==i?void 0:i.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return je.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,i=null==a?void 0:a.find((t=>"text"===t.id));return i&&(e=this.calcDataItemScript(i)),e}}),_s=t("TreeStaticNodeData",class extends Rs{constructor(t,e,a){var i,s;super(t,e,a);const o="root"===t.nodeValue?void 0:t.nodeValue,n="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(n):n},enumerable:!0,configurable:!0}),this._text=t.text,this._value=o,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=o||(null==t?void 0:t._value)}this.srfkey=(null==(i=this._deData)?void 0:i.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),Vs=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,rt(a.isOriginField)||(this.isOriginField=a.isOriginField),rt(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(d.isNumber(this.dataType)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),Fs=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var ks=["REGION","REGION2","REGION3","REGION4"],Ws=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:i,longitudeAppDEFieldId:s,latitudeAppDEFieldId:o,textAppDEFieldId:n,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:l}=e,d=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,ks.includes(this._itemStyle)?s&&d.set("_areaCode",s):(s&&d.set("_longitude",s),o&&d.set("_latitude",o)),c&&d.set("_tooltip",c),n&&d.set("_text",n),r&&d.set("_value",r),l&&(this._symbol=l.rawContent||l.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:d.has(a)?t[d.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:d.has(a)?t[d.get(a)]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}});var Us=t("PanelData",class{constructor(t,e){const a=new J,i={},s={};return t.forEach((t=>{var e;i[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,o,n)=>(Object.prototype.hasOwnProperty.call(i,o)?i[o]?e[i[o]]=n:t[o]=n:e[o]=n,a.emit("change",o),i[o]&&i[o]!==o&&a.emit("change",i[o]),s[o]&&s[o]!==o&&a.emit("change",s[o]),!0),get:(t,s,o)=>"_evt"===s?a:i[s]?e[i[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const a=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,a),a}})}destroy(){this._evt.reset()}});var Bs=t("ChartData",class{constructor(t,e,a,i){return this._seriesModelId=null==e?void 0:e.id,this._catalog=a,this._groupName=i,this._uuid=Q(),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}}),zs=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},Gs=t("GanttStaticNodeData",class extends _s{constructor(t,e,a,i){super(e,a,i),this._snDataItemValue=zs(t.sndataItemName,e),this._beginDataItemValue=zs(t.beginDataItemName,e),this._endDataItemValue=zs(t.endDataItemName,e),this._prevDataItemValue=zs(t.prevDataItemName,e),this._finishDataItemValue=zs(t.finishDataItemName,e),this._totalDataItemValue=zs(t.totalDataItemName,e)}}),js=t("GanttDataSetNodeData",class extends Ms{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=zs(t.sndataItemName,e,s),this._beginDataItemValue=zs(t.beginDataItemName,e,s),this._endDataItemValue=zs(t.endDataItemName,e,s),this._prevDataItemValue=zs(t.prevDataItemName,e,s),this._finishDataItemValue=zs(t.finishDataItemName,e,s),this._totalDataItemValue=zs(t.totalDataItemName,e,s)}}),Ks=t("GanttCodeListNodeData",class extends Os{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=zs(t.sndataItemName,e,s),this._beginDataItemValue=zs(t.beginDataItemName,e,s),this._endDataItemValue=zs(t.endDataItemName,e,s),this._prevDataItemValue=zs(t.prevDataItemName,e,s),this._finishDataItemValue=zs(t.finishDataItemName,e,s),this._totalDataItemValue=zs(t.totalDataItemName,e,s)}}),Xs=t("MqttService",class{constructor(t,e,a){if(this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new J,this.options={connectTimeout:6e3,clientId:Q(),username:"",password:"",keepalive:60,clean:!0},Y(t)||Y(e))throw new Error("mqttTopic or token is empty");this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),a=t.default?t.default:t,{location:i}=window;this.client=a.connect("ws://".concat(i.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.debug("mqtt reconnect")})),this.client.on("close",(()=>{console.debug("mqtt close")}))}close(){var t;null==(t=this.client)||t.end()}}),Hs=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,a){const i=e.srfsessionid||"applocation";this.cache.has(i)||this.cache.set(i,new Map);const s=this.cache.get(i);if(!s.has(a)){const e=await ibiz.hub.getAppDataEntity(a,this.appModel.appId);if(!e)throw new n("未找到应用实体[".concat(a,"]"));const o=t.constructorCache.get(a.toUpperCase());let r;r=o?await o(i,e):new Bi(i,e),s.set(a,r)}return s.get(a)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};Hs.constructorCache=new Map;var Ys=t("DEServiceUtil",Hs),qs=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=dt(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new n("应用视图[".concat(t,"]不存在"));if((o.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=ge(r.appDataEntityId);o.srfkey&&(o[t]=o.srfkey,o.srfkey=void 0),0===a.srfuf&&(o[t]=void 0,delete a.srfuf)}if(r.redirectView){return Me(await ibiz.hub.getAppView(t),o,a,s)}const{openMode:c="INDEXVIEWTAB"}=r;switch(s.openMode||c){case"INDEXVIEWTAB":return s.noWaitRoute?(this.openIndexViewTab(r,o,a),{ok:!0}):this.openIndexViewTab(r,o,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,o,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,o,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,o,a);case"USER":return this.openUserCustom(r,o,a);default:return this.openIndexViewTab(r,o,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,e,a,i={}){if(!e)throw new n("气泡打开缺少event");return ibiz.openView.popover(t.id,e,a,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};qs.TAG="ibiz.app-view.open";var Qs=t("OpenAppViewCommand",qs),Js=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!o)throw new n("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:l}=o,d=e.clone();Object.assign(d,ie(r,a,e));const h=ie(c,a,e);switch(l){case"APPVIEW":return this.openAppView(o,d,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(o);case"PDTAPPFUNC":return this.openPdAppFunc(o,d,h);case"JAVASCRIPT":return this.executeJavaScript(o,d,h);case"CUSTOM":return this.custom(o,d,h);default:throw new i(o,"未支持的应用功能类型: ".concat(l))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new n("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute(Qs.TAG,t.appViewId,e,a,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,a){throw ibiz.log.warn("openPdAppFunc",t,e,a),new n("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new n("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new n("未实现")}};Js.TAG="ibiz.app-func.exec";var $s=t("AppFuncCommand",Js);function Zs(){new $s,new Qs}var to=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new g({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new Mi(t.appId,"PSSysApp",t.codeName),this.deService=new Ys(t),this.codeList=new Oi(t),this.authority=new Hi(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),ibiz.env.enableMqtt&&ibiz.appData&&(this.mqtt=new Xs(ibiz.appData.mqtttopic,f(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.asyncAction.next(t)})),await this.mqtt.connect())}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,i;let s=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!s&&e){s=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}}),eo=class{parse(t){return t}},ao=class{constructor(){this.appMenu=new eo}},io=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const a=this.calcAppViewId(t);this.viewConfigs.set(a,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new n("视图[".concat(e,"]不存在"));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},so=class{constructor(){this.view=new io}},oo=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(oo||{})),no=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(no||{})),ro=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(ro||{})),co=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new n("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),lo=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new co(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),ho=t("CTXState",class{}),po=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new J(3e3),this.controllersMap=new Map,this.state=new ho}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),uo=t("ActivityCounter",class extends co{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())}}),mo=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await ye(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:i,uiactionMode:s,uiactionTag:o}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(o))&&(this.noDataDisabled=!0,"SINGLEKEY"!==i&&"MULTIKEY"!==i||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),go=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),fo=t("QXEventEx",class extends J{constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((a=>{a(t,...e)}))}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),i=this.anyEventFns.map((a=>a(t,...e))),s=Promise.all(i),o=await a,n=await s;return o.concat(...n)}reset(){super.reset(),st(this.anyEventFns)}}),wo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new fo}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function Eo(t){return window.location.hash.split("/").length>2*t+2}function Io(t,e){return(!rt(t)&&""!==t||!rt(e)&&""!==e)&&t!==e}function yo(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof Gi&&(e=e.getOrigin()),e}function vo(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,o=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&o)"REG"===o.ruleType?i.push({pattern:new RegExp(o.regExCode),message:o.ruleInfo,trigger:"change blur"}):"SCRIPT"===o.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{je.execScriptFn({rule:t,value:e,callback:a,source:i},o.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=a||e;i.push({validator:(e,a,i,s)=>{if(Y(s[t]))return!0;const{isPast:o,infoMessage:c}=Ke(t,s,r.groupCond);return o||i(new n(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function Do(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:o}=t;return a&&e.push({validator:(t,e,i)=>{if(rt(e)||!(e.length>a))return!0;i(new Error("内容长度必须小于等于".concat(a,",当前长度为").concat(e.length)))}}),i&&e.push({validator:(t,e,a)=>{if(rt(e)||!(e.length<i))return!0;a(new Error("内容长度必须大于等于".concat(i,",当前长度为").concat(e.length)))}}),rt(s)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),rt(o)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&ot(e)&&e<o))return!0;a(new Error("值必须大于等于".concat(o)))}}),e}var Co=t("ValueExUtil",class{static mergeDefault(t){return ut(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(rt(e)||""===e)return"";const{valueType:a,objectNameField:i,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!i)throw new n("缺少objectNameField");const t=i.toLowerCase();return"OBJECTS"===a?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===a?e.join(s):"".concat(e)}});function Ao(t,e){var a;const{name:s,valueType:o,defaultValue:r,valueFormat:c}=t,{data:l,context:d,params:h}=e;if(rt(o)&&rt(r))return;if("RESET"===o)return null;const p=l[s];if(!mt(p)){if(!o&&r)return r;switch(o){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(d,r))return d[r];break;case"OPERATORNAME":return d.srfusername;case"OPERATOR":return d.srfuserid;case"CURTIME":return ft().format(c);case"PARAM":return l[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new n("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return Q();default:throw new i({},"默认值类型[".concat(o,"]未支持"))}}}var bo="asyncimportdata2",Po="importdata2";async function To(t,e,a){if(!ibiz.util.getExcelUtil)throw new n("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new n("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function xo(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid),s="/jsonschema/".concat(i.name);return(await a.net.get(s)).data}var No="__self",So=t("BaseController",class{constructor(t,e,a,i){this.model=t,this.context=e,this.params=a,this.ctx=i,this.id=Q(),this.state={},this.name="",this.evt=new wo(this.getEventArgs.bind(this)),this.mountCounter=new uo(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(No),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(No)||this.mountCounter.attend(No)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),Lo=class t{constructor(t){this.msgGroupId=t,this.viewMsgMap=new Map}async init(t){var e,a;const i=ibiz.hub.getApp(t.srfappid).model,s=null==(e=i.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new n("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const o=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=o.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),o.splice(e,1))})),o.length)throw new n("没有找到".concat(o.join(","),"视图消息模型"))}getDeFieldName(t,e){var a,i;if(e)return null==(i=null==(a=Ie(t,e))?void 0:a.name)?void 0:i.toLowerCase()}static async fetchDataSet(t,e,i){const{appDataEntityId:s,appDEDataSetId:o}=t;if(!o)throw new a(t,"未配置实体数据集");const n=await ibiz.hub.getApp(e.srfappid).deService.exec(s,o,e,i);return n.data.length?n.data:[]}async calcViewMessages(t,e){const a=this.msgGroup.appViewMsgGroupDetails,i=[];return(null==a?void 0:a.length)&&await Promise.all(a.map((async a=>{if(1===this.viewMsgMap.get(a.appViewMsgId).dynamicMode){const s=await this.calcDynaMsgs(a,t,e);i.push(...s)}else{const t=this.calcStaticMsg(a);i.push(t)}}))),i}calcStaticMsg(t){const{position:e}=t,a=this.viewMsgMap.get(t.appViewMsgId),{title:i,message:s,removeMode:o,position:n,messageType:r}=a,{userTag:c,userTag2:l,userTag3:d,userTag4:h}=a;return{title:i,message:s,position:e||n,messageType:r,removeMode:o,extraParams:{userTag:c,userTag2:l,userTag3:d,userTag4:h}}}async calcDynaMsgs(e,i,s){const o=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:n,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:l,msgTypeAppDEFieldId:d,contentAppDEFieldId:h,msgPosAppDEFieldId:p}=o;if(!n)throw new a(o,"未配置应用实体");const u=await ibiz.hub.getAppDataEntity(n,i.srfappid),m={...s},g=this.getDeFieldName(u,r);g&&(m.sort="".concat(g,",asc"));const f=await t.fetchDataSet(o,i,m);if(!f.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(u,c),I=this.getDeFieldName(u,p),y=this.getDeFieldName(u,h),v=this.getDeFieldName(u,d),D=this.getDeFieldName(u,l);return f.map((t=>{const e={};return I&&!rt(t[I])&&(e.position=t[I]),E&&!rt(t[E])&&(e.title=t[E]),y&&!rt(t[y])&&(e.message=t[y]),v&&!rt(t[v])&&(e.messageType=t[v]),D&&!rt(t[D])&&(e.removeMode=t[D]),ct(w,e)}))}},Ro=t("ViewController",class extends So{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),l.create({},e),a||{},new po(i)),this.session={},this.modal=new ra({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new lo,this.isCloseView=!1,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Ne(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn("未找到视图引擎实现:",t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await _i.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{mt(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await Sa(t);this.providers[t.name]=e;const a=Te(this.model);a&&await Promise.all(a.map((async t=>{const e=await Sa(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=xe(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===this.context.srfsessionid&&ibiz.uiDomainManager.destroy(this.context.srfsessionid),this.context.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){if(this.context.srfappid=this.model.appId,rt(this.context.srfsessionid)||lt(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}const t=this.model.appViewNavContexts;let e={};H(t)&&(e=ie(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let i={};H(a)&&(i=ie(a,this.params,this.context)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const i of this.engines)if(a=await i.call(t,e),void 0!==a)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(void 0===a)throw new n("没有引擎支持预置界面行为".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Lo(t),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){const[e,...a]=t,i={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(i,{confirmButtonText:e.extraParams.userTag}),"WARN"===e.messageType?await ibiz.modal.warning(i):"ERROR"===e.messageType?await ibiz.modal.error(i):await ibiz.modal.info(i),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),Oo=(t("MobViewController",class extends Ro{}),t("WFStepTraceViewController",class extends Ro{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),a=null==(t=this.ctx.parent)?void 0:t.view;if(a&&a.model.appDataEntityId){const t=await e.deService.getService(a.context,a.model.appDataEntityId),i=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(i);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let o={};i&&t&&(o=ie(i,t,a,e));const n=Object.assign(e.clone(),o);let r={};return s&&t&&(r=ie(s,t,a,e)),{context:n,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}})),Mo=(t("CodeListEditorController",class extends Oo{async loadCodeList(t){const{context:e,params:i}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,i),a}throw new a(this.model,"编辑器类型[".concat(this.model.editorType,"],未配置代码表"))}}),t("ControlController",class extends So{constructor(t,e,a,i){if(super(t,l.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=de(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=dt(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await Sa(this.controlPanel);this.providers[this.controlPanel.name]=t}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)}))}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let i={};H(e)&&(i=ie(e,this.params,this.context)),Object.assign(this.context,i);let s={};H(a)&&(s=ie(a,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let i=this.getData()||[];return(null==t?void 0:t.data)&&(i=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(a,t.viewParam),{context:e,params:a,data:i}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};H(t)&&(e=ie(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:i}=this.model,s=null==(a=null==i?void 0:i.ctrlMsgItems)?void 0:a.find((e=>e.name===t));let n,r;if(s&&s.content){r=rt(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),n=je.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();n=ibiz.i18n.t(e,""),n===e&&(n="")}if(!n&&(null==e?void 0:e.default)&&(n=e.default),!n&&(null==e?void 0:e.error)&&(n=n||e.error.message),n){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new o(n,r);ibiz.message.success(n,r,0===r)}}})),_o=t("MDControlController",class extends Mo{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)}));const e=this.onDataChange.bind(this);this.onDataChange=_((t=>{e(t)}),300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const a=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(a.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,o={...this.params};return a&&(o.page=e-1,o.size=a),!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),t&&Object.assign(o,t),o}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),o=await this.service.fetch(i,s);"number"==typeof o.total&&(this.state.total=o.total),a?this.state.items.push(...o.data):this.state.items=o.data,await this.afterLoad(t,o.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new n("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{const o=ge(this.model.appDataEntityId);await ma(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[o]=t.srfkey,await this.service.remove(i,a),s=!0}this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:i,default:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:i}),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,a;const{selectedData:i}=this.state;I(i,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,i=await ibiz.hub.getAppDataEntity(e,this.model.appId),s=null==(t=i.appDEDataImports)?void 0:t.find((t=>t.id===a));if(!s)throw new n("无导入模型!");let o="DataImport";s.enableCustomized&&(o="DataImport2");const r=ibiz.overlay.createModal(o,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),Vo=t("AppMenuController",class extends Mo{constructor(t,e,a,i){super(t,e,a,i),this.itemProviders={},this.flattenAllItems()}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Ei(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new n("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const o=this.itemProviders[t];if(o&&o.onClick)return o.onClick(s,e,this);if(!s.appFuncId)throw new a(s,"没有配置应用功能");const r=this.context.clone();r.srfappid=s.appId,this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute($s.TAG,s.appFuncId,r,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let i=!0;t.accessKey&&(i=this.app.authority.calcByResCode(t.accessKey));let s=i;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}a.permitted=i,a.visible=s}return this.state.menuItemsState[t.id]=a,a}flattenAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var a;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(a=e.appMenuItems)?void 0:a.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),Fo=(t("AppMenuIconViewController",class extends Vo{async onClickMenuItem(t,e){const i=y(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new n("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!i.appFuncId)throw new a(i,"没有配置应用功能");const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute($s.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends Ki{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const i=a.map((async a=>{const i=a.appDEDataSetId||"fetchdefault";return this.exec2(i,t,e,void 0,a.appDataEntityId)}));return(await Promise.all(i)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new n("未找到日历项模型");const i=a[e];if(!i)throw new n("未找到日历项模型");return t.map((t=>new Fs(i,t)))}async exec2(t,e,a={},i={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,a,i)}}));t("CalendarController",class extends _o{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Fo(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(a,i)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const a=t.beginTime,i=e.beginTime;let s=0;return ft(a).isAfter(i)?s=-1:ft(a).isBefore(i)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:i}=t;if(!a||!i){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:ft(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:ft(a).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:i}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,o={...this.params};if(!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),a&&(o.page=e-1,o.size=a),t&&Object.assign(o,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(o);Object.assign(o,t)}return o}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});ft.extend(vt),ft.extend(Ct),ft.extend(bt),ft.extend(Tt),ft.extend(Nt);var ko="$default_group",Wo=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:s,id:o,userParam:n}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=i||{};this.xAxisIndex=N(r),this.yAxisIndex=N(c),this.seriesName=s||o,this.staticOptions=this.calcStaticOptions(),n&&(this.seriesUserParam=Ho(n))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(rt(e))return;if(rt(t))return e;const i=this.chartGenerator.codeListMap.get(t);if(null==i?void 0:i.length){const t=i.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}prepareChartData(t,e,a,i){var s;this.groupField&&Object.assign(e,{[this.groupField]:i}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const o=new Bs(e,this.model,a,i);t[i].get(a).chartData=o,null==(s=this.chartDataArr)||s.push(o)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=ko;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(rt(e))return;s=e}if(!e[s]&&(e[s]=new Map,i&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(i).forEach((t=>{e[s].set(t.text,{value:0})}))}const o=this.translateVal(i,t[this.catalogField],!0);if(o)e[s].get(o)||e[s].set(o,{value:0}),e[s].get(o).value=x(e[s].get(o).value,t[this.valueField]),e[s].get(o).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(o).value},o,s):this.prepareChartData(e,t,o,s);else if(i&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(i).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,s)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const a=t[e],i=this.calcSeriesData(a);let s={...this.staticOptions,data:i};return e!==ko&&(s.name=e),this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push([a,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,i;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[ko].get(t.name))?void 0:e.chartData:null==(i=null==(a=this.groupData)?void 0:a[t.seriesName].get(t.name))?void 0:i.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(dt(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=ft(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(ft(t[this.catalogField]).format("YYYY"),"-").concat(ft(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(ft(t[this.catalogField]).format("YYYY"),"-").concat(ft(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const i=t[a];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(i.keys()).sort(((t,e)=>ft(t).diff(ft(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,o]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(o,10)})));const o=new Map;s.forEach((t=>{o.set(t,i.get(t))})),t[a]=o}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(ft(e))}))}));const i=ft.max(a),s=ft.min(a);if("DAY"===e){let e=s;const a=i;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const a=i.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const a=i.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,10);e++)for(let a=1;a<=4;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,10);e++){const a=ft("".concat(e,"-12-31")).isoWeek();for(let i=1;i<=a;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},Uo=class extends Wo{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:i}=this.model;return i&&(t.step="middle"),t}},Bo=class extends Wo{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},zo=class extends Wo{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},Go=class extends Wo{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},jo=class extends Wo{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Ko=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},Xo=class extends Wo{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Ko(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),i=Object.keys(e).map((t=>{const i=e[t],s=a.indicatorKeys.map((t=>i.has(t)?i.get(t).value:0));return{name:t===ko?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=gt(s,this.seriesUserParam)),s}};function Ho(t){const e={};return t&&Object.keys(t).forEach((a=>{const i=a.indexOf(".");if(-1===i)return;const s=a.slice(i+1);if(s)try{e[s]=JSON.parse(t[a])}catch(i){e[s]=t[a]}})),e}var Yo=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:i,chartYAxises:s,userParam:o}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==i?void 0:i.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(i)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),o&&(this.chartUserParam=Ho(o))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new Uo(t,this);break;case"bar":e=new Bo(t,this);break;case"scatter":e=new jo(t,this);break;case"pie":e=new Go(t,this);break;case"funnel":e=new zo(t,this);break;case"radar":e=new Xo(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:i,titlePos:s}=t,o={show:e,text:a,subtext:i,left:"center"},n=null==s?void 0:s.toLowerCase();return"left"===n||"right"===n?o.left=n:"bottom"!==n&&"top"!==n||(o.top=n),o}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,i={};i.show=e;const s=null==a?void 0:a.toLowerCase();return"left"===s||"right"===s?(i.left=s,i.top="middle",i.orient="vertical"):"bottom"===s&&(i.top=s),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:i,userParam:s}=t;let o={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===i?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===i&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===i?45:0}};s&&(o=gt(o,Ho(s))),e.push(o)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const i=ibiz.hub.getApp(t.srfappid),s=async a=>{if(!a||this.codeListMap.has(a))return;const s=await i.codeList.get(a,t,e);this.codeListMap.set(a,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await s(e),await s(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const i=e.length,s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const o=e.length-1;for(let t=i;t<=o;t++)this.seriesGeneratorIndexMap.set(t,a)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=gt(this.staticOptions,this.options),this.chartUserParam&&(this.options=gt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new n("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},qo=t("ChartService",class extends Ki{}),Qo=(t("ChartController",class extends _o{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new qo(this.model),await this.service.init(this.context),this.generator=new Yo(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new n("chart对象没有正确初始化");if(!this.options)throw new n("options还没计算");this.chart.setOption(this.options),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends Mo{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):"")}))}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),Jo=class{};function $o(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(n){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=dt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:je.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(r,"报错,源参数:"),c),t}return c}var Zo=class extends Jo{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const o=$o(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return Fe(o,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=$o(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return Fe(o,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o,this.op,this.value)}}},tn=class t extends Jo{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new Zo(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},en=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===(e||0)&&a&&(this.groupCond=new tn(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(e))}}},an=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new en(t)))}},sn=class extends an{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},on=class extends an{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:o}=t;if(!e)throw new a(this.model,"未配置界面行为");let n=[s];if(i){const e=t.params[i];n=e instanceof Array?e:[e]}await xn.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:n},this.model.appId)}},nn=class extends an{async exec(t){}},rn=class extends an{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}},cn=class extends an{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new i(a,"暂未支持逻辑处理参数操作".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:i}=t;if(!i)throw new n("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const o=$o(e,t);if(s)try{je.execScriptFn({srcVal:o,dstParam:e.params[i]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error("给目标参数属性".concat(a,"赋值报错,目标参数:"),e.params[i]),t}else e.params[i]=o}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=$o(e,t);e.params[a]=dt(i)}bindParam(t,e){const a=$o(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:i,srcIndex:s,srcSize:o}=t,n=$o(e,t),r=i||0,c=s||0,l=o||n.length;e.params[a].splice(r,0,...n.slice(c,l))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i;e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},ln=class extends an{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:i,invokeParamId:s}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!s)throw new a(this.model,"没有配置操作参数");if(!e)throw new a(this.model,"没有配置调用方法");const o=t.params[s];if(!o)throw new n("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new n("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new n("没有找到调用方法".concat(e));await r[e](o)}},dn=class extends an{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=$o(t,this.model);t.params[e]=s}},hn=class extends an{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:o}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:n}=this.model,{message:r}=this.model;if(o){const e=t.params[o];e.title&&(n=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:n||"消息",desc:r};let l=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,l=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,l=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const d=await ibiz.modal.confirm(c);t.setLastReturn(l[d?0:1])}},pn=class extends an{async exec(t){const e=await Ja(this.model);e&&await e.exec(this.model,t)}},un=class extends an{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];console.log("逻辑节点".concat(i,"操作参数值:"),s)}},mn=class extends an{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},gn=class extends an{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=$o(t,this.model);t.params[e]=dt(s)}},fn=class extends an{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=$o(t,this.model),c=s||0,l=o||0,d=n||r.length;t.params[e].splice(c,0,...r.slice(l,d))}},wn=class extends an{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s;t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},En=class extends an{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},In=class extends an{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,n);c.ok&&(t.params[o]=c.data)}},yn=class extends an{async exec(t){const{errorInfo:e}=this.model;throw new n(e)}},vn=class extends an{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:i,fireCtrlId:s}=this.model;if(!s)throw new a(this.model,"没有配置触发对象");if(!e)throw new a(this.model,"没有配置事件名称参数");if(!i)throw new a(this.model,"没有配置事件参数");const o=t.params[s];if(!o)throw new n("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new n("没有找到事件参数对象".concat(i));await o.evt.emit(e,r)}},Dn=class extends an{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!i)throw new a(this.model,"没有配置实体");if(!e)throw new a(this.model,"没有配置实体逻辑");if(!s)throw new a(this.model,"没有配置传入逻辑参数");const r=t.params[s];if(!r)throw new n("没有找到传入参数".concat(s));const c=await Ds(e,i,t.context,r,t.params);o&&(t.params[o]=c)}},Cn=class extends an{async exec(t){console.log(t),je.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},An=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:o,params:n,data:r}=s,c=ibiz.hub.getApp(a.appId);if("layoutPanel"!==a.codeName)if(a.default)a.entityListParam?t.params[e]=r||[]:t.params[e]=r&&r.length>0?r[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const i=s.view.getController(a.codeName.toLowerCase());i?t.params[e]=i:ibiz.log.error("视图逻辑初始化参数,未找到".concat(a.codeName,"指定部件对象"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=c;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=o;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=n;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}else t.params[e]=s.view.layoutPanel.panelItems}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},bn=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new nn(t);break;case"END":a=new rn(t);break;case"DEACTION":a=new sn(t);break;case"DEUIACTION":a=new on(t);break;case"PREPAREJSPARAM":a=new cn(t);break;case"RESETPARAM":a=new mn(t);break;case"COPYPARAM":a=new gn(t);break;case"BINDPARAM":a=new dn(t);break;case"VIEWCTRLINVOKE":a=new ln(t);break;case"MSGBOX":a=new hn(t);break;case"DEBUGPARAM":a=new un(t);break;case"APPENDPARAM":a=new fn(t);break;case"SORTPARAM":a=new wn(t);break;case"RENEWPARAM":a=new En(t);break;case"DEDATASET":a=new In(t);break;case"THROWEXCEPTION":a=new yn(t);break;case"VIEWCTRLFIREEVENT":a=new vn(t);break;case"DELOGIC":a=new Dn(t);break;case"PFPLUGIN":a=new pn(t);break;case"RAWJSCODE":a=new Cn(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new An(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new Qo(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(i);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Pn=new Map;async function Tn(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new n("找不到实体".concat(e,"的界面逻辑").concat(t));Pn.has(s)||Pn.set(s,new bn(s));const o=Pn.get(s);return await o.exec(a),null}var xn=t("UIActionUtil",class{static async exec(t,e,a){const i=await ye(t,a);if(!i)throw new n("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await qa(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const o=await this.exec(t,e,a);if(o.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(o.refresh)switch(o.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(i=e.view.parentView)||i.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}}}),Nn=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:o,uilogicAttachMode:n}=t;if("REPLACE"===n){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Tn(s,o,e),i}if(!await this.isConfirm(t,e))return this.returnError(i);const r=await this.execAction(t,e);if(Object.assign(i,r),!0===i.cancel)return this.returnError(i);if("AFTER"===t.uilogicAttachMode){if(!s)throw new a(t,"没有配置实体界面逻辑");await Tn(s,o,this.mergeArgsByResult(e,i))}const c=this.mergeArgsByResult(e,i);if(t.closeEditView)this.doNextAction(t,c,t.appId);else{const e=await this.doNextAction(t,c,t.appId);if(e&&(Object.assign(i,e),!0===e.cancel))return this.returnError(i)}return i}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return!t.enableConfirm||!a||ibiz.confirm.warning({title:"操作确认",desc:a})}async doNextAction(t,e,a){const i=t.nextId;if(i)return xn.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const o=ge(t.appDataEntityId),n=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[a[0]];break;case"MULTIDATA":s=a;break;case"MULTIKEY":s=o&&a.length>0?a.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=o?[{[n]:t.srfkey||t[n]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(o&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||o,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const l=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,d=ie(c,l?ne(c,a):a[0]||{},i,e);Object.assign(r,d);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:ie(h,l?ne(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:o,cmlanguageRes:n,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=o,s=n;break;case"success":i=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||i);t!==s.lanResTag&&(i=t)}if(i){const{data:t}=a,e={...a};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,je.execScriptFn(e,"`".concat(i,"`"),{isAsync:!1,singleRowReturn:!0})}}}),Sn=t("BackendUIActionProvider",class extends Nn{async execAction(t,e){const{context:i,params:s,data:o,event:n}=e,r={},c=t.appDataEntityId,l=t.appDEMethodId;if(!c||!l)throw new a(t,"未配置实体或实体行为");const{resultContext:d,resultParams:h,resultData:p}=await this.handleParams(t,i,o,s),u={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute(Qs.TAG,m,d,h,{event:n});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===p.length&&p.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));p.forEach((t=>{t.srfactionparam=e}))}}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),f=p.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,u))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await g.deService.exec(c,l,d,w?f:f[0],u);if(E.ok){const a=this.calcMessage("success",t,e);a&&ibiz.message.success(a)}return Object.assign(r,{data:$(E.data)?E.data:[E.data],nextContext:d,nextParams:u}),r}}),Ln=t("SysUIActionProvider",class extends Nn{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,i=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===i)return{closeView:!0};return await a.callUIAction(i,e)||{}}}),Rn=t("FrontUIActionProvider",class extends Nn{async execAction(t,e){const{context:s,params:o,data:n,event:r,noWaitRoute:c}=e;let l={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=v.fill(t.htmlPageUrl,s,null==n?void 0:n[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:d}=await this.handleParams(t,s,n,o),h=await ibiz.commands.execute(Qs.TAG,e,i,d,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(l.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(l.data=h.data,l.nextContext=i,l.nextParams={...o,...d});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":l=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":l=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return l}doOther(t,e){const{scriptCode:i}=t,{context:s,params:o,data:n,event:r,view:c}=e;if(i){return je.execScriptFn({context:s,params:o,data:n,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:o,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),l=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!l)throw new n("没有找到实体打印项");{let t="";if(!o||!o[c.codeName.toLowerCase()])throw new n("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(o[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:l.codeName,...r}});if(!e.ok)throw new n("打印失败");if(r&&r.srfcontenttype){const t=null==(s=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:s.slice(9),a=URL.createObjectURL(e.data),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){var a;const i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),s=null==(a=i.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let o="DataImport";if(s&&s.enableCustomized&&(o="DataImport2"),s){const t=ibiz.overlay.createModal(o,{dismiss:()=>t.dismiss(),appDataEntity:i,dataImport:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new n("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=o.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new n("没有找到实体导出项");{const t="/".concat(null==(i=o.codeName2)?void 0:i.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(r.codeName),a={page:0,size:r.maxRowCount?r.maxRowCount:1e3,...e.params,...s},c=await ibiz.net.request(t,{method:"post",data:a});if(200!==c.status)throw new n("导出请求失败");{let t="".concat(o.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([c.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}}}),On=t("WFWithdrawUIActionProvider",class extends Nn{async execAction(t,e){const{view:a}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),Mn=class extends Nn{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function _n(){const t=new Rn;Ha("FRONT",(()=>t));const e=new Sn;Ha("BACKEND",(()=>e));const a=new Ln;Ha("SYS",(()=>a));const i=new On;Ha("DEUIACTION_WFWithdraw",(()=>i));const s=new Mn;Ha("SYS_Logout",(()=>s))}var Vn=t("ToolbarController",class extends Mo{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new go,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const i=t.uiactionId,s=await ye(i,t.appId);if(!s)throw new n("没有找到界面行为模型".concat(i));const o=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;o&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],o=this.getEventArgs();o.params=Object.assign(a,o.params),await xn.execAndResolved(i,{...o,data:s,event:e},t.appId)}finally{o&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new mo(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const i="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:i?"extra":"deuiaction"}),i||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof Gi&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const t={};a&&(t.data=[a]),r(this.model,(e=>{const a=this.state.buttonsState[e.id];if(a){if(a.visible){const i=this.scheduler.triggerItemVisible(e.id,t);void 0!==i&&(a.visible=i)}if(!a.disabled){const i=this.scheduler.triggerItemEnable(e.id,t);void 0!==i&&(a.disabled=!i)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),Fn=t("ContextMenuController",class extends Vn{}),kn=(t("DashboardController",class extends Mo{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=yo(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var i;if(t.controlType&&a.includes(t.controlType))return;const s=await Ka(t);if(s){this.providers[t.id]=s;const a=await s.createController(t,this,e);this.portlets[t.id]=a,(null==(i=t.controls)?void 0:i.length)&&await this.initPortlets(t.controls,a)}})))}async dataChangeNotify(t){await ma(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t){var e,a;this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null,this.model=t,this.config=new Mi(t.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(a=this.model.codeName)?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Wn=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=he(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new kn}onDataChange(t){let e=t.data[0];e&&e instanceof Gi&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new go;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new mo(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:i}=this.dashboard.view.model;i&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const i=t.uiactionId;await xn.execAndResolved(i,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=pe(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),Un=(t("ContainerPortletController",class extends Wn{}),t("ViewPortletController",class extends Wn{}),t("MenuPortletController",class extends Wn{}),t("ChartPortletController",class extends Wn{}),t("ActionBarPortletController",class extends Wn{}),t("HtmlPortletController",class extends Wn{}),t("ListPortletController",class extends Wn{}),t("RawItemPortletController",class extends Wn{}),t("DataViewControlService",class extends Ki{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new Vs(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new Vs(e,e);this.dataUIMap.set(e,i)}))}})),Bn=t("DataViewControlController",class extends _o{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new Un(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const a=new go;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new mo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),t.groupActionGroupState=a}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[a],i=this.state.groups.find((t=>t.key===e));i&&i.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var a,i;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof Gi&&(s=s.getOrigin()),s&&(null==(a=e.groupActionGroupState)||a.update(s,this.model.appDataEntityId))):null==(i=e.groupActionGroupState)||i.update(void 0,this.model.appDataEntityId)}));else{const a=this.state.groups.find((e=>-1!==e.children.indexOf(t)));a&&(null==(e=a.groupActionGroupState)||e.update(a.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const i=new go,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),i;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new mo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.getOrigin())}return i}async onActionClick(t,e,a){const i=t.uiactionId;await xn.execAndResolved(i,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};xn.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const i=t.uiactionId,s={...this.params,srfgroup:a.key};await xn.execAndResolved(i,{context:this.context,params:s,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:i,minorSortDir:s}=this.model,o=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:n}=t;if(t.capLanguageRes&&(n=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:n,key:t.appDEFieldId};o&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),zn=t("ExpBarControlController",class extends Mo{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),i=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem())}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&Eo(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:i}=t,s=this.getNavViewMsg(e[0],a,i);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,a,i){const{navDER:s,navFilter:o,navigateContexts:n,navigateParams:r,appDataEntityId:c}=t,l={deName:c?ge(c):void 0,navFilter:o,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:n,navParams:r},d={context:a,params:i,data:e},{resultContext:h,resultParams:p}=re(l,d),u=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:u,params:{...p}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new n("多节点视图由子类实现")}getNavViewMsg(t,e,a){const i=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:i,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),Gn=(t("CalendarExpBarController",class extends zn{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:i}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:i,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends zn{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const i=t._id,s=t._deData||t,o=this.getNodeModel(t._nodeId);if(!o)throw new n("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(o,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:o.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,a)=>{0===a?e.push(t):e.push("".concat(e[a-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends zn{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,a,i){var s;const{context:o,params:n}=super.prepareParams(t,e,a,i);if(e._seriesModelId){const a=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(a){const{navigateContexts:t,navigateParams:s}=a,r=ie(t,e,i,o),c=ie(s,e,i,n);return{context:Object.assign(o.clone(),r),params:c}}}return{context:o,params:n}}getNavViewMsg(t,e,a){var i;let s;if(t._seriesModelId){const e=null==(i=this.XDataModel.dechartSerieses)?void 0:i.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const o=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:o.context,params:o.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends Mo{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new Gi,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await ma(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,a=void 0){await Promise.all(t.map((async t=>{const i=await Va(t);if(!i)return;e.providers[t.id]=i;const s=await i.createController(t,e,a);if(e.details[t.id]=s,"FORMITEM"===t.detailType&&e.formItems.push(s),"MDCTRL"===t.detailType&&e.formMDCtrls.push(s),Pe(t))return;const o=be(t);o.length&&await this.initDetailControllers(o,e,s)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Io(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}})),jn=class extends ji{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:o,createDV:n,updateDVT:r,updateDV:c,valueFormat:l}=s,d="create"===i?o:r,h="create"===i?n:c,p=s.id.toLowerCase(),u=Ao({name:p,valueType:d,defaultValue:h,valueFormat:l},{data:t,context:e,params:a});void 0!==u&&(t[p]=u)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Kn=t("SearchFormService",class extends jn{async getDraft(t,e={}){let a={ok:!0,status:200,data:this.getFilteredData({...e})};return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new Vs(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}}),Xn=(t("SearchFormController",class extends Gn{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Mi(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new Kn(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const a=this.state.data[e];null!=a&&""!==a&&(t[e]=a)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const i=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===i,a="BOTTOM"!==i,"NONE"===t&&(e=!0,a=!0);const s=t=>{let i,o="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],o=e,!0))),i&&i.length>0){const n=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(n.push(t),s(t))})),n.length<i.length&&(t[o]=n)}};(a||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new n("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new n("没有找到保存的搜索条件");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),Hn=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Hn||{})),Yn=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Yn||{})),qn=t("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:i}=this.model;if(t){const{width:e,height:a}=he(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName),i&&i.lanResTag&&(this.model.caption=ibiz.i18n.t(i.lanResTag,this.model.caption))}createState(){var t;return new Xn(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const i=a.relatedDetailNames||[];if(e||C(i,t))try{const t=He(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=pe(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=pe(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}async onClick(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Qn=t("FormButtonState",class extends Xn{constructor(){super(...arguments),this.loading=!1}}),Jn=(t("FormButtonController",class extends qn{createState(){var t;return new Qn(null==(t=this.parent)?void 0:t.state)}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await xn.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends Xn{constructor(){super(...arguments),this.showMask=!1}})),$n=(t("FormDRUIPartController",class extends qn{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Jn(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),C(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;H(e)&&(t=Object.assign(t,ie(e,this.data,this.form.params,this.form.context)));const a=ie(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=Q(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends Xn{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),Zn=t("FormGroupPanelController",class extends qn{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new $n(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new go;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new mo(t.id,this.form.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await xn.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),tr=t("FormItemState",class extends Xn{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),er=(t("FormItemController",class extends qn{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new tr(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Oa(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ca(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...vo(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...Do(this.model.editor)),this.rules.length>0&&(this.validator=new wt({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&Y(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}setDefaultValue(t,e=this.data){const{createDVT:a,createDV:i,updateDVT:s,updateDV:o}=this.model,n=t?a:s,r=t?i:o,c=Ao({name:this.name,valueType:n,defaultValue:r,valueFormat:this.model.valueFormat},{data:e,context:this.context,params:this.params});void 0!==c&&(e[this.name]=c)}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),t("FormMDCtrlController",class extends qn{get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return A.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return A.checkPermission(this.model.buildInActions,2)}get enableDelete(){return A.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}})),ar=(t("FormMDCtrlMDController",class extends er{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");"GRID"===t.controlType&&b(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await Sa(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new i(this.model,"多数据部件类型".concat(this.model.contentType,"暂不支持添加数据"));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController不存在")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends Xn{}),ir=(t("FormMDCtrlFormController",class extends er{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new ar(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await Sa(t);e&&(this.formProvider=e);const{appDataEntityId:i}=this.model.contentControl;this.deName=ge(i)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const a={...this.params};return{id:t.srfkey,context:e,params:a}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const a=e.data[0],i=this.state.items.find((e=>e.id===t));i&&i.context[this.deName]!==a.srfkey&&(i.context[this.deName]=a.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new n("没有找到对应".concat(t,"的表单控制器"));await e.remove();const a=this.state.items.findIndex((e=>e.id===t));-1!==a&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const i={id:Q(),context:e,params:a};void 0!==t?this.state.items.splice(t,0,i):this.state.items.push(i)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends er{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new i(this.model,"暂不支持重复器样式".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=dt(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,a)=>t!==a));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends $n{})),sr=(t("FormPageController",class extends Zn{createState(){var t;return new ir(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Xn{})),or=(t("FormRawItemController",class extends qn{createState(){var t;return new sr(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Xn{})),nr=(t("FormTabPageController",class extends qn{createState(){var t;return new or(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPanelState",class extends Xn{})),rr=(t("FormTabPanelController",class extends qn{createState(){var t;return new nr(null==(t=this.parent)?void 0:t.state)}}),t("EditFormService",class extends jn{async get(t,e={}){var a;let i=await this.exec((null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"update"),i}async getDraft(t,e={}){var a;let i=await this.exec((null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}async remove(t,e={}){var a;return await this.exec((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const i=e instanceof Gi?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return o=this.handleResponse(o),o}async update(t,e){var a;const i=e instanceof Gi?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return o=this.handleResponse(o),o}async goBack(t,e){var i;const s=null==(i=this.model.goBackControlAction)?void 0:i.appDEMethodId;if(!s)throw new a(this.model,"缺少返回操作实体行为");let o=await this.exec(s,t,e instanceof Gi?e.getOrigin():e);return o=this.handleResponse(o),o}async updateFormItem(t,e,a={}){let i=await this.exec(t,e,a);return i=this.handleResponse(i),i}async wfStart(t,e,a){var i;const s=(null==(i=this.model.wfstartControlAction)?void 0:i.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,a instanceof Gi?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let o="";o=e.type?e.type:(null==(i=s.wfsubmitControlAction)?void 0:i.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(o,t,e,a instanceof Gi?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const a=e,i=a.id.toLowerCase(),s=a.fieldName||e.appDEFieldId;let o;o=s?new Vs(i,s,{isOriginField:!0,dataType:a.dataType}):new Vs(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,o)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}})),cr=(t("EditFormController",class extends Gn{constructor(){super(...arguments),this.oldData=new Gi}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new rr(this.model),await this.service.init(this.context),this.autoSave=_(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=i.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=dt(this.context),e=dt(this.params),a=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(a&&this.params[a]){t[ge(this.model.appDataEntityId)]=this.params[a],delete e[a],delete this.params[a],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=Q(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!fe(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=dt(a);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),s=await this.service.get(e,i)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await P(500,this.save.bind(this),[t])}if(!await this.validate())throw new n("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],o=0===s.srfuf;let r;try{r=o?await this.service.create(a,s):await this.service.update(a,s)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(o?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):b(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(o?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(this.data.$origin,o?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i,s=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(s=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!s)return!1;await this.startLoading();try{i=await this.service.remove(e,a)}catch(t){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=i.ok}return this.state.data=new Gi,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&b(this.data,t.data),this.data}async updateFormItem(t){var e;const a=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!a)throw new n("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:o,scriptCode:r,showBusyIndicator:c}=a,l=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),o&&r)t=je.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},a=await this.service.updateFormItem(i,this.context,e);t=a.data}t&&(null==l?void 0:l.length)&&await Promise.all(l.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new n("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"流程启动成功"})}async wfSubmit(t){if(!await this.validate())throw new n("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"流程提交成功"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{demand:t}=this.model,e={silent:!0,noFillBack:!0};t&&(e.data=this.getDiffData());try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((a=>{t[a]===this.oldData[a]&&a!==t.srfkeyfield||(e[a]=t[a])})),e.srfuf=t.srfuf,new Gi(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return je.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),lr=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),dr=t("GridService",class extends Ki{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const i=t.id.toLowerCase(),s=t.appDEFieldId;let o;if(s){const n=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));o=new Vs(i,n,{isOriginField:!0,dataType:r.dataType})}else o=new Vs(i,i);this.dataUIMap.set(i,o)}))}}async updateGridEditItem(t,e,a={}){const i=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await i.exec(t,e,a);return s=this.handleResponse(s),s}}),hr={string:25,number:6,integer:9,date:5};var pr=t("GridController",class extends _o{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new dr(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await xo(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var a;if(!t.properties)return;const{properties:i}=t;if(!(Object.keys(i).length>0))return;const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e})}));const o={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[],r=[];return s.forEach((t=>{n.push({appId:e.model.appId,appDEFieldId:o[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:o[t.key],id:t.key,valueType:"SIMPLE",dataType:hr[t.type]})})),{degridColumns:n,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=dt(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===a.findIndex((e=>e.id===t.id)))),...a]}}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:i}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(s,"没有配置代码表"));const o=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==o&&0!==o){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(o,1);this.state.columnStates.unshift(...t)}if("CODELIST"===i){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(s,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await ma(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new lr(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.state.rows.forEach((t=>{Object.values(t.uiActionGroupStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,i="CODELIST"===a,s=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[s];i||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:i}=this.model;if("ALL"!==t)return;if(!i||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const s=await this.getFetchParams(),o=ibiz.hub.getApp(this.context.srfappid),n=await o.deService.exec(e,i,this.context,void 0,s);n.data.length&&([this.state.remoteAggResult]=n.data)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a))return void ibiz.log.error("不支持新建行");if("row"===a){if(this.state.rows.find((t=>t.showRowEdit)))throw new n("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let o;Object.assign(i,s);try{o=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=o.data;T(r,s),this.state.items.unshift(r);const c=new lr(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,a=this.findRowState(t);if(!a)throw new n("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await P(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new n("行数据校验不通过,保存取消");let i;const s=ge(this.model.appDataEntityId),o=this.context.clone();o[s]=t.srfkey;try{i=e?await this.service.create(o,t):await this.service.update(o,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:a.data}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await ma(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await Wa(t);if(!a)return;this.providers[t.codeName]=a;const i=await a.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=i,t.enableRowEdit&&(this.editColumns[t.codeName]=i)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=i:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:a,frozenLastColumn:i}=this.model;t.forEach(((t,s)=>{t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":a&&s<a?t.fixed="left":i&&s>=e-i&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Io(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await ma(Object.values(this.editColumns).map((async a=>a.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new n("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new n("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=dt(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let a;t&&(a=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(a,e)}async updateGridEditItem(t,e){var a;const i=null==(a=this.model.degridEditItemUpdates)?void 0:a.find((t=>t.id===e));if(!i)throw new n("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:o,customCode:r,scriptCode:c}=i,l=o.map((t=>t.id));let d;if(r&&c)d=je.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},a=await this.service.updateGridEditItem(s,this.context,e);d=a.data}d&&(null==l?void 0:l.length)&&await Promise.all(l.map((e=>this.setRowValue(t,e,d[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let i;await this.startLoading();try{i=await this.service.fetch(e,a)}finally{await this.endLoading()}return i.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),i=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=a.codeList.getCodeList(t.codeListId),e.codeListItems=await a.codeList.get(t.codeListId,this.context)),e}));if(i)return Promise.all(i)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=null==(e=this.dataEntity.appDEDataExports)?void 0:e.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=t=>{var e;const a=new Map;this.allExportColumns&&this.allExportColumns.length>0?null==(e=this.allExportColumns)||e.forEach((t=>{t.codeListItems&&a.set(t.appDEFieldId,t.codeListItems)})):Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&a.set(t,this.fieldColumns[t].codeListItems)}));const i=dt(t.map((t=>t.getOrigin())));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;a.get(e)&&(t[e]=(null==(i=a.get(e).find((a=>a.value===t[e])))?void 0:i.text)||t[e])}))})),i};let i=[],s=[];this.allExportColumns&&this.allExportColumns.length>0?(i=this.allExportColumns.map((t=>t.appDEFieldId)),s=this.allExportColumns.map((t=>t.caption))):(i=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.id)),s=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.caption)));const o=(r=i,(await(async()=>{var e;const i=null==(e=t.params)?void 0:e.type;let s=[];if("activatedPage"===i&&(s=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:o}=t.params,n="customPage"===i?{page:0,offset:(a-1)*e,size:(o-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:n})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new n("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await To(s,o,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:o,updateDV:n,updateDVT:r}=i.editItem,c=e?o:r,l=e?s:n,d=Ao({name:i.fieldName,valueType:c,defaultValue:l,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==d&&(a[i.fieldName]=d)})),a}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((a=>a.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.saveColumnStates()}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:this.initColumnStates()}changeColumnStateSort(t,e,a){const i=this.state.columnStates.find((e=>e.key===t));i&&(this.state.columnStates.splice(a,1),this.state.columnStates.splice(e,0,i),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}}),ur=t("GridFieldColumnController",class extends cr{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}async onInit(){await super.onInit(),this.loadCodeList=_(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new go;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new mo(t.id,this.grid.context.srfappid,e);a.addState(t.id,i)}})),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.model.codeName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:i}=this.model;if(!i)return{context:e,params:a};const{navigateContexts:s,navigateParams:o}=le(i);let n={};s&&t&&(n=ie(s,t,a,e));const r=Object.assign(e.clone(),n);let c={};o&&t&&(c=ie(o,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.model.codeName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:o}=this.model;if(!o)return;const n=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...n}),c=dt(this.params),{context:l,params:d}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Qs.TAG,o,l,d,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await xn.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:o}=this.model;if(rt(a)||"NONE"===a)return;const n=e||this.model.id;let r;if(t=t.filter((t=>!rt(t[n]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new i(this.model,"远程聚合暂未支持"):new i(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[n])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[n])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[n])));break;case"MIN":r=Math.min(...t.map((t=>t[n])));break;default:throw new i(this.model,"暂未支持属性列聚合模式".concat(a))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error("".concat(r," 值格式化错误"))}return c&&o&&(c+=o),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Co.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(d.isDate(this.dataType)){const t=ft(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const i=t.uiactionId;await xn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),mr=(t("GridUAColumnController",class extends cr{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new go;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new mo(t.id,this.grid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await xn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends ur{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}get fieldName(){return this.model.dataItemName}async onInit(){await super.onInit();const t=Ae(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Oa(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ca(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...vo(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...Do(this.editItem.editor)),this.rules.length>0&&(this.validator=new wt({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let i=!1;a&&a.length>0&&a.forEach((t=>{e.includes(t)&&(i=!0)})),i&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new n("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&Y(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:i}=a;return t.errors[e]=i[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends cr{}),t("ListService",class extends Ki{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new Vs(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new Vs(e,e);this.dataUIMap.set(e,i)}))}})),gr=(t("ListController",class extends _o{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new mr(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=a.get(e[t])||[];i.push(e),a.set(e[t],i)}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,i=[],s=ibiz.hub.getApp(this.context.srfappid),o=await s.codeList.get(e,this.context,this.params),n=[];o.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),n.push(e.value)}));const r=a.filter((e=>-1===n.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends Mo{constructor(t,e,a,i,s){super(t,e,a,i),this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var i,s;const o=await za(t);if(!o)return;e.providers[t.id]=o;const n=await o.createController(t,e,a);e.panelItems[t.id]=n,(null==(i=t.panelItems)?void 0:i.length)&&!n.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,n),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,n)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new n("未获取到面板数据");const i=this.convertData(a);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=i,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=Oe(this.model),a=e.map((t=>t.id)),i=new Us(e,t);return i._evt.on("change",(t=>{a.includes(t)&&this.dataChangeNotify([t])})),i}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),fr=(t("ViewLayoutPanelController",class extends gr{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),wr=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=he(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new fr(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const i=a.relatedItemNames||[];if(e||C(i,t))try{const t=Ye(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=pe(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=pe(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends Mo{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),i={...this.params};t&&Object.assign(a,ie(t,this.params,this.context)),e&&Object.assign(i,ie(e,this.params,this.context)),this.state.context=a,this.state.params=i}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),["ISNULL","ISNOTNULL"]),Er=t("SearchBarFilterController",class{constructor(t,e){var a;let i;this.model=t,this.searchBar=e,this.noEditor=!1,t.appDEFieldId&&(i=Ie(e.appDataEntity,t.appDEFieldId)),this.fieldName=i?i.codeName.toLowerCase():t.id,this.label=t.caption||(null==i?void 0:i.logicName)||t.id,this.valueOP=null==(a=t.defsearchMode)?void 0:a.valueOP,this.noEditor=this.valueOP?wr.includes(this.valueOP):!this.model.editor}get context(){return this.searchBar.context}get params(){return this.searchBar.params}async init(){if(!this.noEditor){if(!this.model.editor)throw new a(this.model,"缺少编辑器模型");this.editorProvider=await Oa(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Ir=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=await this.app.net.post("".concat(this.themeUrl,"/fetch_default"),{app_view_tag:this.viewTag,sort:"create_time,asc"});return t.ok&&(t.data=this.convertBackDataToFront(t.data)),t}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag});return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag})}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:t,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{id:t,theme_model:JSON.stringify(e),app_view_tag:this.viewTag,show:e.show})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[a]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),a)}async updateBatch(t){const e=this.convertFrontDataToBack(t),a=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(a),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.name&&(e.caption=t.name),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={appId:t.appId,app_view_tag:this.viewTag,id:t.id};return t.caption&&(e.name=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},yr="",vr={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Dr={};function Cr(t,e){if(t.enumSource)return{appId:yr,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Dr["".concat(t.type,"_").concat(e)]}Object.keys(vr).forEach((t=>{vr[t].forEach((e=>{if(wr.includes(e))return;const a="".concat(t,"_").concat(e);Dr[a]||("date"!==t||["IN","NOTIN"].includes(e)?Dr[a]={appId:yr,editorType:"TEXTBOX",id:a}:Dr[a]={appId:yr,editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends Mo{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.addSchemaFilters=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Ir(this.model,this.view.model.codeName),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups()}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await xo(this.model.appDataEntityId,this.context);if(!e)return;const a=await async function(t,e){var a;if(!t.properties)return[];const{properties:i}=t;if(!(Object.keys(i).length>0))return[];const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e,enumSource:i[t].enumSource})}));const o={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[];return s.forEach((t=>{const e=vr[t.type];e?e.forEach((e=>{t&&n.push({appId:yr,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:yr,valueOP:e},editor:Cr(t,e)})})):ibiz.log.error("未支持的类型",t.type)})),n}(e,this),i=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===a.findIndex((e=>{var a;return e.appDEFieldId===t.appDEFieldId&&(!(null==(a=t.defsearchMode)?void 0:a.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&i.push(t)})),a.length>0&&(this.model=dt(this.model),this.model.searchBarFilters=a.concat(...i),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data){const t=ie(je.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=this.getOriginFilterNodes(),this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(null==(t=this.searchBarFilters)?void 0:t.length)&&(this.searchBarFilters.forEach((t=>{const e=new Er(t,this);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.enableFilter)return;let t=!1,e=!1;if(r(this.state.filterNodes[0],(a=>{a.leaf&&(a.field&&a.valueOP&&!rt(a.value)?t=!0:e=!0)})),t&&!e){return[this.formatFilters(this.state.filterNodes[0])]}}formatFilters(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map((t=>this.formatFilters(t)))}}parseFilters(t){if("GROUP"===t.condtype)return{leaf:!1,logicType:"AND"===t.condop?"AND":"OR",children:(t.searchconds||[]).map((t=>this.parseFilters(t)))};if("DEFIELD"===t.condtype)return{leaf:!0,field:t.fieldname||null,valueOP:t.condop||null,value:t.value||null};throw new n("无效的condtype:".concat(t.condtype))}getOriginFilterNodes(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}async initSearBarGroups(){if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const a={...t,saved:!1,show:!0,searchGroupData:{},order:100*(e+1)};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(a.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(a.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(a.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(a.show="1"===e.valid_flag)}catch(e){ibiz.log.error("".concat(t.data,"非标准JSON格式:"),e)}return a})));const t=await this.service.fetch();t.ok&&t.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.id===t.id));if(e)b(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,a)=>e.order>this.state.searchBarGroups[t].order?a:t),0);this.state.searchBarGroups.push({appId:this.context.srfappid,saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)}))}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:this.calcFilters(),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success("保存成功");else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem.id,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.id===e.data.id));t&&(t.saved=!0),ibiz.message.success("保存成功")}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(b(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>this.parseFilters(t)));this.state.filterNodes=e}else this.state.filterNodes=this.getOriginFilterNodes();this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}}),t("TabExpPanelController",class extends Mo{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&Eo(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);!0===e&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:i,navigateParams:s,appDataEntityId:o}=t,n={deName:ge(o),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:l}=re(n,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...l}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}});var Ar=t("TreeService",class extends Ki{async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ce(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:a});if(0===s.length)return;(await ma(s.map((async a=>{const i=De(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=ve(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,n)];break;case"DE":r=await this.getDENodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{var a;if(l&&(!c||c&&0===e)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,a,i){return new _s(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:o,parentFilter:n,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,l={...a.params},d={...a.context,...(null==e?void 0:e._context)||{}};let h,p,u,m={};if(e){h=e;for(let t=1;t<i;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=De(this.model,h._nodeId);t.appDataEntityId&&(u=ge(t.appDataEntityId)),p=h._value}const{resultContext:g,resultParams:f}=re({deName:u,navFilter:n?"n_".concat(n.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:o,navContexts:s},{derValue:p,context:d,params:l,data:m});return Object.assign(d,g),Object.assign(l,f),{context:d,params:l,navContext:g,navParams:f}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:l}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const d=await this.app.deService.exec(o,s,n,r);if(d.data.length){return d.data.map((e=>new Ms(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:l})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,o);if(c.length){return c.map((e=>new Os(t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}}),br=t("TreeController",class extends _o{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),a=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new Fn(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async initService(){this.service=new Ar(this.model),await this.service.init(this.context)}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Ce(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var a;if(null==(a=t.parentDER1N)?void 0:a.pickupDEFName){const a=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&e.push({minorEntityId:a.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const a=t.decontextMenu;if(null==(e=null==a?void 0:a.detoolbarItems)?void 0:e.length){let e=0;const i=[];r(a,(t=>{if("DEUIACTION"===t.itemType){e+=1;const a=t;200===a.actionLevel&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:i[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let a;e&&await this.startLoading();try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;let i;this.state.isLoading=!0;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=i:this.state.rootNodes=i,await this.afterLoadNodes(i),i}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var a;const i=null==(a=this.contextMenuInfos[t._nodeId])?void 0:a.clickTBUIActionItem;if(i)return this.doUIAction(i.uiactionId,t,e,i.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e._id!==t._id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t._id);if(e&&!a)this.state.expandedKeys.push(t._id);else if(!e&&a){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),a=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(a)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,a,i){const s=this.getEventArgs(),o=this.parseTreeNodeData(e),n=await xn.exec(t,{...s,...o,event:a},i);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){return{data:[{...t,...t._deData||{}}],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var a;(null==(a=t._children)?void 0:a.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"_id",i=this.state.items.find((e=>e[a]===t[a]));if(!i)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{_parent:t}=i;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?i._parent:i,o=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:o})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const a=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==a.length&&await Promise.all(a.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,a){var i,s;const o=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,o.appDataEntityId);if((null==(i=t._parent)?void 0:i._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,o.appDataEntityId)}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return null==a?void 0:a.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,i){var s,o,n;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),l="inner"===i?e:e._parent,d=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(o=e._parent)?void 0:o._id)!==(null==(n=t._parent)?void 0:n._id)){const e=this.findDropNodeRS(l._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=l._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const p=t._parent._children;if(p.splice(p.indexOf(t),1),"inner"===i)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let a=l._children.indexOf(e);"next"===i&&(a+=1),l._children.splice(a,0,t)}("inner"===i||d)&&(t._parent=l,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([l]));const{sortAppDEFieldId:u,sortDir:m,allowOrder:g}=h;if(!0===g){if(!u)throw new a(h,"缺少配置排序属性");const e=u.toLowerCase(),i="ASC"===m,s=[...l._children];i||s.reverse();const o=t=>t+(100-t%100),n=t=>t[e]||0;let c;s.forEach(((a,i)=>{const l=a._deData;void 0===c?a===t&&(c=0===i?100:o(n(s[i-1]._deData)),l[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=n(l)&&(l[e]=o(c),r.push(a)),c=n(l))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:d})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const a=this.getNodeModel(t._nodeId),i=t._deData,s=ge(a.appDataEntityId),o=this.context.clone();o[s]=i.srfkey;const n=await e.deService.exec(a.appDataEntityId,"update",o,i);n.data&&(t._deData=n.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if(!t._deData)throw new n("不是实体树节点数据");t._text=e,t._deData[i.textAppDEFieldId]=e,await this.updateDeNodeData([t])}}),Pr=t("WizardPanelService",class extends ji{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}}),Tr=(t("WizardPanelController",class extends Mo{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,i;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),o=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),n=null==o?void 0:o.stepTag;this.stepTags[s]=n})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Pr(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await Sa(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new n("找不到".concat(t,"的表单控制器"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const i=await a.load();Object.assign(this.formData,i)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=ge(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new n("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new n("找不到标识为".concat(t,"的向导表单"));return a}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,{},this.params),e=ge(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new n("没有上一个表单");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,a=this.model.dewizard.dewizardForms;if(t&&a){const a=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),i=t[a+1];if(!i)throw new n("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new n("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends Ki{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new Vs(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new Vs(e,e);this.dataUIMap.set(e,i)}))}})),xr=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Nr=(t("MDCtrlController",class extends _o{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new Tr(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new xr(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new xr(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const i=t.uiactionId;await xn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new go;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new mo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.data.getOrigin()),t.uaColStates[e.id]=i}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(new xr(e,this)))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(new xr(e,this))}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}}),t("KanbanService",class extends Un{async updateGroup(t,e){var a;const i=(null==(a=this.model.updateGroupControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}})),Sr=(t("KanbanController",class extends Bn{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new Nr(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:i}=this.model;if(!e)throw new a(this.model,"排序属性没配置");if(!i)throw new a(this.model,"排序方向没配置");const s="ASC"===i;t.forEach((t=>{const a=t[e];if(rt(a))t[e]=0;else{const e=Number(a);if(Number.isNaN(e))throw new n("".concat(t.srfmajortext,"的排序属性无法转换成数值"))}})),t.sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e]))}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,a){this.setSelectGroup(a.key),super.onGroupToolbarClick(t,e,a)}async onGroupActionClick(t,e,a,i){this.setSelectGroup(i.key);const s={...this.params,srfgroup:i},o=t.uiactionId;await xn.execAndResolved(o,{context:this.context,params:s,data:[e],view:this.view,event:a},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new n("看板部件必须开启分组");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));i.push({caption:a.text,color:a.color,key:a.value,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=o}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning("当前看板不允许调整分组!");const e="ASC"===this.model.minorSortDir,{from:a,to:i,fromIndex:s,toIndex:o}=t,n=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],l=this.state.groups.find((t=>t.key===a)),d=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=l.children[s];return e[n]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),p=[...d.children],u=[...d.children],m=l.children[s];t.from!==t.to?(m[n]=t.to,u.splice(o,0,m)):(u.splice(s,1),u.splice(o,0,m));const g=l.children.splice(s,1);let f;d.children.splice(o,0,...g),e||(p.reverse(),u.reverse());let w,E=[];u.forEach(((t,e)=>{void 0===f?t!==p[e]&&(f=p[e]?p[e][r]||100:0===e?100:h(p[e-1][r]),t[r]=f,c.push(t)):(f>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),f=w,w=0,E=[]),t[r]=h(f),c.push(t)):(0===E.length&&(w=f),E.push(t)),f=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=ge(this.model.appDataEntityId),a=this.context.clone();a[e]=t.srfkey;const i=await this.service.updateGroup(a,t);if(i.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,i.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,a){const i=this.state.groups.find((e=>e.key===t));i&&(i[e]=a)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const a=t.split("quicktoolbar_")[1];this.setGroupController(a,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const a=t.split("batchtoolbar_")[1];this.setGroupController(a,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends Ar{})),Lr=t("TreeGridExRowState",class{constructor(t,e){this.uaColStates={},this.data=t,Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)}))}}),Rr=t("TreeGridExController",class extends br{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={}}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new Sr(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await gi(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=a:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=a)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,a)=>{t.uaColumn&&(t.fixed=a+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new Lr(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}}),Or=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}}),Mr=(t("TreeGridExFieldColumnController",class extends Or{}),t("TreeGridExUAColumnController",class extends Or{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new go;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new mo(t.id,this.treeGrid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await xn.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}}),t("TreeGridController",class extends pr{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const i=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!i)throw new a(this.model,"树表格无值列模式");if(!s)throw new a(this.model,"树表格无父值列模式");this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=i.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends dr{}),t("MEditViewPanelService",class extends Ki{})),_r=(t("MEditViewPanelController",class extends _o{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new Mr(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const i=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);this.parameters=a&&i?[{parameterName:null==(t=i.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=i.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,a),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===a.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,a={id:t[e]?t[e]:"mockId:".concat(Q()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:i,pathName:s}=e;t[i]&&!Object.is(t[i],"")&&Object.assign(a.context,{[s]:t[i]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(a,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(a,{srfmajortext:"草稿--新建"})})),a}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex((t=>t.id===e));if(a<0)throw new n("编辑视图面板部件UI数据不存在");const i=this.state.panelUiItems[a];i.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):i.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),t("MapService",class extends Ki{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const i=[];if(null==(a=this.model.sysMapItems)?void 0:a.length){const a=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:o,appDEDataSetId:n,customCond:r}=s,c=t.clone(),l={...e};if(r){const a=je.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=le(a);i&&Object.assign(c,ie(i,e,t)),s&&Object.assign(l,ie(i,e,t))}}const d=await a.deService.exec(o,n,c,l);d.data&&i.push(...d.data.map((t=>new Ws(t,s))))})))}return new u(i,200)}})),Vr=(t("MapController",class extends _o{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new _r(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);a.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(a,i);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),i=[],s=[];return a.forEach((t=>{"REGION"===t._itemStyle?i.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=i,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const a=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=a;break;case"strareacode":this.state.strAreaCode="true"===a;break;case"jsonbaseurl":this.state.jsonBaseUrl=a}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends ji{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(null==(a=this.dataEntity.codeName2)?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let s=await ibiz.net.request(i,{method:"post",data:e});return s=this.handleResponse(s),s}})),Fr=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},kr=class extends Fr{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},Wr=class extends Fr{},Ur=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new kr(t);case"USER2":return new Wr(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},Br=(t("ReportPanelController",class extends Mo{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=Ur.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new Vr(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam),i=await this.service.fetch(e,a);this.state.data=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),t("GanttService",class extends Ar{execDeService(t,e,a,i){return this.app.deService.exec(t,e,a,i)}async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ce(this.model,{parentId:t._nodeId,hasQuery:a});if(0===s.length)return;(await ma(s.map((async a=>{const i=De(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=ve(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,n)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:l,rootNode:d}=t,h=d&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{if(l&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new Gs(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:l}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const d=await this.app.deService.exec(o,s,n,r);if(d.data.length){return d.data.map((e=>new js(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:l})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,o);if(c.length){return c.map((e=>new Ks(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}})),zr=(t("GanttController",class extends Rr{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new Br(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}transformNodeDataItem(t,e){var a;const i={};return null==(a=t.detreeNodeDataItems)||a.forEach((t=>{t.id&&t.appDEFieldId&&e.hasOwnProperty(t.id.toLowerCase())&&Object.assign(i,{[t.appDEFieldId.toLowerCase()]:e[t.id.toLowerCase()]})})),i}async updateNodeData(t,e,a=!1){const i=t.srfkey?"srfkey":"_id",s=this.state.items.find((e=>e[i]===t[i]));if(!s||!s.srfkey)return void ibiz.log.error("找不到对应的动态实体树节点数据",t);const o=this.getNodeModel(s._nodeId);if(o){const i=a?this.transformNodeDataItem(o,e):e;if(Object.keys(i).length>0){const e=ge(o.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(o.appDataEntityId,"update",a,i)).status&&this.refreshNodeChildren(t,!0)}}}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),Gr=class{constructor(){this.convert=new ao,this.controller=new zr,this.appMap=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new so,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId){const a=this.calcAppViewId(t);this.view2appMap.set(a,e)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(t),t}throw new n("视图[".concat(e,"]不存在"))}async loadAppView(t,e,a){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,a)}throw new n("视图[".concat(e,"]不存在"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return a=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new n("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new n("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new to(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new Mi(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,a){return(await this.getAppAsync(t)).deService.getService(a,e)}reset(){this.appMap.clear(),this.configCache=void 0}},jr=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:i}=t,s="".concat(i,"_").concat(a),o=this.viewEngines.get(s);if(o)return o(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),Kr=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:i}=this.view;ibiz.log.debug("".concat(a.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_header;e&&(e.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_footer;t&&(t.state.visible=!1)}}}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,i;let s=!1;const{model:o}=this.view;if(!1===o.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else s=!0;if(ibiz.env.isMob){if(this.leftToolbar)s=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)s=!0;else{const t=null==(a=this.viewLayoutPanel)?void 0:a.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)s=!0;else{const t=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;t&&(t.state.visible=!1)}return s}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:i}=this.view;if(!t)throw new n("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),o=await s.deService.exec(t,"get",a,i),{data:r}=o;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Xr=(t("MDViewEngine",class extends Kr{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?this.openData(e):"New"===t?this.newData(e):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Search"===t?(await this.searchForm.search(),null):"Reset"===t?(await this.searchForm.reset(),null):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,i;const{data:s,event:o}=t,n=(t.context||this.view.context).clone(),r=t.params||this.view.params;n[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||ge(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:n,params:r,data:s,event:o,view:this.view}));if(-1===c)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!c.ok}}async newData(t){var e,i,s;const{data:o,event:n,copyMode:r}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=dt(this.view.params);r&&(c.srfcopymode=r);const l=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:o,event:n,view:this.view}));if(-1===l)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!l.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){let t=super.calcViewHeaderVisible();if(this.searchBar&&this.searchBar.state.visible)t=!0;else{const t=this.viewLayoutPanel.panelItems.view_searchbar;t&&(t.state.visible=!1)}return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),class{constructor(){this.layoutPanel=new qe,this.theme=new da,this.text=new la,this.hbs=new ee,this.rawValue=new ua,this.action=xn,this.error=new Ot,this.error.register(new Rt)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}}),Hr=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new n("Method not implemented.")}destroy(){}},Yr=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},qr=class extends Hr{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const i=this.logic.scriptCode;this.scriptFn=je.createScriptFn(t,i,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Qr=class extends Hr{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Tn(e,i,t)}},Jr=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),ut(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const i={itemName:t,triggerType:e},s=this.triggerAndExecute(i,a);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const i=this.getExecuteParams(e);return a.execute(i)}triggerControlEvent(t,e,a){const i={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(i,a)}},$r=class extends Jr{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Zr=class extends Jr{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},tc=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}},ec=class{constructor(){this.executorFactory=new Yr,this.triggerFactory=new tc}createViewScheduler(t){return new Zr(t)}createControlScheduler(t){return new $r(t)}},ac=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new n("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},ic=class extends ac{},sc=class extends ac{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new n("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:i}=t;return{context:e,params:a,data:(null==i?void 0:i[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(a=this.logic.itemName)?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},oc=class extends ac{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new a(this.logic,"定时器缺少定时间隔");this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new n("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},nc=class extends Hr{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:i,params:s,...o}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new n("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const d=c.navigateContexts||[],h=Object.assign(i,ie(d,r[0],s,i));let p={};const u=c.navigateParams;return H(u)&&(p=ie(u,r[0],s,i)),ibiz.commands.execute(Qs.TAG,l,h,p,o)}async calcOpenViewRef(t,e){const i=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=i.formTypeAppDEFieldId||i.dataTypeAppDEFieldId;if(!s)throw new a(t,"".concat(i.codeName,"[多表单实体] or [索引实体]缺少类型属性配置"));const{data:o}=e,r=o[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,l=null==c?void 0:c.find((t=>t.refMode===r));if(!l)throw new n("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return l}async executeNewDataAppUILogic(t,e){const{context:s,params:o,...n}=e,{data:r,view:c}=e,{enableWizardAdd:l,enableBatchAdd:d,batchAddOnly:h,newDataAppView:p}=t;let u;if(l){if(u=await this.getWizardNewViewRef(t,e),!u)return{ok:!1}}else if(d){const e=ge(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(u=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!u)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(u=p,!u||!u.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},g={};const f=(null==r?void 0:r[0])||{},w=u.navigateContexts;H(w)&&(m=ie(w,f,o,s)),m=Object.assign(s,m);const E=u.navigateParams;if(H(E)&&(g=ie(E,f,o,s)),o.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const I=await ibiz.commands.execute(Qs.TAG,u.refAppViewId,m,g,n);return d&&I.data&&await this.doBatchAdd(t,I.data,s,u,e.view),I}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:o}=t,{context:r,params:c,...l}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const d=await ibiz.commands.execute(Qs.TAG,s.refAppViewId,r,c,{...l,openMode:"POPUPMODAL"});if(!d.ok)return;const h=null==(i=d.data)?void 0:i[0];if(!h)throw new n("请选中一条数据");const p=h.srfkey,u=null==o?void 0:o.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===p.toUpperCase()}));if(!u)throw new n("没有找到与索引类型".concat(p,"相关的实体的编辑视图"));return u}async doBatchAdd(t,e,i,s,o){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),l=c.minorAppDERSs,d=s.refMode.toLowerCase();if(!l)throw new a(c,"实体没有从关系集合!");let h="";if(null==l||l.forEach((t=>{const e=ge(t.majorAppDataEntityId);d===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new n("没有找到".concat(d,"在当前实体的外键属性"));const p={srfkey:h},u=null==(r=o.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(u){const t=u.value.split(",");for(const e of t){const[t,a]=e.split(":");t&&a&&(p[t]=a)}}ibiz.log.debug("批量新建转换映射属性",p);const m=e.map((t=>{const e={};return Object.keys(p).forEach((a=>{const i=p[a];e[i]=t[a]})),e}));ibiz.log.debug("批量新建创建数据",m);const g=ibiz.hub.getApp(i.srfappid).deService;await g.exec(c.id,"Create",i,m)}}},rc=class extends ac{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>sa[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},cc=class extends ac{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>na[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},lc=class extends Hr{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");xn.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Et.dirname(this.url.pathname)}dir(t){return this.url.origin+Et.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=a,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));
1
+ System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var a,i,s,o,n,r,c,d,l,h,u,p,m,f,g,w,E,y,v,I,D,C,A,b,P,T,x,N,S,L,R,O,M,_,V,F,k,W,U,z,B,G,j,K,X,H,Y,q,Q,J,$,Z,tt,et,at,it,st,ot,nt,rt,ct,dt,lt,ht,ut,pt,mt,ft,gt,wt,Et;return{setters:[function(t){a=t.RuntimeModelError,i=t.ModelError,s=t.HttpError,o=t.NoticeError,n=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.IBizContext,l=t.DataTypes,h=t.clone,u=t.CoreConst,p=t.HttpResponse,m=t.updateKeyDefine,f=t.Net,g=t.getToken,w=t.NOOP,E=t.IBizParams,y=t.isElementSame,v=t.findRecursiveChild,I=t.StringUtil,D=t.debounceAndAsyncMerge,C=t.isOverlap,A=t.BitMask,b=t.mergeInLeft,P=t.awaitTimeout,T=t.mergeDefaultInLeft,x=t.plus,N=t.toNumberOrNil},function(t){S=t.isEmpty,L=t.isString,R=t.isArray,O=t.isObject,M=t.isNil,_=t.debounce,V=t.camelCase,F=t.eq,k=t.gt,W=t.gte,U=t.findIndex,z=t.lt,B=t.lte,G=t.upperFirst,j=t.snakeCase,K=t.kebabCase,X=t.isFunction},function(t){H=t.notNilEmpty,Y=t.isNilOrEmpty,q=t.AsyncSeriesHook,Q=t.createUUID,J=t.QXEvent,$=t.isArray,Z=t.getCookie,tt=t.setCookie,et=t.clearCookie,at=t.ascSort,it=t.descSort,st=t.clearAll,ot=t.isNumber},function(t){nt=t.default},function(t){rt=t.isNil,ct=t.mergeRight,dt=t.isEmpty,lt=t.clone,ht=t.equals,ut=t.where,pt=t.mergeLeft,mt=t.isNotNil,ft=t.mergeDeepRight},function(t){gt=t.default},function(t){wt=t.default},function(t){Et=t.default}],execute:function(){t({asyncImportData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(xo);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));const o=await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}});await(n=o.data.asyncacitonid,new Promise((t=>{const e=a=>{const i=a.messageid||a.data.asyncacitonid;if(n!==i)return;const s=a.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED");var n},calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:a}=t;let i;if(e||a){switch(i={display:"flex"},e){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(a){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:fe,calcDynaClass:ue,calcGridLayoutPos:function(t){const{layout:e,colXS:a,colXSOffset:i,colSM:s,colSMOffset:o,colMD:n,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,a)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:a&&-1!==a?a:void 0});return{xs:l(a,i),sm:l(s,o),md:l(n,r),lg:l(c,d)}},calcLayoutHeightWidth:he,calcMainStateOPPrivsStrs:me,calcNavParams:re,calcResPath:Li,compare:ke,compareNumber:We,contains:Ue,convertNavData:ie,convertNavDataByArray:oe,convertObjectToNavParams:ae,execDELogic:Ds,execDELogicAction:As,execDELogicById:Cs,execFieldLogics:Ps,execUILogic:Sn,exportData:So,fieldValueToBoolean:Oi,filterFieldLogics:Ee,filterValueRules:ca,findChildFormDetails:be,findDELogic:we,findEditItem:Ae,findFieldById:ye,findModelChild:ce,formatMultiData:ne,generateEditorRules:bo,generateRules:Ao,getAllPanelField:Oe,getAppCounterProvider:xa,getAppMenuItemProvider:yi,getAppViewRef:function(t,e){var a,i;let s=t.appViewRefs||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(a=t,ibiz.register.get("".concat(ei,"_").concat(a)));var a;if(e)return e;throw new n("找不异步操作类型".concat(t,"对应的适配器"))},getChildNodeRSs:Ce,getControl:function(t,e){var a,i;let s=t.controls||[];(null==(i=null==(a=t.viewLayoutPanel)?void 0:a.controls)?void 0:i.length)&&(s=s.concat(t.viewLayoutPanel.controls));return s.find((t=>t.name===e||t.codeName===e||t.id===e))},getControlPanel:le,getControlProvider:La,getControlsByView:Te,getDEMethodProvider:pi,getDERedirectToView:Ve,getDeACMode:async function(t,e,a){var i;const s=await ibiz.hub.getAppDataEntity(e,a);return null==(i=s.appDEACModes)?void 0:i.find((e=>e.id===t))},getDefaultValue:To,getEditorProvider:Ma,getEntitySchema:Lo,getFormDetailProvider:Fa,getGridColumnProvider:Ua,getMatchResPath:Si,getOriginData:Co,getPFPlugin:function(t,e){const i=ibiz.hub.getApp(e);if(!i)throw new a(i,"未找到应用");const{model:s}=i;if(!s.appPFPluginRefs)throw new a(s,"应用未配置插件");const o=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!o)throw new Error("未找到插件".concat(t));return o},getPanelItemProvider:Ga,getPlatformProvider:di,getPlatformType:oi,getPortletProvider:Xa,getRootNode:Ie,getTreeGridExColumnProvider:gi,getTreeNode:De,getUIActionById:ve,getUIActionItemsByActionLevel:function(t,e){const a=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const i=t;i.actionLevel===e&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),a},getUIActionProvider:Qa,getUILogicNodeProvider:$a,getViewEngines:Ne,getViewLogics:xe,getViewProvider:async function(t){let e;const{viewType:a,viewStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Aa(s,o);if(t&&(e=ti(t)),e)return e;ibiz.log.error("找不到视图插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=ti("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到视图类型:[".concat(a,"]的视图样式:[").concat(i,"]对应的适配器"),t)}e||(e=ti(a));e||(e=ti("DEFAULT"));return e},getWFContext:Qe,getWFSubmitViewId:function(t,e){var a;const{type:i,sequenceflowview:s,sequenceflowmobview:o}=e,n=(null==(a=t.viewLayoutPanel)?void 0:a.appViewRefs)||t.appViewRefs,r=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?o:s),c=null==n?void 0:n.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:fa,hasDeCodeName:ge,hasSubRoute:Io,importData:async function(t,e,a){const i=new FormData;i.append("file",t);let s="".concat(e.codeName2.toLowerCase(),"/").concat(No);(null==a?void 0:a.codeName)&&(s+="?srfimporttag=".concat(a.codeName));return(await ibiz.net.request(s,{method:"post",data:i,headers:{"Content-Type":"multipart/form-data"}})).data},install:function(){const{ibiz:t}=window;t.util=new Qr,t.hub=new Hr,t.register=new Lt,t.config=new St,t.auth=new qi,t.asyncAction=new Qi,t.engine=new Yr,t.uiDomainManager=new pa,eo(),kn(),Rs(),Ci(),ibiz.scheduler=new oc,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new cc(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new cc(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new cc(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new dc(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new rc(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new hc(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new uc(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Zr(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new tc(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new tc(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new lc(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new pc(t,e))),function(){const t=new ii;ri("Browser",(()=>t))}(),t.platform=di()},installCommand:eo,isDataContainer:Se,isFormDataContainer:Pe,isValueChange:Do,matchMainState:pe,openRedirectView:Me,parseUserParams:de,presetAppCounterProvider:Ci,presetDEMethodProvider:Rs,presetUIActionProvider:kn,registerAppCounterProvider:Pa,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(wi,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ei,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(Na,"_").concat(t),e)},registerDEMethodProvider:hi,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ra,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(_a,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(ka,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(za,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ri,registerPortletProvider:function(t,e){ibiz.register.register("".concat(ja,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(mi,"_").concat(t),e)},registerUIActionProvider:Ya,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(Ja,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(Za,"_").concat(t),e)},strContain:ze,testCond:Fe,toLocalOpenWFRedirectView:async function(t,e,a={}){const i=await _e(t,e,a);await ibiz.commands.execute($s.TAG,i.viewId,i.context,i.params,i.opts)},verifyDeRules:Ke,verifyFormGroupLogic:He,verifyPanelGroupLogic:Ye});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function yt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vt={exports:{}};!function(t,e){t.exports=function(t,e,a){var i=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var a;1===e.length&&e[0].length>0&&(e=e[0]),a=(e=e.filter((function(t){return t})))[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][t](a)||(a=e[i]);return a};a.max=function(){var t=[].slice.call(arguments,0);return i("isAfter",t)},a.min=function(){var t=[].slice.call(arguments,0);return i("isBefore",t)}}}(vt);var It=yt(vt.exports),Dt={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(Dt);var Ct=yt(Dt.exports),At={exports:{}};!function(t,e){var a,i;t.exports=(a="month",i="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var o=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===i?this.add(3*t,a):o.bind(this)(t,e)};var n=s.startOf;s.startOf=function(t,e){var s=this.$utils(),o=!!s.u(e)||e;if(s.p(t)===i){var r=this.quarter()-1;return o?this.month(3*r).startOf(a).startOf("day"):this.month(3*r+2).endOf(a).endOf("day")}return n.bind(this)(t,e)}})}(At);var bt=yt(At.exports),Pt={exports:{}};!function(t,e){var a,i;t.exports=(a="week",i="year",function(t,e,s){var o=e.prototype;o.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var o=s(this).startOf(i).add(1,i).date(e),n=s(this).endOf(a);if(o.isBefore(n))return 1}var r=s(this).startOf(i).date(e).startOf(a).subtract(1,"millisecond"),c=this.diff(r,a,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},o.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Pt);var Tt=yt(Pt.exports),xt={exports:{}};!function(t,e){var a;t.exports=(a="day",function(t,e,i){var s=function(t){return t.add(4-t.isoWeekday(),a)},o=e.prototype;o.isoWeekYear=function(){return s(this).year()},o.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),a);var e,o,n,r=s(this),c=(e=this.isoWeekYear(),n=4-(o=(this.$u?i.utc:i)().year(e).startOf("year")).isoWeekday(),o.isoWeekday()>4&&(n+=7),o.add(n,a));return r.diff(c,"week")+1},o.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var n=o.startOf;o.startOf=function(t,e){var a=this.$utils(),i=!!a.u(e)||e;return"isoweek"===a.p(t)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(t,e)}})}(xt);var Nt=yt(xt.exports),St=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0}}},Lt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const a=this.providers.get(t);if(a)return a(...e)}}),Rt=t("DefaultErrorHandler",class{handle(t){return t instanceof a||t instanceof i?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error("没有注册无权限错误处理器"):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof o?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof n&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Ot=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error("没有找到能处理该错误的处理器",t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),Mt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,a){return a.fn?e?a.fn(t):a.inverse(t):e?a.hash.yes=!0:a.hash.no=!1}};Mt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var _t=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},Vt=class extends _t{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const a=t.filter((t=>!!t)).length===t.length;return Mt.handleJudgmentExecute(this,a,e)}},Ft=class extends _t{constructor(t){super(t,"camelCase")}onExecute(t){return t?V(t):""}},kt=class extends _t{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Wt=class extends _t{constructor(t){super(t,"eq")}onExecute(t,e,a){const i=F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ut=class extends _t{constructor(t){super(t,"gt")}onExecute(t,e,a){const i=k(t,e);return Mt.handleJudgmentExecute(this,i,a)}},zt=class extends _t{constructor(t){super(t,"gte")}onExecute(t,e,a){const i=W(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Bt=class extends _t{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,a,i){let s=!1;return s=R(t)?!F(U(t,(t=>F(t[e],a))),-1):t.hasOwnProperty(e)&&(s=F(t[e],a)),Mt.handleJudgmentExecute(this,s,i)}},Gt=class extends _t{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},jt=class extends _t{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Kt=class extends _t{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},Xt=class extends _t{constructor(t){super(t,"lt")}onExecute(t,e,a){const i=z(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Ht=class extends _t{constructor(t){super(t,"lte")}onExecute(t,e,a){const i=B(t,e);return Mt.handleJudgmentExecute(this,i,a)}},Yt=class extends _t{constructor(t){super(t,"neq")}onExecute(t,e,a){const i=!F(t,e);return Mt.handleJudgmentExecute(this,i,a)}},qt=class extends _t{constructor(t){super(t,"not")}onExecute(t,e){const a=Handlebars.Utils.isEmpty(t);return Mt.handleJudgmentExecute(this,a,e)}},Qt=class extends _t{constructor(t){super(t,"or")}onExecute(...t){var e;const a=t[t.length-1];t.pop();const i=t.find((t=>!!t));if(a.fn){const t=(null==(e=a.data)?void 0:e.root)||{};return i?a.fn(t):a.inverse(t)}return i||""}},Jt=class extends _t{constructor(t){super(t,"pascalCase")}onExecute(t){return t?G(t):""}},$t=class extends _t{constructor(t){super(t,"snakeCase")}onExecute(t){return t?j(t):""}},Zt=class extends _t{constructor(t){super(t,"spinalCase")}onExecute(t){return t?K(t):""}},te=class extends _t{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var ee=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var a;return this.hsb=t.default||t,this.p=null,a=this.hsb,new Vt(a),new Ft(a),new kt(a),new Wt(a),new Ut(a),new zt(a),new Gt(a),new jt(a),new Kt(a),new Xt(a),new Ht(a),new Yt(a),new qt(a),new Qt(a),new Jt(a),new $t(a),new Zt(a),new te(a),new Bt(a),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error("handlebars not init");return this.hsb.compile(t)(e)}});function ae(t){const e=[],a=/^%(.+)%$/;for(const i in t){let s=!0,o=t[i];H(t[i])&&a.test(t[i])&&(s=!1,o=t[i].substring(1,t[i].length-1)),e.push({key:i.toLowerCase(),rawValue:s,value:o})}return e}function ie(t,...e){if(!t||S(t))return{};return oe(Array.isArray(t)?t:ae(t),...e)}function se(t,e){const a=t.find((t=>!Y(t)&&(t[e]||Object.prototype.hasOwnProperty.call(t,e))));return{find:!!a,value:null==a?void 0:a[e]}}function oe(t,...e){const a=/\$\{[^}]*\}/g,i={};for(const s of t)if(s.rawValue)i[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(a);if(null!==t){let a=s.value;t.forEach((t=>{const{find:i,value:s}=se(e,t.slice(2,-1).toLowerCase());i&&(a=a.replace(t,"".concat(s)))})),i[s.key.toLowerCase()]=a}else{const{find:t,value:a}=se(e,s.value.toLowerCase());t&&(i[s.key.toLowerCase()]=a)}}return i}function ne(t,e){const a={};if(!t)return a;const i=Array.isArray(t)?t:ae(t),s=e[0];return i.forEach((t=>{const{rawValue:i,value:o}=t;!i&&o&&Object.prototype.hasOwnProperty.call(s,o)&&(a[o]=e.map((t=>t[o])).join(";"))})),a}function re(t,e){const{deName:a,navFilter:i,pickupDEFName:s,navContexts:o,navParams:n}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(a&&(h[a]=p),i&&(u[i]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=ie(o,d,c,r),f=ie(n,d,c,r);return Object.assign(h,m),Object.assign(u,f),{resultContext:h,resultParams:u}}function ce(t,e){if(t&&e){const a=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(a)return a}return null}function de(t){const e={},a={},i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const o=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(a,{[t[1]]:o});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:o});break;default:Object.assign(i,{key:o})}}}return{navigateContexts:e,navigateParams:a,other:i}}function le(t){let e;if(t.controlRenders){const a=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==a?void 0:a.layoutPanel}return e}function he(t){const{width:e,height:a,widthMode:i,heightMode:s}=t,o={width:"",height:""};return"FULL"===i?o.width="100%":e&&e>0&&(o.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===i?"%":"px")),"FULL"===s?o.height="100%":a&&a>0&&(o.height=a>0&&a<=1?"".concat(100*a,"%"):"".concat(a,"PERCENTAGE"===s?"%":"px")),o}function ue(t,e){const a=[],i=je.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return L(i)?a.push(i):R(i)?a.push(...i):O(i)&&Object.keys(i).forEach((t=>{i[t]&&a.push(t)})),a}function pe(t,e){const{mainStateAppDEFieldIds:a,demainStates:i}=t;if(a&&i){const t=[];return a.forEach((a=>{t.push(e[a])})),i.find((e=>{const{stateValue:a,state2Value:i,state3Value:s}=e;let o=!0;const n=[a,i,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(n[e])){o=!1;break}return o}))}}function me(t,e){const a=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:i,opprivAllowMode:s}=t,o=(null==i?void 0:i.map((t=>t.name)))||[];let n=[];if(s)n=o;else{n=[...a.deopprivs,...e.deopprivs].filter((t=>!o.includes(t.name))).map((t=>t.name))}return n}function fe(t){return t.split(".").pop()}function ge(t,e){const a=fe(e);return H(t[a])}function we(t,e){var a;return null==(a=e.appDELogics)?void 0:a.find((e=>e.id===t))}function Ee(t,e){var a,i;const s=[];return null==(a=t.appDEFields)||a.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(i=t.appDELogics)?void 0:i.filter((t=>s.includes(t.id))))||[]}function ye(t,e){var a;return null==(a=t.appDEFields)?void 0:a.find((t=>t.id===e))}async function ve(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Ie(t){return t.detreeNodes.find((t=>t.rootNode))}function De(t,e){return t.detreeNodes.find((t=>t.id===e))}function Ce(t,e){const a=e.parentId||Ie(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===a&&(i=t.searchMode,s=e.hasQuery,3===i||(s?1===i:2===i));var i,s}))}function Ae(t,e){var a;return null==(a=t.degridEditItems)?void 0:a.find((t=>t.codeName===e))}function be(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Pe(t){return"MDCTRL"===t.detailType}function Te(t){const{viewLayoutPanel:e}=t,a=t.controls||[];return e&&a.push(...e.controls||[]),a}function xe(t){const{viewLayoutPanel:e}=t,a=t.appViewLogics||[];return e&&a.push(...e.appViewLogics||[]),a}function Ne(t){const{viewLayoutPanel:e}=t,a=t.appViewEngines||[];return e&&a.push(...e.appViewEngines||[]),a.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn("未支持的引擎分类:".concat(t.engineType)),!1)))}function Se(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Le=["panelItems","panelTabPages","rootPanelItems"];function Re(t){let e=[];for(const a of Le)if(t[a]){e=t[a];break}const a=[];return e.length&&(a.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Se(t)||a.push(...Re(t))}))),a}function Oe(t){return Re(t)}async function Me(t,e,a={},i={}){return async function(t,e,a={},i={}){let s;try{s=await Ve(t,e,a,i)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const a=window.open(t,"_blank");a&&(a.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute($s.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,a,i)}async function _e(t,e,a={}){const i=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(i+1,e.length)),o=nt.parse(s,{delimiter:";"}),r=o.srfdename||"";if(!r)throw new n("重定向参数缺少实体名称");const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new n("未找到指定实体的codeName: ".concat(r));o[c.toLowerCase()]=o[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete o.srfdename,"undo"!==o.srfwf){const t=o.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),a=t.substring(t.lastIndexOf("v"));o.wf=e,o.wfVersion=a}return o.srfprocessinstanceid&&(t.srfprocessinstanceid=o.srfprocessinstanceid,delete o.srfprocessinstanceid),{context:t,params:o,opts:a,viewId:l.id}}async function Ve(t,e,i={},s={}){var o;const r=ie(t.appViewNavContexts||[],i,e);e=Object.assign(e.clone(),r);const c=ie(t.appViewNavParams||[],i,e);Object.assign(i,c);const d=t.appDataEntityId,l=fe(d);let h=(null==(o=s.data)?void 0:o[0])||{};e[l]=h[l]||e[l]||i[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,i);if(t.ok){h=t.data;let a=h.linkurl;if(a){if(e.srfprocessinstanceid&&(a+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==a.indexOf("appredirectview?")&&(a=a.slice(a.indexOf("appredirectview?"))),a.startsWith("http://")||a.startsWith("https://"))return{type:"url",url:a};if(a.startsWith("appredirectview?")){return{type:"view",...await _e(e,a,s)}}throw new n("未支持的linkUrl格式:".concat(a))}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(d,t.appId),g=await async function(t,e,a,i){let s="";const o=e.typeAppDEFieldId;if(o){const{codeName:a}=ye(t,o),s=i[a.toLowerCase()];if(H(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn("重定向视图[".concat(e.name,"]自定义类别属性[").concat(o,"]值为空"),i)}const n="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=a.srfwf;if(H(r))return H(a.wf)?"".concat(n,":").concat(r.toUpperCase(),":").concat(a.wf.toUpperCase()):"".concat(n,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=ye(t,t.indexTypeAppDEFieldId);c=i[e.toLowerCase()]}if(Y(c)&&t.formTypeAppDEFieldId){const{codeName:e}=ye(t,t.formTypeAppDEFieldId);c=i[e.toLowerCase()]}s=H(c)?"".concat(n,":").concat(c.toString().toUpperCase()):"".concat(n);return s}(f,t,i,h);let w="";if(!g.startsWith("view://")){const o=g.split(":"),n=2===o.length?g:o.slice(0,2).join(":"),r="".concat(f.name.toUpperCase(),":").concat(g),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===g||e===n}));if(d){if(w=d.refAppViewId,w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(d,"未配置实际引用视图")}throw ibiz.log.error("重定向视图引用有:",null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:a})=>({viewId:t,tag:e,title:a})))),new a(t,"未找到重定向标识[".concat(g,"]或[").concat(r,"]或工作流[").concat(n,"]对应视图"))}{const t=new URL(g);t.searchParams.size>0&&t.searchParams.forEach(((t,e)=>{i[e]=t}));const e=t.pathname.replace("//","").split("/"),[a,s]=e;w=s||a}if(w)return{type:"view",viewId:w,context:e,params:i,opts:{...s,data:[h]}};throw new a(t,"标识[".concat(g,"]未匹配到实际引用视图"))}function Fe(t,e,a){if(Object.is(e,"IN"))return Ue(t,a);if(Object.is(e,"NOTIN"))return!Ue(t,a);switch(e){case"EQ":return"".concat(t)==="".concat(a);case"NOTEQ":return"".concat(t)!=="".concat(a);case"LT":return ke(t,a)<0;case"LTANDEQ":return ke(t,a)<=0;case"GT":return ke(t,a)>0;case"GTANDEQ":return ke(t,a)>=0;case"ISNULL":return Y(t);case"ISNOTNULL":return H(t);case"TESTNULL":return rt(t);case"IN":return Ue(t,a);case"NOTIN":return!Ue(t,a);case"LIKE":return ze(t,a);case"LEFTLIKE":return ze(t,a,"start");case"RIGHTLIKE":return ze(t,a,"end");default:throw new n("值操作:".concat(e,",暂未支持"))}}function ke(t,e){const a=Number(t),i=Number(e);if(!Number.isNaN(a)&&!Number.isNaN(i))return We(a,i);const s=new Date(t).getTime(),o=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(o))return We(s,o);throw new n("".concat(t," 和 ").concat(e," 无法比较大小"))}function We(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function Ue(t,e){if(!e||"string"!=typeof e)throw new n("范围比较的条件值不存或者不是字符串");if(t){return e.split(",").includes("".concat(t))}return!1}function ze(t,e,a){if(!t||!e)return!1;const i="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),o=i.indexOf(s);switch(a){case"start":return 0===o;case"end":return o+s.length===i.length;default:return-1!==o}}var Be={singleRowReturn:!1,isAsync:!0},Ge=t("ScriptFunction",class{constructor(t,e,a=Be){this.argKeys=[],this.options=a;const i=this.formatCode(e,a);this.calcArgKeys(t,a);const s=new Function(...this.argKeys,i);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error("报错脚本",i),t}}}formatCode(t,e){let a=t;return e.singleRowReturn&&(a="return (".concat(a,")")),e.isAsync&&(a="return (async function() { ".concat(a,"} )();")),a}calcArgKeys(t,e){const a=e.presetParams?Object.keys(e.presetParams):[];a.push(...t);a.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util"),this.argKeys=Array.from(new Set(a))}convertArgs(t){const{presetParams:e}=this.options,a=e?ct(e,t):t;a.document=document,a.selector=t=>document.getElementsByClassName(t);const i=[];return this.argKeys.forEach((t=>{void 0===a[t]&&this.fillDefaultParams(t,a),i.push(a[t])})),i}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const a=e.view;if(a)switch(t){case"parent":e.parent=a.parentView;break;case"topView":e.topView=a.getTopView();break;case"parentView":e.parentView=a.parentView;break;case"topViewSession":e.topViewSession=a.getTopView().session;break;case"viewSession":e.viewSession=a.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),je=t("ScriptFactory",class{static createScriptFn(t,e,a){return new Ge(t,e,a)}static execScriptFn(t,e,a){return this.createScriptFn(Object.keys(t),e,a).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function Ke(t,e,a){const i={isPast:!0,infoMessage:a.ruleInfo};if(function(t){return"GROUP"===t.condType}(a)){const s=a.conds;s&&s.length>0&&(i.isPast=function(t,e,a="AND",i=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===a;for(let i=0,o=t.length;i<o;i++){const o=e(t[i],i);if("AND"===a){if(!o){s=!1;break}}else if("OR"===a&&o){s=!0;break}}return i?!s:s}(s,(a=>{const{isPast:s,infoMessage:o}=Ke(t,e,a);return i.infoMessage=o,s}),a.condOp,!!a.notMode),!i.isPast&&("AND"===a.condOp&&a.notMode||"OR"===a.condOp&&!a.notMode)&&(i.infoMessage=a.ruleInfo))}else{t=(null==a?void 0:a.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(a))i.isPast=!function(t,e,a,i,s,o,r){Object.is(s,"CURTIME")&&(a="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){a=o[a=a?a.toLowerCase():""]?o[a]:a}(rt(i)||dt(i))&&(i="内容必须符合值规则");const c=Fe(t,e,a);if(!c&&r)throw new n(i);return!c}(e[t],a.condOp,a.paramValue,a.ruleInfo,a.paramType,e,a.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(a))i.isPast=!function(t,e,a,i,s,o,r){Y(o)&&(o="值必须符合值范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!0}if(Xe(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(a){if(c<e){if(r)throw new n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!=i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"REGEX"===t.condType}(a))i.isPast=!Xe(e[t],a.regExCode,a.ruleInfo,a.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(a))i.isPast=!function(t,e,a,i,s,o,r){Y(o)&&(o="内容长度必须符合范围规则");if(Y(t)){if(r)throw new n("值为空");return o="值为空",!0}const c=t.length;if(null!==e)if(a){if(c<e){if(r)throw new n(o);return!0}}else if(c<=e){if(r)throw new n(o);return!0}if(null!==i)if(s){if(c>i){if(r)throw new n(o);return!0}}else if(c>=i){if(r)throw new n(o);return!0}return o="",!1}(e[t],a.minValue,a.includeMinValue,a.maxValue,a.includeMaxValue,a.ruleInfo,a.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(a)&&(null==a?void 0:a.sysValueRule)){const{ruleType:s,regExCode:o,scriptCode:r,ruleInfo:c}=a.sysValueRule;if(i.infoMessage=a.ruleInfo||c,"REG"===s)i.isPast=!Xe(e[t],o,i.infoMessage,a.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:o}=function(t,e,a,i,s){Y(i)&&(i="值必须符合脚本规则");const o=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=je.execScriptFn({value:t,data:o},a,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(i="",!c&&s)throw new n(i);return{isPast:c,infoMessage:r||i}}(e[t],e,r,i.infoMessage,a.keyCond);i.isPast=s,i.infoMessage=o||i.infoMessage}}}catch(t){i.isPast=!1}i.isPast=a.notMode?!i.isPast:i.isPast}return i}function Xe(t,e,a,i){Y(a)&&(a="值必须符合正则规则");if(Y(t)){if(i)throw new n("值为空");return a="值为空",!0}if(!new RegExp(e).test(t)){if(i)throw new n(a);return!0}return a="",!1}function He(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.defdlogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!He(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>He(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Fe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}function Ye(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const i=e.panelItemLogics;if(!i||0===i.length)throw new a(e,"发现空逻辑组,逻辑无法正常执行!");let s=!0;if("AND"===e.groupOP){s=void 0===i.find((e=>!Ye(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>Ye(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return Fe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new i(e,"未支持的逻辑类型".concat(e.logicType))}var qe=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const a=lt(this.cache.get(e));t.viewLayoutPanel=a,t.appCounterRefs&&(a.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(a.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(a.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(a.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(a.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:a}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(a)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:a,blankMode:i,mainMenuAlign:s}=t;let o="";i?o="BLANK_MODE":s&&(o=s.toUpperCase());let n="";return n=""!==o?"".concat(e,"_").concat(a,"_").concat(o):"".concat(e,"_").concat(a),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(n)&&(n+="_NO_NAV"),n}});function Qe(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var Je=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))(Je||{})),$e=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))($e||{})),Ze=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(Ze||{})),ta=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.LOAD_MORE="LoadMore",t))(ta||{})),ea=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(ea||{})),aa=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(aa||{})),ia=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(ia||{})),sa=t("StudioViewEvents",class{});sa.onViewMounted="onMounted",sa.onViewDestroyed="onDestroyed";var oa=t("StudioPanelEvents",class{});oa.onClick="onClick",oa.onChange="onChange",oa.onEnter="onEnter",oa.onLeave="onLeave";var na=t("StudioControlEvents",class{});na.onBeforeLoad="onBeforeLoad",na.onLoadSuccess="onLoadSuccess",na.onLoadError="onLoadError",na.onBeforeLoadDraft="onBeforeLoadDraft",na.onLoadDraftSuccess="onLoadDraftSuccess",na.onLoadDraftError="onLoadDraftError",na.onBeforeSave="onBeforeSave",na.onSaveSuccess="onSaveSuccess",na.onSaveError="onSaveError",na.onBeforeRemove="onBeforeRemove",na.onRemoveSuccess="onRemoveSuccess",na.onRemoveError="onRemoveError",na.CLICK="onClick";var ra=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new q,beforeDismiss:new q},this._dismiss=t=>{ibiz.log.error("外部关闭能力未注册",t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={allowClose:!0};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),e.allowClose?(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function ca(t,e){return t.filter((t=>{const{checkMode:a}=t,i=t.deformItemName||t.degridEditItemName;return 2!==a&&i===e}))}var da=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),la=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=lt(t.themeParams||{}),a=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:a}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let a=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t];a+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}a+="}";const i=document.createElement("style");i.id=t.themeTag,i.type="text/css",i.innerHTML=a,document.head.appendChild(i)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),ha=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn("事务已经开启, 单个界面域只能开启一个事务"):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error("当前事务未提交,不可以直接关闭事务");this.state.isOpen=!1}},ua=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new ha,this.id=t||Q()}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const a=t.majorAppDataEntityId;this.rs2Map.has(a)||this.rs2Map.set(a,[]),this.rs2Map.get(a).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),pa=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new ua(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error("无效的界面域标识[".concat(t,"]"))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),ma=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}});async function fa(t,e=!0){const a=await Promise.allSettled(t),i=[],s=[];if(a.forEach((t=>{"fulfilled"===t.status?i.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return i}var ga=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,a){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==a)return!1;let i=-1;if(e==a?i=0:e>a&&(i=1),"EQ"===t||"ABSEQ"===t)return 0===i;if("GT"===t)return i>0;if("GTANDEQ"===t)return i>=0;if("LT"===t)return i<0;if("LTANDEQ"===t)return i<=0;if("NOTEQ"===t)return 0!==i}if("LIKE"===t)return null!=e&&null!=a&&-1!==e.toString().toUpperCase().indexOf(a.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=a&&0===e.toString().toUpperCase().indexOf(a.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},wa=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Ea=class extends wa{parse(t){const e=t.length;let a=!0,i=!1,s=!1;for(let o=0;o<e;o++)if(a){const e=t[o];this.setCondOp(e),a=!1,i=!0}else if(i){const e=t[o];this.setParam(e),i=!1,s=!0}else if(s){const e=t[o];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},ya=class t extends wa{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const a=e.length;let i=!0,s=!0,o=!1;for(let r=0;r<a;r++){if(i&&s){if("!"===e[r]){this.setNotMode(!0),i=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,i=!1,o=!0}else if(o){const a=e[r];if(!(a instanceof Array))throw new n("值必须为数组");a.forEach((e=>{if(e.length>0){const a=e[0].toString();if("!"===a||"OR"===a||"AND"===a){const a=new t;a.parse(e),this.childCondList.push(a)}else{const t=new Ea;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},va=class extends ya{},Ia=class extends Ea{},Da=class t extends ga{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,a,i){if(e instanceof ya){const t=e.getChildPSModelCondBases();if(null==t||dt(t))return!e.isNotMode();const s="AND"===e.getCondOp();let o=s;for(let e=0;e<t.length;e++){const n=t[e];if(this.testCond(n,a,i)){if(!s){o=!0;break}}else if(s){o=!1;break}}return e.isNotMode()?!o:o}if(e instanceof Ea){dt(e.getParam())&&ibiz.log.warn("没有指定属性名称",e);const s=a[e.getParam().toLowerCase()];let o=null;const n=e.getValueType(),r=e.getValue();return null==n||dt(n)?o=e.getValue():(dt(r)&&ibiz.log.warn("没有指定上下文参数名称"),t.PARAMTYPE_WEBCONTEXT===n?o=i.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===n&&(o=i.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,o)}return ibiz.log.warn("无法识别的条件对象",e),!1}createPSModelSingleCond(){return new Ia}createPSModelGroupCond(){return new va}};Da.PARAMTYPE_DATACONTEXT="DATACONTEXT",Da.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Ca=t("PSDEDQCondEngine",Da);async function Aa(t,e){var a;const i=null==(a=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:a.find((e=>e.pluginCode.toLowerCase()===t));if(i)return await ibiz.plugin.loadPlugin(i),"".concat(i.pluginType,"_").concat(i.pluginCode);ibiz.log.error("未匹配到插件[".concat(t,"]模型"))}var ba=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Pa(t,e){ibiz.register.register("".concat(ba,"_").concat(t),e)}function Ta(t){return ibiz.register.get("".concat(ba,"_").concat(t))}async function xa(t){let e;const{codeName:a,counterType:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Aa(s,o);if(t&&(e=Ta(t)),e)return e;ibiz.log.error("找不到系统计数器插件".concat(t,"对应的适配器"))}if("CUSTOM"===i){if(e=Ta(a),e)return e;throw new n("找不到自定义系统计数器".concat(a,"对应的适配器"))}if(e=Ta(i),e)return e;throw new n("找不系统计数器类型".concat(i,"对应的适配器"))}var Na=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Sa(t){return ibiz.register.get("".concat(Na,"_").concat(t))}async function La(t){let e;const{controlType:a,controlStyle:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Aa(s,o);if(t&&(e=Sa(t)),e)return e;ibiz.log.error("找不到部件插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Sa("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到部件类型:[".concat(a,"]的部件样式:[").concat(i,"]对应的适配器"),t)}if(e=Sa(a),e)return e;"DATAINFOBAR"!==a&&ibiz.log.error("找不到部件类型".concat(a,"对应的适配器"))}var Ra=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Oa(t){return ibiz.register.get("".concat(Ra,"_").concat(t))}async function Ma(t){let e;const{editorType:a,editorStyle:i,predefinedType:s,sysPFPluginId:o,appId:n}=t;if(o){const t=await Aa(o,n);if(t&&(e=Oa(t)),e)return e;ibiz.log.error("找不到编辑器插件".concat(t,"对应的适配器"))}if(i&&"DEFAULT"!==i){if(e=Oa("".concat(a,"_").concat(i)),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的编辑器样式:[").concat(i,"]对应的适配器"),t)}if(s){let o="".concat(s,"_").concat(a);if(i&&"DEFAULT"!==i&&(o+="_".concat(i)),e=Oa(o),e)return e;ibiz.log.error("找不到编辑器类型:[".concat(a,"]的预置类型:[").concat(s,"]对应的适配器"),t)}if(e=Oa(a),e)return e;ibiz.log.error("找不到编辑器类型".concat(a,"对应的适配器"))}var _a=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Va(t){return ibiz.register.get("".concat(_a,"_").concat(t))}async function Fa(t){let e;const{detailType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Aa(i,s);if(t&&(e=Va(t)),e)return e;ibiz.log.error("找不到表单成员插件".concat(t,"对应的适配器"))}if(e=Va(a),e)return e;ibiz.log.error("找不到表单成员类型".concat(a,"对应的适配器"))}var ka=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Wa(t){return ibiz.register.get("".concat(ka,"_").concat(t))}async function Ua(t){let e;const{columnType:a,enableRowEdit:i,sysPFPluginId:s,appId:o}=t;if(s){const t=await Aa(s,o);if(t&&(e=Wa(t)),e)return e;ibiz.log.error("找不到表格列插件".concat(t,"对应的适配器"))}const n=i?"".concat(a,"_EDIT"):a;if(e=Wa(n),e)return e;ibiz.log.error("找不到表格列类型".concat(n,"对应的适配器"))}var za=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Ba(t){return ibiz.register.get("".concat(za,"_").concat(t.toUpperCase()))}async function Ga(t){var e;let a;const{itemType:i,sysPFPluginId:s,appId:o,controlRenders:n}=t;if(s){const t=await Aa(s,o);if(t&&(a=Ba(t)),a)return a;ibiz.log.error("找不到面板成员插件".concat(t,"对应的适配器"))}if(n&&n.length>0)a=Ba("PREDEFINE_RENDER");else{if("CONTAINER"===i){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(a=Ba(i),a)return a;ibiz.log.error("找不到面板容器预置类型为".concat(e,"的适配器,注册key为").concat(i))}if("RAWITEM"===i){const i=(null==(e=t.rawItem)?void 0:e.predefinedType)||"DEFAULT",s="RAWITEM_".concat(i);if(a=Ba(s),a)return a;ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器,注册key为").concat(s))}if("FIELD"===i){const{editor:e}=t;if(e&&e.predefinedType){if(a=Ba("FIELD_".concat(e.predefinedType.toUpperCase())),a)return a}}a=Ba(i)}if(a)return a;ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"))}var ja=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Ka(t){return ibiz.register.get("".concat(ja,"_").concat(t))}async function Xa(t){let e;const{portletType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Aa(i,s);if(t&&(e=Ka(t)),e)return e;ibiz.log.error("找不到门户部件插件".concat(t,"对应的适配器"))}if(e=Ka(a),e)return e;ibiz.log.error("找不到门户部件成员类型".concat(a,"对应的适配器"))}var Ha=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Ya(t,e){ibiz.register.register("".concat(Ha,"_").concat(t),e)}function qa(t){return ibiz.register.get("".concat(Ha,"_").concat(t))}async function Qa(t){let e;const{uiactionMode:a,sysPFPluginId:i,appId:s,uiactionTag:o}=t;if(i){const t=await Aa(i,s);if(t&&(e=qa(t)),e)return e;ibiz.log.error("找不到界面行为插件".concat(t,"对应的适配器"))}if(e=qa("".concat(a,"_").concat(o)),e)return e;if(e=qa(a),e)return e;throw new n("找不界面行为模式".concat(a,"对应的适配器"))}var Ja=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function $a(t){let e;const{sysPFPluginId:a,appId:i}=t,s=await Aa(a,i);if(s){if(e=ibiz.register.get("".concat(Ja,"_").concat(s)),e)return e;throw new n("找不到界面逻辑前端插件节点,插件".concat(s,"对应的适配器"))}}var Za=t("VIEW_PROVIDER_PREFIX","VIEW");function ti(t){return ibiz.register.get("".concat(Za,"_").concat(t))}var ei=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var ai=t("PlatformProviderBase",class{back(){throw new Error("Method not implemented.")}init(){throw new Error("Method not implemented.")}async login(t,e,a){return ibiz.auth.login(t,e)}async download(t,e){const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new n("下载文件失败");if(a.data){const t=e;return c(a.data,t),Promise.resolve(!0)}throw new n("文件流数据不存在")}}),ii=t("BrowserPlatformProvider",class extends ai{});var si=window.navigator.userAgent.toLowerCase();function oi(){return/Android|Adr/i.test(si)?"Android":/iPhone|iPod|iPad/i.test(si)?"IOS":/MicroMessenger/i.test(si)?"WeChat":/DingTalk/i.test(si)?"DingTalk":/miniProgram/i.test(si)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var ni=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ri(t,e){ibiz.register.register("".concat(ni,"_").concat(t),e)}function ci(t){return ibiz.register.get("".concat(ni,"_").concat(t))}function di(){const t=ci(oi());return t||ci("Browser")}var li=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function hi(t,e){ibiz.register.register("".concat(li,"_").concat(t),e)}function ui(t){return ibiz.register.get("".concat(li,"_").concat(t))}async function pi(t){let e;const{methodType:a,sysPFPluginId:i,appId:s}=t;if(i){const t=await Aa(i,s);if(t&&(e=ui(t)),e)return e;ibiz.log.error("找不到实体行为插件".concat(t,"对应的适配器"))}if(e=ui(a),e)return e;throw new n("找不实体行为方法类型为".concat(a,"的适配器"))}var mi=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function fi(t){return ibiz.register.get("".concat(mi,"_").concat(t))}async function gi(t){let e;const{columnType:a,appId:i,renderSysPFPluginId:s}=t;if(s){const t=await Aa(s,i);if(t&&(e=fi(t)),e)return e;ibiz.log.error("找不到树表格列插件".concat(t,"对应的适配器"))}if(e=fi(a),e)return e;ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"))}var wi=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Ei(t){return ibiz.register.get("".concat(wi,"_").concat(t))}async function yi(t){let e;const{sysPFPluginId:a,appId:i,itemType:s}=t;if(a){const t=await Aa(a,i);if(t&&(e=Ei(t)),e)return e;ibiz.log.error("找不到应用菜单项插件".concat(t,"对应的适配器"))}return e=Ei(s),e}var vi=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new J,this.data={}}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load()}setParams(t,e){t&&(this.context=lt(t)),e&&(this.params=lt(e))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new n("未实现计数器加载方法")}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&H(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),Ii=t("AppDECounter",class extends vi{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new a(this.model,"未找到获取计数器行为!");this.action=i,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),Di=t("AppDECounterProvider",class{createCounter(t){return new Ii(t)}});function Ci(){Pa("DEDR",(()=>new Di))}var Ai=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const a=new Ca;return 1===e.length?a.parse(this.calcCond(e)[0]):e.length>1&&a.parse(["AND",this.calcCond(e)][0]),this.map.set(t,a),a}return null}static calcCond(t){const e=[];return t.forEach((t=>{const a=[];if("GROUP"===t.condType){const e=t;e.notMode&&a.push("!"),a.push(t.condOp);const i=e.dedqconditions;if(i){const t=this.calcCond(i);a.push(t)}}else{if("SINGLE"!==t.condType)throw new i(t,"暂未支持的查询条件类型: ".concat(t.condType));{const e=t;a.push(e.condOp),a.push(e.fieldName),e.condValue?e.vartypeId?a.push({type:e.vartypeId,value:e.condValue}):a.push(e.condValue):a.push("")}}e.push(a)})),e}});Ai.map=new WeakMap;var bi=t("DynamicCodeListCache",class{constructor(t){this.cache=new Map,this.isPredefined=!1,this.codeList=t}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(t))throw new i(this.codeList,"预定义类型".concat(t,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:a,textAppDEFieldId:i,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:o,iconPathAppDEFieldId:n,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d}=this.codeList,l=a?t[a]:t.srfkey;if(e.id=l,e.value=l,e.text=i?t[i]:t.srfmajortext,(s||o||n||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),o&&(e.sysImage.cssClassX=t[o]),n&&(e.sysImage.imagePath=t[n]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Oi(t[c])),d&&t[d])try{e.data=je.execSingleLine(t[d])}catch(t){ibiz.log.error("动态代码表数据属性返回值不为对象格式的字符串,无法转换!")}return e}async load(t,e={}){const i=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:o,minorSortAppDEFieldId:n,minorSortDir:r,pvalueAppDEFieldId:c,customCond:d}=this.codeList,l={...e};if(n&&r&&Object.assign(l,{sort:"".concat(n.toLowerCase(),",").concat(r.toLowerCase())}),d){const e=ie(je.execSingleLine(d),l,t);Object.assign(l,e)}if(l.size||(l.size=1e4),this.isPredefined){const t=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),l);return Object.freeze(t.data.items)}if(!s)throw new a(this.codeList,"未配置应用实体");if(!o)throw new a(this.codeList,"未配置数据集");const h=await i.deService.exec(s,o,t,void 0,l);let u=[];if(h.data.length)if(c){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:a}=this.codeList,i={},s=[];return t.forEach((t=>{i[t[e]]=this.convertData(t)})),t.forEach((t=>{const o=i[t[a]];o?(o.children=o.children||[],o.children.push(i[t[e]])):s.push(i[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const a=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(a)){const t=this.cache.get(a);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(a)}const i=this.load(t,e),{cacheTimeout:s}=this.codeList,o=-1===s||rt(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,n={expirationTime:(new Date).getTime()+o,promise:i};this.cache.set(a,n);const r=await i;return n.items=r,delete n.promise,r}});function Pi(t,e){if(null!=e){const{srfkey:t}=e;if(!rt(t)&&!dt(t))return!0}throw new n("执行「".concat(t,"」不存在「srfkey」无法处理"))}function Ti(t,e){const{srfsessionid:a}=e;if(!rt(a)&&!dt(a))return!0;throw new n("执行「".concat(t,"」不存在「srfsessionid」无法处理"))}var xi=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const a=this.cacheMap.get(e.srfkey);a&&(a.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,lt(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new n("新建联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Ti("add",t),(rt(e.srfkey)||dt(e.srfkey))&&(e.srfkey=Q()),e.srftempdate=(new Date).getTime();const a=()=>{this.cacheMap.set(e.srfkey,lt(e)),ibiz.log.warn("add",e.srfkey,e)},i=this.getTransaction(t);return i?i.change(e.srfkey,(()=>{a()})):a(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Ti("get",t);const a=this.cacheMap.get(e);return ibiz.log.warn("get",e,a),lt(a)}catch(t){return ibiz.log.error(t),null}}update(t,e){const a=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),a!==e.srfkey&&this.checkData(t,e.srfkey)))throw new n("更新联合主键数据失败,已有主键为".concat(e.srfkey,"的数据"));try{Ti("update",t),Pi("update",e),e.srftempdate=(new Date).getTime();const i=this.cacheMap.get(a);if(i){const s=lt(i);s.assign(e);const o=()=>{i.assign(e),a!==e.srfkey&&this.cacheMap.delete(a),this.cacheMap.set(e.srfkey,i),ibiz.log.warn("update",e.srfkey,e)},n=this.getTransaction(t);return n?n.change(e.srfkey,(()=>{o()})):o(),s}throw new Error("数据不存在,无法更新!")}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Ti("delete",t);const a=e;if(this.cacheMap.has(a)){const e=this.cacheMap.get(a),i=()=>{this.cacheMap.delete(a),ibiz.log.warn("delete",a)},s=this.getTransaction(t);return s?s.change(a,(()=>{i()})):i(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Ti("add",t);const a=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},i=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(rt(s.srfkey)||dt(s.srfkey))&&(s.srfkey=Q()),s.srftempdate=(new Date).getTime();const o=lt(s);i?i.change(o.srfkey,(()=>{a(o)})):a(o)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Ti("update",t);const a=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},i=this.getTransaction(t);for(let s=0;s<e.length;s++){const o=e[s];Pi("update",o);const r=o.srfkey;if(this.isUnionKey&&(this.calcUnionKey(o),r!==o.srfkey&&this.checkData(t,o.srfkey)))throw new n("更新联合主键数据失败,已有主键为".concat(o.srfkey,"的数据"));o.srftempdate=(new Date).getTime();const c=this.cacheMap.get(o.srfkey);if(!c)throw new Error("数据[".concat(o.srfdename,"-").concat(o.srfmajortext,"(").concat(o.srfkey,")]不存在,无法更新!"));{const t=lt(c);t.assign(o),e[s]=t,i?i.change(o.srfkey,(()=>{c.assign(o),a(c,r)})):(c.assign(o),a(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Ti("delete",t)}catch(t){return ibiz.log.error(t),e}const a=[];for(let t=0;t<e.length;t++){const i=e[t];this.cacheMap.has(i)||a.push(i)}if(a.length>0)throw new Error("未找到以下数据「".concat(a.join("、"),"」,无法删除!"));const i=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},s=this.getTransaction(t);for(let t=0;t<e.length;t++){const a=e[t];s?s.change(a,(()=>{i(a)})):i(a)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=ht(t.srfkey)),delete t.srfkey;for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const i=t[a];e[a]=ht(i)}return ut(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>ce(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>rt(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),Ni=/\$\{(.*?)\}/g;function Si(t,e){const a=(e.requestPaths||[]).map((t=>{const e=t.match(Ni);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:a}=e;return 0===a.length||a.every(((e,i)=>i===a.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(a.length>0)return a[0]}function Li(t,e){const a=Si(t,e);if(a){if(a.keys.length>0){let{path:e}=a;return a.keys.forEach(((i,s)=>{e=s===a.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):e.replace("${".concat(i,"}"),t[i])})),e}return a.path}return""}var Ri=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(rt(e.page)||dt(e.page)||(this.page=e.page),rt(e.size)||dt(e.size)||(this.size=e.size),rt(e.query)||dt(e.query)||(this.query=e.query),!rt(e.sort)&&!dt(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Oi(t){return[1,"1",!0,"true"].includes(t)}var Mi=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const a=t.codeItems;let i=[];return(null==a?void 0:a.length)&&(i=this.formatStaticItems(a,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(i)),i}setCodeList(t){const{id:e,codeName:a}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(a,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var a;let i=t.text;t.textLanguageRes&&(i=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const o={text:i,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?je.execSingleLine(t.data):void 0,sysImage:t.sysImage};return(null==(a=t.codeItems)?void 0:a.length)&&(o.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(o)}))}async getDynamicCodeList(t,e,a={}){let i;const s=t.codeName;return this.cache.has(s)?i=this.cache.get(s):(i=new bi(t),this.cache.set(s,i),await i.init()),i.get(e,a)}async get(t,e,a){const i=this.allCodeLists.get(t);if(!i)throw new n("找不到".concat(t,"代码表"));return"STATIC"===i.codeListType?this.getStatic(i):"DYNAMIC"===i.codeListType?this.getDynamicCodeList(i,e,a):[]}}),_i=t("ConfigService",class{constructor(t,e,a){this.appId=t,this.folder=e,this.tag=a,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),Vi=t("CounterService",class{static async getCounter(t,e,a){const i=t.id;if(this.counterMap.has(i)){const t=this.counterMap.get(i);if(!1===t.isDestroyed)return t;this.counterMap.delete(i)}const s=(await xa(t)).createCounter(t);return await s.init(e,a),this.counterMap.set(i,s),s}static async getCounterByRef(t,e,i){const{appCounter:s}=t;if(!s)throw new a(t,"未配置应用计数器!");return this.getCounter(s,e,i)}});Vi.counterMap=new Map;var Fi=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:a}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(a))}async getWFLink(t,e){const a=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(a,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(a,t)})}async wfSubmit(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(a,t)})}async wfWithdraw(t,e,a){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(a,t)})}async wfReassign(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepBefore(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(a,t)})}async wfAddStepAfter(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(a,t)})}async wfSendBack(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(a,t)})}async wfSendCopy(t,e,a){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(a,t)})}async exec(t,e,a={},i={}){switch(t){case"wfstart":return this.wfStart(e,a,i);case"wfsubmit":return this.wfSubmit(e,a,i);case"reassign":return this.wfReassign(e,a,i);case"addstepbefore":return this.wfAddStepBefore(e,a,i);case"addstepafter":return this.wfAddStepAfter(e,a,i);case"sendback":return this.wfSendBack(e,a,i);case"sendcopy":return this.wfSendCopy(e,a,i);default:throw new n("「".concat(t,"」未实现"))}}}),ki=class{constructor(t){this.model=t}exportData(t,e,a,i){const s=Li(a,this.model),o="".concat(s,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(o,{method:"post",data:i,responseType:"blob"})}},Wi=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(Wi||{})),Ui=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,a={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:lt(a instanceof t?a._data:a)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const i=ce(e.appDEFields||[],e.keyAppDEFieldId);if(i){const t=i.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主键字段"));const s=ce(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn("实体[".concat(e.codeName,"]未配置主文本字段"));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:rt(this.srfkey)?Q():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:a}=this,i={};Object.keys(e).forEach((t=>{i[t]={enumerable:!0,set(a){e[t]=a},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();i[s]={enumerable:!0,set(i){e[s]=a(i,t.stdDataType)},get:()=>e[s]},e[s]=a(e[s],t.stdDataType)})),Object.defineProperties(this,i)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let a={};return a=e instanceof t?e._data:e,Object.keys(a).forEach((t=>{void 0===a[t]&&delete a[t]})),Object.assign(this._data,a),this}convertVal(t,e){if(null==t)return t;if(rt(e))return t;if(l.isNumber(e)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),zi=t("MethodDto",class{constructor(t,e,a,i){this.service=t,this.entity=e,this.isLocalMode=a,this.dto=i,this.dtoMap=new Map,i?(this.app=ibiz.hub.getApp(e.appId),this.fields=i.appDEMethodDTOFields||[]):this.fields=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,a)=>{e[a+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((a=>{const i=parseInt(a,10);e[i-1]=t[i]})),e}async get(t,e,s=!1){const o={},n=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(o[d]=0===e[d].length?null:this.convertArrayToListMap(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const i=n.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=i.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const a=lt(t);a[this.entity.codeName.toLowerCase()]=e.srfkey;const i={};h.parentAppDEFieldId&&(i[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,a,i)}else{if(r.entity.id===this.entity.id)throw new a(c,"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!");u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,a=[];for(let i=0;i<e.length;i++)a.push(await r.get(t,e[i],!0));o[d]=a}}break;default:throw new i(c,"未支持的应用实体方法输入属性类型: ".concat(c.type))}}return{...e,...o}}async sets(t,e){const a=ibiz.uiDomainManager.get(t.srfsessionid);return a&&!0!==a.state.rsInit&&(await this.calcRs(t),a.calcParentRs(),a.state.rsInit=!0),Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const i=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[i])e[i]=this.convertListMapToArray(e[i]);else{if(!a.refAppDataEntityId)return;const s=await this.getFieldDto(t,a),o=e[i];if(o&&o.length>0){const i=e[this.entity.keyAppDEFieldId];a.refPickupAppDEFieldId&&o.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await s.sets(t,o)}else await s.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[t];const i=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,i),i})))}async calcRs(t,e=0){if(e>10)return;e+=1;const a=ibiz.uiDomainManager.get(t.srfsessionid),i=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<i.length;s++){const o=i[s];if(!o.refAppDataEntityId)continue;if(0===a.getDERConfig(o.refAppDataEntityId).length){const i=await this.getFieldDto(t,o);i.entity.minorAppDERSs&&a.setDERConfig(o.refAppDataEntityId,i.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await i.calcRs(t,e)}}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const a=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),i=ce(a.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,a.id);s.isLocalMode=!0;const o=s.createMethodDto(i,{isLocalMode:!0});return this.dtoMap.set(e.codeName,o),o}}),Bi=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new xi(e),this.configCache=new _i(e.appId,"PSAppDataEntity",e.codeName),this.wf=new Fi(e),this.file=new ki(e)}async getMethod(t,e=!1){const s=e?"ac-".concat(t):t;if(this.methodMap.has(s))return this.methodMap.get(s);const o=ce(this.model.appDEMethods,t);if(!o)throw new a(this.model,"未找到服务方法: ".concat(t));const n=await pi(o);if(!n)throw new i(o,"未支持的服务方法类型: ".concat(o.methodType));const r=n.create(this,this.model,o,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(s,r),r}async exec(t,e,a,i){const s=await this.getMethod(t);if(s)return s.exec(e,a,i);throw new n("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}getDraft(t,e,a){return this.exec("GetDraft",t,e,a)}create(t,e,a){return this.exec("Create",t,e,a)}get(t,e,a){return this.exec("Get",t,e,a)}update(t,e,a){return this.exec("Update",t,e,a)}remove(t,e,a){return this.exec("Remove",t,e,a)}fetchDefault(t,e,a){return this.exec("FetchDefault",t,e,a)}getDraftTemp(t,e,a){return this.exec("GetDraftTemp",t,e,a)}createTemp(t,e,a){return this.exec("CreateTemp",t,e,a)}getTemp(t,e,a){return this.exec("GetTemp",t,e,a)}updateTemp(t,e,a){return this.exec("UpdateTemp",t,e,a)}removeTemp(t,e,a){return this.exec("RemoveTemp",t,e,a)}fetchTempDefault(t,e,a){return this.exec("FetchTempDefault",t,e,a)}async execAc(t,e,a,i={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,a,i);throw new n("".concat(this.model.codeName,"未支持「").concat(t,"」方法"))}aiChatSse(t,e,a={},i={}){const s=ibiz.hub.getApp(this.model.appId),o=this.calcSsePath(e);return new Promise(((e,n)=>{s.net.sse("/".concat(o),{srfactag:"AIChat",...a},{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),onmessage:e=>{if(e.data){const a=JSON.parse(e.data);t(a)}},onclose:()=>{e()},onerror:t=>{n(t)}})}))}aiChatHistory(t,e={},a={}){const i=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return i.net.post(s,a,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const a=t[this.model.codeName.toLowerCase()],i="/".concat(this.model.codeName2.toLowerCase(),"/ssechatcompletion").concat(e?"/histories":"").concat(a?"/".concat(a):"");return Li(t,this.model)+i}newEntity(t){return t instanceof Ui?t.clone():new Ui(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new zi(this,this.model,null==e?void 0:e.isLocalMode,t)}}),Gi=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],ji=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:rt(this.srfkey)?Q():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const a=t.dataKey;this.linkProperty(e,a,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,a){const i=!a||a.isOriginField;Gi.includes(t)||(i||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=lt(this.$origin),a=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{a[t]=this[t]})),a}}),Ki=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,a,i){return await this.app.deService.exec(this.model.appDataEntityId,t,e,a,i)}handleResponse(t){return h(t)}toUIData(t){return new ji(t,this.dataUIMap)}}),Xi=t("MDControlService",class extends Ki{async fetch(t,e={}){var a;const i=(null==(a=this.model.fetchControlAction)?void 0:a.appDEMethodId)||"fetchdefault";let s=await this.exec(i,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var a;const i=(null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var a;const i=(null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft";let s=await this.exec(i,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var a;const i=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.exec(i,t,void 0,e)}async create(t,e){var a;const i=(null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var a;const i=(null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,a={}){throw new n("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"]))),e.ok&&($(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),Hi=t("DeAuthorityService",class{constructor(t){this.entityModel=t}async calcByDataAccessAction(t,e){if(e.srfopprivs&&!e.srfopprivs.includes(t))return!1;return!!await this.calcByDeMainState(t,e)}async calcByDeMainState(t,e){let a=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),a;ibiz.log.debug("操作标识".concat(t,"主状态计算开始"),e,i);const s=pe(i,e);if(s){ibiz.log.debug("匹配主状态",s);const e=me(s,i);ibiz.log.debug("允许的主状态权限集合",e),a=e.includes(t)}else ibiz.log.debug("没匹配主状态,返回false"),a=!1;return ibiz.log.debug("操作标识".concat(t,"权限计算结束:").concat(a)),a}}),Yi=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new n("未找到应用实体[".concat(t,"]"));const a=this.constructorCache.get(t);let i;i=a?await a(e):new Hi(e),this.cache.set(t,i)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByDataAccessAction(t,e,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(e&&a){return(await this.getService(a)).calcByDataAccessAction(t,e)}return!0}}),qi=t("V7AuthService",class{get isAnonymous(){return"1"===Z(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error("未找到匿名登录配置用户名或密码"),!1;const a=await this.login(t,e);if(a){tt(u.IS_ANONYMOUS,"1",0,!0);const t=Z(u.TOKEN),e=Z(u.TOKEN_EXPIRES),a=Z(u.TOKEN_REMEMBER);tt(u.TOKEN,t,0,!0),tt(u.TOKEN_EXPIRES,e,0,!0),tt(u.TOKEN_REMEMBER,a,0,!0)}return a}async login(t,e,a){try{const i=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:a}),{data:s}=i;if(s&&s.token){a&&tt(u.TOKEN_REMEMBER,"1",7,!0),tt(u.TOKEN,s.token,a?7:0,!0);const t=(new Date).getTime()+1e3*(s.expirein||7199);tt(u.TOKEN_EXPIRES,"".concat(t),a?7:0,!0),et(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:"登录失败",desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),et(u.TOKEN),et(u.TOKEN_EXPIRES),et(u.TOKEN_REMEMBER),et(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0,!0}catch(t){ibiz.notification.error({title:"登出失败",desc:t.message||""})}return!1}async extendLogin(){if(this.isAnonymous)return;const t=Z(u.TOKEN),e=Z(u.TOKEN_EXPIRES),a=Z(u.TOKEN_REMEMBER);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=await ibiz.net.get("/uaa/refreshtoken2");if(t.ok){tt(u.TOKEN,t.data.token,a?7:0,!0);const e=(new Date).getTime()+1e3*(t.data.expirein||7199);tt(u.TOKEN_EXPIRES,"".concat(e),a?7:0,!0)}this.extendLogin()}),t)}}getAuthInfo(){const t=Z(u.TOKEN),e=!!Z(u.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}}),Qi=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return rt(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),Ji=t("MethodInput",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodInput;if(s){const a=ce(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}}),$i=t("MethodReturn",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i;const s=a.appDEMethodReturn;if(s){const a=ce(e.appDEMethodDTOs||[],s.appDEMethodDTOId);a&&(this.dto=t.createMethodDto(a,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const a=ibiz.hub.getApp(this.entity.appId);a.deService.clearTempCache({srfappid:a.appId,srfsessionid:t.srfsessionid});return(await this.dto.sets(t,[e]))[0]}return Y(e)&&(e={}),new Ui(this.entity,e)}}),Zi=t("Method",class{constructor(t,e,a,i=!1){this.service=t,this.entity=e,this.method=a,this.isLocalMode=i,this.app=ibiz.hub.getApp(e.appId),this.input=new Ji(t,e,a),this.result=new $i(t,e,a)}async request(t,e,i,s){const{actionType:o,requestMethod:n}=this.method;if("REMOTE"===o){const e=this.method.codeName.toLowerCase();let o=null;switch(n){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),i||s||{});break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),i||s);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),i||s||{});break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),i||s);break;default:throw new a(this.method,n?"未支持的请求方式: ".concat(n):"未配置请求方式")}return o}throw new a(this.method,"未支持的行为类型[".concat(o,"]"))}mergeRequestPath(t,e){return"".concat(t,"/").concat(e)}calcPath(t){const e="/".concat(this.entity.codeName2.toLowerCase());return Li(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),ts=class{constructor(t,e,a,i){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:R(a)?a:[a],params:i}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},es=class{},as=class extends es{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const o=t.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return Fe(o[this.dstField],this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=t.params[this.srcParam];return Fe(o[this.dstField],this.op,e[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o[this.dstField],this.op,this.value)}}},is=class t extends es{constructor(e){super(),this.model=e;const a=e.conds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new as(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},ss=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new is(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},os=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new ss(t)))}},ns=class extends os{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDELogicParamId:s,retDELogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},rs=class extends os{async exec(t){}},cs=class extends os{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:a,rawValue:s}=this.model;if(a)switch(a){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(a))}}};function ds(t,e){const{srcDELogicParamId:a,srcFieldName:s,srcValue:o,expression:n}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[a],t.isEntityParam(a)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=lt(ibiz.env);break;case"EXPRESSION":if(!n)throw new i(e,"表达式为空");c=je.execScriptFn(t,n,{singleRowReturn:!0,isAsync:!1});break;default:throw new i(e,"暂未支持源值类型".concat(r))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:je.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(d,"报错,源参数:"),c),t}return c}var ls=class extends os{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{switch(e.paramAction){case"SETPARAMVALUE":return this.setParamValue(e,t);case"RESETPARAM":return this.resetParam(e,t);case"COPYPARAM":return this.copyParam(e,t);case"BINDPARAM":return this.bindParam(e,t);case"RENEWPARAM":return this.renewParam(e,t);case"APPENDPARAM":return this.appendParam(e,t);case"SORTPARAM":return this.sortParam(e,t);default:throw new i(e,"暂未支持逻辑处理参数操作".concat(e.paramAction))}})))}copyParam(t,e){const{dstDELogicParamId:a}=t,i=ds(e,t);e.params[a]=lt(i)}bindParam(t,e){const a=ds(e,t);e.params[t.dstDELogicParamId]=a}setParamValue(t,e){const{dstFieldName:a,dstDELogicParamId:i}=t;let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const o=ds(e,t);s?e.params[i][s]=o:e.params[i]=o}resetParam(t,e){const{dstDELogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDELogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDELogicParamId:a,dstIndex:i,srcIndex:s,srcSize:o}=t,n=ds(e,t),r=i||0,c=s||0,d=o||n.length;e.params[a].splice(r,0,...n.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i.toLowerCase();e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},hs=class extends os{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDELogicParamId:i,retDELogicParamId:s}=this.model,o=t.params[i],n=ibiz.hub.getApp(t.context.srfappid),r=await n.deService.exec(a,e,t.context,o);r.ok&&(t.params[s]=r.data)}},us=class extends os{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=ds(t,this.model);t.params[e]=s}},ps=class extends os{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},ms=class extends os{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},fs=class extends os{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=ds(t,this.model);t.params[e]=lt(s)}},gs=class extends os{async exec(t){const{dstDELogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s.toLowerCase();t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},ws=class extends os{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=ds(t,this.model),c=s||0,d=o||0,l=n||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},Es=class extends os{async exec(t){const{errorCode:e,errorInfo:a}=this.model;throw new s({response:{status:e,statusText:a}})}},ys=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model;if(a.default)a.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(a.appGlobalParam)t.params[e]=lt(ibiz.env);else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.appContextParam)t.params[e]=t.parameters.context;else if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.cloneParam)t.params[e]=lt(t.data||{});else{if(a.envParam)throw new i(a,"未支持的逻辑参数类型: 系统环境变量");if(a.fileListParam)throw new i(a,"未支持的逻辑参数类型: 文件对象列表变量");if(a.fileParam)throw new i(a,"未支持的逻辑参数类型: 文件对象变量");if(a.filterParam)throw new i(a,"未支持的逻辑参数类型: 过滤器对象变量");if(a.lastParam)throw new i(a,"未支持的逻辑参数类型: 最后数据变量");if(a.originEntity)throw new i(a,"未支持的逻辑参数类型: 原始数据对象");if(a.sessionParam)throw new i(a,"未支持的逻辑参数类型: 操作会话变量")}}}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},vs=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new a(t,"脚本代码模式没有配置脚本代码");this.scriptFn=je.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new a(t,"实体逻辑没有配置逻辑节点");t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new rs(t);break;case"END":a=new cs(t);break;case"DEACTION":a=new ns(t);break;case"PREPAREPARAM":a=new ls(t);break;case"DEDATASET":a=new hs(t);break;case"THROWEXCEPTION":a=new Es(t);break;case"BINDPARAM":a=new us(t);break;case"RESETPARAM":a=new ps(t);break;case"COPYPARAM":a=new fs(t);break;case"RENEWPARAM":a=new ms(t);break;case"APPENDPARAM":a=new ws(t);break;case"SORTPARAM":a=new gs(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new ys(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,i){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:i});const s=new ts(this.params,t,e,i);this.initLogicParams(s);const{startDELogicNodeId:o}=this.model;if(!o||!this.nodes.has(o))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(o);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Is=new Map;async function Ds(t,e,a={},i={}){Is.has(t)||Is.set(t,new vs(t));return Is.get(t).exec(e,a,i)}async function Cs(t,e,a,i,s){const o=await async function(t,e,a){return we(t,await ibiz.hub.getAppDataEntity(e,a))}(t,e,a.srfappid);if(!o)throw new n("".concat(e,"找不到实体逻辑").concat(t));return Ds(o,a,i,s)}async function As(t,e,a,i){const o=lt(e),n=a?lt(a):a,r=i?lt(i):i;try{const e=await Ds(t,o,n,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function bs(t,e,a,i,s){const o=Ee(t,e);if(o.length){(await Promise.all(o.map((t=>Ds(t,a,i,s))))).forEach((t=>{Object.assign(i,t)}))}}async function Ps(t,e,a,i,s={}){if(i){if(!R(i))return bs(t,e,a,i,s);await Promise.all(i.map((i=>bs(t,e,a,i,s))))}}var Ts=t("DEActionMethod",class extends Zi{async inputHandle(t,e){return R(e)?e:this.input.handle(t,e)}async exec(t,e,i){let s;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Ps(this.entity,"change",t,e,i),"DELOGIC"===this.method.actionType){const o=we(this.method.appDELogicId,this.entity);if(!o)throw new a(this.method,"缺少实体处理逻辑");s=await As(o,t,e,i)}else switch(e&&!this.isLocalMode&&(e=await this.inputHandle(t,e)),this.method.codeName){case"Create":s=await this.create(t,e,i||{});break;case"Get":s=await this.get(t,i);break;case"GetDraft":s=await this.getDraft(t,i);break;case"Remove":s=await this.remove(t,i);break;case"Update":s=await this.update(t,e,i);break;case"CreateTemp":s=await this.createTemp(t,e);break;case"GetTemp":s=await this.getTemp(t,e);break;case"GetDraftTemp":s=await this.getDraftTemp(t,i);break;case"RemoveTemp":s=await this.removeTemp(t,e);break;case"UpdateTemp":s=await this.updateTemp(t,e);break;default:{let a=this.calcPath(t);if(this.method.needResourceKey){let i=t[this.entity.codeName.toLowerCase()];M(i)&&(i=R(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),a="".concat(a,"/").concat(i)}const o=await this.request(a,t,e,i);o.data=await this.result.handle(t,o.data),s=o}}return s.data&&await Ps(this.entity,"compute",t,s.data,i),s}async create(t,e,a){if(!e)throw new n("create行为没有传data");if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.post(i,e,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e)}async update(t,e,a){if(!e)throw new n("update行为没有传data");if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const i=this.calcPath(t),s=await this.app.net.put("".concat(i,"/").concat(t[this.entity.codeName.toLowerCase()]),e,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e);return i.data=await this.result.handle(t,i.data),i}async getDraft(t,e){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),i=await this.app.net.get("".concat(a,"/getdraft"),e);return i.data=await this.result.handle(t,i.data),i}async createTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,a)),new p(i)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new p(t):new p(t,500)}catch(t){return new p(t,500)}}async removeTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(a,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const i=this.service.local.delete(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,i){const s=ibiz.uiDomainManager.get(e.srfsessionid),o=s.transaction;let n=!1;!1===o.state.isOpen&&(o.open(),n=!0);try{let i=s.getDERConfigByMajor(this.entity.id);if(i.length>0){const s=this.service.local.get(e,t);i=at(i,"removeOrder");for(const o of i){if("DER1N"!==o.rstype)throw new a(o,"目前只支持[DER1N]关系类型关联删除删除");const{removeActionType:i,removeRejectMsg:n,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=o,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=lt(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(i){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const a=await l.remove(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[o.parentAppDEFieldId.toLowerCase()]=void 0;const a=await l.updateTemp(h,e);if(!1===a.ok)throw new Error(a.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e="无法删除[".concat(this.entity.logicName,"-").concat(s.srfmajortext,"], 数据被[").concat(l.model.logicName,"-").concat(t,"]引用");throw new Error(n||e)}}}}n&&o.state.isOpen&&o.commit()}catch(t){throw n&&o.state.isOpen&&o.rollback(),t}finally{n&&o.state.isOpen&&o.close()}}async updateTemp(t,e){try{const a=this.createEntity(e);let i;return i=R(a)?await Promise.all(a.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,a)),i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let a=null;e&&(a=e[this.entity.keyAppDEFieldId.toLowerCase()]),!a&&t&&(a=t[this.entity.codeName.toLowerCase()]);const i=this.service.local.get(t,a);return i?new p(i):new p(i,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new p(!0)}attach(t,e){const a=t.srfsessionid,i=ibiz.uiDomainManager.get(a).getDERConfig(this.entity.id);return i.length>0&&i.forEach((a=>{if(a.parentAppDEFieldId){const{majorAppDataEntityId:i,parentAppDEFieldId:s}=a,o=fe(i),n=s.toLowerCase(),r=t[o];r&&r!==e.srfkey&&(e[n]=r)}})),e}}),xs=class{create(t,e,a,i){return new Ts(t,e,a,i.localMode)}},Ns=t("FetchMethod",class extends Zi{async exec(t,e,a){const s=e&&!R(e)?e:a||{};let o;if(this.isLocalMode){const e=Ai.getCond(this.method),a=new Ri(t,s),i=await this.searchLocal(e,a);o=new p(i,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const i=this.calcPath(t);o=await this.request(i,t,e,a)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const n=o.data||[];o.data=n.map((t=>this.createEntity(t)))}return o.data&&await Ps(this.entity,"compute",t,o.data,s),o}async searchLocal(t,e,a=this.entity.quickSearchAppDEFieldIds){let i=this.service.local.getList();t?i.length>0&&(i=i.filter((a=>t.test(a,e)))):i.length>0&&e.query&&""!==e.query&&a&&(i=i.filter((t=>{const i=new RegExp(e.query);for(let e=0;e<a.length;e+=1){const s=t[a[e]];if(i.test(s))return!0}return!1}))),rt(e.sortField)||dt(e.sortField)||(i="DESC"===e.sortMode?it(i,e.sortField):at(i,e.sortField));const{page:s,size:o}=e,n=s*o,r=(s+1)*o-1;return i.slice(n,r).map((t=>lt(t)))}async fetchCodeListSet(t,e){const{appCodeListId:i}=this.method;if(!i)throw new a(this.method,"没有指定数据来源代码表");const s=await this.app.codeList.get(i,t,e),{keyAppDEFieldId:o,majorAppDEFieldId:n}=this.entity,r=s.map((t=>({[o]:t.value,[n]:t.text})));return new p(r,200)}}),Ss=t("AcFetchMethod",class extends Ns{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Ls=class{create(t,e,a,i){return i.acMode?new Ss(t,e,a,i.localMode):new Ns(t,e,a,i.localMode)}};function Rs(){const t=new xs;hi("DEACTION",(()=>t));const e=new Ls;hi("FETCH",(()=>e)),hi("FETCHTEMP",(()=>e))}var Os=t("TreeNodeData",class{constructor(t,e,a){this._uuid=Q(),this._leaf=!1,this._leaf=!0===a.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._parent&&(this._context={...this._parent._context}),a.navContext&&(this._context=Object.assign(this._context||{},a.navContext)),a.navParams&&(this._params={...a.navParams}),this._nodeId=t.id}calcIcon(t){const{sysImage:e}=t,a={};return e&&(e.cssClass&&(a.cssClass=e.cssClass),e.imagePath&&(a.imagePath=e.imagePath)),Object.values(a).length>0?a:void 0}}),Ms=t("TreeCodeListNodeData",class extends Os{constructor(t,e,a){super(t,e,a);const{data:i}=a;this._text=i.text,this._value=i.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=fe(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),_s=["_id","_value","_text","_deData","clone"],Vs=t("TreeDataSetNodeData",class t extends Os{constructor(e,a,i){var s,o;super(e,a,i);const{data:n}=i;this._deData=n;const r="".concat(e.id,"@").concat(n.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get:()=>e.textAppDEFieldId?n[e.textAppDEFieldId]:n.srfmajortext,enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get:()=>e.idAppDEFieldId?n[e.idAppDEFieldId]:n.srfkey,enumerable:!0,configurable:!0}),e.appDataEntityId){const t=fe(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:n.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId&&(this._leaf=Oi(n[e.leafFlagAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId.toLowerCase();c.set(e,a),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(o=e.detreeNodeColumns)||o.forEach((t=>{const e=t.detreeColumnId,a=t.dataItemName;e&&a?l.set(e,a):ibiz.log.error("模型异常缺少detreeColumnId或者dataItemName",t)}));const h=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:void 0;return this.clone=()=>{const a=lt(this._deData),i=new t(e,this._parent,{data:a,leaf:this._leaf,navContext:this._context,navParams:this._params});return Object.keys(this).forEach((t=>{const e=h(t);rt(e)&&!_s.includes(t)&&(i[t]=this[t])})),i},new Proxy(this,{set(t,e,a){const i=h(e);return rt(i)?t[e]=a:t._deData[i]=a,!0},get(t,e,a){const i=h(e);return rt(i)?t[e]:rt(t._deData[i])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[i];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return m(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:a,detreeNodeDataItems:i}=t;a&&this._deData[a]&&(e.imagePath=this._deData[a]),e&&(this._icon=e);const s=null==i?void 0:i.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return je.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:a}=t,i=null==a?void 0:a.find((t=>"text"===t.id));return i&&(e=this.calcDataItemScript(i)),e}}),Fs=t("TreeStaticNodeData",class extends Os{constructor(t,e,a){var i,s;super(t,e,a);const o="root"===t.nodeValue?void 0:t.nodeValue,n="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(n):n},enumerable:!0,configurable:!0}),this._text=t.text,this._value=o,e&&a.parentValueLevel){let t=e;for(let e=1;e<a.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=o||(null==t?void 0:t._value)}this.srfkey=(null==(i=this._deData)?void 0:i.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),ks=t("UIMapField",class{constructor(t,e,a={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,rt(a.isOriginField)||(this.isOriginField=a.isOriginField),rt(a.dataType)||(this.dataType=a.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=rt(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug("".concat(t,"不能转换成数字")),t):e}return t}}),Ws=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var Us=["REGION","REGION2","REGION3","REGION4"],zs=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:a,itemStyle:i,longitudeAppDEFieldId:s,latitudeAppDEFieldId:o,textAppDEFieldId:n,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=a+t.srfkey,this._itemStyle=i,this._mapItemId=a,Us.includes(this._itemStyle)?s&&l.set("_areaCode",s):(s&&l.set("_longitude",s),o&&l.set("_latitude",o)),c&&l.set("_tooltip",c),n&&l.set("_text",n),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:l.has(a)?t[l.get(a)]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:l.has(a)?t[l.get(a)]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}});var Bs=t("PanelData",class{constructor(t,e){const a=new J,i={},s={};return t.forEach((t=>{var e;i[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,o,n)=>(Object.prototype.hasOwnProperty.call(i,o)?i[o]?e[i[o]]=n:t[o]=n:e[o]=n,a.emit("change",o),i[o]&&i[o]!==o&&a.emit("change",i[o]),s[o]&&s[o]!==o&&a.emit("change",s[o]),!0),get:(t,s,o)=>"_evt"===s?a:i[s]?e[i[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const a=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,a),a}})}destroy(){this._evt.reset()}});var Gs=t("ChartData",class{constructor(t,e,a,i){return this._seriesModelId=null==e?void 0:e.id,this._catalog=a,this._groupName=i,this._uuid=Q(),new Proxy(this,{set:(e,a,i)=>(Object.prototype.hasOwnProperty.call(t,a)?t[a]=i:e[a]=i,!0),get:(e,a,i)=>void 0!==e[a]?e[a]:void 0!==t[a]?t[a]:void 0,ownKeys(e){const a=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,a),a}})}}),js=(t,e,a={})=>{let i="";if(!t||!e.detreeNodeDataItems)return i;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(i=a[s.appDEFieldId]),i},Ks=t("GanttStaticNodeData",class extends Fs{constructor(t,e,a,i){super(e,a,i),this._snDataItemValue=js(t.sndataItemName,e),this._beginDataItemValue=js(t.beginDataItemName,e),this._endDataItemValue=js(t.endDataItemName,e),this._prevDataItemValue=js(t.prevDataItemName,e),this._finishDataItemValue=js(t.finishDataItemName,e),this._totalDataItemValue=js(t.totalDataItemName,e)}}),Xs=t("GanttDataSetNodeData",class extends Vs{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=js(t.sndataItemName,e,s),this._beginDataItemValue=js(t.beginDataItemName,e,s),this._endDataItemValue=js(t.endDataItemName,e,s),this._prevDataItemValue=js(t.prevDataItemName,e,s),this._finishDataItemValue=js(t.finishDataItemName,e,s),this._totalDataItemValue=js(t.totalDataItemName,e,s)}}),Hs=t("GanttCodeListNodeData",class extends Ms{constructor(t,e,a,i){super(e,a,i);const{data:s}=i;this._snDataItemValue=js(t.sndataItemName,e,s),this._beginDataItemValue=js(t.beginDataItemName,e,s),this._endDataItemValue=js(t.endDataItemName,e,s),this._prevDataItemValue=js(t.prevDataItemName,e,s),this._finishDataItemValue=js(t.finishDataItemName,e,s),this._totalDataItemValue=js(t.totalDataItemName,e,s)}}),Ys=t("MqttService",class{constructor(t,e,a){if(this.mqttTopic=t,this.token=e,this.appId=a,this.evt=new J,this.options={connectTimeout:6e3,clientId:Q(),username:"",password:"",keepalive:60,clean:!0},Y(t)||Y(e))throw new Error("mqttTopic or token is empty");this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),a=t.default?t.default:t,{location:i}=window;this.client=a.connect("ws://".concat(i.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end()}}),qs=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,a){const i=e.srfsessionid||"applocation";this.cache.has(i)||this.cache.set(i,new Map);const s=this.cache.get(i);if(!s.has(a)){const e=await ibiz.hub.getAppDataEntity(a,this.appModel.appId);if(!e)throw new n("未找到应用实体[".concat(a,"]"));const o=t.constructorCache.get(a.toUpperCase());let r;r=o?await o(i,e):new Bi(i,e),s.set(a,r)}return s.get(a)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}async exec(t,e,a,i,s){return(await this.getService(a,t)).exec(e,a,i,s)}};qs.constructorCache=new Map;var Qs=t("DEServiceUtil",qs),Js=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=lt(e),r=await ibiz.hub.config.view.get(t);if(!r)throw new n("应用视图[".concat(t,"]不存在"));if((o.srfkey||0===a.srfuf)&&r.appDataEntityId){const t=fe(r.appDataEntityId);o.srfkey&&(o[t]=o.srfkey,o.srfkey=void 0),0===a.srfuf&&(o[t]=void 0,delete a.srfuf)}if(r.redirectView){return Me(await ibiz.hub.getAppView(t),o,a,s)}const{openMode:c="INDEXVIEWTAB"}=r,d=s.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&o.toRouteDepth&&(o.toRouteDepth=void 0),d){case"INDEXVIEWTAB":return s.noWaitRoute?(this.openIndexViewTab(r,o,a),{ok:!0}):this.openIndexViewTab(r,o,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,o,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,s.event,o,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,o,a);case"USER":return this.openUserCustom(r,o,a);default:return this.openIndexViewTab(r,o,a)}}openIndexViewTab(t,e,a={}){return ibiz.openView.root(t.id,e,a)}async openModal(t,e,a={}){return ibiz.openView.modal(t.id,e,a)}async openPopover(t,e,a,i={}){if(!e)throw new n("气泡打开缺少event");return ibiz.openView.popover(t.id,e,a,i)}async openDrawer(t,e,a={}){return ibiz.openView.drawer(t.id,e,a)}async openUserCustom(t,e,a={}){return ibiz.openView.custom(t.id,e,a)}};Js.TAG="ibiz.app-view.open";var $s=t("OpenAppViewCommand",Js),Zs=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,a={},s={}){const o=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!o)throw new n("找不到叫".concat(t,"的应用功能"));const{navigateContexts:r,navigateParams:c,appFuncType:d}=o,l=e.clone();Object.assign(l,ie(r,a,e));const h=ie(c,a,e);switch(d){case"APPVIEW":return this.openAppView(o,l,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(o);case"PDTAPPFUNC":return this.openPdAppFunc(o,l,h);case"JAVASCRIPT":return this.executeJavaScript(o,l,h);case"CUSTOM":return this.custom(o,l,h);default:throw new i(o,"未支持的应用功能类型: ".concat(d))}}async openAppView(t,e,a,i){if(!t.appViewId)throw new n("应用视图[".concat(t.appViewId,"]不存在"));return ibiz.commands.execute($s.TAG,t.appViewId,e,a,i)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,a){throw ibiz.log.warn("openPdAppFunc",t,e,a),new n("未实现")}executeJavaScript(t,e,a){throw ibiz.log.warn("executeJavaScript",t,e,a),new n("未实现")}custom(t,e,a){throw ibiz.log.warn("custom",t,e,a),new n("未实现")}};Zs.TAG="ibiz.app-func.exec";var to=t("AppFuncCommand",Zs);function eo(){new to,new $s}var ao=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(t.appId)}),this.configCache=new _i(t.appId,"PSSysApp",t.codeName),this.deService=new Qs(t),this.codeList=new Mi(t),this.authority=new Yi(t)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),ibiz.env.enableMqtt&&ibiz.appData&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new Ys(ibiz.appData.mqtttopic,g(),this.model.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.asyncAction.next(t)})),await this.mqtt.connect())}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}async getUIAction(t){const[,e]=t.split("@");if(e){const a=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUIActions.find((e=>e.id===t));if(a)return a}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var a,i;let s=null==(a=this.model.deopprivs)?void 0:a.find((e=>e.name===t));if(!s&&e){s=null==(i=(await ibiz.hub.getAppDataEntity(e,this.model.appId)).deopprivs)?void 0:i.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.model.appId)).appDEUILogics.find((e=>e.id===t))}}),io=class{parse(t){return t}},so=class{constructor(){this.appMenu=new io}},oo=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const a=this.calcAppViewId(t);this.viewConfigs.set(a,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new n("视图[".concat(e,"]不存在"));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},no=class{constructor(){this.view=new oo}},ro=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(ro||{})),co=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(co||{})),lo=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(lo||{})),ho=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t))(ho||{})),uo=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new n("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),po=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new uo(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),mo=t("CTXState",class{}),fo=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new J(3e3),this.controllersMap=new Map,this.state=new mo}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),go=t("ActivityCounter",class extends uo{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())}}),wo=t("UIActionButtonState",class{constructor(t,e,a){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=a,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await ve(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:a,actionTarget:i,uiactionMode:s,uiactionTag:o}=t;this.dataAccessAction=e,1===a?this.noPermissionHidden=!1:6===a&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(o))&&(this.noDataDisabled=!0,"SINGLEKEY"!==i&&"MULTIKEY"!==i||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.appDeName&&e&&!e.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(e,"不一致")),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e)}async update(t,e){this.isInit||await this.init(),await this.calcPermission(t,e),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!t||this.noKeyDisabled&&!t.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),Eo=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e){await Promise.all(this.children.map((a=>a.update(t,e))))}}),yo=t("QXEventEx",class extends J{constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((a=>{a(t,...e)}))}async asyncEmit(t,...e){const a=super.asyncEmit(t,...e),i=this.anyEventFns.map((a=>a(t,...e))),s=Promise.all(i),o=await a,n=await s;return o.concat(...n)}reset(){super.reset(),st(this.anyEventFns)}}),vo=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new yo}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function Io(t){return window.location.hash.split("/").length>2*t+2}function Do(t,e){return(!rt(t)&&""!==t||!rt(e)&&""!==e)&&t!==e}function Co(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof ji&&(e=e.getOrigin()),e}function Ao(t,e,a){const i=[];return t.forEach((t=>{const{valueRuleType:s}=t,o=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&o)"REG"===o.ruleType?i.push({pattern:new RegExp(o.regExCode),message:o.ruleInfo,trigger:"change blur"}):"SCRIPT"===o.ruleType&&i.push({validator:(t,e,a,i)=>{if(!e)return!0;try{je.execScriptFn({rule:t,value:e,callback:a,source:i},o.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=a||e;i.push({validator:(e,a,i,s)=>{if(Y(s[t]))return!0;const{isPast:o,infoMessage:c}=Ke(t,s,r.groupCond);return o||i(new n(c||r.ruleInfo)),!0},trigger:"change blur"})}})),i}function bo(t){const e=[],{maxLength:a,minLength:i}=t,{maxValue:s,minValue:o}=t;return a&&e.push({validator:(t,e,i)=>{if(rt(e)||!(e.length>a))return!0;i(new Error("内容长度必须小于等于".concat(a,",当前长度为").concat(e.length)))}}),i&&e.push({validator:(t,e,a)=>{if(rt(e)||!(e.length<i))return!0;a(new Error("内容长度必须大于等于".concat(i,",当前长度为").concat(e.length)))}}),rt(s)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&ot(e)&&e>s))return!0;a(new Error("值必须小于等于".concat(s)))}}),rt(o)||e.push({validator:(t,e,a)=>{if(!(!rt(e)&&ot(e)&&e<o))return!0;a(new Error("值必须大于等于".concat(o)))}}),e}var Po=t("ValueExUtil",class{static mergeDefault(t){return pt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(rt(e)||""===e)return"";const{valueType:a,objectNameField:i,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(a)){if(!i)throw new n("缺少objectNameField");const t=i.toLowerCase();return"OBJECTS"===a?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===a?e.join(s):"".concat(e)}});function To(t,e){var a;const{name:s,valueType:o,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(rt(o)&&rt(r))return;if("RESET"===o)return null;const u=d[s];if(!mt(u)){if(!o&&r)return r;switch(o){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return gt().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(a=ibiz.appData)?void 0:a.context))throw new n("appdata.context不存在");return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return Q();default:throw new i({},"默认值类型[".concat(o,"]未支持"))}}}var xo="asyncimportdata2",No="importdata2";async function So(t,e,a){if(!ibiz.util.getExcelUtil)throw new n("ibiz.util.getExportExcel不存在");const i=await ibiz.util.getExcelUtil();if(!i)throw new n("导出模块加载错误");try{return i.exportJsonToExcel({header:t,data:e,filename:a,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function Lo(t,e){const a=ibiz.hub.getApp(e.srfappid),i=await ibiz.hub.getAppDataEntity(t,e.srfappid),s="/jsonschema/".concat(i.name);return(await a.net.get(s)).data}var Ro="__self",Oo=t("BaseController",class{constructor(t,e,a,i){this.model=t,this.context=e,this.params=a,this.ctx=i,this.id=Q(),this.state={},this.name="",this.evt=new vo(this.getEventArgs.bind(this)),this.mountCounter=new go(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Ro),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(Ro)||this.mountCounter.attend(Ro)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),Mo=class t{constructor(t){this.msgGroupId=t,this.viewMsgMap=new Map}async init(t){var e,a;const i=ibiz.hub.getApp(t.srfappid).model,s=null==(e=i.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new n("找不到视图消息组".concat(this.msgGroupId,"的模型"));this.msgGroup=s;const o=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(a=i.appViewMsgs)||a.forEach((t=>{const e=o.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),o.splice(e,1))})),o.length)throw new n("没有找到".concat(o.join(","),"视图消息模型"))}getDeFieldName(t,e){var a,i;if(e)return null==(i=null==(a=ye(t,e))?void 0:a.name)?void 0:i.toLowerCase()}static async fetchDataSet(t,e,i){const{appDataEntityId:s,appDEDataSetId:o}=t;if(!o)throw new a(t,"未配置实体数据集");const n=await ibiz.hub.getApp(e.srfappid).deService.exec(s,o,e,i);return n.data.length?n.data:[]}async calcViewMessages(t,e){const a=this.msgGroup.appViewMsgGroupDetails,i=[];return(null==a?void 0:a.length)&&await Promise.all(a.map((async a=>{if(1===this.viewMsgMap.get(a.appViewMsgId).dynamicMode){const s=await this.calcDynaMsgs(a,t,e);i.push(...s)}else{const t=this.calcStaticMsg(a);i.push(t)}}))),i}calcStaticMsg(t){const{position:e}=t,a=this.viewMsgMap.get(t.appViewMsgId),{title:i,message:s,removeMode:o,position:n,messageType:r}=a,{userTag:c,userTag2:d,userTag3:l,userTag4:h}=a;return{title:i,message:s,position:e||n,messageType:r,removeMode:o,extraParams:{userTag:c,userTag2:d,userTag3:l,userTag4:h}}}async calcDynaMsgs(e,i,s){const o=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:n,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u}=o;if(!n)throw new a(o,"未配置应用实体");const p=await ibiz.hub.getAppDataEntity(n,i.srfappid),m={...s},f=this.getDeFieldName(p,r);f&&(m.sort="".concat(f,",asc"));const g=await t.fetchDataSet(o,i,m);if(!g.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(p,c),y=this.getDeFieldName(p,u),v=this.getDeFieldName(p,h),I=this.getDeFieldName(p,l),D=this.getDeFieldName(p,d);return g.map((t=>{const e={};return y&&!rt(t[y])&&(e.position=t[y]),E&&!rt(t[E])&&(e.title=t[E]),v&&!rt(t[v])&&(e.message=t[v]),I&&!rt(t[I])&&(e.messageType=t[I]),D&&!rt(t[D])&&(e.removeMode=t[D]),ct(w,e)}))}},_o=t("ViewController",class extends Oo{constructor(t,e,a,i){super(ibiz.util.layoutPanel.fill(t),d.create({},e),a||{},new fo(i)),this.session={},this.modal=new ra({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new po,this.isCloseView=!1,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const t=Ne(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn("未找到视图引擎实现:",t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await Vi.getCounterByRef(t,this.context);this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={}}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{mt(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await La(t);this.providers[t.name]=e;const a=Te(this.model);a&&await Promise.all(a.map((async t=>{const e=await La(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const i=xe(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated())))}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){if(this.context.srfappid=this.model.appId,rt(this.context.srfsessionid)||dt(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}const t=this.model.appViewNavContexts;let e={};H(t)&&(e=ie(t,this.params,this.context)),Object.assign(this.context,e);const a=this.model.appViewNavParams;let i={};H(a)&&(i=ie(a,this.params,this.context)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let a;for(const i of this.engines)if(a=await i.call(t,e),void 0!==a)break;return a}async callUIAction(t,e){const a=this.call(t,e);if(void 0===a)throw new n("没有引擎支持预置界面行为".concat(t));return a}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Mo(t),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){const[e,...a]=t,i={title:e.title,desc:e.message};e.extraParams.userTag&&Object.assign(i,{confirmButtonText:e.extraParams.userTag}),"WARN"===e.messageType?await ibiz.modal.warning(i):"ERROR"===e.messageType?await ibiz.modal.error(i):await ibiz.modal.info(i),a.length&&this.alertViewMessage(a)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}}),Vo=(t("MobViewController",class extends _o{}),t("WFStepTraceViewController",class extends _o{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),a=null==(t=this.ctx.parent)?void 0:t.view;if(a&&a.model.appDataEntityId){const t=await e.deService.getService(a.context,a.model.appDataEntityId),i=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(i);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}}handlePublicParams(t,e,a){const{navigateContexts:i,navigateParams:s}=this.model;let o={};i&&t&&(o=ie(i,t,a,e));const n=Object.assign(e.clone(),o);let r={};return s&&t&&(r=ie(s,t,a,e)),{context:n,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Po.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=gt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),Fo=(t("CodeListEditorController",class extends Vo{async loadCodeList(t){const{context:e,params:i}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let a=[];return a=await t.codeList.get(this.model.appCodeListId,e,i),a}throw new a(this.model,"编辑器类型[".concat(this.model.editorType,"],未配置代码表"))}}),t("ControlController",class extends Oo{constructor(t,e,a,i){if(super(t,d.create({},e),new E({},a),i),this.controlParams={},this.providers={},this.registerToCtx(),this.controlPanel=le(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=lt(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await La(this.controlPanel);this.providers[this.controlPanel.name]=t}this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)}))}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:a}=this.model;let i={};H(e)&&(i=ie(e,this.params,this.context)),Object.assign(this.context,i);let s={};H(a)&&(s=ie(a,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this.state.activated=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}handlerAbilityParams(t){const e=this.context.clone(),a={...this.params};let i=this.getData()||[];return(null==t?void 0:t.data)&&(i=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(a,t.viewParam),{context:e,params:a,data:i}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};H(t)&&(e=ie(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}actionNotification(t,e){var a;const{ctrlMsg:i}=this.model,s=null==(a=null==i?void 0:i.ctrlMsgItems)?void 0:a.find((e=>e.name===t));let n,r;if(s&&s.content){r=rt(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),n=je.execScriptFn(t,"`".concat(s.content,"`"),{isAsync:!1,singleRowReturn:!0})}else{const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();n=ibiz.i18n.t(e,""),n===e&&(n="")}if(!n&&(null==e?void 0:e.default)&&(n=e.default),!n&&(null==e?void 0:e.error)&&(n=n||e.error.message),n){if(null==e?void 0:e.error)throw ibiz.log.error(e.error),new o(n,r);ibiz.message.success(n,r,0===r)}}})),ko=t("MDControlController",class extends Fo{constructor(){super(...arguments),this.commandDataChange=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)}));const e=this.onDataChange.bind(this);this.onDataChange=_((t=>{e(t)}),300),ibiz.mc.command.change.on(this.onDataChange),this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return ibiz.mc.command.change.off(this.onDataChange),super.onDestroyed()}onDataChange(t){t.data&&t.data.srfdecodename===this.dataEntity.codeName&&(this.state.activated?this.refresh():this.commandDataChange=!0)}onActivated(){super.onActivated(),this.commandDataChange&&(this.refresh(),this.commandDataChange=!1)}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const a=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(a.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,o={...this.params};return a&&(o.page=e-1,o.size=a),!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),t&&Object.assign(o,t),o}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,a=!0===t.isLoadMore;e?this.state.curPage=1:a&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),o=await this.service.fetch(i,s);"number"==typeof o.total&&(this.state.total=o.total),a?this.state.items.push(...o.data):this.state.items=o.data,await this.afterLoad(t,o.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){await this.load({isInitialLoad:!1})}async remove(t){const{context:e,params:a,data:i}=this.handlerAbilityParams(t);if(!(null==i?void 0:i.length))throw new n("未选中数据");if(!0!==(null==t?void 0:t.silent)){if(!await ibiz.confirm.error({title:"数据删除",desc:"确认删除数据?"}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{const o=fe(this.model.appDataEntityId);await fa(i.map((async t=>{if(0!==t.srfuf){const i=e.clone();i[o]=t.srfkey,await this.service.remove(i,a),s=!0}this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:i,default:"数据[".concat(i.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:i}),t}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,a;const{selectedData:i}=this.state;y(i,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(a=this.quickToolbarController)||a.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.srfkey!==t.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){var t;const{appDataEntityId:e,dedataImportId:a}=this.model,i=await ibiz.hub.getAppDataEntity(e,this.model.appId),s=null==(t=i.appDEDataImports)?void 0:t.find((t=>t.id===a));if(!s)throw new n("无导入模型!");let o="DataImport";s.enableCustomized&&(o="DataImport2");const r=ibiz.overlay.createModal(o,{dismiss:()=>r.dismiss(),appDataEntity:i},{width:"auto",placement:"center"});r.present(),await r.onWillDismiss()}async exportData(t){}}),Wo=t("AppMenuController",class extends Fo{constructor(t,e,a,i){super(t,e,a,i),this.itemProviders={},this.flattenAllItems()}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await yi(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,i=!0){const s=v(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new n("找不到名为".concat(t,"的菜单项"));this.evt.emit("onClick",{eventArg:t,event:e});const o=this.itemProviders[t];if(o&&o.onClick)return o.onClick(s,e,this);if(!s.appFuncId)throw new a(s,"没有配置应用功能");const r=this.context.clone();r.srfappid=s.appId,this.routeDepth&&i&&Object.assign(r,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(to.TAG,s.appFuncId,r,this.params)}initMenuItemState(t){var e;const a={permitted:!0,visible:!0};if(t.hidden)a.visible=!1;else{let i=!0;t.accessKey&&(i=this.app.authority.calcByResCode(t.accessKey));let s=i;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}a.permitted=i,a.visible=s}return this.state.menuItemsState[t.id]=a,a}flattenAllItems(){const t=[],e=a=>{a.forEach((a=>{t.push(a),a.appMenuItems&&a.appMenuItems.length>0&&e(a.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var a;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(a=e.appMenuItems)?void 0:a.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),Uo=(t("AppMenuIconViewController",class extends Wo{async onClickMenuItem(t,e){const i=v(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!i)throw new n("找不到名为".concat(t,"的菜单项"));if(this.evt.emit("onClick",{eventArg:t,event:e}),!i.appFuncId)throw new a(i,"没有配置应用功能");const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(to.TAG,i.appFuncId,s,this.params)}}),t("CalendarService",class extends Xi{async search(t,e={}){const{sysCalendarItems:a}=this.model;if(!a)return[];const i=a.map((async a=>{const i=a.appDEDataSetId||"fetchdefault";return this.exec2(i,t,e,void 0,a.appDataEntityId)}));return(await Promise.all(i)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:a}=this.model;if(!a)throw new n("未找到日历项模型");const i=a[e];if(!i)throw new n("未找到日历项模型");return t.map((t=>new Ws(i,t)))}async exec2(t,e,a={},i={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,a,i)}}));t("CalendarController",class extends ko{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Uo(this.model),await this.service.init(this.context)}async load(t={}){const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(a,i)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const a=t.beginTime,i=e.beginTime;let s=0;return gt(a).isAfter(i)?s=-1:gt(a).isBefore(i)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:a,srfenddate:i}=t;if(!a||!i){const t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:gt(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:gt(a).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:a,srfenddate:i}}async getFetchParams(t={}){const{curPage:e,size:a,sortQuery:i,noSort:s}=this.state,o={...this.params};if(!s&&i&&(o.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(o,{...this.state.searchParams}),a&&(o.page=e-1,o.size=a),t&&Object.assign(o,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(o);Object.assign(o,t)}return o}async onRowClick(t){const{selectedData:e}=this.state,a=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});gt.extend(It),gt.extend(Ct),gt.extend(bt),gt.extend(Tt),gt.extend(Nt);var zo="$default_group",Bo=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:i,caption:s,id:o,userParam:n}=t;if(!t.catalogField)throw new a(t,"缺少分类属性配置");if(!t.valueField)throw new a(t,"缺少值属性配置");this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=i||{};this.xAxisIndex=N(r),this.yAxisIndex=N(c),this.seriesName=s||o,this.staticOptions=this.calcStaticOptions(),n&&(this.seriesUserParam=Qo(n))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,a=!1){if(rt(e))return;if(rt(t))return e;const i=this.chartGenerator.codeListMap.get(t);if(null==i?void 0:i.length){const t=i.find((t=>t.value===e));if(t)return t.text}return a?void 0:e}prepareChartData(t,e,a,i){var s;this.groupField&&Object.assign(e,{[this.groupField]:i}),this.catalogField&&Object.assign(e,{[this.catalogField]:a});const o=new Gs(e,this.model,a,i);t[i].get(a).chartData=o,null==(s=this.chartDataArr)||s.push(o)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:a,catalogCodeListId:i}=this.model;return t.forEach((t=>{let s=zo;if(this.groupField){const e=this.translateVal(a,t[this.groupField]);if(rt(e))return;s=e}if(!e[s]&&(e[s]=new Map,i&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(i).forEach((t=>{e[s].set(t.text,{value:0})}))}const o=this.translateVal(i,t[this.catalogField],!0);if(o)e[s].get(o)||e[s].set(o,{value:0}),e[s].get(o).value=x(e[s].get(o).value,t[this.valueField]),e[s].get(o).chartData?this.prepareChartData(e,{[this.valueField]:e[s].get(o).value},o,s):this.prepareChartData(e,t,o,s);else if(i&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(i).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,s)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const a=t[e],i=this.calcSeriesData(a);let s={...this.staticOptions,data:i};return e!==zo&&(s.name=e),this.seriesUserParam&&(s=ft(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push([a,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),a=this.calcGroupData(e);return this.addTimeData(a),this.calcGroupSeries(a)}getChartDataByParams(t){var e,a,i;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[zo].get(t.name))?void 0:e.chartData:null==(i=null==(a=this.groupData)?void 0:a[t.seriesName].get(t.name))?void 0:i.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(lt(t))}));const{groupMode:a}=this.model;return a&&e.forEach((t=>{let e="";if("DAY"===a||"YEAR"===a||"MONTH"===a){if("DAY"===a?e="YYYY-MM-DD":"YEAR"===a?e="YYYY":"MONTH"===a&&(e="YYYY-MM"),t[this.catalogField]){const a=gt(t[this.catalogField]).format(e);t[this.catalogField]=a}}else if("QUARTER"===a){if(t[this.catalogField]){const e="".concat(gt(t[this.catalogField]).format("YYYY"),"-").concat(gt(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===a&&t[this.catalogField]){const e="".concat(gt(t[this.catalogField]).format("YYYY"),"-").concat(gt(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((a=>{const i=t[a];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(i.keys()).sort(((t,e)=>gt(t).diff(gt(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(i.keys()).sort(((t,e)=>{const[a,i]=t.split("-"),[s,o]=e.split("-");return a!==s?parseInt(a,10)-parseInt(s,10):parseInt(i,10)-parseInt(o,10)})));const o=new Map;s.forEach((t=>{o.set(t,i.get(t))})),t[a]=o}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const a=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{a.push(gt(e))}))}));const i=gt.max(a),s=gt.min(a);if("DAY"===e){let e=s;const a=i;for(;null==e?void 0:e.isSameOrBefore(a,"day");){const a=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const a=i.year();for(;e<=a;){const a=e.toString();Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const a=i.clone().startOf("month");for(;e.isSameOrBefore(a);){const a=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,10);e++)for(let a=1;a<=4;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((a=>{t[a].forEach(((t,a)=>{e.push(a)}))}));const a=e.reduce(((t,e)=>e<t?e:t),e[0]),i=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=a.split("-"),[o]=i.split("-");for(let e=parseInt(s,10);e<=parseInt(o,10);e++){const a=gt("".concat(e,"-12-31")).isoWeek();for(let i=1;i<=a;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}}this.sortTimeData(t)}},Go=class extends Bo{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:i}=this.model;return i&&(t.step="middle"),t}},jo=class extends Bo{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},Ko=class extends Bo{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},Xo=class extends Bo{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,a)=>{e.push({name:a,value:[t.value,t.chartData]})})),e}},Ho=class extends Bo{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new a(this.model,"序列没有配置X坐标轴");if(void 0===this.yAxisIndex)throw new a(this.model,"序列没有配置Y坐标轴");const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Yo=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const a=this.indicator[t];(!a||a.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},qo=class extends Bo{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Yo(this.chartGenerator.radarMap.size));const a=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{a.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,a=this.chartGenerator.radarMap.get(this.catalogField),i=Object.keys(e).map((t=>{const i=e[t],s=a.indicatorKeys.map((t=>i.has(t)?i.get(t).value:0));return{name:t===zo?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:i};return this.seriesUserParam&&(s=ft(s,this.seriesUserParam)),s}};function Qo(t){const e={};return t&&Object.keys(t).forEach((a=>{const i=a.indexOf(".");if(-1===i)return;const s=a.slice(i+1);if(s)try{e[s]=JSON.parse(t[a])}catch(i){e[s]=t[a]}})),e}var Jo=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:a,chartXAxises:i,chartYAxises:s,userParam:o}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),a&&(this.staticOptions.legend=this.calcLegendOption(a)),(null==i?void 0:i.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(i)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),o&&(this.chartUserParam=Qo(o))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new Go(t,this);break;case"bar":e=new jo(t,this);break;case"scatter":e=new Ho(t,this);break;case"pie":e=new Xo(t,this);break;case"funnel":e=new Ko(t,this);break;case"radar":e=new qo(t,this);break;default:ibiz.log.error("图表暂未支持序列类型".concat(t.seriesType))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:a,subTitle:i,titlePos:s}=t,o={show:e,text:a,subtext:i,left:"center"},n=null==s?void 0:s.toLowerCase();return"left"===n||"right"===n?o.left=n:"bottom"!==n&&"top"!==n||(o.top=n),o}calcLegendOption(t){const{showLegend:e,legendPos:a}=t,i={};i.show=e;const s=null==a?void 0:a.toLowerCase();return"left"===s||"right"===s?(i.left=s,i.top="middle",i.orient="vertical"):"bottom"===s&&(i.top=s),i}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:a,dataShowMode:i,userParam:s}=t;let o={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:a,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===i?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===i&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===i?45:0}};s&&(o=ft(o,Qo(s))),e.push(o)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var a;if(this.codeListMap.clear(),!(null==(a=this.model.dechartSerieses)?void 0:a.length))return;const i=ibiz.hub.getApp(t.srfappid),s=async a=>{if(!a||this.codeListMap.has(a))return;const s=await i.codeList.get(a,t,e);this.codeListMap.set(a,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:a}=t;await s(e),await s(a)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((a=>{const i=e.length,s=a.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const o=e.length-1;for(let t=i;t<=o;t++)this.seriesGeneratorIndexMap.set(t,a)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=ft(this.staticOptions,this.options),this.chartUserParam&&(this.options=ft(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new n("找不到".concat(t.seriesIndex,"序列的generator!"));return e.getChartDataByParams(t)}},$o=t("ChartService",class extends Xi{}),Zo=(t("ChartController",class extends ko{initState(){super.initState(),this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new $o(this.model),await this.service.init(this.context),this.generator=new Jo(this.model),await this.generator.init(this.context,this.params),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const a=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),a}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.updateChart()}updateChart(){if(!this.chart)throw new n("chart对象没有正确初始化");if(!this.options)throw new n("options还没计算");this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends Fo{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):"")}))}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),tn=class{};function en(t,e){const{srcDEUILogicParamId:a,srcFieldName:s,srcValue:o}=e,n=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(n){case"SRCDLPARAM":c=t.params[a];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(o);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=lt(ibiz.env);break;default:throw new i(e,"暂未支持源值类型".concat(n))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:je.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error("从源参数取属性".concat(r,"报错,源参数:"),c),t}return c}var an=class extends tn{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const o=en(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const t=null!=s[this.value]?s[this.value]:e[this.value];return Fe(o,this.op,t)}case"SRCENTITYFIELD":{if(!this.value)throw new a(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const e=en(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});return Fe(o,this.op,e)}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return Fe(o,this.op,this.value)}}},sn=class t extends tn{constructor(e){super(),this.model=e;const a=e.deuilogicLinkConds||[];this.conds=a.map((e=>"SINGLE"===e.logicType?new an(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,i){let s=!0;if(0===this.conds.length)throw new a(this.model,"界面连接条件逻辑组未配置逻辑项");for(let a=0;a<this.conds.length;a++){const o=this.conds[a].test(t,e,i);if("AND"===this.op&&!1===o){s=!1;break}if("OR"===this.op&&!0===o){s=!0;break}}return this.notMode?!s:s}},on=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:a}=this.model;0===(e||0)&&a&&(this.groupCond=new sn(a))}async exec(t){const{linkMode:e}=this.model,{context:a,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,a,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(e))}}},nn=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new on(t)))}},rn=class extends nn{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!e)throw new a(this.model,"未指定应用实体");if(!i)throw new a(this.model,"未指定实体行为");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,i,t.context,n,t.viewParam);c.ok&&(t.params[o]=c.data)}},cn=class extends nn{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:i}=this.model,{data:s,parameters:o}=t;if(!e)throw new a(this.model,"未配置界面行为");let n=[s];if(i){const e=t.params[i];n=e instanceof Array?e:[e]}await Ln.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:n},this.model.appId)}},dn=class extends nn{async exec(t){}},ln=class extends nn{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:a,returnParamId:s}=this.model;if(e)switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(a);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(e))}}},hn=class extends nn{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const a of e)switch(a.paramAction){case"SETPARAMVALUE":await this.setParamValue(a,t);break;case"RESETPARAM":await this.resetParam(a,t);break;case"COPYPARAM":await this.copyParam(a,t);break;case"BINDPARAM":await this.bindParam(a,t);break;case"RENEWPARAM":await this.renewParam(a,t);break;case"APPENDPARAM":await this.appendParam(a,t);break;case"SORTPARAM":await this.sortParam(a,t);break;default:throw new i(a,"暂未支持逻辑处理参数操作".concat(a.paramAction))}}setParamValue(t,e){const{dstFieldName:a,dstDEUILogicParamId:i}=t;if(!i)throw new n("没有目标参数对象id");let s=a;e.isEntityParam(i)&&(s=null==s?void 0:s.toLowerCase());const o=en(e,t);if(s)try{je.execScriptFn({srcVal:o,dstParam:e.params[i]},"dstParam.".concat(a," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error("给目标参数属性".concat(a,"赋值报错,目标参数:"),e.params[i]),t}else e.params[i]=o}copyParam(t,e){const{dstDEUILogicParamId:a}=t,i=en(e,t);e.params[a]=lt(i)}bindParam(t,e){const a=en(e,t);e.params[t.dstDEUILogicParamId]=a}resetParam(t,e){const{dstDEUILogicParamId:a}=t;e.resetParam(a)}renewParam(t,e){const{dstDEUILogicParamId:a}=t;e.renewParam(a)}appendParam(t,e){const{dstDEUILogicParamId:a,dstIndex:i,srcIndex:s,srcSize:o}=t,n=en(e,t),r=i||0,c=s||0,d=o||n.length;e.params[a].splice(r,0,...n.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:a,dstFieldName:i,dstSortDir:s}=t,o=i;e.params[a].sort(((t,e)=>"ASC"===s?t[o]-e[o]:e[o]-t[o]))}},un=class extends nn{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:i,invokeParamId:s}=this.model;if(!i)throw new a(this.model,"没有配置界面对象");if(!s)throw new a(this.model,"没有配置操作参数");if(!e)throw new a(this.model,"没有配置调用方法");const o=t.params[s];if(!o)throw new n("没有找到操作参数".concat(s));const r=t.params[i];if(!r)throw new n("没有找到界面对象".concat(i));if(!r[e]||!X(r[e]))throw new n("没有找到调用方法".concat(e));await r[e](o)}},pn=class extends nn{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=en(t,this.model);t.params[e]=s}},mn=class extends nn{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:o}=this.model;if(!e)throw new a(this.model,"缺少消息类型的配置");if(!s)throw new a(this.model,"缺少按钮类型的配置");let{title:n}=this.model,{message:r}=this.model;if(o){const e=t.params[o];e.title&&(n=e.title),e.message&&(r=e.message)}const c={type:this.typeMap[e],title:n||"消息",desc:r};let d=[];switch(s){case"YESNO":c.confirmButtonText="是",c.cancelButtonText="否",c.showConfirmButton=!0,c.showCancelButton=!0,d=["yes","no"];break;case"OK":c.confirmButtonText="确定",c.showConfirmButton=!0,c.showCancelButton=!1,d=["ok"];break;case"OKCANCEL":c.confirmButtonText="确定",c.cancelButtonText="取消",c.showConfirmButton=!0,c.showCancelButton=!0,d=["ok","cancel"];break;default:throw new i(this.model,"".concat(s,"暂未支持"))}const l=await ibiz.modal.confirm(c);t.setLastReturn(d[l?0:1])}},fn=class extends nn{async exec(t){const e=await $a(this.model);e&&await e.exec(this.model,t)}},gn=class extends nn{async exec(t){const{dstDEUILogicParamId:e,name:i}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");const s=t.params[e];ibiz.log.debug("逻辑节点".concat(i,"操作参数值:"),s)}},wn=class extends nn{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.resetParam(e)}},En=class extends nn{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const s=en(t,this.model);t.params[e]=lt(s)}},yn=class extends nn{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:i,dstIndex:s,srcIndex:o,srcSize:n}=this.model;if(!e||!i)throw new a(this.model,"缺少目标参数对象或者源参数对象配置");const r=en(t,this.model),c=s||0,d=o||0,l=n||r.length;t.params[e].splice(c,0,...r.slice(d,l))}},vn=class extends nn{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:i,dstFieldName:s}=this.model;if(!e||!s)throw new a(this.model,"缺少目标参数对象或目标属性配置");const o=s;t.params[e].sort(((t,e)=>"ASC"===i?t[o]-e[o]:e[o]-t[o]))}},In=class extends nn{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new a(this.model,"缺少目标参数对象配置");t.renewParam(e)}},Dn=class extends nn{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!s)throw new a(this.model,"缺少配置过滤参数");const n=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(i,e,t.context,n);c.ok&&(t.params[o]=c.data)}},Cn=class extends nn{async exec(t){const{errorInfo:e}=this.model;throw new n(e)}},An=class extends nn{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:i,fireCtrlId:s}=this.model;if(!s)throw new a(this.model,"没有配置触发对象");if(!e)throw new a(this.model,"没有配置事件名称参数");if(!i)throw new a(this.model,"没有配置事件参数");const o=t.params[s];if(!o)throw new n("没有找到触发对象".concat(s));const r=t.params[i];if(!r)throw new n("没有找到事件参数对象".concat(i));await o.evt.emit(e,r)}},bn=class extends nn{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:i,dstDEUILogicParamId:s,retDEUILogicParamId:o}=this.model;if(!i)throw new a(this.model,"没有配置实体");if(!e)throw new a(this.model,"没有配置实体逻辑");if(!s)throw new a(this.model,"没有配置传入逻辑参数");const r=t.params[s];if(!r)throw new n("没有找到传入参数".concat(s));const c=await Cs(e,i,t.context,r,t.params);o&&(t.params[o]=c)}},Pn=class extends nn{async exec(t){je.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Tn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,a=this.model,{parameters:s}=t,{context:o,params:n,data:r}=s,c=ibiz.hub.getApp(a.appId);if("layoutPanel"!==a.codeName)if(a.default)a.entityListParam?t.params[e]=r||[]:t.params[e]=r&&r.length>0?r[0]:{};else if(a.activeContainerParam)t.params[e]=s.ctrl||s.view;else if(a.activeCtrlParam)t.params[e]=s.ctrl;else if(a.ctrlParam){const i=s.view.getController(a.codeName.toLowerCase());i?t.params[e]=i:ibiz.log.error("视图逻辑初始化参数,未找到".concat(a.codeName,"指定部件对象"))}else if(a.activeViewParam)t.params[e]=s.view;else if(a.appGlobalParam)t.params[e]=ibiz.env;else if(a.applicationParam)t.params[e]=c;else if(a.entityListParam)t.params[e]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)t.params[e]={};else if(a.lastReturnParam)t.initLastReturnParam(e);else if(a.navContextParam)t.params[e]=o;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)t.params[e]=[];else if(a.simpleParam)t.params[e]={};else if(a.viewNavDataParam)t.params[e]=n;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}else t.params[e]=s.view.layoutPanel.panelItems}renew(t){const e=this.model.id,a=this.model;if(a.entityListParam||a.simpleListParam||a.entityPageParam)t.params[e]=[];else{if(!a.simpleParam&&!a.entityParam)throw new i(a,"未支持的逻辑参数类型重新建立变量");t.params[e]={}}}},xn=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new a(t,"界面逻辑没有配置逻辑节点");t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let a;switch(e){case"BEGIN":a=new dn(t);break;case"END":a=new ln(t);break;case"DEACTION":a=new rn(t);break;case"DEUIACTION":a=new cn(t);break;case"PREPAREJSPARAM":a=new hn(t);break;case"RESETPARAM":a=new wn(t);break;case"COPYPARAM":a=new En(t);break;case"BINDPARAM":a=new pn(t);break;case"VIEWCTRLINVOKE":a=new un(t);break;case"MSGBOX":a=new mn(t);break;case"DEBUGPARAM":a=new gn(t);break;case"APPENDPARAM":a=new yn(t);break;case"SORTPARAM":a=new vn(t);break;case"RENEWPARAM":a=new In(t);break;case"DEDATASET":a=new Dn(t);break;case"THROWEXCEPTION":a=new Cn(t);break;case"VIEWCTRLFIREEVENT":a=new An(t);break;case"DELOGIC":a=new bn(t);break;case"PFPLUGIN":a=new fn(t);break;case"RAWJSCODE":a=new Pn(t);break;default:throw new i(t,"未支持的逻辑节点类型: ".concat(e))}this.nodes.set(t.id,a)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Tn(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 Zo(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new a(this.model,"未设置起始节点");{const t=this.nodes.get(i);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:a}=t;for(let i=0;i<a.length;i++){const s=a[i];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!1===t.model.parallelOutput))break}}},Nn=new Map;async function Sn(t,e,a){const i=ibiz.hub.getApp(a.context.srfappid),s=await i.getDEUILogic(t,e);if(!s)throw new n("找不到实体".concat(e,"的界面逻辑").concat(t));Nn.has(s)||Nn.set(s,new xn(s));const o=Nn.get(s);return await o.exec(a),null}var Ln=t("UIActionUtil",class{static async exec(t,e,a){const i=await ve(t,a);if(!i)throw new n("没找到".concat(t,"的界面行为模型"));if("SINGLEDATA"===i.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await Qa(i)).exec(i,e)}static async execAndResolved(t,e,a){var i,s;const o=await this.exec(t,e,a);if(o.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(o.refresh)switch(o.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(i=e.view.parentView)||i.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}}}),Rn=t("UIActionProviderBase",class{async exec(t,e){const i={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{appDEUILogicId:s,appDataEntityId:o,uilogicAttachMode:n}=t;if("REPLACE"===n){if(!s)throw new a(t,"没有配置实体界面逻辑");return await Sn(s,o,e),i}if(!await this.isConfirm(t,e))return this.returnError(i);const r=await this.execAction(t,e);if(Object.assign(i,r),!0===i.cancel)return this.returnError(i);if("AFTER"===t.uilogicAttachMode){if(!s)throw new a(t,"没有配置实体界面逻辑");await Sn(s,o,this.mergeArgsByResult(e,i))}const c=this.mergeArgsByResult(e,i);if(t.closeEditView)this.doNextAction(t,c,t.appId);else{const e=await this.doNextAction(t,c,t.appId);if(e&&(Object.assign(i,e),!0===e.cancel))return this.returnError(i)}return i}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t){return Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const a=this.calcMessage("confirm",t,e);return!t.enableConfirm||!a||ibiz.confirm.warning({title:"操作确认",desc:a})}async doNextAction(t,e,a){const i=t.nextId;if(i)return Ln.exec(i,e,a)}async handleParams(t,e,a,i){let s=[];const o=fe(t.appDataEntityId),n=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[a[0]];break;case"MULTIDATA":s=a;break;case"MULTIKEY":s=o&&a.length>0?a.map((t=>({[n]:t.srfkey||t[n]}))):[{}];break;case"SINGLEKEY":{const t=a[0]||{};s=o?[{[n]:t.srfkey||t[n]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(o&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:a}=t,i=a||o,s=e||"srfkey";c.unshift({key:i,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&a.length>0,l=ie(c,d?ne(c,a):a[0]||{},i,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:ie(h,d?ne(h,a):a[0]||{},i,r)}}calcMessage(t,e,a){let i,s;const{confirmMsg:o,cmlanguageRes:n,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":i=o,s=n;break;case"success":i=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||i);t!==s.lanResTag&&(i=t)}if(i){const{data:t}=a,e={...a};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,je.execScriptFn(e,"`".concat(i,"`"),{isAsync:!1,singleRowReturn:!0})}}}),On=t("BackendUIActionProvider",class extends Rn{async execAction(t,e){const{context:i,params:s,data:o,event:n}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new a(t,"未配置实体或实体行为");const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,i,o,s),p={...h},m=t.frontAppViewId;if(m){const t=await ibiz.commands.execute($s.TAG,m,l,h,{event:n});if(!(null==t?void 0:t.ok))return r.cancel=!0,r;if((null==t?void 0:t.ok)&&t.data){0===u.length&&u.push({});const e=t.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((t=>{t.srfactionparam=e}))}}const f=ibiz.hub.getApp(null==i?void 0:i.srfappid),g=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await f.deService.exec(c,d,l,w?g:g[0],p);if(E.ok){const a=this.calcMessage("success",t,e);a&&ibiz.message.success(a)}return Object.assign(r,{data:$(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),Mn=t("SysUIActionProvider",class extends Rn{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:a}=e,i=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===i)return{closeView:!0};return await a.callUIAction(i,e)||{}}}),_n=t("FrontUIActionProvider",class extends Rn{async execAction(t,e){const{context:s,params:o,data:n,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=I.fill(t.htmlPageUrl,s,null==n?void 0:n[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new a(t,"未配置打开视图");const{resultContext:i,resultParams:l}=await this.handleParams(t,s,n,o),h=await ibiz.commands.execute($s.TAG,e,i,l,{event:r,noWaitRoute:c});(null==h?void 0:h.ok)||(d.cancel=!0),(null==h?void 0:h.ok)&&h.data&&(d.data=h.data,d.nextContext=i,d.nextParams={...o,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=this.doOther(t,e);break;default:throw new i(t,"未支持的前台处理模式[".concat(t.frontProcessType,"]"))}return d}doOther(t,e){const{scriptCode:i}=t,{context:s,params:o,data:n,event:r,view:c}=e;if(i){return je.execScriptFn({context:s,params:o,data:n,el:null==r?void 0:r.target,view:c},i)||{}}throw new a(t,"自定义类型缺少配置脚本代码")}async executePrint(t,e){var a,i,s;const{resultContext:o,resultParams:r}=await this.handleParams(t,e.context,e.data,e.params),c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),d=null==(a=c.appDEPrints)?void 0:a.find((e=>e.id===t.appDEPrintId));if(!d)throw new n("没有找到实体打印项");{let t="";if(!o||!o[c.codeName.toLowerCase()])throw new n("没有找到数据主键");t+="/".concat(null==(i=c.codeName2)?void 0:i.toLowerCase(),"/printdata/").concat(o[c.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:d.codeName,...r}});if(!e.ok)throw new n("打印失败");if(r&&r.srfcontenttype){const t=null==(s=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:s.slice(9),a=URL.createObjectURL(e.data),i=document.createElement("a");i.href=a,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){var a;const{resultContext:i,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=o.appDEDataImports)?void 0:a.find((e=>e.id===t.appDEDataImportId));let c="DataImport";if(r&&r.enableCustomized&&(c="DataImport2"),r){const t=ibiz.overlay.createModal(c,{dismiss:()=>t.dismiss(),appDataEntity:o,dataImport:r,context:i,params:s},{width:"auto",placement:"center"});return t.present(),await t.onWillDismiss(),{refresh:!0,refreshMode:1}}throw new n("没有找到实体导入项")}async executeDataExport(t,e){var a,i;const{resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),o=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(a=o.appDEDataExports)?void 0:a.find((e=>e.id===t.appDEDataExportId));if(!r)throw new n("没有找到实体导出项");{const t="/".concat(null==(i=o.codeName2)?void 0:i.toLowerCase(),"/exportdata/fetchdefault?srfexporttag=").concat(r.codeName),a={page:0,size:r.maxRowCount?r.maxRowCount:1e3,...e.params,...s},c=await ibiz.net.request(t,{method:"post",data:a});if(200!==c.status)throw new n("导出请求失败");{let t="".concat(o.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([c.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}}}),Vn=t("WFWithdrawUIActionProvider",class extends Rn{async execAction(t,e){const{view:a}=e;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&a&&(await a.call("WFWithdraw",e),i=!0),{refresh:!1,closeView:i}}}),Fn=class extends Rn{async execAction(t,e){if(await ibiz.confirm.info({title:"确认退出登录",desc:"您确定要退出登录吗?退出后您将无法继续访问已登录状态的功能和信息,请确保您已保存所有未完成的操作。"})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function kn(){const t=new _n;Ya("FRONT",(()=>t));const e=new On;Ya("BACKEND",(()=>e));const a=new Mn;Ya("SYS",(()=>a));const i=new Vn;Ya("DEUIACTION_WFWithdraw",(()=>i));const s=new Fn;Ya("SYS_Logout",(()=>s))}var Wn=t("ToolbarController",class extends Fo{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new Eo,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,a={}){if("DEUIACTION"===t.itemType){const i=t.uiactionId,s=await ve(i,t.appId);if(!s)throw new n("没有找到界面行为模型".concat(i));const o=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;o&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],o=this.getEventArgs();o.params=Object.assign(a,o.params),await Ln.execAndResolved(i,{...o,data:s,event:e},t.appId)}finally{o&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if("DEUIACTION"===t.itemType){const e=t,a=new wo(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,a)}}),{childrenFields:["detoolbarItems"]}),await this.calcButtonState()}async onItemClick(t,e,a){const i="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:i?"extra":"deuiaction"}),i||await this.doUIAction(t,e,a)}async calcButtonState(t,e){let a=t;if(t&&t instanceof ji&&(a=t.getOrigin()),await this.state.buttonsState.update(a,e),this.scheduler){const t={};a&&(t.data=[a]),r(this.model,(e=>{const a=this.state.buttonsState[e.id];if(a){if(a.visible){const i=this.scheduler.triggerItemVisible(e.id,t);void 0!==i&&(a.visible=i)}if(!a.disabled){const i=this.scheduler.triggerItemEnable(e.id,t);void 0!==i&&(a.disabled=!i)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),Un=t("ContextMenuController",class extends Wn{}),zn=(t("DashboardController",class extends Fo{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=Co(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const a=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var i;if(t.controlType&&a.includes(t.controlType))return;const s=await Xa(t);if(s){this.providers[t.id]=s;const a=await s.createController(t,this,e);this.portlets[t.id]=a,(null==(i=t.controls)?void 0:i.length)&&await this.initPortlets(t.controls,a)}})))}async dataChangeNotify(t){await fa(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t){var e,a;this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.model=null,this.model=t,this.config=new _i(t.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(a=this.model.codeName)?void 0:a.toLowerCase()))}async loadCustomModelData(){const t=await this.config.load();return t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),this.customModelData}async saveCustomModelData(t){return await this.config.save({model:t,colNum:this.layoutColNum,rowH:this.layoutRowH})&&(this.customModelData=t),t}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Bn=t("PortletPartController",class{get context(){return this.dashboard.context}get params(){return this.dashboard.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}constructor(t,e,a){this.model=t,this.dashboard=e,this.parent=a,this.state=this.createState()}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e}=this.model;if(t){const{width:t,height:e}=he(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),await this.initActionStates()}createState(){return new zn}onDataChange(t){let e=t.data[0];e&&e instanceof ji&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Eo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new wo(t.id,this.dashboard.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a;const{appDataEntityId:i}=this.dashboard.view.model;i&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,a=[]){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.dashboard.context,params:this.dashboard.params,data:a,view:this.dashboard.view,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=ue(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),Gn=(t("ContainerPortletController",class extends Bn{}),t("ViewPortletController",class extends Bn{}),t("MenuPortletController",class extends Bn{}),t("ChartPortletController",class extends Bn{}),t("ActionBarPortletController",class extends Bn{}),t("HtmlPortletController",class extends Bn{}),t("ListPortletController",class extends Bn{}),t("RawItemPortletController",class extends Bn{}),t("DataViewControlService",class extends Xi{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new ks(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new ks(e,e);this.dataUIMap.set(e,i)}))}})),jn=t("DataViewControlController",class extends ko{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new Gn(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const a=new Eo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new wo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),t.groupActionGroupState=a}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:a}=this.model;if(a)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[a],i=this.state.groups.find((t=>t.key===e));i&&i.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var a,i;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof ji&&(s=s.getOrigin()),s&&(null==(a=e.groupActionGroupState)||a.update(s,this.model.appDataEntityId))):null==(i=e.groupActionGroupState)||i.update(void 0,this.model.appDataEntityId)}));else{const a=this.state.groups.find((e=>-1!==e.children.indexOf(t)));a&&(null==(e=a.groupActionGroupState)||e.update(a.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let a=0;a<e.length;a++)"ACTIONITEM"===e[a].itemType&&(t=e[a]);return t}getOptItemAction(t){var e;const i=new Eo,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new a(this.model,"操作项没有配置界面行为组");if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug("操作项界面行为组没有配置界面行为"),i;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new wo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.getOrigin())}return i}async onActionClick(t,e,a){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.context,params:this.params,data:[e],view:this.view,event:a},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const a={...this.params,srfgroup:e};Ln.execAndResolved("new",{context:this.context,params:a,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,a){const i=t.uiactionId,s={...this.params,srfgroup:a.key};await Ln.execAndResolved(i,{context:this.context,params:s,data:a.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:i,minorSortDir:s}=this.model,o=i&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:n}=t;if(t.capLanguageRes&&(n=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new a(t,"启用排序的项必须关联实体属性");const r={caption:n,key:t.appDEFieldId};o&&i===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),Kn=t("ExpBarControlController",class extends Fo{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const a=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),i=[];null==a||a.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){t.isInitialLoad&&(this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem())}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&Io(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:a,params:i}=t,s=this.getNavViewMsg(e[0],a,i);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,a,i){const{navDER:s,navFilter:o,navigateContexts:n,navigateParams:r,appDataEntityId:c}=t,d={deName:c?fe(c):void 0,navFilter:o,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:n,navParams:r},l={context:a,params:i,data:e},{resultContext:h,resultParams:u}=re(d,l),p=Object.assign(a.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new n("多节点视图由子类实现")}getNavViewMsg(t,e,a){const i=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,a);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:i,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),Xn=(t("CalendarExpBarController",class extends Kn{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const a=new Date(e.beginTime);this.xDataController.setSelectDate(a)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:a,params:i}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return a.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:a,params:i,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends Kn{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new a(this.model,"无法获取多数据部件[".concat(this.model.xdataControlName,"]控制器"));return t}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let a;return e&&e.forEach((e=>{e.id===t&&(a=e)})),a}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,a){const i=t._id,s=t._deData||t,o=this.getNodeModel(t._nodeId);if(!o)throw new n("找不到".concat(t._nodeId,"的节点模型"));const r=this.prepareParams(o,s,e,a);return r.context.currentSrfNav=i,this.state.srfnav=i,{key:i,viewId:o.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,a)=>{0===a?e.push(t):e.push("".concat(e[a-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends Kn{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,a,i){var s;const{context:o,params:n}=super.prepareParams(t,e,a,i);if(e._seriesModelId){const a=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(a){const{navigateContexts:t,navigateParams:s}=a,r=ie(t,e,i,o),c=ie(s,e,i,n);return{context:Object.assign(o.clone(),r),params:c}}}return{context:o,params:n}}getNavViewMsg(t,e,a){var i;let s;if(t._seriesModelId){const e=null==(i=this.XDataModel.dechartSerieses)?void 0:i.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const o=this.prepareParams(this.XDataModel,t,e,a);return{key:t._uuid,context:o.context,params:o.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends Fo{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[]}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new ji,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await fa(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,i=void 0){await Promise.all(t.map((async t=>{const s=await Fa(t);if(!s)return;if(e.details[t.id])throw new a(t,"初始化异常: 表单成员[".concat(t.id,"](").concat(t.detailType,")已存在,表单项标识重复请检查配置"));e.providers[t.id]=s;const o=await s.createController(t,e,i);if(e.details[t.id]=o,"FORMITEM"===t.detailType&&e.formItems.push(o),"MDCTRL"===t.detailType&&e.formMDCtrls.push(o),Pe(t))return;const n=be(t);n.length&&await this.initDetailControllers(n,e,o)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||Do(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}})),Hn=class extends Ki{setDefault(t,e,a,i){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:o,createDV:n,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===i?o:r,h="create"===i?n:c,u=s.id.toLowerCase(),p=To({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:a});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Yn=t("SearchFormService",class extends Hn{async getDraft(t,e={}){let a={ok:!0,status:200,data:this.getFilteredData({...e})};return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new ks(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}}),qn=(t("SearchFormController",class extends Xn{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new _i(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new Yn(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const a=this.state.data[e];null!=a&&""!==a&&(t[e]=a)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,a=!1;const i=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===i,a="BOTTOM"!==i,"NONE"===t&&(e=!0,a=!0);const s=t=>{let i,o="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(i=t[e],o=e,!0))),i&&i.length>0){const n=[];i.forEach((t=>{e&&"control_buttons_right"===t.id||a&&"control_buttons_bottom"===t.id||(n.push(t),s(t))})),n.length<i.length&&(t[o]=n)}};(a||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new n("没有找到可以应用的搜索条件");e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new n("没有找到保存的搜索条件");this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),Qn=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Qn||{})),Jn=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Jn||{})),$n=t("FormDetailController",class{constructor(t,e,a){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=a,this.state=this.createState()}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:a,capLanguageRes:i}=this.model;if(t){const{width:e,height:a}=he(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName),i&&i.lanResTag&&(this.model.caption=ibiz.i18n.t(i.lanResTag,this.model.caption))}createState(){var t;return new qn(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.defdgroupLogics)||a.forEach((a=>{const i=a.relatedDetailNames||[];if(e||C(i,t))try{const t=He(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=ue(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=ue(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const a=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Zn=t("FormButtonState",class extends qn{constructor(){super(...arguments),this.loading=!1}}),tr=(t("FormButtonController",class extends $n{createState(){var t;return new Zn(null==(t=this.parent)?void 0:t.state)}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await Ln.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends qn{constructor(){super(...arguments),this.showMask=!1}})),er=(t("FormDRUIPartController",class extends $n{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new tr(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),C(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;H(e)&&(t=Object.assign(t,ie(e,this.data,this.form.params,this.form.context)));const a=ie(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(a))this.navContext=t,this.navParams=a,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=Q(),this.navContext=t,this.navParams=a}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug("接收到关系界面的数据变更事件",t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends qn{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),ar=t("FormGroupPanelController",class extends $n{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new er(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const a=new Eo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new wo(t.id,this.form.context.srfappid,e);a.addState(t.id,i)}})),await a.update(),this.state.actionGroupState=a}async onActionClick(t,e){const a=t.uiactionId;await Ln.execAndResolved(a,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),ir=t("FormItemState",class extends qn{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),sr=(t("FormItemController",class extends $n{constructor(t,e,a){super(t,e,a),this.rules=[]}createState(){var t;return new ir(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:t}=this.model;t||(this.state.enableCondDisabled=!0),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Ma(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=ca(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...Ao(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...bo(this.model.editor)),this.rules.length>0&&(this.validator=new wt({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&Y(this.data[this.name]))return this.state.error="请填写".concat(this.model.caption||""),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}setDefaultValue(t,e=this.data){const{createDVT:a,createDV:i,updateDVT:s,updateDV:o}=this.model,n=t?a:s,r=t?i:o,c=To({name:this.name,valueType:n,defaultValue:r,valueFormat:this.model.valueFormat},{data:e,context:this.context,params:this.params});void 0!==c&&(e[this.name]=c)}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),t("FormMDCtrlController",class extends $n{get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return A.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return A.checkPermission(this.model.buildInActions,2)}get enableDelete(){return A.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}refresh(){}async validate(){return!0}})),or=(t("FormMDCtrlMDController",class extends sr{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");"GRID"===t.controlType&&b(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await La(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new i(this.model,"多数据部件类型".concat(this.model.contentType,"暂不支持添加数据"));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug("mdController不存在")}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends qn{}),nr=(t("FormMDCtrlFormController",class extends sr{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new or(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new a(this.model,"多数据部件未配置内容部件");t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await La(t);e&&(this.formProvider=e);const{appDataEntityId:i}=this.model.contentControl;this.deName=fe(i)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const a={...this.params};return{id:t.srfkey,context:e,params:a}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const a=e.data[0],i=this.state.items.find((e=>e.id===t));i&&i.context[this.deName]!==a.srfkey&&(i.context[this.deName]=a.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new n("没有找到对应".concat(t,"的表单控制器"));await e.remove();const a=this.state.items.findIndex((e=>e.id===t));-1!==a&&this.state.items.splice(a,1)}create(t){const e=this.context.clone(),a={...this.params};this.state.items||(this.state.items=[]);const i={id:Q(),context:e,params:a};void 0!==t?this.state.items.splice(t,0,i):this.state.items.push(i)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends sr{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new i(this.model,"暂不支持重复器样式".concat(this.model.detailStyle))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=lt(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,a)=>t!==a));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let a=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(a=!0)})),a&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends er{})),rr=(t("FormPageController",class extends ar{createState(){var t;return new nr(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends qn{})),cr=(t("FormRawItemController",class extends $n{createState(){var t;return new rr(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends qn{})),dr=(t("FormTabPageController",class extends $n{createState(){var t;return new cr(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends qn{constructor(){super(...arguments),this.activeTab=""}})),lr=(t("FormTabPanelController",class extends $n{createState(){var t;return new dr(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}}),t("EditFormService",class extends Hn{async get(t,e={}){var a;let i=await this.exec((null==(a=this.model.getControlAction)?void 0:a.appDEMethodId)||"get",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"update"),i}async getDraft(t,e={}){var a;let i=await this.exec((null==(a=this.model.getDraftControlAction)?void 0:a.appDEMethodId)||"getdraft",t,void 0,e);return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}async remove(t,e={}){var a;return await this.exec((null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var a;const i=e instanceof ji?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.createControlAction)?void 0:a.appDEMethodId)||"create",t,s);return o=this.handleResponse(o),o}async update(t,e){var a;const i=e instanceof ji?e.getOrigin():e,s=this.getFilteredData(i);let o=await this.exec((null==(a=this.model.updateControlAction)?void 0:a.appDEMethodId)||"update",t,s);return o=this.handleResponse(o),o}async goBack(t,e){var i;const s=null==(i=this.model.goBackControlAction)?void 0:i.appDEMethodId;if(!s)throw new a(this.model,"缺少返回操作实体行为");let o=await this.exec(s,t,e instanceof ji?e.getOrigin():e);return o=this.handleResponse(o),o}async updateFormItem(t,e,a={}){let i=await this.exec(t,e,a);return i=this.handleResponse(i),i}async wfStart(t,e,a){var i;const s=(null==(i=this.model.wfstartControlAction)?void 0:i.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,a instanceof ji?a.getOrigin():a)}async wfSubmit(t,e,a){var i;const s=this.model;let o="";o=e.type?e.type:(null==(i=s.wfsubmitControlAction)?void 0:i.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(o,t,e,a instanceof ji?a.getOrigin():a)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const a=e,i=a.id.toLowerCase(),s=a.fieldName||e.appDEFieldId;let o;o=s?new ks(i,s,{isOriginField:!0,dataType:a.dataType}):new ks(i,i,{isOriginField:t.includes(i)}),this.dataUIMap.set(i,o)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((a=>{void 0!==t[a.dataKey]&&(e[a.dataKey]=t[a.dataKey])})),e}})),hr=(t("EditFormController",class extends Xn{constructor(){super(...arguments),this.oldData=new ji}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new lr(this.model),await this.service.init(this.context),this.autoSave=_(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:a}),i=await this.service.getDraft(e,a)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=i.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=lt(this.context),e=lt(this.params),a=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(a&&this.params[a]){t[fe(this.model.appDataEntityId)]=this.params[a],delete e[a],delete this.params[a],delete e.srfcopymode,delete this.params.srfcopymode}let i;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),i=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return i.data.srfkey=void 0,i.data.tempsrfkey=Q(),this.state.modified=!1,this.state.data=i.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!ge(this.context,this.model.appDataEntityId))return this.loadDraft();const{context:e,params:a}=this.handlerAbilityParams(t),i=lt(a);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",void 0),s=await this.service.get(e,i)}catch(t){throw await this.evt.emit("onLoadError",void 0),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",void 0),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await P(500,this.save.bind(this),[t])}if(!await this.validate())throw new n("请检查表单填写!");e||await this.startLoading(),await this.evt.emit("onBeforeSave",void 0);const{context:a,data:i}=this.handlerAbilityParams(t),s=i[0],o=0===s.srfuf;let r;try{r=o?await this.service.create(a,s):await this.service.update(a,s)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(o?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):b(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",void 0),this.formStateNotify("SAVE"),e||this.actionNotification("".concat(o?"CREATE":"UPDATE","SUCCESS"),{default:"".concat(this.data.srfmajortext||"","保存成功")}),ibiz.mc.command.send(this.data.$origin,o?"OBJECTCREATED":"OBJECTUPDATED"),this.data}async remove(t){const{context:e,params:a}=this.handlerAbilityParams(t);let i,s=!1;if(await this.evt.emit("onBeforeRemove",void 0),1===this.data.srfuf){if(s=await ibiz.modal.confirm({title:"提示",desc:"确认删除吗?"}),!s)return!1;await this.startLoading();try{i=await this.service.remove(e,a)}catch(t){throw await this.evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=i.ok}return this.state.data=new ji,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",void 0),this.actionNotification("REMOVESUCCESS"),ibiz.mc.command.send(this.data.$origin,"OBJECTREMOVED"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&b(this.data,t.data),this.data}async updateFormItem(t){var e;const a=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!a)throw new n("没找到".concat(t,"表单项更新"));const{appDEMethodId:i,defiupdateDetails:s,customCode:o,scriptCode:r,showBusyIndicator:c}=a,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),o&&r)t=je.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},a=await this.service.updateFormItem(i,this.context,e);t=a.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new n("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:"流程启动成功"})}async wfSubmit(t){if(!await this.validate())throw new n("请检查表单填写!");await this.startLoading();const{context:e,params:a}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,a,this.data),ibiz.mc.command.send(this.data.$origin,"OBJECTUPDATED"),ibiz.mc.command.send({srfdecodename:"SysTodo"},"OBJECTUPDATED")}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:"流程提交成功"})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{demand:t}=this.model,e={silent:!0,noFillBack:!0};t&&(e.data=this.getDiffData());try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((a=>{t[a]===this.oldData[a]&&a!==t.srfkeyfield||(e[a]=t[a])})),e.srfuf=t.srfuf,new ji(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}}),t("GridColumnController",class{constructor(t,e){var a;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(a=this.deGridDataItem)?void 0:a.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return je.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),ur=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}}))}}),pr=t("GridService",class extends Xi{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const i=t.id.toLowerCase(),s=t.appDEFieldId;let o;if(s){const n=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new a(t,"未找到对应的表格数据项[".concat(s,"]"));o=new ks(i,n,{isOriginField:!0,dataType:r.dataType})}else o=new ks(i,i);this.dataUIMap.set(i,o)}))}}async updateGridEditItem(t,e,a={}){const i=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await i.exec(t,e,a);return s=this.handleResponse(s),s}}),mr={string:25,number:6,integer:9,date:5};var fr=t("GridController",class extends ko{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计"}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new pr(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=D(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await Lo(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var a;if(!t.properties)return;const{properties:i}=t;if(!(Object.keys(i).length>0))return;const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e})}));const o={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[],r=[];return s.forEach((t=>{n.push({appId:e.model.appId,appDEFieldId:o[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:o[t.key],id:t.key,valueType:"SIMPLE",dataType:mr[t.type]})})),{degridColumns:n,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:a}=e;this.model=lt(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===a.findIndex((e=>e.id===t.id)))),...a]}}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:i}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new a(this.model,"没有配置分组属性的属性列");const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new a(this.groupFieldColumn.model,"分组属性的属性列".concat(s,"没有配置代码表"));const o=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==o&&0!==o){if(this.isMultistageHeader)throw new a(this.model,"请将分组属性列".concat(s,"配置为第一列"));const t=this.state.columnStates.splice(o,1);this.state.columnStates.unshift(...t)}if("CODELIST"===i){if(!e)throw new a(this.model,"代码表分组模式需要配置代码表");if(this.groupFieldColumn.model.appCodeListId!==e)throw new a(this.model,"分组代码表与属性列".concat(s,"的代码表不一致"))}}async afterLoad(t,e){return await super.afterLoad(t,e),await fa(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new ur(t,this);return this.gridStateNotify(e,"LOAD"),e})),this.state.rows.forEach((t=>{Object.values(t.uaColStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.state.rows.forEach((t=>{Object.values(t.uiActionGroupStates).forEach((e=>{e.update(t.data.getOrigin(),this.model.appDataEntityId)}))})),this.calcGroupData(e),this.calcAggResult(e),e}calcGroupData(t){const{enableGroup:e,groupMode:a}=this.model;if(e){const e=new Map,i="CODELIST"===a,s=this.groupFieldColumn.model.id;i&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const a=t[s];i||e.has(a)||e.set(a,[]),e.has(a)&&e.get(a).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==a?void 0:a.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:i}=this.model;if("ALL"!==t)return;if(!i||!e)throw new a(this.model,"缺少配置聚合实体或聚合数据集");const s=await this.getFetchParams(),o=ibiz.hub.getApp(this.context.srfappid),n=await o.deService.exec(e,i,this.context,void 0,s);n.data.length&&([this.state.remoteAggResult]=n.data)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const a=e.calcFieldAgg(t);a&&(this.state.aggResult[e.model.id]=a)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const a=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==a&&e.children.splice(a,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:a}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(a))return void ibiz.log.error("不支持新建行");if("row"===a){if(this.state.rows.find((t=>t.showRowEdit)))throw new n("请先完成当前行编辑中的行的操作")}const i={...this.params},s=this.calcDefaultValue({},!0);let o;Object.assign(i,s);try{o=await this.service.getDraft(this.context,i)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=o.data;T(r,s),this.state.items.unshift(r);const c=new ur(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,a=this.findRowState(t);if(!a)throw new n("行数据不存在");if(!a.modified)return void ibiz.log.debug("值没有发生改变");if(a.processing)return void await P(500,this.save.bind(this),[t]);if(!await this.validate(a))throw new n("行数据校验不通过,保存取消");let i;const s=fe(this.model.appDataEntityId),o=this.context.clone();o[s]=t.srfkey;try{i=e?await this.service.create(o,t):await this.service.update(o,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:a.data}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,i.data),a.data=i.data,a.modified=!1,this.gridStateNotify(a,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await fa(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const a=await Ua(t);if(!a)return;this.providers[t.codeName]=a;const i=await a.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=i,t.enableRowEdit&&(this.editColumns[t.codeName]=i)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=i:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:a,frozenLastColumn:i}=this.model;t.forEach(((t,s)=>{t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":a&&s<a?t.fixed="left":i&&s>=e-i&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Do(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await fa(Object.values(this.editColumns).map((async a=>a.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((a=>{a.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new n("当前表格不支持行编辑,无法切换开启行编辑");this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new n("同时只能有一行开启行编辑");if(1===t.data.srfuf){t.cacheData=lt(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let a;t&&(a=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(a,e)}async updateGridEditItem(t,e){var a;const i=null==(a=this.model.degridEditItemUpdates)?void 0:a.find((t=>t.id===e));if(!i)throw new n("没找到".concat(e,"编辑列更新"));const{appDEMethodId:s,degeiupdateDetails:o,customCode:r,scriptCode:c}=i,d=o.map((t=>t.id));let l;if(r&&c)l=je.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},a=await this.service.updateGridEditItem(s,this.context,e);l=a.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let i;await this.startLoading();try{i=await this.service.fetch(e,a)}finally{await this.endLoading()}return i.data}async findAllExportColumns(t){var e;const a=ibiz.hub.getApp(this.context.srfappid),i=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=a.codeList.getCodeList(t.codeListId),e.codeListItems=await a.codeList.get(t.codeListId,this.context)),e}));if(i)return Promise.all(i)}async exportData(t){var e;this.model.dedataExportId&&!this.dataExport&&(this.dataExport=null==(e=this.dataEntity.appDEDataExports)?void 0:e.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport)));const a=t=>{var e;const a=new Map;this.allExportColumns&&this.allExportColumns.length>0?null==(e=this.allExportColumns)||e.forEach((t=>{t.codeListItems&&a.set(t.appDEFieldId,t.codeListItems)})):Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&a.set(t,this.fieldColumns[t].codeListItems)}));const i=lt(t.map((t=>t.getOrigin())));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;a.get(e)&&(t[e]=(null==(i=a.get(e).find((a=>a.value===t[e])))?void 0:i.text)||t[e])}))})),i};let i=[],s=[];this.allExportColumns&&this.allExportColumns.length>0?(i=this.allExportColumns.map((t=>t.appDEFieldId)),s=this.allExportColumns.map((t=>t.caption))):(i=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.id)),s=Object.keys(this.fieldColumns).map((t=>this.fieldColumns[t].model.caption)));const o=(r=i,(await(async()=>{var e;const i=null==(e=t.params)?void 0:e.type;let s=[];if("activatedPage"===i&&(s=this.state.rows.map((t=>t.data))),"maxRowCount"===i||"customPage"===i){const{size:e}=this.state,{startPage:a,endPage:o}=t.params,n="customPage"===i?{page:0,offset:(a-1)*e,size:(o-a+1)*e}:{size:1e3,page:0};s=await this.loadData({viewParam:n})}if("selectedRows"===i&&(s=this.getData()),0===s.length)throw new n("无导出数据");return a(s)})()).map((t=>r.map((e=>t[e])))));var r;await So(s,o,this.model.logicName)}calcDefaultValue(t,e){const a={};return Object.values(this.editColumns).forEach((i=>{const{createDV:s,createDVT:o,updateDV:n,updateDVT:r}=i.editItem,c=e?o:r,d=e?s:n,l=To({name:i.fieldName,valueType:c,defaultValue:d,valueFormat:i.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(a[i.fieldName]=l)})),a}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((a=>a.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.saveColumnStates()}setGroupParams(t){t.sort?this.state.sortQuery=t.sort:this.state.sortQuery="",t.columnstates?this.state.columnStates=t.columnstates:this.initColumnStates()}changeColumnStateSort(t,e,a){const i=this.state.columnStates.find((e=>e.key===t));i&&(this.state.columnStates.splice(a,1),this.state.columnStates.splice(e,0,i),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}}),gr=t("GridFieldColumnController",class extends hr{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=_(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const a=new Eo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new wo(t.id,this.grid.context.srfappid,e);a.addState(t.id,i)}})),t.uiActionGroupStates[this.model.codeName]=a}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,a){const{userParam:i}=this.model;if(!i)return{context:e,params:a};const{navigateContexts:s,navigateParams:o}=de(i);let n={};s&&t&&(n=ie(s,t,a,e));const r=Object.assign(e.clone(),n);let c={};o&&t&&(c=ie(o,t,a,e));return{context:r,params:{...a,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const a=this.model.linkValueItem||"srfkey",s=t.data[a];if(null==s)throw new i(this.model,"未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:o}=this.model;if(!o)return;const n=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...n}),c=lt(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute($s.TAG,o,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const a=this.model.deuiactionId;await Ln.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}calcFieldAgg(t){const{aggField:e,aggMode:a,aggValueFormat:s,unitName:o}=this.model;if(rt(a)||"NONE"===a)return;const n=e||this.model.id;let r;if(t=t.filter((t=>!rt(t[n]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new i(this.model,"远程聚合暂未支持"):new i(this.grid.model,"暂未支持聚合模式".concat(this.grid.model.aggMode));switch(a){case"SUM":r=t.map((t=>t[n])).reduce(((t,e)=>x(t,e)),0);break;case"AVG":r=t.map((t=>t[n])).reduce(((t,e)=>x(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[n])));break;case"MIN":r=Math.min(...t.map((t=>t[n])));break;default:throw new i(this.model,"暂未支持属性列聚合模式".concat(a))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error("".concat(r," 值格式化错误"))}return c&&o&&(c+=o),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return Po.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=gt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,a){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),wr=(t("GridUAColumnController",class extends hr{initActionStates(t){var e;const{deuiactionGroup:i}=this.model;if(!i)throw new a(this.model,"操作列没有配置界面行为组");if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const s=new Eo;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new wo(t.id,this.grid.context.srfappid,e);s.addState(t.id,a)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,a){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:a},t.appId)}}),t("GridFieldEditColumnController",class extends gr{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=Ae(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Ma(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=ca(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...Ao(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...bo(this.editItem.editor)),this.rules.length>0&&(this.validator=new wt({[this.fieldName]:this.rules}))}async setRowValue(t,e,a){a=a||this.fieldName,await this.grid.setRowValue(t,a,e)}async dataChangeNotify(t,e){const{resetItemNames:a}=this.editItem;let i=!1;a&&a.length>0&&a.forEach((t=>{e.includes(t)&&(i=!0)})),i&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new n("".concat(this.editItem.codeName,"校验报错,").concat(t.errors[this.fieldName]))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const a=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==a&&(e=a)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const a=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);t.editColStates[this.fieldName].readonly=a}calcEnableCond(t){const{enableCond:e}=this.editItem,a=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return a;case 2:return!a;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&t.editColStates[e].required&&Y(t.data[e]))return t.errors[e]="请填写".concat(this.model.caption||""),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(a){const{errors:i}=a;return t.errors[e]=i[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends hr{}),t("ListService",class extends Xi{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new ks(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new ks(e,e);this.dataUIMap.set(e,i)}))}})),Er=(t("ListController",class extends ko{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new wr(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=a.get(e[t])||[];i.push(e),a.set(e[t],i)}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:a}=this.state,i=[],s=ibiz.hub.getApp(this.context.srfappid),o=await s.codeList.get(e,this.context,this.params),n=[];o.forEach((e=>{const s=a.filter((a=>a[t]===e.value));i.push({caption:e.text,key:e.value,children:[...s]}),n.push(e.value)}));const r=a.filter((e=>-1===n.indexOf(e[t])));r.length>0&&i.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=i}}}),t("PanelController",class extends Fo{constructor(t,e,a,i,s){super(t,e,a,i),this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,a=void 0){t&&await Promise.all(t.map((async t=>{var i,s;const o=await Ga(t);if(!o)return;e.providers[t.id]=o;const n=await o.createController(t,e,a);e.panelItems[t.id]=n,(null==(i=t.panelItems)?void 0:i.length)&&!n.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,n),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,n)})))}async load(){var t,e;const a=await this.prepareData();if(!a)throw new n("未获取到面板数据");const i=this.convertData(a);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=i,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=Oe(this.model),a=e.map((t=>t.id)),i=new Bs(e,t);return i._evt.on("change",(t=>{a.includes(t)&&this.dataChangeNotify([t])})),i}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),yr=(t("ViewLayoutPanelController",class extends Er{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const a=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=a(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=a(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1;let e,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)})}})),vr=(t("PanelItemController",class{constructor(t,e,a){this.model=t,this.panel=e,this.parent=a,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState()}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:a}=this.model;if(t){const{width:e,height:a}=he(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(a)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==a?void 0:a.cssName)&&this.state.class.label.push(a.cssName)}destroy(){}createState(){var t;return new yr(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==a&&(e=a)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const a=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==a&&(e=!a)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var a;this.parent&&!this.parent.state.visible||null==(a=this.model.panelItemGroupLogics)||a.forEach((a=>{const i=a.relatedItemNames||[];if(e||C(i,t))try{const t=Ye(this.data,a);switch(a.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=ue(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=ue(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends Fo{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,a=this.context.clone(),i={...this.params};t&&Object.assign(a,ie(t,this.params,this.context)),e&&Object.assign(i,ie(e,this.params,this.context)),this.state.context=a,this.state.params=i}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),["ISNULL","ISNOTNULL"]),Ir=t("SearchBarFilterController",class{constructor(t,e){var a;let i;this.model=t,this.searchBar=e,this.noEditor=!1,t.appDEFieldId&&(i=ye(e.appDataEntity,t.appDEFieldId)),this.fieldName=i?i.codeName.toLowerCase():t.id,this.label=t.caption||(null==i?void 0:i.logicName)||t.id,this.valueOP=null==(a=t.defsearchMode)?void 0:a.valueOP,this.noEditor=this.valueOP?vr.includes(this.valueOP):!this.model.editor}get context(){return this.searchBar.context}get params(){return this.searchBar.params}async init(){if(!this.noEditor){if(!this.model.editor)throw new a(this.model,"缺少编辑器模型");this.editorProvider=await Ma(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}}),Dr=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=await this.app.net.post("".concat(this.themeUrl,"/fetch_default"),{app_view_tag:this.viewTag,sort:"create_time,asc"});return t.ok&&(t.data=this.convertBackDataToFront(t.data)),t}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag});return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t),{app_view_tag:this.viewTag})}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:t,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{id:t,theme_model:JSON.stringify(e),app_view_tag:this.viewTag,show:e.show})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[a]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),a)}async updateBatch(t){const e=this.convertFrontDataToBack(t),a=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(a),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.name&&(e.caption=t.name),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={appId:t.appId,app_view_tag:this.viewTag,id:t.id};return t.caption&&(e.name=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},Cr="",Ar={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},br={};function Pr(t,e){if(t.enumSource)return{appId:Cr,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return br["".concat(t.type,"_").concat(e)]}Object.keys(Ar).forEach((t=>{Ar[t].forEach((e=>{if(vr.includes(e))return;const a="".concat(t,"_").concat(e);br[a]||("date"!==t||["IN","NOTIN"].includes(e)?br[a]={appId:Cr,editorType:"TEXTBOX",id:a}:br[a]={appId:Cr,editorType:"DATEPICKER",id:a})}))}));t("SearchBarController",class extends Fo{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.addSchemaFilters=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated();const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Dr(this.model,this.view.model.codeName),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups()}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await Lo(this.model.appDataEntityId,this.context);if(!e)return;const a=await async function(t,e){var a;if(!t.properties)return[];const{properties:i}=t;if(!(Object.keys(i).length>0))return[];const s=[];Object.keys(i).forEach((t=>{let e;switch(i[t].type){case"string":e="string","date-time"===i[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error("未支持的类型".concat(i[t].type))}s.push({key:t,description:i[t].description,type:e,enumSource:i[t].enumSource})}));const o={};null==(a=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const n=[];return s.forEach((t=>{const e=Ar[t.type];e?e.forEach((e=>{t&&n.push({appId:Cr,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Cr,valueOP:e},editor:Pr(t,e)})})):ibiz.log.error("未支持的类型",t.type)})),n}(e,this),i=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===a.findIndex((e=>{var a;return e.appDEFieldId===t.appDEFieldId&&(!(null==(a=t.defsearchMode)?void 0:a.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&i.push(t)})),a.length>0&&(this.model=lt(this.model),this.model.searchBarFilters=a.concat(...i),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"))}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data){const t=ie(je.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const a=this.calcFilters();return a&&(e.searchconds=a),e}resetFilter(){this.state.filterNodes=this.getOriginFilterNodes(),this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;(null==(t=this.searchBarFilters)?void 0:t.length)&&(this.searchBarFilters.forEach((t=>{const e=new Ir(t,this);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init()))))}calcFilters(){if(!this.enableFilter)return;let t=!1,e=!1;if(r(this.state.filterNodes[0],(a=>{a.leaf&&(a.field&&a.valueOP&&!rt(a.value)?t=!0:e=!0)})),t&&!e){return[this.formatFilters(this.state.filterNodes[0])]}}formatFilters(t){return t.leaf?{condtype:"DEFIELD",fieldname:t.field,condop:t.valueOP,value:t.value}:{condtype:"GROUP",condop:t.logicType,bnotmode:!1,searchconds:t.children.map((t=>this.formatFilters(t)))}}parseFilters(t){if("GROUP"===t.condtype)return{leaf:!1,logicType:"AND"===t.condop?"AND":"OR",children:(t.searchconds||[]).map((t=>this.parseFilters(t)))};if("DEFIELD"===t.condtype)return{leaf:!0,field:t.fieldname||null,valueOP:t.condop||null,value:t.value||null};throw new n("无效的condtype:".concat(t.condtype))}getOriginFilterNodes(){return[{leaf:!1,logicType:"AND",children:[{leaf:!0,field:null,valueOP:null,value:null}]}]}async initSearBarGroups(){if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const a={...t,saved:!1,show:!0,searchGroupData:{},order:100*(e+1)};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(a.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(a.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(a.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(a.show="1"===e.valid_flag)}catch(e){ibiz.log.error("".concat(t.data,"非标准JSON格式:"),e)}return a})));const t=await this.service.fetch();t.ok&&t.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.id===t.id));if(e)b(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,a)=>e.order>this.state.searchBarGroups[t].order?a:t),0);this.state.searchBarGroups.push({appId:this.context.srfappid,saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)}))}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:this.calcFilters(),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success("保存成功");else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem.id,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.id===e.data.id));t&&(t.saved=!0),ibiz.message.success("保存成功")}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(b(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>this.parseFilters(t)));this.state.filterNodes=e}else this.state.filterNodes=this.getOriginFilterNodes();this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}}),t("TabExpPanelController",class extends Fo{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName=""}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&Io(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const a=this.getNavViewMsg(t);!0===e&&(a.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:a})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:a,navigateContexts:i,navigateParams:s,appDataEntityId:o}=t,n={deName:fe(o),navFilter:a,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:i,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=re(n,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d}}}getNavViewMsg(t){const{context:e,params:a}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:a,viewId:t.embeddedAppDEViewId,isCache:this.isCache}}});var Tr=t("TreeService",class extends Xi{async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ce(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:a});if(0===s.length)return;(await fa(s.map((async a=>{const i=De(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ie(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,a,n)];break;case"DE":r=await this.getDENodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{var a;if(d&&(!c||c&&0===e)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,a,i){return new Fs(t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}getNodeRSFilterParams(t,e,a){const{parentValueLevel:i,navigateContexts:s,navigateParams:o,parentFilter:n,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...a.params},l={...a.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<i;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=De(this.model,h._nodeId);t.appDataEntityId&&(p=fe(t.appDataEntityId)),u=h._value}const{resultContext:f,resultParams:g}=re({deName:p,navFilter:n?"n_".concat(n.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:o,navContexts:s},{derValue:u,context:l,params:d,data:m});return Object.assign(l,f),Object.assign(d,g),{context:l,params:d,navContext:f,navParams:g}}async getDENodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(o,s,n,r);if(l.data.length){return l.data.map((e=>new Vs(t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,o);if(c.length){return c.map((e=>new Ms(t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}}),xr=t("TreeController",class extends ko{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),a=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),this.model.detreeNodes.forEach((t=>{var e,a;(null==(a=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:a.length)&&(this.contextMenus[t.decontextMenu.id]=new Un(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async initService(){this.service=new Tr(this.model),await this.service.init(this.context)}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Ce(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var a;if(null==(a=t.parentDER1N)?void 0:a.pickupDEFName){const a=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&e.push({minorEntityId:a.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const a=t.decontextMenu;if(null==(e=null==a?void 0:a.detoolbarItems)?void 0:e.length){let e=0;const i=[];r(a,(t=>{if("DEUIACTION"===t.itemType){e+=1;const a=t;200===a.actionLevel&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:i[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let a;e&&await this.startLoading();try{a=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,a),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),a}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),a=!!e.query;let i;this.state.isLoading=!0;try{i=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:a,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=i:this.state.rootNodes=i,await this.afterLoadNodes(i),i}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var a;const i=null==(a=this.contextMenuInfos[t._nodeId])?void 0:a.clickTBUIActionItem;if(i)return this.doUIAction(i.uiactionId,t,e,i.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect){const{selectedData:e}=this.state,a=e.filter((e=>e._id!==t._id));a.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(a)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const a=this.state.expandedKeys.includes(t._id);if(e&&!a)this.state.expandedKeys.push(t._id);else if(!e&&a){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),a=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(a)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,a,i){const s=this.getEventArgs(),o=this.parseTreeNodeData(e),n=await Ln.exec(t,{...s,...o,event:a},i);if(n.closeView)this.view.closeView();else if(n.refresh)switch(n.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){return{data:[{...t,...t._deData||{}}],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var a;(null==(a=t._children)?void 0:a.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const a=t.srfkey?"srfkey":"_id",i=this.state.items.find((e=>e[a]===t[a]));if(!i)return void ibiz.log.error("找不到对应的树节点数据",t);if(e){const{_parent:t}=i;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?i._parent:i,o=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:o})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const a=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==a.length&&await Promise.all(a.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,a){var i,s;const o=this.getNodeModel(t._nodeId);if("inner"===a)return!!this.findDropNodeRS(e._nodeId,o.appDataEntityId);if((null==(i=t._parent)?void 0:i._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,o.appDataEntityId)}findDropNodeRS(t,e){const a=this.dropNodeRss.get(t);return null==a?void 0:a.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,i){var s,o,n;"inner"!==i||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===i?e:e._parent,l=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===i||(null==(o=e._parent)?void 0:o._id)!==(null==(n=t._parent)?void 0:n._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===i)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let a=d._children.indexOf(e);"next"===i&&(a+=1),d._children.splice(a,0,t)}("inner"===i||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:f}=h;if(!0===f){if(!p)throw new a(h,"缺少配置排序属性");const e=p.toLowerCase(),i="ASC"===m,s=[...d._children];i||s.reverse();const o=t=>t+(100-t%100),n=t=>t[e]||0;let c;s.forEach(((a,i)=>{const d=a._deData;void 0===c?a===t&&(c=0===i?100:o(n(s[i-1]._deData)),d[e]=c,-1===r.indexOf(a)&&r.push(a)):(c>=n(d)&&(d[e]=o(c),r.push(a)),c=n(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const a=this.getNodeModel(t._nodeId),i=t._deData,s=fe(a.appDataEntityId),o=this.context.clone();o[s]=i.srfkey;const n=await e.deService.exec(a.appDataEntityId,"update",o,i);n.data&&(t._deData=n.data)})))}async modifyNodeText(t,e){const i=this.getNodeModel(t._nodeId);if(!i.allowEditText)throw new a(i,"树节点没有配置编辑模式:名称");if(!t._deData)throw new n("不是实体树节点数据");t._text=e,t._deData[i.textAppDEFieldId]=e,await this.updateDeNodeData([t])}}),Nr=t("WizardPanelService",class extends Ki{async initialize(t,e={},a={}){var i;const s=null==(i=this.model.initControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}async finish(t,e={},a={}){var i;const s=null==(i=this.model.finishControlAction)?void 0:i.appDEMethodId;let o=await this.exec(s,t,e,a);return o=this.handleResponse(o),o}}),Sr=(t("WizardPanelController",class extends Fo{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}initState(){super.initState()}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,a,i;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),o=null==(i=null==(a=this.model.dewizard)?void 0:a.dewizardSteps)?void 0:i.find((e=>e.id===t.dewizardStepId)),n=null==o?void 0:o.stepTag;this.stepTags[s]=n})),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Nr(this.model),await this.service.init(this.context);const{deeditForms:a}=this.model;a&&a.length>0&&await Promise.all(a.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const a=await La(t);a&&(this.providers[e]=a)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug("找不到".concat(t,"的向导表单")),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new n("找不到".concat(t,"的表单控制器"));return e}async onFormMounted(t,e){const a=e.ctrl;this.formControllers.set(t,a);const i=await a.load();Object.assign(this.formData,i)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const a=fe(this.model.appDataEntityId);!this.context[a]&&e&&e.srfkey&&(this.context[a]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new n("没有配置向导表单集合");const a=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!a)throw new n("找不到标识为".concat(t,"的向导表单"));return a}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){const t=await this.service.initialize(this.context,{},this.params),e=fe(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new n("没有上一个表单");this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save();let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,a=this.model.dewizard.dewizardForms;if(t&&a){const a=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),i=t[a+1];if(!i)throw new n("找不到下一个向导步骤");const s=this.getWizardFormByTag(i.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new n("找不到下一个向导表单");this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save(),await this.finish()}}),t("MDCtrlService",class extends Xi{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),a=t.appDEFieldId;let i;if(a){const s=a.toLowerCase();i=new ks(e,s,{isOriginField:!0,dataType:t.dataType})}else i=new ks(e,e);this.dataUIMap.set(e,i)}))}})),Lr=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Rr=(t("MDCtrlController",class extends ko{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new Sr(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){await this.load({isInitialLoad:!0})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new Lr(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new Lr(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,a){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.view,event:a},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:a}=this.model;e&&this.initUIActionGroup(t,e),a&&this.initUIActionGroup(t,a)}initUIActionGroup(t,e){var a;(null==(a=e.uiactionGroupDetails)?void 0:a.length)||ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Eo;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const a=new wo(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),i.update(t.data.getOrigin()),t.uaColStates[e.id]=i}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:i}=this.model;if(t&&e){if(!i)throw new a(this.model,"分组属性没有配置");"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(new Lr(e,this)))}));const i=[];a.forEach(((t,e)=>{i.push({caption:e,key:e,children:[...t]})})),this.state.groups=i}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(new Lr(e,this))}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,key:a.value,children:t})})),this.state.groups=o}}),t("KanbanService",class extends Gn{async updateGroup(t,e){var a;const i=(null==(a=this.model.updateGroupControlAction)?void 0:a.appDEMethodId)||"update";let s=await this.exec(i,t,e.getOrigin());return s=this.handleResponse(s),s}})),Or=(t("KanbanController",class extends jn{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new Rr(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.draggable=this.enableEditOrder||this.enableEditGroup}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:i}=this.model;if(!e)throw new a(this.model,"排序属性没配置");if(!i)throw new a(this.model,"排序方向没配置");const s="ASC"===i;t.forEach((t=>{const a=t[e];if(rt(a))t[e]=0;else{const e=Number(a);if(Number.isNaN(e))throw new n("".concat(t.srfmajortext,"的排序属性无法转换成数值"))}})),t.sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e]))}async afterLoad(t,e){return this.sortItems(this.state.items),super.afterLoad(t,e)}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,a){this.setSelectGroup(a.key),super.onGroupToolbarClick(t,e,a)}async onGroupActionClick(t,e,a,i){this.setSelectGroup(i.key);const s={...this.params,srfgroup:i},o=t.uiactionId;await Ln.execAndResolved(o,{context:this.context,params:s,data:[e],view:this.view,event:a},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new n("看板部件必须开启分组");return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,a=new Map;e.forEach((e=>{const i=e[t];rt(i)||(a.has(i)||a.set(i,[]),a.get(i).push(e))}));const i=[];a.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));i.push({caption:a.text,color:a.color,key:a.value,children:[...t]})})),this.state.groups=i}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new a(this.model,"分组代码表没有配置");const{items:i}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),i.forEach((e=>{const a=e[t],i=s.get(a);i&&i.push(e)}));const o=[];s.forEach(((t,e)=>{const a=this.groupCodeListItems.find((t=>t.value===e));o.push({caption:a.text,color:a.color,key:a.value,children:t})})),this.state.groups=o}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning("当前看板不允许调整分组!");const e="ASC"===this.model.minorSortDir,{from:a,to:i,fromIndex:s,toIndex:o}=t,n=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===a)),l=this.state.groups.find((t=>t.key===i));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning("当前看板不允许调整次序");const e=d.children[s];return e[n]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[s];t.from!==t.to?(m[n]=t.to,p.splice(o,0,m)):(p.splice(s,1),p.splice(o,0,m));const f=d.children.splice(s,1);let g;l.children.splice(o,0,...f),e||(u.reverse(),p.reverse());let w,E=[];p.forEach(((t,e)=>{void 0===g?t!==u[e]&&(g=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=g,c.push(t)):(g>=t[r]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),g=w,w=0,E=[]),t[r]=h(g),c.push(t)):(0===E.length&&(w=g),E.push(t)),g=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=fe(this.model.appDataEntityId),a=this.context.clone();a[e]=t.srfkey;const i=await this.service.updateGroup(a,t);if(i.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,i.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,a){const i=this.state.groups.find((e=>e.key===t));i&&(i[e]=a)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const a=t.split("quicktoolbar_")[1];this.setGroupController(a,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const a=t.split("batchtoolbar_")[1];this.setGroupController(a,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends Tr{})),Mr=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),_r=t("TreeGridExController",class extends xr{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new Or(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await gi(t);if(!e)return;this.providers[t.codeName]=e;const a=await e.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=a:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=a)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,a)=>{t.uaColumn&&(t.fixed=a+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new Mr(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug("简单模式,不保存");if("DE"!==t._nodeType)throw new n("非实体节点数据不能保存");const e=this.state.rows[t._uuid];if(!e)throw new n("行数据不存在");if(!e.modified)return void ibiz.log.debug("值没有发生改变");if(e.processing)return void await P(500,this.save.bind(this),[t]);const a=this.getNodeModel(t._nodeId),{appDataEntityId:i}=a,s=0===t._deData.srfuf;if(s)throw new n("暂不支持新建");const o=fe(i),r=this.context.clone();r[o]=t._deData.srfkey;const c=ibiz.hub.getApp(this.context.srfappid);let d;try{d=await c.deService.exec(i,"update",r,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(s?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=d.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await fa(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((a=>{a.gridStateNotify(t,e)}))}async setRowValue(t,e,a){if(!Object.prototype.hasOwnProperty.call(t.data,e)||Do(t.data[e],a)){t.data[e]=a,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await fa(Object.values(this.columns).map((async a=>a.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const a={};return Object.values(this.fieldColumns).forEach((i=>{const s=i.nodeColumnControllerMap.get(t._nodeId);if(!s||!s.nodeEditItem)return;const{createDV:o,createDVT:n,updateDV:r,updateDVT:c}=s.nodeEditItem,d=e?n:c,l=e?o:r,h=To({name:i.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(a[i.name]=h)})),a}async switchRowEdit(t,e,a=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const i=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==i){if(!1===i)if(a)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new n("同时只能有一行开启行编辑");if(1===t.data._deData.srfuf){t.cacheData=lt(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=i,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=i})),this._evt.emit("onRowEditChange",{row:t})}}}),Vr=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),Fr=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:i,detreeNodeDataItems:s,detreeNodeEditItems:o}=e,n=null==i?void 0:i.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==s?void 0:s.find((t=>t.id===n.dataItemName));if(!n||!r)throw new a(e,"节点没有配置对应表格列".concat(this.fieldColumn.name,"的数据项"));if(this.nodeColumn=n,this.nodeDataItem=r,n.enableRowEdit){const t=null==o?void 0:o.find((t=>t.id===n.id));if(!t)throw new a(e,"没有找到对应表格列".concat(this.fieldColumn.name,"的编辑项模型"));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await Ma(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const a=new Eo;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new wo(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.name]=a}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const a=this.nodeColumn.linkValueItem||"srfkey",i=t.data[a];if(null==i)throw new n("未在行数据中取到 ".concat(a," 的值"));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const o=Qe(t.data),r=Object.assign(this.context.clone(),{srfkey:i,...o}),c=lt(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:a}=de(d);let i={};e&&t.data&&(i=ie(e,t.data,c,r)),Object.assign(r,i);let s={};a&&t.data&&(s=ie(a,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute($s.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const a=this.nodeColumn.deuiactionId;await Ln.execAndResolved(a,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,a){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return Po.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=gt(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const a=await e.codeList.get(t,this.context,this.params);return this.codeListItems=a,a}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}async setRowValue(t,e,a){a=a||this.name,await this.treeGrid.setRowValue(t,a,e)}}),kr=(t("TreeGridExFieldColumnController",class extends Vr{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new Fr(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const a=this.nodeColumnControllerMap.get(t.data._nodeId);a&&a.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends Vr{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)return;if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug("操作列界面行为组没有配置界面行为");const i=new Eo;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new wo(t.id,this.treeGrid.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.model.id]=i}async onActionClick(t,e,a){const i=t.uiactionId;await Ln.execAndResolved(i,{context:this.context,params:this.params,data:[e.data],view:this.treeGrid.view,event:a},t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(t.data._deData)}}}),t("TreeGridController",class extends fr{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const i=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!i)throw new a(this.model,"树表格无值列模式");if(!s)throw new a(this.model,"树表格无父值列模式");this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=i.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends pr{}),t("MEditViewPanelService",class extends Xi{})),Wr=(t("MEditViewPanelController",class extends ko{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new kr(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const a=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(a.appDataEntityId){const i=await ibiz.hub.getAppDataEntity(a.appDataEntityId,a.appId);this.parameters=a&&i?[{parameterName:null==(t=i.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=i.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const a=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,a),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===a.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,a={id:t[e]?t[e]:"mockId:".concat(Q()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:i,pathName:s}=e;t[i]&&!Object.is(t[i],"")&&Object.assign(a.context,{[s]:t[i]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(a,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(a,{srfmajortext:"草稿--新建"})})),a}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let a=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(a=!0),await this.handleDelete(t),a&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const a=this.state.panelUiItems.findIndex((t=>t.id===e));if(a<0)throw new n("编辑视图面板部件UI数据不存在");const i=this.state.panelUiItems[a];i.id.startsWith("mockId:")?this.state.panelUiItems[a]=this.handlePanelItemParams(t):i.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[a].id)}}),t("MapService",class extends Xi{async init(t){await super.init(t)}async fetchAll(t,e={}){var a;const i=[];if(null==(a=this.model.sysMapItems)?void 0:a.length){const a=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:o,appDEDataSetId:n,customCond:r}=s,c=t.clone(),d={...e};if(r){const a=je.execSingleLine(r);if(a){const{navigateContexts:i,navigateParams:s}=de(a);i&&Object.assign(c,ie(i,e,t)),s&&Object.assign(d,ie(i,e,t))}}const l=await a.deService.exec(o,n,c,d);l.data&&i.push(...l.data.map((t=>new zs(t,s))))})))}return new p(i,200)}})),Ur=(t("MapController",class extends ko{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new Wr(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:a}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);a.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(a,i);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const a=await super.afterLoad(t,e),i=[],s=[];return a.forEach((t=>{"REGION"===t._itemStyle?i.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=i,a}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const a=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=a;break;case"strareacode":this.state.strAreaCode="true"===a;break;case"jsonbaseurl":this.state.jsonBaseUrl=a}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends Ki{async fetch(t,e={}){var a;this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(null==(a=this.dataEntity.codeName2)?void 0:a.toLowerCase(),"/report?srfreporttag=").concat(this.model.codeName);let s=await ibiz.net.request(i,{method:"post",data:e});return s=this.handleResponse(s),s}})),zr=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},Br=class extends zr{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},Gr=class extends zr{},jr=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error("报表面板生成器工厂参数错误,报表面板未指定报表类型");switch(t.appDEReport.reportType){case"USER":return new Br(t);case"USER2":return new Gr(t);default:throw new Error("指定报表".concat(t.appDEReport.reportType,"类型报表面板生成器暂未实现"))}}},Kr=(t("ReportPanelController",class extends Fo{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=jr.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new Ur(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam),i=await this.service.fetch(e,a);this.state.data=i.data,await this.afterLoad(t,i.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){await this.load({isInitialLoad:!1})}}),t("GanttService",class extends Tr{execDeService(t,e,a,i){return this.app.deService.exec(t,e,a,i)}async fetchChildNodes(t,e){const{hasQuery:a}=e;let i=[];if(t){const s=Ce(this.model,{parentId:t._nodeId,hasQuery:a});if(0===s.length)return;(await fa(s.map((async a=>{const i=De(this.model,a.childDETreeNodeId);return this.fetchNodeDatasByType(i,a,t,e)})),!1)).forEach((t=>{i.push(...t)}))}else{const t=Ie(this.model);i=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return i}async fetchNodeDatasByType(t,e,a,s){const o=0===Ce(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,n={...s,leaf:o};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,a,n)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,a,n);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,a,n);break;default:throw new i(t,"".concat(t.treeNodeType,"节点类型未支持"))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return o||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,a,i){return new Ks(this.model,t,a,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!i.leaf})}async getDEGanttNodeDatas(t,e,a,i){const{appDEDataSetId:s,appDataEntityId:o}=t,{context:n,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(o,s,n,r);if(l.data.length){return l.data.map((e=>new Xs(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:c,navParams:d})))}return[]}async getCodeListGanttNodeDatas(t,e,a,i){const{context:s,params:o,navContext:n,navParams:r}=e?this.getNodeRSFilterParams(e,a,i):{context:i.context,params:i.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,o);if(c.length){return c.map((e=>new Hs(this.model,t,a,{data:e,leaf:!!i.leaf,navContext:n,navParams:r})))}return[]}})),Xr=(t("GanttController",class extends _r{initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new Kr(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}transformNodeDataItem(t,e){var a;const i={};return null==(a=t.detreeNodeDataItems)||a.forEach((t=>{t.id&&t.appDEFieldId&&e.hasOwnProperty(t.id.toLowerCase())&&Object.assign(i,{[t.appDEFieldId.toLowerCase()]:e[t.id.toLowerCase()]})})),i}async updateNodeData(t,e,a=!1){const i=t.srfkey?"srfkey":"_id",s=this.state.items.find((e=>e[i]===t[i]));if(!s||!s.srfkey)return void ibiz.log.error("找不到对应的动态实体树节点数据",t);const o=this.getNodeModel(s._nodeId);if(o){const i=a?this.transformNodeDataItem(o,e):e;if(Object.keys(i).length>0){const e=fe(o.appDataEntityId),a=Object.assign(this.context.clone(),{[e]:s.srfkey});200===(await this.service.execDeService(o.appDataEntityId,"update",a,i)).status&&this.refreshNodeChildren(t,!0)}}}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),Hr=class{constructor(){this.convert=new so,this.controller=new Xr,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new no,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const a=t.split(".");e=a[a.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,a=-1){const i=this.calcAppViewId(t);if(this.view2appMap.has(i)){const t=this.view2appPriorityMap.get(i);if(t&&t<a)return}this.view2appMap.set(i,e),-1!==a&&this.view2appPriorityMap.set(i,a)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),a=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(a)||await this.createApp(a),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(a,e);return this.registerAppView(t),t}throw new n("视图[".concat(e,"]不存在"))}async loadAppView(t,e,a){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,a)}throw new n("视图[".concat(e,"]不存在"))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const a=this.dataEntities.get(e);if(a.has(t))return a.get(t)}if(this.modelLoaderProvider){let a;return a=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(a,e),a}throw new n("未找到应用实体[".concat(t,"]"))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new n("请先注册模型加载适配器");const e=await this.modelLoaderProvider.getApp(t),a=new ao(e);return this.appMap.set(t,a),await this.modelLoaderProvider.initApp(t),await a.init(),this.configCache||(this.configCache=new _i(ibiz.env.appId,"PSSysHub","Global")),a}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,a){return(await this.getAppAsync(t)).deService.getService(a,e)}reset(){this.appMap.clear(),this.configCache=void 0}},Yr=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:a,engineCat:i}=t,s="".concat(i,"_").concat(a),o=this.viewEngines.get(s);if(o)return o(...e);ibiz.log.error("没有".concat(s,"对应的引擎"),t)}}),qr=t("ViewEngineBase",class{constructor(t){this.view=t,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:t}=this.view;t.push("captionbar","toolbar")}async onMounted(){var t,e;const{model:a,childNames:i}=this.view;ibiz.log.debug("".concat(a.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_header;e&&(e.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_footer;t&&(t.state.visible=!1)}}}async onDestroyed(){}async call(t,e){if("GetData"===t)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var t,e,a,i;let s=!1;const{model:o}=this.view;if(!1===o.showCaptionBar){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_captionbar;e&&(e.state.visible=!1)}else s=!0;if(ibiz.env.isMob){if(this.leftToolbar)s=!0;else{const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.lefttoolbar;t&&(t.state.visible=!1)}if(this.rightToolbar)s=!0;else{const t=null==(a=this.viewLayoutPanel)?void 0:a.panelItems.righttoolbar;t&&(t.state.visible=!1)}}else if(this.toolbar)s=!0;else{const t=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;t&&(t.state.visible=!1)}return s}calcViewFooterVisible(){let t=!1;return this.footerToolbar&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:a,params:i}=this.view;if(!t)throw new n("该视图没有实体,无法加载实体数据");const s=ibiz.hub.getApp(a.srfappid),o=await s.deService.exec(t,"get",a,i),{data:r}=o;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),Qr=(t("MDViewEngine",class extends qr{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const a=!!this.searchForm;e.state.keepAlive=a,e.state.visible=a&&!!t.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault&&this.load()}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){return"ToggleFilter"===t?(this.toggleFilter(),null):"Edit"===t||"View"===t?this.openData(e):"New"===t?this.newData(e):"Remove"===t?(await this.remove(e),null):"Import"===t?(await this.importData(),null):"Refresh"===t?(await this.refresh(),null):"ExportExcel"===t?(await this.exportData(e),null):"Search"===t?(await this.searchForm.search(),null):"Reset"===t?(await this.searchForm.reset(),null):"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,i;const{data:s,event:o}=t,n=(t.context||this.view.context).clone(),r=t.params||this.view.params;n[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||fe(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:n,params:r,data:s,event:o,view:this.view}));if(-1===c)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!c.ok}}async newData(t){var e,i,s;const{data:o,event:n,copyMode:r}=t;if(!(null==(i=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:i.find((t=>"newdata"===t.id))))throw new a(this.view.model,"缺少newdata的视图逻辑");const c=lt(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:o,event:n,view:this.view}));if(-1===d)throw new a(this.view.model,"缺少newdata的视图逻辑");return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){let t=super.calcViewHeaderVisible();if(this.searchBar&&this.searchBar.state.visible)t=!0;else{const t=this.viewLayoutPanel.panelItems.view_searchbar;t&&(t.state.visible=!1)}return t}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}}),class{constructor(){this.layoutPanel=new qe,this.theme=new la,this.text=new da,this.hbs=new ee,this.rawValue=new ma,this.action=Ln,this.error=new Ot,this.error.register(new Rt)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}}),Jr=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new n("Method not implemented.")}destroy(){}},$r=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const a=this.constructorMap.get(t.logicType);if(!a)throw new i(t,"逻辑类型 ".concat(t.logicType," 暂未支持!"));return a(t,e)}},Zr=class extends Jr{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,a){this.convertScriptArgs=e;const i=this.logic.scriptCode;this.scriptFn=je.createScriptFn(t,i,a),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},tc=class extends Jr{execute(t){const{appDEUILogicId:e,appDataEntityId:i}=this.logic;if(!e)throw new a(this.logic,"没有配置实体界面逻辑");Sn(e,i,t)}},ec=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const a=this.createTrigger(t);this.triggers.set(t.id,a),a.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),pt(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((a=>{a.match(t)&&e.push(a)})),e}triggerAndExecute(t,e={}){const a=this.getMatchTriggers(t);if(a.length>0){const t=this.getExecuteParams(e);return a.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,a){const i={itemName:t,triggerType:e},s=this.triggerAndExecute(i,a);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const a=this.triggers.get(t);if(!a)return-1;const i=this.getExecuteParams(e);return a.execute(i)}triggerControlEvent(t,e,a){const i={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(i,a)}},ac=class extends ec{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},ic=class extends ec{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},sc=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const a=this.constructorMap.get(t.triggerType);if(!a)throw new i(t,"触发器类型 ".concat(t.triggerType," 暂未支持!"));return a(t,e)}},oc=class{constructor(){this.executorFactory=new $r,this.triggerFactory=new sc}createViewScheduler(t){return new ic(t)}createControlScheduler(t){return new ac(t)}},nc=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new n("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},rc=class extends nc{},cc=class extends nc{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new n("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env"],(t=>{const{context:e,params:a,data:i}=t;return{context:e,params:a,data:(null==i?void 0:i[0])||{},env:ibiz.env}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,a;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(a=this.logic.itemName)?void 0:a.toLowerCase())}execute(t){return!!this.executor.execute(t)}},dc=class extends nc{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new a(this.logic,"定时器缺少定时间隔");this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new n("定时器缺少默认参数回调");const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},lc=class extends Jr{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:i,params:s,...o}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new n("opendata没有可操作数据!");let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new a(t,"opendata视图逻辑没有配置默认打开视图");const d=c.refAppViewId;if(!d)throw new a(t,"opendata视图逻辑的默认打开视图没有实际引用视图");const l=c.navigateContexts||[],h=Object.assign(i,ie(l,r[0],s,i));let u={};const p=c.navigateParams;return H(p)&&(u=ie(p,r[0],s,i)),ibiz.commands.execute($s.TAG,d,h,u,o)}async calcOpenViewRef(t,e){const i=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=i.formTypeAppDEFieldId||i.dataTypeAppDEFieldId;if(!s)throw new a(t,"".concat(i.codeName,"[多表单实体] or [索引实体]缺少类型属性配置"));const{data:o}=e,r=o[0][s];if(!r)throw new a(t,"数据源无表单类型应用实体属性值");const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new n("没有找到与表单类型".concat(r,"相关的实体的编辑视图"));return d}async executeNewDataAppUILogic(t,e){const{context:s,params:o,...n}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=fe(c.parentView.model.appDataEntityId),i=t.batchAddAppViews;if(p=null==i?void 0:i.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new a(t,"没有找到批添加需要打开的选择视图")}else{if(h)throw new i(t,"batchAddOnly暂未支持");if(p=u,!p||!p.refAppViewId)throw new a(t,"newdata视图逻辑没有配置默认新建数据视图")}let m={},f={};const g=(null==r?void 0:r[0])||{},w=p.navigateContexts;H(w)&&(m=ie(w,g,o,s)),m=Object.assign(s,m);const E=p.navigateParams;if(H(E)&&(f=ie(E,g,o,s)),o.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&g&&(f[t]=g.srfkey,f.srfcopymode=!0)}f.srfuf=0;const y=await ibiz.commands.execute($s.TAG,p.refAppViewId,m,f,n);return l&&y.data&&await this.doBatchAdd(t,y.data,s,p,e.view),y}async getWizardNewViewRef(t,e){var i;const{wizardAppView:s,newDataAppViews:o}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new a(t,"缺少默认索引实体选择视图");const l=await ibiz.commands.execute($s.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(i=l.data)?void 0:i[0];if(!h)throw new n("请选中一条数据");const u=h.srfkey,p=null==o?void 0:o.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new n("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}async doBatchAdd(t,e,i,s,o){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,i.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new a(c,"实体没有从关系集合!");let h="";if(null==d||d.forEach((t=>{const e=fe(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new n("没有找到".concat(l,"在当前实体的外键属性"));const u={srfkey:h},p=null==(r=o.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,a]=e.split(":");t&&a&&(u[t]=a)}}ibiz.log.debug("批量新建转换映射属性",u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((a=>{const i=u[a];e[i]=t[a]})),e}));ibiz.log.debug("批量新建创建数据",m);const f=ibiz.hub.getApp(i.srfappid).deService;await f.exec(c.id,"Create",i,m)}}},hc=class extends nc{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>sa[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},uc=class extends nc{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const a=t.eventNames.split(";");this.listenEventNames=a.map((t=>na[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},pc=class extends Jr{execute(t){if(!this.logic.appDEUIActionId)throw new a(this.logic,"逻辑中缺少触发应用实体界面行为id");Ln.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Et.dirname(this.url.pathname)}dir(t){return this.url.origin+Et.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,a)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.onload=t,i.onerror=a,document.head.appendChild(i)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,a){this.tag=t,this.repo=e,this.config=a}})}}}));