@ibiz-template/runtime 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +79 -55
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/de-logic/index.d.ts +13 -0
- package/out/de-logic/index.d.ts.map +1 -1
- package/out/de-logic/index.js +34 -2
- package/out/engine/md-view.engine.d.ts +2 -2
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +6 -2
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -0
- package/out/interface/controller/controller/control/i-pickup-view-panel.controller.d.ts +10 -0
- package/out/interface/controller/controller/control/i-pickup-view-panel.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-tree-exp-bar.controller.d.ts +11 -0
- package/out/interface/controller/controller/control/i-tree-exp-bar.controller.d.ts.map +1 -1
- package/out/interface/controller/event/control/i-pickup-view-panel.event.d.ts +15 -0
- package/out/interface/controller/event/control/i-pickup-view-panel.event.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/de-logic/index.ts +50 -2
- package/src/engine/md-view.engine.ts +7 -2
- package/src/index.ts +2 -0
- package/src/interface/controller/controller/control/i-pickup-view-panel.controller.ts +10 -0
- package/src/interface/controller/controller/control/i-tree-exp-bar.controller.ts +13 -1
- package/src/interface/controller/event/control/i-pickup-view-panel.event.ts +16 -0
package/dist/index.system.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda"],(function(e){"use strict";var t,s,i,a,n,r,o,c,l,h,d,u,p,E,g,m,f,w,I,D,A,P,y,v,T,_,C,b,V,L;return{setters:[function(e){t=e.RuntimeError,s=e.RuntimeModelError,i=e.ModelError,a=e.IBizContext,n=e.Net,r=e.StringUtil,o=e.NOOP,c=e.isElementSame,l=e.HttpResponse,h=e.HttpError},function(e){d=e.isEmpty,u=e.isFunction},function(e){p=e.notNilEmpty,E=e.isNilOrEmpty,g=e.AsyncSeriesHook,m=e.QXEvent,f=e.createUUID,w=e.isArray,I=e.clearAll,D=e.ascSort,A=e.descSort},function(e){P=e.default},function(e){y=e.isNotNil,v=e.isNil,T=e.mergeRight,_=e.isEmpty,C=e.clone,b=e.equals,V=e.where,L=e.mergeLeft}],execute:function(){e({calcContentAlignStyle:function(e){const{valignSelf:t,halignSelf:s}=e,i={};if(t||s){switch(Object.assign(i,{display:"flex"}),t){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(s){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:$,calcDynaClass:function(e,t){return Ee.execScriptFn({data:t},e,{singleRowReturn:!0})},calcGridLayoutPos:function(e){const{layout:t,colXS:s,colXSOffset:i,colSM:a,colSMOffset:n,colMD:r,colMDOffset:o,colLG:c,colLGOffset:l}=e,h=(e,s)=>({span:(e&&-1!==e?e:"TABLE_24COL"===t?24:12)*("TABLE_24COL"===t?1:2),offset:s&&-1!==s?s:void 0});return{xs:h(s,i),sm:h(a,n),md:h(r,o),lg:h(c,l)}},calcLayoutHeightWidth:function(e){const{width:t,height:s,widthMode:i,heightMode:a}=e,n={width:"",height:""};"FULL"===i?n.width="100%":t&&t>0&&(n.width="".concat(t,"PERCENTAGE"===i?"%":"px"));"FULL"===a?n.height="100%":s&&s>0&&(n.height="".concat(s,"PERCENTAGE"===a?"%":"px"));return n},calcMainStateOPPrivsStrs:q,calcNavParams:function(e,t){const{deName:s,navFilter:i,pickupDEFName:a,navContexts:n,navParams:r}=e,{context:o,params:c,data:l,derValue:h}=t,d={},u={},p=h||l.srfkey;p&&(s&&(d[s]=p),i&&(u[i]=p),a&&(u["n_".concat(a.toLowerCase(),"_eq")]=p));const E=z(n,o,c,l),g=z(r,o,c,l);return Object.assign(d,E),Object.assign(u,g),{resultContext:d,resultParams:u}},calcResPath:Ke,calcRouteContext:function(e){let t=[];t=t.sort(((e,t)=>t.length-e.length));const[s]=t;if(s){const e={};return s.forEach((([t,s])=>{e[t]=s})),e}return{}},compare:ce,compareNumber:le,contains:he,convertNavData:z,convertNavDataByArray:G,convertNavDataByObject:j,convertObjectToNavParams:X,filterFieldLogics:J,filterValueRules:function(e,t){return e.filter((e=>{const{checkMode:s}=e,i=e.deformItemName||e.degridEditItemName;return 2!==s&&i===t}))},findChildFormDetails:function(e){let t;switch(e.detailType){case"TABPANEL":t=e.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":t=e.deformDetails}return t||[]},findDELogic:Q,findEditItem:function(e,t){var s;return null==(s=e.degridEditItems)?void 0:s.find((e=>e.codeName===t))},findFieldById:Z,findModelChild:H,formatMultiData:K,generateRules:function(e,s,i){const a=[];return e.forEach((e=>{const{valueRuleType:n}=e,r=e.sysValueRule,o=e.defvalueRule;if("SYSVALUERULE"===n&&r)"REG"===r.ruleType?a.push({pattern:new RegExp(r.regExCode),message:r.ruleInfo,trigger:"change blur"}):"SCRIPT"===r.ruleType&&a.push({validator:(e,t,s,i)=>{if(!t)return!0;try{Ee.execScriptFn({rule:e,value:t,callback:s,source:i},r.scriptCode)}catch(e){return console.error(e),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&o){const e=i||s;a.push({validator:(s,i,a,n)=>{if(E(n[e]))return!0;const{isPast:r,infoMessage:c}=ge(e,n,o.groupCond);return r||a(new t(c||o.ruleInfo)),!0},trigger:"change blur"})}})),a},getAppViewRef:function(e,t){var s,i;let a=e.appViewRefs||[];(null==(i=null==(s=e.viewLayoutPanel)?void 0:s.appViewRefs)?void 0:i.length)&&(a=a.concat(e.viewLayoutPanel.appViewRefs));return a.find((e=>e.name===t||e.id===t))},getChildNodeRSs:function(e,t){const s=t.parentId||te(e).id;return e.detreeNodeRSs.filter((e=>{return e.parentDETreeNodeId===s&&(i=e.searchMode,a=t.hasQuery,3===i||(a?1===i:2===i));var i,a}))},getControl:function(e,t){var s,i;let a=e.controls||[];(null==(i=null==(s=e.viewLayoutPanel)?void 0:s.controls)?void 0:i.length)&&(a=a.concat(e.viewLayoutPanel.controls));return a.find((e=>e.name===t||e.codeName===t||e.id===t))},getControlProvider:Ft,getControlsByView:se,getDeACMode:async function(e,t,s){var i;const a=await ibiz.hub.getAppDataEntity(t,s);return null==(i=a.appDEACModes)?void 0:i.find((t=>t.id===e))},getEditorProvider:async function(e){let t;const{editorType:s,editorStyle:i}=e;if(i&&"DEFAULT"!==i){t=Ut("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到编辑器类型:[".concat(s,"]的编辑器样式:[").concat(i,"]对应的适配器"),e)}t||(t=Ut(s));t||ibiz.log.error("找不到编辑器类型".concat(s,"对应的适配器"));return t},getFormDetailProvider:async function(e){let t;const{detailType:s}=e;t||(i=s,t=ibiz.register.get("".concat(zt,"_").concat(i)));var i;t||ibiz.log.error("找不到表单成员类型".concat(s,"对应的适配器"));return t},getGridColumnProvider:async function(e){let t;const{columnType:s,enableRowEdit:i}=e,a=i?"".concat(s,"_EDIT"):s;t||(t=function(e){return ibiz.register.get("".concat(Gt,"_").concat(e))}(a));t||ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"));return t},getMatchResPath:Xe,getOriginData:function(e){let t=Array.isArray(e)?e[0]:e;t&&t instanceof Tt&&(t=t.getOrigin());return t},getPanelItemProvider:async function(e){var t;let s;const{itemType:i}=e;if("CONTAINER"===i){const t=e.predefinedType||"DEFAULT";s=Xt("CONTAINER_".concat(t)),s||ibiz.log.error("找不到面板容器预置类型为".concat(t,"的适配器"))}if("RAWITEM"===i){const i=(null==(t=e.rawItem)?void 0:t.predefinedType)||"DEFAULT";s=Xt("RAWITEM_".concat(i)),s||ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器"))}s||(s=Xt(i));s||ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"));return s},getPortletProvider:async function(e){let t;const{portletType:s}=e;t||(i=s,t=ibiz.register.get("".concat(Qt,"_").concat(i)));var i;t||ibiz.log.error("找不到门户部件成员类型".concat(s,"对应的适配器"));return t},getRootNode:te,getTreeNode:function(e,t){return e.detreeNodes.find((e=>e.id===t))},getUIActionById:ee,getUIActionProvider:Yt,getViewEngines:ae,getViewLogics:ie,getViewProvider:async function(e){let t;const{viewType:s,viewStyle:i}=e;if(i&&"DEFAULT"!==i){t=$t("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到视图类型:[".concat(s,"]的视图样式:[").concat(i,"]对应的适配器"),e)}t||(t=$t(s));t||(t=$t("DEFAULT"));return t},getWFContext:function(e){const t={};e.param09&&(t.srfprocessinstanceid=e.param09);return t},getWFSubmitViewId:function(e,t){var s;const{type:i,sequenceFlowView:a,sequenceFlowMobView:n}=t,r=(null==(s=e.viewLayoutPanel)?void 0:s.appViewRefs)||e.appViewRefs,o=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:a),c=r.find((e=>e.name===o));return null==c?void 0:c.refAppViewId},hasDeCodeName:function(e,t){const s=$(t);return y(e[s])},install:function(){const{ibiz:e}=window;e.util=new xt,e.hub=new Ot,e.register=new U,e.config=new k,e.auth=new Vt,e.engine=new Wt,Le(),ms(),ibiz.scheduler=new ys,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((e,t)=>new _s(e,t))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((e,t)=>new _s(e,t))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((e,t)=>new _s(e,t))),ibiz.scheduler.triggerFactory.register("TIMER",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("CUSTOM",((e,t)=>new Ts(e,t))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((e,t)=>new Vs(e,t))),ibiz.scheduler.executorFactory.register("SCRIPT",((e,t)=>new ws(e,t))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((e,t)=>new Is(e,t))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((e,t)=>new Is(e,t))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((e,t)=>new bs(e,t)))},installCommand:Le,isValueChange:function(e,t){if((v(e)||""===e)&&(v(t)||""===t))return!1;return e!==t},matchMainState:Y,openRedirectView:ne,parseUserParams:function(e){const t={},s={},i={};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const n=e[a];if(-1!==a.indexOf(".")){const e=a.split(".");switch(e[0]){case"SRFNAVPARAM":Object.assign(t,{[e[1]]:n});break;case"SRFNAVCTX":Object.assign(s,{[e[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:t,navigateParams:s,other:i}},presetUIActionProvider:ms,registerControlProvider:function(e,t){ibiz.register.register("".concat(St,"_").concat(e),t)},registerEditorProvider:function(e,t){ibiz.register.register("".concat(kt,"_").concat(e),t)},registerFormDetailProvider:function(e,t){ibiz.register.register("".concat(zt,"_").concat(e),t)},registerGridColumnProvider:function(e,t){ibiz.register.register("".concat(Gt,"_").concat(e),t)},registerPanelItemProvider:function(e,t){ibiz.register.register("".concat(jt,"_").concat(e.toUpperCase()),t)},registerPortletProvider:function(e,t){ibiz.register.register("".concat(Qt,"_").concat(e),t)},registerUIActionProvider:Ht,registerViewProvider:function(e,t){ibiz.register.register("".concat(qt,"_").concat(e),t)},strContain:de,testCond:oe,toLocalOpenWFRedirectView:re,verifyDeRules:ge,verifyFormGroupLogic:function e(t,a){if(function(e){return"GROUP"===e.logicType}(a)){const i=a.defdlogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!e(t,s)))}else if("OR"===a.groupOP){n=void 0!==a.defdlogics.find((s=>e(t,s)))}return a.notMode?!n:n}if(function(e){return"SINGLE"===e.logicType}(a))return oe(t[a.defdname.toLowerCase()],a.condOP,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))},verifyPanelGroupLogic:function e(t,a){if(function(e){return"GROUP"===e.logicType}(a)){const i=a.panelItemLogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!e(t,s)))}else if("OR"===a.groupOP){n=void 0!==a.panelItemLogics.find((s=>e(t,s)))}return a.notMode?!n:n}if(function(e){return"SINGLE"===e.logicType}(a))return oe(t[a.dstModelField.toLowerCase()],a.condOp,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))}});var R,M,O=Object.create,W=Object.defineProperty,N=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,S=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,F=(R={"../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"(e,t){function s(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var s,i="",a=0,n=-1,r=0,o=0;o<=e.length;++o){if(o<e.length)s=e.charCodeAt(o);else{if(47===s)break;s=47}if(47===s){if(n===o-1||1===r);else if(n!==o-1&&2===r){if(i.length<2||2!==a||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",a=0):a=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),n=o,r=0;continue}}else if(2===i.length||1===i.length){i="",a=0,n=o,r=0;continue}t&&(i.length>0?i+="/..":i="..",a=2)}else i.length>0?i+="/"+e.slice(n+1,o):i=e.slice(n+1,o),a=o-n-1;n=o,r=0}else 46===s&&-1!==r?++r:r=-1}return i}var a={resolve:function(){for(var e,t="",a=!1,n=arguments.length-1;n>=-1&&!a;n--){var r;n>=0?r=arguments[n]:(void 0===e&&(e=process.cwd()),r=e),s(r),0!==r.length&&(t=r+"/"+t,a=47===r.charCodeAt(0))}return t=i(t,!a),a?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(s(e),0===e.length)return".";var t=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&a&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return s(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];s(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":a.normalize(e)},relative:function(e,t){if(s(e),s(t),e===t)return"";if((e=a.resolve(e))===(t=a.resolve(t)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var n=e.length,r=n-i,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var c=t.length-o,l=r<c?r:c,h=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===t.charCodeAt(o+d))return t.slice(o+d+1);if(0===d)return t.slice(o+d)}else r>l&&(47===e.charCodeAt(i+d)?h=d:0===d&&(h=0));break}var u=e.charCodeAt(i+d);if(u!==t.charCodeAt(o+d))break;47===u&&(h=d)}var p="";for(d=i+h+1;d<=n;++d)d!==n&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+t.slice(o+h):(o+=h,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(s(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,a=-1,n=!0,r=e.length-1;r>=1;--r)if(47===(t=e.charCodeAt(r))){if(!n){a=r;break}}else n=!1;return-1===a?i?"/":".":i&&1===a?"//":e.slice(0,a)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');s(e);var i,a=0,n=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!r){a=i+1;break}}else-1===c&&(r=!1,c=i+1),o>=0&&(l===t.charCodeAt(o)?-1==--o&&(n=i):(o=-1,n=c))}return a===n?n=c:-1===n&&(n=e.length),e.slice(a,n)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){a=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(a,n)},extname:function(e){s(e);for(var t=-1,i=0,a=-1,n=!0,r=0,o=e.length-1;o>=0;--o){var c=e.charCodeAt(o);if(47!==c)-1===a&&(n=!1,a=o+1),46===c?-1===t?t=o:1!==r&&(r=1):-1!==t&&(r=-1);else if(!n){i=o+1;break}}return-1===t||-1===a||0===r||1===r&&t===a-1&&t===i+1?"":e.slice(t,a)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var s=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return s?s===t.root?s+i:s+e+i:i}("/",e)},parse:function(e){s(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,a=e.charCodeAt(0),n=47===a;n?(t.root="/",i=1):i=0;for(var r=-1,o=0,c=-1,l=!0,h=e.length-1,d=0;h>=i;--h)if(47!==(a=e.charCodeAt(h)))-1===c&&(l=!1,c=h+1),46===a?-1===r?r=h:1!==d&&(d=1):-1!==r&&(d=-1);else if(!l){o=h+1;break}return-1===r||-1===c||0===d||1===d&&r===c-1&&r===o+1?-1!==c&&(t.base=t.name=0===o&&n?e.slice(1,c):e.slice(o,c)):(0===o&&n?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(o,r),t.base=e.slice(o,c)),t.ext=e.slice(r,c)),o>0?t.dir=e.slice(0,o-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,t.exports=a}},function(){return M||(0,R[x(R)[0]])((M={exports:{}}).exports,M),M.exports}),k=class{constructor(){this.view={enableDataInfoBar:!0},this.grid={editShowMode:"cell",editSaveMode:"cell-blur"},this.appMenu={enableEcho:!1},this.codeList={timeout:36e5}}},U=e("RegisterCenter",class{constructor(){this.providers=new Map}register(e,t){this.providers.set(e,t)}unRegister(e){this.providers.delete(e)}get(e,...t){const s=this.providers.get(e);if(s)return s(...t)}});function z(e,...t){return!e||d(e)?{}:"[object Array]"===Object.prototype.toString.call(e)?G(e,...t):"[object Object]"===Object.prototype.toString.call(e)?j(e,...t):{}}function G(e,...t){const s={};for(const i of e)if(p(i.value)&&!i.rawValue){const e=t.find((e=>!E(e)&&(e[i.value]||Object.prototype.hasOwnProperty.call(e,i.value))));e&&(s[i.key.toLowerCase()]=e[i.value])}else s[i.key.toLowerCase()]=i.value||null;return s}function j(e,...t){const s={},i=/^%(.+)%$/;for(const a in e)if(p(e[a])&&i.test(e[a])){const i=e[a].substring(1,e[a].length-1),n=t.find((e=>Object.prototype.hasOwnProperty.call(e,i)));n&&(s[a.toLowerCase()]=n[i])}else s[a.toLowerCase()]=e[a]||null;return s}function X(e){const t=[],s=/^%(.+)%$/;for(const i in e){let a=!0,n=e[i];p(e[i])&&s.test(e[i])&&(a=!1,n=e[i].substring(1,e[i].length-1)),t.push({key:i.toLowerCase(),rawValue:a,value:n})}return t}function K(e,t){const s={};if(!e)return s;const i=Array.isArray(e)?e:X(e),a=t[0];return i.forEach((e=>{const{rawValue:i,value:n}=e;!i&&n&&Object.prototype.hasOwnProperty.call(a,n)&&(s[n]=t.map((e=>e[n])).join(";"))})),s}function H(e,t){if(e){const s=e.find((e=>e.id===t));if(s)return s}return null}function Y(e,t){const{mainStateAppDEFieldIds:s,demainStates:i}=e;if(s&&i){const e=[];return s.forEach((s=>{e.push(t[s])})),i.find((t=>{const{stateValue:s,state2Value:i,state3Value:a}=t;let n=!0;const r=[s,i,a];for(let t=0;t<e.length;t++)if("".concat(e[t])!=="".concat(r[t])){n=!1;break}return n}))}}function q(e,t){const s=ibiz.hub.getApp().model,{demainStateOPPrivs:i,opprivAllowMode:a}=e,n=(null==i?void 0:i.map((e=>e.name)))||[];let r=[];if(a)r=n;else{r=[...s.deopprivs,...t.deopprivs].filter((e=>!n.includes(e.name))).map((e=>e.name))}return r}function $(e){return e.split(".").pop()}function Q(e,t){var s;return null==(s=t.appDELogics)?void 0:s.find((t=>t.id===e))}function J(e,t){var s,i;const a=[];return null==(s=e.appDEFields)||s.forEach((e=>{"compute"===t&&e.computeAppDEFLogicId?a.push(e.computeAppDEFLogicId):"change"===t&&e.onChangeAppDEFLogicId?a.push(e.onChangeAppDEFLogicId):"default"===t&&e.defaultValueAppDEFLogicId&&a.push(e.defaultValueAppDEFLogicId)})),(null==(i=e.appDELogics)?void 0:i.filter((e=>a.includes(e.id))))||[]}function Z(e,t){var s;return null==(s=e.appDEFields)?void 0:s.find((e=>e.id===t))}async function ee(e){const[,,t]=e.split("@");return ibiz.hub.getApp(t).getUIAction(e)}function te(e){return e.detreeNodes.find((e=>e.rootNode))}function se(e){const{viewLayoutPanel:t}=e,s=e.controls||[];return t&&s.push(...t.controls||[]),s}function ie(e){const{viewLayoutPanel:t}=e,s=e.appViewLogics||[];return t&&s.push(...t.appViewLogics||[]),s}function ae(e){const{viewLayoutPanel:t}=e,s=e.appViewEngines||[];return t&&s.push(...t.appViewEngines||[]),s}async function ne(e,t,i={},a=[]){return async function(e,t,i={},a=[]){const n=e.appViewNavContexts||[],r=z(n,t,i);t=Object.assign(t.clone(),r);const o=e.appViewNavParams||[],c=z(o,t,i);Object.assign(i,c);const l=e.appDataEntityId,h=$(l);let d=a[0]||{};t[h]=d[h]||t[h]||i[h];const u=e.getDataAppDEActionId,g=ibiz.hub.getApp(e.appId),m=await g.deService.getService(l);ibiz.loading.showRedirect();try{const e=await m.exec(u||"get",t,i);if(e.ok){d=e.data;let s=d.linkurl;if(s)return t.srfprocessinstanceid&&(s+=";srfprocessinstanceid=".concat(t.srfprocessinstanceid)),ibiz.env.dev&&-1!==s.indexOf("appredirectview?")&&(s=s.slice(s.indexOf("appredirectview?"))),s.startsWith("http://")||s.startsWith("https://")?new Promise((e=>{const t=window.open(s,"_blank");t&&(t.callback=()=>{e({ok:!0,data:[]})})})):s.startsWith("appredirectview?")?(await re(t,s),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(l,e.appId),w=await async function(e,t,s,i){let a="";const n=t.typeAppDEFieldId;if(n){const{codeName:t}=Z(e,n),s=i[t.toLowerCase()];if(p(s))return s}const r="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),o=s.srfwf;if(p(o))return p(s.wf)?"".concat(r,":").concat(o.toUpperCase(),":").concat(s.wf.toUpperCase()):"".concat(r,":").concat(o.toUpperCase());let c="";if(e.indexTypeAppDEFieldId){const{codeName:t}=Z(e,e.indexTypeAppDEFieldId);c=i[t.toLowerCase()]}if(E(c)&&e.formTypeAppDEFieldId){const{codeName:t}=Z(e,e.formTypeAppDEFieldId);c=i[t.toLowerCase()]}a=p(c)?"".concat(r,":").concat(c):"".concat(r);return a}(f,e,i,d),I=w.split(":"),D=2===I.length?w:I.slice(0,2).join(":"),A="".concat(f.name.toUpperCase(),":").concat(w),P=e.redirectAppViewRefs,y=null==P?void 0:P.find((e=>e.name===A||e.name===w||e.name===D));if(!y)throw ibiz.log.error("重定向视图引用有:",null==P?void 0:P.map((({refAppViewId:e,name:t,realTitle:s})=>({viewId:e,tag:t,title:s})))),new s(e,"未找到重定向标识[".concat(w,"]或[").concat(A,"]或[").concat(D,"]对应视图"));{const e=y.refAppViewId;if(!e)throw new s(y,"未配置实际引用视图");{const s=await ibiz.commands.execute(Ce.TAG,e,t,i,{data:[d]});if(s)return s}}return{ok:!0,data:[]}}(e,t,i,a)}async function re(e,s){const i=s.lastIndexOf("?"),a=decodeURIComponent(s.substring(i+1,s.length)),n=P.parse(a,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new t("重定向参数缺少实体名称");const o=ibiz.hub.getApp(e.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!o)throw new t("未找到指定实体的codeName: ".concat(r));n[o.toLowerCase()]=n[r.toLowerCase()];const c="".concat(o).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(c);if(delete n.srfdename,"undo"!==n.srfwf){const e=n.processDefinitionKey.split("-")[3],t=e.substring(0,e.lastIndexOf("v")),s=e.substring(e.lastIndexOf("v"));n.wf=t,n.wfVersion=s}n.srfprocessinstanceid&&(e.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),await ibiz.commands.execute(Ce.TAG,l.id,e,n)}function oe(e,s,i){if(Object.is(s,"IN"))return he(e,i);if(Object.is(s,"NOTIN"))return!he(e,i);switch(s){case"EQ":return"".concat(e)==="".concat(i);case"NOTEQ":return"".concat(e)!=="".concat(i);case"LT":return ce(e,i)<0;case"LTANDEQ":return ce(e,i)<=0;case"GT":return ce(e,i)>0;case"GTANDEQ":return ce(e,i)>=0;case"ISNULL":return E(e);case"ISNOTNULL":return p(e);case"TESTNULL":return v(e);case"IN":return he(e,i);case"NOTIN":return!he(e,i);case"LIKE":return de(e,i);case"LEFTLIKE":return de(e,i,"start");case"RIGHTLIKE":return de(e,i,"end");default:throw new t("值操作:".concat(s,",暂未支持"))}}function ce(e,s){const i=Number(e),a=Number(s);if(!Number.isNaN(i)&&!Number.isNaN(a))return le(i,a);const n=new Date(e).getTime(),r=new Date(s).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r))return le(n,r);throw new t("".concat(e," 和 ").concat(s," 无法比较大小"))}function le(e,t){return Number.isNaN(e)&&(e=0),Number.isNaN(t)&&(t=0),e>t?1:e<t?-1:0}function he(e,s){if(!s||"string"!=typeof s)throw new t("范围比较的条件值不存或者不是字符串");if(e){return s.split(",").includes("".concat(e))}return!1}function de(e,t,s){if(!e||!t)return!1;const i="".concat(e).toUpperCase(),a="".concat(t).toUpperCase(),n=i.indexOf(a);switch(s){case"start":return 0===n;case"end":return n+a.length===i.length;default:return-1!==n}}var ue={singleRowReturn:!1},pe=e("ScriptFunction",class{constructor(e,t,s=ue){this.argKeys=[],this.options=s;const i=this.formatCode(t,s);this.calcArgKeys(e,s),this.scriptFn=new Function(...this.argKeys,i)}formatCode(e,t){let s=e;return t.singleRowReturn&&(s="return (".concat(s,")")),s}calcArgKeys(e,t){const s=t.presetParams?Object.keys(t.presetParams):[];s.push(...e),s.push("document","el","selector"),this.argKeys=Array.from(new Set(s))}convertArgs(e){const{presetParams:t}=this.options,s=t?T(t,e):e;s.document=document,s.selector=e=>document.getElementsByClassName(e);const i=[];return this.argKeys.forEach((e=>{i.push(s[e])})),i}exec(e){const t=this.convertArgs(e);return this.scriptFn(...t)}}),Ee=e("ScriptFactory",class{static createScriptFn(e,t,s){return new pe(e,t,s)}static execScriptFn(e,t,s){return this.createScriptFn(Object.keys(e),t,s).exec(e)}});function ge(e,s,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(e){return"GROUP"===e.condType}(i)){const t=i.conds;t&&t.length>0&&(a.isPast=function(e,t,s="AND",i=!1){if(!((null==e?void 0:e.length)>0))return!1;let a="AND"===s;for(let i=0,n=e.length;i<n;i++){const n=t(e[i],i);if("AND"===s){if(!n){a=!1;break}}else if("OR"===s&&n){a=!0;break}}return i?!a:a}(t,(t=>{const{isPast:i,infoMessage:n}=ge(e,s,t);return a.infoMessage=n,i}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{e=null==i?void 0:i.defname.toLowerCase();try{if(function(e){return"SIMPLE"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){Object.is(n,"CURTIME")&&(i="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){i=r[i=i?i.toLowerCase():""]?r[i]:i}(v(a)||_(a))&&(a="内容必须符合值规则");const c=oe(e,s,i);if(!c&&o)throw new t(a);return!c}(s[e],i.condOp,i.paramValue,i.ruleInfo,i.paramType,s,i.keyCond);else if(function(e){return"VALUERANGE2"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){E(r)&&(r="值必须符合值范围规则");if(E(e)){if(o)throw new t("值为空");return r="值为空",!0}if(me(e,/^-?\d*\.?\d+$/,"",o))return!0;const c=Number.parseFloat(e);if(null!==s)if(i){if(c<s){if(o)throw new t(r);return!0}}else if(c<=s){if(o)throw new t(r);return!0}if(null!=a)if(n){if(c>a){if(o)throw new t(r);return!0}}else if(c>=a){if(o)throw new t(r);return!0}return r="",!1}(s[e],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(e){return"REGEX"===e.condType}(i))a.isPast=!me(s[e],i.regExCode,i.ruleInfo,i.keyCond);else if(function(e){return"STRINGLENGTH"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){E(r)&&(r="内容长度必须符合范围规则");if(E(e)){if(o)throw new t("值为空");return r="值为空",!0}const c=e.length;if(null!==s)if(i){if(c<s){if(o)throw new t(r);return!0}}else if(c<=s){if(o)throw new t(r);return!0}if(null!==a)if(n){if(c>a){if(o)throw new t(r);return!0}}else if(c>=a){if(o)throw new t(r);return!0}return r="",!1}(s[e],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(e){return"SYSVALUERULE"===e.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:n,regExCode:r,scriptCode:o,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===n)a.isPast=!me(s[e],r,a.infoMessage,i.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:r}=function(e,s,i,a,n){E(a)&&(a="值必须符合脚本规则");const r=s;let o="",c=!0;const l=e=>{c=!1,(null==e?void 0:e.length)>0?e.forEach((e=>{(null==e?void 0:e.message)&&(o+=e.message)})):(null==e?void 0:e.message)&&(o=e.message)};try{const t=Ee.execScriptFn({value:e,data:r},i);"boolean"==typeof t&&(c=t)}catch(e){ibiz.log.error(e),l(e)}if(a="",!c&&n)throw new t(a);return{isPast:c,infoMessage:o||a}}(s[e],s,o,a.infoMessage,i.keyCond);a.isPast=n,a.infoMessage=r||a.infoMessage}}}catch(e){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function me(e,s,i,a){E(i)&&(i="值必须符合正则规则");if(E(e)){if(a)throw new t("值为空");return i="值为空",!0}if(!new RegExp(s).test(e)){if(a)throw new t(i);return!0}return i="",!1}var fe=e("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(e,t){this.cache.set(e,t)}get(e){return this.cache.get(e)}fill(e){const{viewLayoutPanel:t}=e;if(!t||!0===t.useDefaultLayout){const t=this.calcLayoutTag(e);if(this.cache.has(t)){const s=C(this.cache.get(t));e.viewLayoutPanel=s,e.appCounterRefs&&(s.appCounterRefs=e.appCounterRefs,delete e.appCounterRefs),e.appViewEngines&&(s.appViewEngines=e.appViewEngines,delete e.appViewEngines),e.appViewLogics&&(s.appViewLogics=e.appViewLogics,delete e.appViewLogics),e.appViewRefs&&(s.appViewRefs=e.appViewRefs,delete e.appViewRefs),e.controls&&(s.controls=e.controls,delete e.controls)}}return e}calcLayoutTag(e){const{viewType:t,viewStyle:s}=e;return"APPINDEXVIEW"===t?this.calcIndexViewLayoutTag(e):"".concat(t,"_").concat(s)}calcIndexViewLayoutTag(e){const{viewType:t,viewStyle:s,blankMode:i,mainMenuAlign:a}=e;let n="";return i?n="BLANK_MODE":a&&(n=a.toUpperCase()),""!==n?"".concat(t,"_").concat(s,"_").concat(n):"".concat(t,"_").concat(s)}});var we=e("ControlType",(e=>(e.APP_MENU="APPMENU",e.GRID="GRID",e.FORM="FORM",e.SEARCHFORM="SEARCHFORM",e.TOOLBAR="TOOLBAR",e.DRBAR="DRBAR",e.VIEWPANEL="VIEWPANEL",e.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",e.DATAVIEW="DATAVIEW",e.TREEGRID="TREEGRID",e.WF_EXPBAR="WFEXPBAR",e.TREEVIEW="TREEVIEW",e.TREE_EXP_BAR="TREEEXPBAR",e.TAB_VIEWPANEL="TABVIEWPANEL",e.DRTAB="DRTAB",e.CHART="CHART",e.REPORT_PANEL="REPORTPANEL",e.LIST="LIST",e.MOB_MDCTRL="MOBMDCTRL",e.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",e.WIZARD_PANEL="WIZARDPANEL",e.UPDATE_PANEL="UPDATEPANEL",e.SEARCHBAR="SEARCHBAR",e.DASHBOARD="DASHBOARD",e.CALENDAR="CALENDAR",e.PANEL="PANEL",e.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",e.MAP="MAP",e.GANTT="GANTT",e.TREE_GRIDEX="TREEGRIDEX",e.KANBAN="KANBAN",e.CALENDAR_EXPBAR="CALENDAREXPBAR",e.CHART_EXPBAR="CHARTEXPBAR",e.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",e.GANTT_EXPBAR="GANTTEXPBAR",e.GRID_EXPBAR="GRIDEXPBAR",e.LIST_EXPBAR="LISTEXPBAR",e.MAP_EXPBAR="MAPEXPBAR",e.STATE_WIZARD_PANEL="STATEWIZARDPANEL",e.TAB_EXP_PANEL="TABEXPPANEL",e.CUSTOM="CUSTOM",e.CAPTIONBAR="CAPTIONBAR",e))(we||{})),Ie=e("ViewType",(e=>(e.APP_INDEX_VIEW="APPINDEXVIEW",e.DE_GRID_VIEW="DEGRIDVIEW",e.DE_EDIT_VIEW="DEEDITVIEW",e.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",e.APP_ERROR_VIEW="APPERRORVIEW",e.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",e.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",e.APP_LOGIN_VIEW="APPLOGINVIEW",e.APP_LOGOUT_VIEW="APPLOGOUTVIEW",e.APP_PANEL_VIEW="APPPANELVIEW",e.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",e.APP_PORTAL_VIEW="APPPORTALVIEW",e.APP_REDIRECT_VIEW="APPREDIRECTVIEW",e.APP_START_VIEW="APPSTARTVIEW",e.APP_WELCOME_VIEW="APPWELCOMEVIEW",e.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",e.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",e.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",e.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",e.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",e.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",e.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",e.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",e.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",e.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",e.DE_CALENDAR_VIEW="DECALENDARVIEW",e.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",e.DE_CHART_VIEW="DECHARTVIEW",e.DE_CHART_VIEW9="DECHARTVIEW9",e.DE_CUSTOM_VIEW="DECUSTOMVIEW",e.DE_DATA_VIEW="DEDATAVIEW",e.DE_DATA_VIEW9="DEDATAVIEW9",e.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",e.DE_EDIT_VIEW2="DEEDITVIEW2",e.DE_EDIT_VIEW3="DEEDITVIEW3",e.DE_EDIT_VIEW4="DEEDITVIEW4",e.DE_EDIT_VIEW9="DEEDITVIEW9",e.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",e.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",e.DE_GANTT_VIEW="DEGANTTVIEW",e.DE_GANTT_VIEW9="DEGANTTVIEW9",e.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",e.DE_GRID_VIEW2="DEGRIDVIEW2",e.DE_GRID_VIEW4="DEGRIDVIEW4",e.DE_GRID_VIEW8="DEGRIDVIEW8",e.DE_GRID_VIEW9="DEGRIDVIEW9",e.DE_HTML_VIEW="DEHTMLVIEW",e.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",e.DE_INDEX_VIEW="DEINDEXVIEW",e.DE_KANBAN_VIEW="DEKANBANVIEW",e.DE_KANBAN_VIEW9="DEKANBANVIEW9",e.DE_LIST_EXP_VIEW="DELISTEXPVIEW",e.DE_LIST_VIEW="DELISTVIEW",e.DE_LIST_VIEW9="DELISTVIEW9",e.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",e.DE_MAP_VIEW="DEMAPVIEW",e.DE_MAP_VIEW9="DEMAPVIEW9",e.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",e.DE_MEDITVIEW9="DEMEDITVIEW9",e.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",e.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",e.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",e.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",e.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",e.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",e.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",e.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",e.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",e.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",e.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",e.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",e.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",e.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",e.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",e.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",e.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",e.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",e.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",e.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",e.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",e.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",e.DE_MOB_MDVIEW="DEMOBMDVIEW",e.DE_MOB_MDVIEW9="DEMOBMDVIEW9",e.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",e.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",e.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",e.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",e.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",e.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",e.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",e.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",e.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",e.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",e.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",e.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",e.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",e.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",e.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",e.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",e.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",e.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",e.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",e.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",e.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",e.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",e.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",e.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",e.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",e.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",e.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",e.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",e.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",e.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",e.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",e.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",e.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",e.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",e.DE_MPICKUP_VIEW="DEMPICKUPVIEW",e.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",e.DE_OPT_VIEW="DEOPTVIEW",e.DE_PANEL_VIEW="DEPANELVIEW",e.DE_PANEL_VIEW9="DEPANELVIEW9",e.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",e.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",e.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",e.DE_PICKUP_VIEW="DEPICKUPVIEW",e.DE_PICKUP_VIEW2="DEPICKUPVIEW2",e.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",e.DE_PORTAL_VIEW="DEPORTALVIEW",e.DE_PORTAL_VIEW9="DEPORTALVIEW9",e.DE_REDIRECT_VIEW="DEREDIRECTVIEW",e.DE_REPORT_VIEW="DEREPORTVIEW",e.DE_TAB_EXP_VIEW="DETABEXPVIEW",e.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",e.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",e.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",e.DE_TREE_EXP_VIEW="DETREEEXPVIEW",e.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",e.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",e.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",e.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",e.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",e.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",e.DE_TREE_VIEW="DETREEVIEW",e.DE_TREE_VIEW9="DETREEVIEW9",e.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",e.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",e.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",e.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",e.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",e.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",e.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",e.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",e.DE_WF_EDIT_VIEW="DEWFEDITVIEW",e.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",e.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",e.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",e.DE_WF_EXP_VIEW="DEWFEXPVIEW",e.DE_WF_GRID_VIEW="DEWFGRIDVIEW",e.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",e.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",e.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",e.DE_WF_START_VIEW="DEWFSTARTVIEW",e.DE_WIZARD_VIEW="DEWIZARDVIEW",e))(Ie||{})),De=e("ViewMode",(e=>(e.ROUTE="ROUTE",e.MODAL="MODAL",e.DRAWER="DRAWER",e.EMBED="EMBED",e.POPOVER="POPOVER",e))(De||{})),Ae=e("SysUIActionTag",(e=>(e.NEW="New",e.EDIT="Edit",e.REFRESH="Refresh",e.EXIT="Exit",e.SAVE_AND_EXIT="SaveAndExit",e.SAVE_AND_NEW="SaveAndNew",e.SAVE="Save",e.SAVE_ROW="SaveRow",e.REMOVE="Remove",e.REMOVE_AND_EXIT="RemoveAndExit",e.NEW_ROW="NewRow",e.TOGGLE_FILTER="ToggleFilter",e.IMPORT="Import",e.EXPORT_EXCEL="ExportExcel",e.SAVE_AND_START="SaveAndStart",e.VIEW_WF_STEP="ViewWFStep",e.NO="No",e.YES="Yes",e.CANCEL="Cancel",e.OK="Ok",e.SEARCH="Search",e.FINISH="Finish",e.NEXT_STEP="NextStep",e.PREV_STEP="PrevStep",e.ADD_SELECTION="AddSelection",e.REMOVE_SELECTION="RemoveSelection",e.REMOVE_ALL="RemoveAll",e.ADD_ALL="AddAll",e.LOGOUT="Logout",e.LOGIN="Login",e.CANCEL_CHANGES="CancelChanges",e.COPY="Copy",e.VIEW="View",e.TOGGLE_ROW_EDIT="ToggleRowEdit",e.LOAD_MORE="LoadMore",e))(Ae||{})),Pe=e("StudioViewEvents",class{});Pe.onViewMounted="onMounted",Pe.onViewDestroyed="onDestroyed";var ye=e("StudioPanelEvents",class{});ye.onClick="onClick",ye.onChange="onChange",ye.onEnter="onEnter",ye.onLeave="onLeave";var ve=e("StudioControlEvents",class{});ve.onBeforeLoad="onBeforeLoad",ve.onLoadSuccess="onLoadSuccess",ve.onLoadError="onLoadError",ve.onBeforeLoadDraft="onBeforeLoadDraft",ve.onLoadDraftSuccess="onLoadDraftSuccess",ve.onLoadDraftError="onLoadDraftError",ve.onBeforeSave="onBeforeSave",ve.onSaveSuccess="onSaveSuccess",ve.onSaveError="onSaveError",ve.onBeforeRemove="onBeforeRemove",ve.onRemoveSuccess="onRemoveSuccess",ve.onRemoveError="onRemoveError",ve.CLICK="onClick";var Te=e("Modal",class{constructor(e){this.mode="EMBED",this.viewUsage=4,this.hooks={shouldDismiss:new g,beforeDismiss:new g},this._dismiss=e=>{ibiz.log.error("外部关闭能力未注册",e)},e.mode&&(this.mode=e.mode),e.routeDepth&&(this.routeDepth=e.routeDepth),e.viewUsage&&(this.viewUsage=e.viewUsage),e.dismiss&&(this._dismiss=e.dismiss)}injectDismiss(e){this._dismiss=e}async dismiss(e={ok:!1,data:[]}){const t={allowClose:!0};return await this.hooks.shouldDismiss.call(t),t.allowClose?(await this.hooks.beforeDismiss.call(e),this._dismiss(e),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});var _e=class e{constructor(){ibiz.commands.register(e.TAG,this.exec.bind(this))}async exec(e,s,a={},n={}){const r=await ibiz.hub.config.view.get(e);if(!r)throw new t("应用视图[".concat(e,"]不存在"));if(s.srfkey&&r.appDataEntityId){s[$(r.appDataEntityId)]=s.srfkey,s.srfkey=void 0}if(r.redirectView){return ne(await ibiz.hub.getAppView(e),s,a,n.data)}const{openMode:o="INDEXVIEWTAB"}=r;switch(n.openMode||o){case"INDEXVIEWTAB":return n.noWaitRoute?void this.openIndexViewTab(r,s,a):this.openIndexViewTab(r,s,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,s,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,n.event,s,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,s,a);case"USER":return this.openUserCustom(r,s,a);default:return this.openIndexViewTab(r,s,a)}}openIndexViewTab(e,t,s={}){return ibiz.openView.root(e,t,s)}async openModal(e,t,s={}){return ibiz.openView.modal(e,t,s)}async openPopover(e,t,s,i={}){return ibiz.openView.popover(e,t,s,i)}async openDrawer(e,t,s={}){return ibiz.openView.drawer(e,t,s)}async openUserCustom(e,t,s={}){return ibiz.openView.custom(e,t,s)}};_e.TAG="ibiz.app-view.open";var Ce=e("OpenAppViewCommand",_e),be=class e{constructor(){ibiz.commands.register(e.TAG,this.exec.bind(this))}async exec(e,s,a={},n={}){const r=ibiz.hub.getApp(s.srfappid).getAppFunc(e);if(!r)throw new t("找不到叫".concat(e,"的应用功能"));const{navigateContexts:o,navigateParams:c,appFuncType:l}=r,h=s.clone();Object.assign(h,z(o,s,a));const d=z(c,s,a);switch(l){case"APPVIEW":return this.openAppView(r,h,d,n);case"OPENHTMLPAGE":return this.openHtmlPage(r);case"PDTAPPFUNC":return this.openPdAppFunc(r,h,d);case"JAVASCRIPT":return this.executeJavaScript(r,h,d);case"CUSTOM":return this.custom(r,h,d);default:throw new i(r,"未支持的应用功能类型: ".concat(l))}}async openAppView(e,s,i,a){if(!e.appViewId)throw new t("应用视图[".concat(e.appViewId,"]不存在"));return ibiz.commands.execute(Ce.TAG,e.appViewId,s,i,a)}openHtmlPage(e){const t=e.htmlPageUrl;window.open(t,"_blank")}openPdAppFunc(e,s,i){throw ibiz.log.warn("openPdAppFunc",e,s,i),new t("未实现")}executeJavaScript(e,s,i){throw ibiz.log.warn("executeJavaScript",e,s,i),new t("未实现")}custom(e,s,i){throw ibiz.log.warn("custom",e,s,i),new t("未实现")}};be.TAG="ibiz.app-func.exec";var Ve=e("AppFuncCommand",be);function Le(){new Ve,new Ce}var Re=e("AppCounter",class{constructor(e){this.model=e,this.destroyed=!1,this.context=a.create(),this.params={},this.evt=new m,this.data={}}get isDestroyed(){return this.destroyed}async init(e,t){this.setParams(e,t),this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new s(this.model,"未找到获取计数器行为!");this.action=i,this.interval(),await this.load()}setParams(e,t){e&&(this.context=C(e)),t&&(this.params=C(t))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){const e=ibiz.hub.getApp(this.context.srfappid),t=await e.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return t.ok&&(this.data=t.data,this.evt.emit("change",this.data)),this.data}refresh(e,t){return this.setParams(e,t),this.load()}onChange(e,t=!0){this.evt.on("change",e),t&&p(this.data)&&e(this.data)}offChange(e){this.evt.off("change",e)}getCounter(e){return this.data[e.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),Me=class{constructor(){this.psModelGroupCondBase=null}parse(e){if(e instanceof Array){const t=this.createPSModelGroupCond();t.parse(e),this.psModelGroupCondBase=t}}testSingleCond(e,t,s){try{if("ISNULL"===e)return null==t;if("ISNOTNULL"===e)return null!=t;if("EQ"===e||"ABSEQ"===e||"GT"===e||"GTANDEQ"===e||"LT"===e||"LTANDEQ"===e||"NOTEQ"===e){let i=-1;if(t==s?i=0:t>s&&(i=1),"EQ"===e||"ABSEQ"===e)return 0===i;if("GT"===e)return i>0;if("GTANDEQ"===e)return i>=0;if("LT"===e)return i<0;if("LTANDEQ"===e)return i<=0;if("NOTEQ"===e)return 0!==i}if("LIKE"===e)return null!=t&&null!=s&&-1!==t.toString().toUpperCase().indexOf(s.toString().toUpperCase());if("LEFTLIKE"===e)return null!=t&&null!=s&&0===t.toString().toUpperCase().indexOf(s.toString().toUpperCase())}catch(e){ibiz.log.error(e)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Oe=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(e){this.strCondOp=e}},We=class extends Oe{parse(e){const t=e.length;let s=!0,i=!1,a=!1;for(let n=0;n<t;n++)if(s){const t=e[n];this.setCondOp(t),s=!1,i=!0}else if(i){const t=e[n];this.setParam(t),i=!1,a=!0}else if(a){const t=e[n];if(t instanceof Object&&!(t instanceof Array)){const e=t;null!=e.type&&this.setValueType(e.type.toString()),null!=e.value&&this.setValue(e.value.toString())}else this.setValue(t);break}}getValueType(){return this.strValueType}setValueType(e){this.strValueType=e}getValue(){return this.strValue}setValue(e){this.strValue=e}getParamType(){return this.strParamType}setParamType(e){this.strParamType=e}getParam(){return this.strParam}setParam(e){this.strParam=e}},Ne=class e extends Oe{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(s){const i=s.length;let a=!0,n=!0,r=!1;for(let o=0;o<i;o++){if(a&&n){if("!"===s[o]){this.setNotMode(!0),a=!1;continue}}if(n){const e=s[o];this.setCondOp(e),n=!1,a=!1,r=!0}else if(r){const i=s[o];if(!(i instanceof Array))throw new t("值必须为数组");i.forEach((t=>{if(t.length>0){const s=t[0].toString();if("!"===s||"OR"===s||"AND"===s){const s=new e;s.parse(t),this.childCondList.push(s)}else{const e=new We;e.parse(t),this.childCondList.push(e)}}}))}}}setNotMode(e){this.bNotMode=e}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},xe=class extends Ne{},Se=class extends We{},Be=class e extends Me{test(e,t){return this.testCond(this.getPSModelGroupCondBase(),e,t)}testCond(t,s,i){if(t instanceof Ne){const e=t.getChildPSModelCondBases();if(null==e||_(e))return!t.isNotMode();const a="AND"===t.getCondOp();let n=a;for(let t=0;t<e.length;t++){const r=e[t];if(this.testCond(r,s,i)){if(!a){n=!0;break}}else if(a){n=!1;break}}return t.isNotMode()?!n:n}if(t instanceof We){_(t.getParam())&&ibiz.log.warn("没有指定属性名称",t);const a=s[t.getParam().toLowerCase()];let n=null;const r=t.getValueType(),o=t.getValue();return null==r||_(r)?n=t.getValue():(_(o)&&ibiz.log.warn("没有指定上下文参数名称"),e.PARAMTYPE_WEBCONTEXT===r?n=i.data[o.toLowerCase()]:e.PARAMTYPE_DATACONTEXT===r&&(n=i.getValue(o.toLowerCase()))),this.testSingleCond(t.getCondOp(),a,n)}return ibiz.log.warn("无法识别的条件对象",t),!1}createPSModelSingleCond(){return new Se}createPSModelGroupCond(){return new xe}};Be.PARAMTYPE_DATACONTEXT="DATACONTEXT",Be.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Fe=e("PSDEDQCondEngine",Be);e("DEDQCondUtil",class{static getCond(e){if(this.map.has(e))return this.map.get(e);const t=e.dedqgroupConditions;if(t){const s=new Fe;return s.parse(["OR",this.calcCond(t)]),this.map.set(e,s),s}return null}static calcCond(e){const t=[];return e.forEach((e=>{const s=[];if("GROUP"===e.condType){const t=e;t.notMode&&s.push("!"),s.push(e.condOp);const i=t.dedqconditions;if(i){const e=this.calcCond(i);s.push(e)}}else{if("SINGLE"!==e.condType)throw new i(e,"暂未支持的查询条件类型: ".concat(e.condType));{const t=e;s.push(t.fieldName),t.condValue||s.push("")}}t.push(s)})),t}}).map=new WeakMap;var ke=e("DynamicCodeListCache",class{constructor(e){this.cache=new Map,this.isPredefined=!1,this.codeList=e}async init(){return this.initPromise=(async()=>{const{predefinedType:e}=this.codeList;if(e){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(e))throw new i(this.codeList,"预定义类型".concat(e,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(e){const t={},{valueAppDEFieldId:s,textAppDEFieldId:i}=this.codeList,a=s?e[s]:e.srfkey;return t.id=a,t.value=a,t.text=i?e[i]:e.srfmajortext,Object.freeze(t)}async load(e={},t={}){const i=ibiz.hub.getApp(e.srfappid);if(this.isPredefined){t.size||(t.size=1e4);const e=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),t);return Object.freeze(e.data.items)}const{appDataEntityId:a,appDEDataSetId:n}=this.codeList;if(!a)throw new s(this.codeList,"未配置应用实体");if(!n)throw new s(this.codeList,"未配置数据集");const r=await i.deService.exec(a,n,e,{},t);let o=[];return r.data.length&&(o=r.data.map((e=>this.convertData(e)))),o}async get(e={},t={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(e,t);const s=JSON.stringify(e)+JSON.stringify(t);if(this.cache.has(s)){const e=this.cache.get(s);if(e.expirationTime>(new Date).getTime())return e.promise?e.promise:e.items;this.cache.delete(s)}const i=this.load(e,t),{cacheTimeout:a}=this.codeList,n=-1===a||v(a)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,r={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(s,r);const o=await i;return r.items=o,delete r.promise,o}});function Ue(e,s){if(null!=s){const{srfkey:e}=s;if(!v(e)&&!_(e))return!0}throw new t("执行「".concat(e,"」不存在「srfkey」无法处理"))}function ze(e,s){const{srfsessionid:i}=s;if(!v(i)&&!_(i))return!0;throw new t("执行「".concat(e,"」不存在「srfsessionid」无法处理"))}var Ge=e("DECache",class{constructor(){this.cacheMap=new Map}forceAdd(e,t){const s=this.getCacheByTag(e).get(t.srfkey);s&&(s.assign(t),ibiz.log.warn("forceAdd",t.srfkey,t))}forceUpdate(e,t){this.getCacheByTag(e).set(t.srfkey,C(t)),ibiz.log.warn("forceUpdate",t.srfkey,t)}forceDelete(e,t){this.getCacheByTag(e).delete(t),ibiz.log.warn("forceDelete",t)}add(e,t){try{ze("add",e),(v(t.srfkey)||_(t.srfkey))&&(t.srfkey=f()),t.srftempdate=(new Date).getTime();return this.getCacheByTag(e).set(t.srfkey,C(t)),ibiz.log.warn("add",t.srfkey,t),t}catch(e){return ibiz.log.error(e),null}}get(e,t){try{ze("get",e);const s=this.getCacheByTag(e).get(t);return ibiz.log.warn("get",t,s),C(s)}catch(e){return ibiz.log.error(e),null}}update(e,t){try{ze("update",e),Ue("update",t),t.srftempdate=(new Date).getTime();const s=this.getCacheByTag(e),i=s.get(t.srfkey);if(i)return i.assign(t),s.set(t.srfkey,i),ibiz.log.warn("update",t.srfkey,t),C(i);throw new Error("数据不存在,无法更新!")}catch(e){return ibiz.log.error(e),null}}delete(e,t){try{ze("delete",e);const s=this.getCacheByTag(e),i=t;if(s.has(i)){const e=s.get(i);return e.srftempdate=(new Date).getTime(),s.delete(i),ibiz.log.warn("delete",i),e}return null}catch(e){return ibiz.log.error(e),null}}createBatch(e,t){try{ze("add",e);const s=this.getCacheByTag(e);for(let e=0;e<t.length;e++){const i=t[e];(v(i.srfkey)||_(i.srfkey))&&(i.srfkey=f()),i.srftempdate=(new Date).getTime();const a=C(i);s.set(i.srfkey,a),t[e]=a,ibiz.log.warn("add",i.srfkey,i)}return t}catch(e){ibiz.log.error(e)}return[]}updateBatch(e,t){try{ze("update",e);const s=this.getCacheByTag(e);for(let e=0;e<t.length;e++){const i=t[e];Ue("update",i),i.srftempdate=(new Date).getTime();const a=s.get(i.srfkey);if(!a)throw new Error("数据[".concat(i.srfdename,"-").concat(i.srfmajortext,"(").concat(i.srfkey,")]不存在,无法更新!"));a.assign(i),s.set(i.srfkey,a),ibiz.log.warn("update",i.srfkey,i),t[e]=C(a)}return t}catch(e){return ibiz.log.error(e),null}}deleteBatch(e,t){try{ze("delete",e)}catch(e){return ibiz.log.error(e),t}const s=this.getCacheByTag(e),i=[];for(let e=0;e<t.length;e++){const a=t[e];s.has(a)||i.push(a)}if(i.length>0)throw new Error("未找到以下数据「".concat(i.join("、"),"」,无法删除!"));for(let e=0;e<t.length;e++){const i=t[e];s.delete(i),ibiz.log.warn("delete",i)}return[]}checkData(e,t){return-1!==this.getList(e).findIndex((e=>e.srfkey===t))}getList(e){try{ze("getList",e);const t=this.getCacheByTag(e);if(!t)return[];const s=t.values();return Array.from(s)}catch(e){return ibiz.log.error(e),[]}}generatePred(e={}){const t={};e.srfkey&&(t.srfkey=b(e.srfkey)),delete e.srfkey;for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const i=e[s];t[s]=b(i)}return V(t)}clear(e){const t=e.srfsessionid;this.cacheMap.size>0&&this.cacheMap.delete(t)}getCacheByTag(e){const t=e.srfsessionid;return this.cacheMap.has(t)||this.cacheMap.set(t,new Map),this.cacheMap.get(t)}}),je=new RegExp("(?<=\\$\\{)(.*?)(?=\\})","g");function Xe(e,t){const s=(t.requestPaths||[]).map((e=>({path:e,keys:e.match(je)||[]}))).filter((t=>{const{keys:s}=t;return 0===s.length||s.every(((t,i)=>i===s.length-1||null!=e[t]))})).sort(((e,t)=>t.keys.length-e.keys.length));if(s.length>0)return s[0]}function Ke(e,t){const s=Xe(e,t);if(s){if(s.keys.length>0){let{path:t}=s;return s.keys.forEach(((i,a)=>{t=a===s.keys.length-1?t.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):t.replace("${".concat(i,"}"),e[i])})),t}return s.path}return""}var He=e("SearchFilter",class{constructor(e,t){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=e,t){if(v(t.page)||_(t.page)||(this.page=t.page),v(t.size)||_(t.size)||(this.size=t.size),v(t.query)||_(t.query)||(this.query=t.query),!v(t.sort)&&!_(t.sort)){const e=t.sort.split(",");e.length>=1&&([this.sortField]=e),e.length>=2&&(this.sortMode=e[1].toUpperCase())}v(t.srfparentkey)||_(t.srfparentkey)||(this.srfparentkey=t.srfparentkey),v(t.srfparentdename)||_(t.srfparentdename)||(this.srfparentdename=t.srfparentdename),this.data={...t},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort,delete this.data.srfparentkey,delete this.data.srfparentdename}}getValue(e){return this.data[e]?this.data[e]:this.context[e]}}),Ye=e("CodeListService",class{constructor(e){this.appModel=e,this.allCodeLists=new Map,this.cache=new Map}getStatic(e){const t=e.codeName;if(this.cache.has(t))return this.cache.get(t);const s=e.codeItems;let i=[];return(null==s?void 0:s.length)&&(i=this.formatStaticItems(s,e.codeItemValueNumber)),this.cache.set(t,Object.freeze(i)),i}setCodeList(e){const{id:t,codeName:s}=e;this.allCodeLists.set(t,e),this.allCodeLists.set(s,e)}getCodeList(e){return this.allCodeLists.get(e)}formatStaticItems(e,t){return e.map((e=>{var s;const i={text:e.text,value:t?Number(e.value):e.value,color:e.color,id:e.codeName};return(null==(s=e.codeItems)?void 0:s.length)&&(i.children=this.formatStaticItems(e.codeItems,t)),Object.freeze(i)}))}async getDynamicCodeList(e,t={},s={}){let i;const a=e.codeName;return this.cache.has(a)?i=this.cache.get(a):(i=new ke(e),this.cache.set(a,i),await i.init()),i.get(t,s)}async get(e,s,i){const a=this.allCodeLists.get(e);if(!a)throw new t("找不到".concat(e,"代码表"));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,s,i):[]}}),qe=e("CounterService",class{static async getCounter(e,t,s){const i=e.id;if(this.counterMap.has(i)){const e=this.counterMap.get(i);if(!1===e.isDestroyed)return e;this.counterMap.delete(i)}const a=new Re(e);return await a.init(t,s),this.counterMap.set(i,a),a}static async getCounterByRef(e,t,i){const{appCounter:a}=e;if(!a)throw new s(e,"未配置应用计数器!");return this.getCounter(a,t,i)}});qe.counterMap=new Map;var $e=e("WorkFlowService",class{constructor(e){this.model=e,this.commonBaseUrl="",this.app=ibiz.hub.getApp(e.appId);const t=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(t.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(e,t){return t.srfprocessinstanceid&&(e.srfprocessinstanceid=t.srfprocessinstanceid),e}async getWFStep(e){const{processDefinitionKey:t,taskDefinitionKey:s}=e;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(t,"/usertasks/").concat(s))}async getWFLink(e,t){const s=e[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=e;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(s,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(t,e)})}async getWFHistory(e){const t=e[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(t,"/process-instances/alls/history"))}async getWFProcessDiagram(e){const t=e[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(t,"/process-instances/alls/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(){return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions2"))}async wfStart(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/process-instances"),{...t,activedata:this.getActiveData(s,e)})}async wfSubmit(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId),{...t,activedata:this.getActiveData(s,e)})}async wfWithdraw(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/withdraw"),{...t,activedata:this.getActiveData(s,e)})}async wfReassign(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/transfer"),{...t,activedata:this.getActiveData(s,e)})}async wfAddStepBefore(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/beforesign"),{...t,activedata:this.getActiveData(s,e)})}async wfSendBack(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/sendback"),{...t,activedata:this.getActiveData(s,e)})}async wfSendCopy(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/sendcopy"),{...t,activedata:this.getActiveData(s,e)})}async exec(e,s,i={},a={}){switch(e){case"wfstart":return this.wfStart(s,i,a);case"wfsubmit":return this.wfSubmit(s,i,a);case"reassign":return this.wfReassign(s,i,a);case"addstepbefore":return this.wfAddStepBefore(s,i,a);case"sendback":return this.wfSendBack(s,i,a);case"sendcopy":return this.wfSendCopy(s,i,a);default:throw new t("「".concat(e,"」未实现"))}}}),Qe=e("Srfuf",(e=>(e[e.CREATE=0]="CREATE",e[e.UPDATE=1]="UPDATE",e))(Qe||{})),Je=e("AppDataEntity",class e{get srfuf(){return this.srfkey?1:0}constructor(t,s){let i;Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:t}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:C(s instanceof e?s._data:s)}),Object.defineProperty(this,"srfdeid",{get:()=>t.id}),Object.defineProperty(this,"srfdecodename",{get:()=>t.codeName});const a=H(t.appDEFields||[],t.keyAppDEFieldId);if(a){const e=a.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfile",{get:()=>e}),Object.defineProperty(this,"srfkey",{set(t){i=t,this._data[e]=t},get(){return this._data[e]||i}})}else ibiz.log.warn("实体[".concat(t.codeName,"]未配置主键字段"));const n=H(t.appDEFields||[],t.majorAppDEFieldId);if(n){const e=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfile",{get:()=>e}),Object.defineProperty(this,"srfmajortext",{set(t){this._data[e]=t},get(){return this._data[e]}})}else ibiz.log.warn("实体[".concat(t.codeName,"]未配置主文本字段"));this.defineProperties()}defineProperties(){var e;const{_data:t}=this,s={},i=Object.keys(t);i.forEach((e=>{s[e]={enumerable:!0,set(s){t[e]=s},get:()=>t[e]}})),null==(e=this._entity.appDEFields)||e.forEach((e=>{const a=e.codeName.toLowerCase();i.includes(a)||(s[a]={enumerable:!0,set(e){t[a]=e},get:()=>t[a]})})),Object.defineProperties(this,s)}clone(){return new e(this._entity,this._data)}assign(t){return t instanceof e?Object.assign(this._data,t._data):Object.assign(this._data,t),this}}),Ze=e("MethodDto",class e{constructor(e,t){this.entity=e,this.dto=t,this.dtoMap=new Map,t?(this.app=ibiz.hub.getApp(e.appId),this.fields=t.appDEMethodDTOFields||[]):this.fields=[]}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async get(e,t){const s={};for(let a=0;a<this.fields.length;a++){const n=this.fields[a],r=n.codeName.toLowerCase();switch(n.type){case"SIMPLE":{const e=t[r];E(e)?s[r]=null:s[r]=e;break}case"DTOS":{const t=await this.getFieldDto(n),i=(await this.app.deService.getService(n.refAppDataEntityId)).local.getList(e);if(i){const a=[];for(let s=0;s<i.length;s++)a.push(await t.get(e,i[s]));s[r]=a}break}default:throw new i(n,"未支持的应用实体方法输入属性类型: ".concat(n.type))}}return s}async sets(e,t){const s=await this.app.deService.getService(this.entity.id);return s.local.clear(e),Promise.all(t.map((async t=>{const i=this.fields.filter((e=>"DTOS"===e.type)).map((async s=>{const i=s.codeName.toLowerCase(),a=await this.getFieldDto(s),n=t[i];n&&await a.sets(e,n)}));for(let e=0;e<i.length;e++)await i[e];const a=new Je(this.entity,t);return this.isLocalMode&&await s.local.add(e,a),a})))}async getFieldDto(t){if(this.dtoMap.has(t.codeName))return this.dtoMap.get(t.codeName);const s=await ibiz.hub.getAppDataEntity(t.refAppDataEntityId,this.entity.appId),i=H(s.appDEMethodDTOs||[],t.refAppDEMethodDTOId),a=new e(s,i);return this.dtoMap.set(t.codeName,a),a}}),et=class{constructor(e,t){this.entity=e,this.method=t,this.app=ibiz.hub.getApp(e.appId),this.input=new class{constructor(e,t){if(this.entity=e,this.input=t,t){const s=H(e.appDEMethodDTOs||[],t.appDEMethodDTOId);s&&(this.dto=new Ze(e,s))}}async handle(e,t){return this.dto?this.dto.get(e,t):t}}(e,t.appDEMethodInput),this.result=new class{constructor(e,t){if(this.entity=e,this.output=t,t){const s=H(e.appDEMethodDTOs||[],t.appDEMethodDTOId);s&&(this.dto=new Ze(e,s))}}async handle(e,t){return this.dto?(await this.dto.sets(e,[t]))[0]:new Je(this.entity,t)}}(e,t.appDEMethodReturn)}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async request(e,t,i,a){const{actionType:n,requestMethod:r}=this.method;if("REMOTE"===n){const t=this.method.codeName.toLowerCase();let n=null;switch(r){case"POST":n=await this.app.net.post("".concat(e,"/").concat(t),i,a);break;case"GET":n=await this.app.net.get("".concat(e,"/").concat(t),i,a);break;case"PUT":n=await this.app.net.put("".concat(e,"/").concat(t),i,a);break;case"DELETE":n=await this.app.net.delete("".concat(e,"/").concat(t),i,a);break;default:throw new s(this.method,r?"未支持的请求方式: ".concat(r):"未配置请求方式")}return n}throw new s(this.method,"未支持的行为类型[".concat(n,"]"))}calcPath(e){const t="/".concat(this.entity.codeName2.toLowerCase());return Ke(e,this.entity)+t}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(e){return new Je(this.entity,e)}},tt=class{},st=class extends tt{constructor(e){super(),this.model=e,this.srcParam=e.srcLogicParamId,this.dstParam=e.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(e,t,a){const n=e.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const e=null!=a[this.value]?a[this.value]:t[this.value];return oe(n[this.dstField],this.op,e)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const t=e.params[this.srcParam];return oe(n[this.dstField],this.op,t[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return oe(n[this.dstField],this.op,this.value)}}},it=class e extends tt{constructor(t){super(),this.model=t;const s=t.conds||[];this.conds=s.map((t=>"SINGLE"===t.logicType?new st(t):new e(t)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(e,t,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(e,t,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},at=class{constructor(e){var t;this.model=e,this.links=null==(t=e.links||[])?void 0:t.map((e=>new class{constructor(e){this.model=e,this.srcNode=null,this.dstNode=null,this.groupCond=null;const t=this.model.delogicLinkGroupCond;t&&(this.groupCond=new it(t))}async exec(e){const{defaultLink:t}=this.model;return!(!t&&this.groupCond)||this.groupCond.test(e,e.context,e.data||{})}}(e)))}},nt=class extends at{async exec(e){const{dstAppDataEntityId:t,dstAppDEActionId:i,dstDELogicParamId:a,retDELogicParamId:n}=this.model;if(!t)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=e.params[a],o=ibiz.hub.getApp(e.context.srfappid),c=await o.deService.exec(t,i,e.context,r,e.viewParams);c.ok&&(e.params[n]=c.data)}},rt=class extends at{async exec(e){}},ot=class extends at{async exec(e){e.isEndNode=!0;const{returnParamId:t,returnType:s,rawValue:a}=this.model;switch(s){case"NONEVALUE":e.result=void 0;break;case"NULLVALUE":e.result=null;break;case"SRCVALUE":e.result=a;break;case"LOGICPARAM":e.result=e.params[t];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(s))}}};function ct(e,t){const{srcDELogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=t;let o;switch(t.srcValueType||(t.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=e.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=e.viewParams;break;case"APPDATA":o=e.context;break;case"ENVPARAM":o=C(ibiz.env);break;default:throw new i(t,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}var lt=class extends at{async exec(e){const t=this.model.delogicNodeParams;(null==t?void 0:t.length)&&await Promise.all(t.map((t=>{switch(t.paramAction){case"SETPARAMVALUE":return this.setParamValue(t,e);case"RESETPARAM":return this.resetParam(t,e);case"COPYPARAM":return this.copyParam(t,e);case"BINDPARAM":return this.bindParam(t,e);case"RENEWPARAM":return this.renewParam(t,e);case"APPENDPARAM":return this.appendParam(t,e);case"SORTPARAM":return this.sortParam(t,e);default:throw new i(t,"暂未支持逻辑处理参数操作".concat(t.paramAction))}})))}copyParam(e,t){const{dstDELogicParamId:s}=e,i=ct(t,e);t.params[s]=C(i)}bindParam(e,t){const s=ct(t,e);t.params[e.dstDELogicParamId]=s}setParamValue(e,t){const{dstFieldName:s,dstDELogicParamId:i}=e,a=null==s?void 0:s.toLowerCase(),n=ct(t,e);a?t.params[i][a]=n:t.params[i]=n}resetParam(e,t){const{dstDELogicParamId:s}=e;t.resetParam(s)}renewParam(e,t){const{dstDELogicParamId:s}=e;t.renewParam(s)}appendParam(e,t){const{dstDELogicParamId:s,dstIndex:i,srcIndex:a,srcSize:n}=e,r=ct(t,e),o=i||0,c=a||0,l=n||r.length;t.params[s].splice(o,0,...r.slice(c,l))}sortParam(e,t){const{dstDELogicParamId:s,dstFieldName:i,dstSortDir:a}=e,n=i.toLowerCase();t.params[s].sort(((e,t)=>"ASC"===a?e[n]-t[n]:t[n]-e[n]))}},ht=class extends at{async exec(e){const{dstAppDEDataSetId:t,dstAppDataEntityId:s,dstDELogicParamId:i,retDELogicParamId:a}=this.model,n=e.params[i],r=ibiz.hub.getApp(e.context.srfappid),o=await r.deService.exec(s,t,e.context,n,e.viewParams);o.ok&&(e.params[a]=o.data)}},dt=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ct(e,this.model);e.params[t]=a}},ut=class extends at{async exec(e){const{dstDELogicParamId:t}=this.model;if(!t)throw new s(this.model,"缺少目标参数对象配置");e.resetParam(t)}},pt=class extends at{async exec(e){const{dstDELogicParamId:t}=this.model;if(!t)throw new s(this.model,"缺少目标参数对象配置");e.renewParam(t)}},Et=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ct(e,this.model);e.params[t]=C(a)}},gt=class extends at{async exec(e){const{dstDELogicParamId:t,dstSortDir:i,dstFieldName:a}=this.model;if(!t||!a)throw new s(this.model,"缺少目标参数对象或目标属性配置");const n=a.toLowerCase();e.params[t].sort(((e,t)=>"ASC"===i?e[n]-t[n]:t[n]-e[n]))}},mt=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i,dstIndex:a,srcIndex:n,srcSize:r}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const o=ct(e,this.model),c=a||0,l=n||0,h=r||o.length;e.params[t].splice(c,0,...o.slice(l,h))}},ft=class extends at{async exec(e){const{errorCode:t,errorInfo:s}=this.model;throw new h({response:{status:t,statusText:s}})}},wt=class{constructor(e){var t,a;if(this.model=e,this.nodes=new Map,this.params=new Map,!(null==(t=e.delogicNodes)?void 0:t.length))throw new s(e,"实体逻辑没有配置逻辑节点");e.delogicNodes.forEach((e=>{const{logicNodeType:t}=e;let s;switch(t){case"BEGIN":s=new rt(e);break;case"END":s=new ot(e);break;case"DEACTION":s=new nt(e);break;case"PREPAREPARAM":s=new lt(e);break;case"DEDATASET":s=new ht(e);break;case"THROWEXCEPTION":s=new ft(e);break;case"BINDPARAM":s=new dt(e);break;case"RESETPARAM":s=new ut(e);break;case"COPYPARAM":s=new Et(e);break;case"RENEWPARAM":s=new pt(e);break;case"APPENDPARAM":s=new mt(e);break;case"SORTPARAM":s=new gt(e);break;default:throw new i(e,"未支持的逻辑节点类型: ".concat(t))}this.nodes.set(e.id,s)})),null==(a=e.delogicParams)||a.forEach((e=>{this.params.set(e.id,new class{constructor(e){this.model=e}calc(e){const t=this.model.id,s=this.model;if(s.default)e.params[t]=e.data||{};else if(s.appGlobalParam)e.params[t]=C(ibiz.env);else if(s.entityListParam)e.params[t]=[];else{if(s.entityPageParam)throw new i(s,"未支持的逻辑参数类型: 分页查询结果");if(s.entityParam)e.params[t]={};else{if(s.lastReturnParam)throw new i(s,"未支持的逻辑参数类型: 上次调用返回");if(s.appContextParam)e.params[t]=e.context;else if(s.simpleListParam)e.params[t]=[];else if(s.simpleParam)e.params[t]={};else if(s.cloneParam)e.params[t]=C(e.data||{});else{if(s.envParam)throw new i(s,"未支持的逻辑参数类型: 系统环境变量");if(s.fileListParam)throw new i(s,"未支持的逻辑参数类型: 文件对象列表变量");if(s.fileParam)throw new i(s,"未支持的逻辑参数类型: 文件对象变量");if(s.filterParam)throw new i(s,"未支持的逻辑参数类型: 过滤器对象变量");if(s.lastParam)throw new i(s,"未支持的逻辑参数类型: 最后数据变量");if(s.originEntity)throw new i(s,"未支持的逻辑参数类型: 原始数据对象");if(s.sessionParam)throw new i(s,"未支持的逻辑参数类型: 操作会话变量")}}}}renew(e){const t=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)e.params[t]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");e.params[t]={}}}}(e))})),this.nodes.forEach((e=>{e.links.forEach((t=>{t.srcNode=e,this.nodes.has(t.model.thenId)&&(t.dstNode=this.nodes.get(t.model.thenId))}))}))}initLogicParams(e){this.params.forEach((t=>{t.model.default&&(e.defaultParamName=t.model.id),t.calc(e)}))}async exec(e,t,i){const a=new class{constructor(e,t,s,i){this.deLogicParams=e,this.context=t,this.data=s,this.viewParams=i,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}resetParam(e){var t;null==(t=this.deLogicParams.get(e))||t.calc(this)}renewParam(e){var t;null==(t=this.deLogicParams.get(e))||t.renew(this)}}(this.params,e,t,i);this.initLogicParams(a);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new s(this.model,"未设置起始节点");{const e=this.nodes.get(n);await this.deepExec(e,a)}return a.isEndNode?a.result:a.params[a.defaultParamName]?a.params[a.defaultParamName]:null}async deepExec(e,t){await e.exec(t);const{links:s}=e;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(t)&&a.dstNode&&(await this.deepExec(a.dstNode,t),!1===e.model.parallelOutput))break}}},It=new Map;async function Dt(e,t,s,i){It.has(e)||It.set(e,new wt(e));return It.get(e).exec(t,s,i)}async function At(e,t,s,i,a){const n=J(e,t);if(n.length){(await Promise.all(n.map((e=>Dt(e,s,i,a))))).forEach((e=>{Object.assign(i,e)}))}}var Pt=class extends et{async exec(e,t,i){if("DELOGIC"===this.method.actionType){const a=Q(this.method.appDELogicId,this.entity);if(!a)throw new s(this.method,"缺少实体处理逻辑");return async function(e,t,s,i){try{const a=await Dt(e,t,s,i);return new l(a)}catch(e){if(e instanceof h)return new l(e,500);throw e}}(a,e,t,i)}let a;switch(this.isLocalMode||(t=await this.input.handle(e,t)),["READ","GETDRAFT"].includes(this.method.actionMode)||await At(this.entity,"change",e,t,i),this.method.codeName){case"Create":a=await this.create(e,t,i);break;case"Get":a=await this.get(e,i);break;case"GetDraft":a=await this.getDraft(e,i);break;case"Remove":a=await this.remove(e,i);break;case"Update":a=await this.update(e,t,i);break;case"CreateTemp":a=await this.createTemp(e,t);break;case"GetTemp":a=await this.getTemp(e,t);break;case"GetDraftTemp":a=await this.getDraftTemp(e,i);break;case"RemoveTemp":a=await this.removeTemp(e,t);break;case"UpdateTemp":a=await this.updateTemp(e,t);break;default:{let s=this.calcPath(e);this.method.needResourceKey&&(s="".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]||t[this.entity.keyAppDEFieldId]));const n=await this.request(s,e,t,i);n.data=await this.result.handle(e,n.data),a=n}}return await At(this.entity,"compute",e,a.data,i),a}async create(e,t,s){if(this.isLocalMode)return this.createTemp(e,this.createEntity(t));const i=this.calcPath(e),a=await this.app.net.post(i,t,s);return a.data=await this.result.handle(e,a.data),a}async remove(e,t){if(this.isLocalMode)return this.removeTemp(e,t);const s=this.calcPath(e);return await this.app.net.delete("".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]),t)}async update(e,t,s={}){if(this.isLocalMode)return this.updateTemp(e,this.createEntity(t));const i=this.calcPath(e),a=await this.app.net.put("".concat(i,"/").concat(e[this.entity.codeName.toLowerCase()]),t,s);return a.data=await this.result.handle(e,a.data),a}async get(e,t={}){if(this.isLocalMode)return this.getTemp(e,t);const s=this.calcPath(e),i=await this.app.net.get("".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]),t);return i.data=await this.result.handle(e,i.data),i}async getDraft(e,t){if(this.isLocalMode)return this.getDraftTemp(e,t);const s=this.calcPath(e),i=await this.app.net.get("".concat(s,"/getdraft"),t);return i.data=await this.result.handle(e,i.data),i}async createTemp(e,t){try{const s=await this.getService(),i=await s.local.add(e,this.createEntity(t));return new l(i)}catch(e){return new l(e,500)}}async getDraftTemp(e,t){try{const e=this.createEntity({});return e?new l(e):new l(e,500)}catch(e){return new l(e,500)}}async removeTemp(e,t){try{let t=null;!t&&e&&(t=e[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.delete(e,t);return s?new l(s):new l(s,500)}catch(e){return new l(e,500)}}async updateTemp(e,t){try{const s=(await this.getService()).local.update(e,this.createEntity(t));return s?new l(s):new l(s,500)}catch(e){return new l(e,500)}}async getTemp(e,t){try{let t=null;!t&&e&&(t=e[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.get(e,t);return s?new l(s):new l(s,500)}catch(e){return new l(e,500)}}async removeBatchTemp(e,t){return new l(!0)}},yt=class extends et{async exec(e,t,s){if(this.isLocalMode){const s=await this.searchLocal(null,new He(e,t));return new l(s,200)}let a;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":a=await this.fetchCodeListSet(e,s);break;case"REMOTE":{const i=this.calcPath(e);a=await this.request(i,e,t,s)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const n=a.data||[];return a.data=n.map((e=>this.createEntity(e))),a.data.length&&await Promise.all(a.data.map((t=>At(this.entity,"compute",e,t,s)))),a}async selectLocal(e,t={}){let s=(await this.getService()).local.getList(e);s=D(s,"srfordervalue");const i={},a={},n={},r={};t.srfkey&&(i.srfkey=b(t.srfkey),delete t.srfkey);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const s=t[e];null==s?(a[e]=b(null),n[e]=b(void 0),r[e]=b("")):i[e]=b(s)}if(!_(i)){const e=V(i),t=V(a),o=V(n),c=V(r);s=s.filter((s=>{if(_(a)){if(e(s))return!0}else if(e(s)&&(t(s)||o(s)||c(s)))return!0;return!1}))}return s.map((e=>e.clone()))}async searchLocal(e,t,s=this.entity.quickSearchAppDEFieldIds){const i=await this.getService();let a=[];e?(a=i.local.getList(t.context),a.length>0&&(a=a.filter((s=>e.test(s,t))))):(a=await this.selectLocal(t.context),a.length>0&&t.query&&""!==t.query&&s&&(a=a.filter((e=>{const i=new RegExp(t.query);for(let t=0;t<s.length;t+=1){const a=e[s[t]];if(i.test(a))return!0}return!1})))),v(t.sortField)||_(t.sortField)||(a="DESC"===t.sortMode?A(a,t.sortField):D(a,t.sortField));const{page:n,size:r}=t,o=n*r,c=(n+1)*r-1;return a.slice(o,c).map((e=>C(e)))}async fetchCodeListSet(e,t){const{appCodeListId:i}=this.method;if(!i)throw new s(this.method,"没有指定数据来源代码表");const a=await this.app.codeList.get(i,e,t),{keyAppDEFieldId:n,majorAppDEFieldId:r}=this.entity,o=a.map((e=>({[n]:e.value,[r]:e.text})));return new l(o,200)}},vt=e("DEService",class{constructor(e){this.model=e,this.methodMap=new Map,this.local=new Ge,this.wf=new $e(e),this.file=new class{constructor(e){this.model=e}exportData(e,t,s,i){const a=Ke(s,this.model),n="".concat(a,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(t.toLowerCase(),"/?srfexporttag=").concat(e.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}}(e)}getMethod(e){if(this.methodMap.has(e))return this.methodMap.get(e);const t=H(this.model.appDEMethods,e);let s=null;switch(t.methodType){case"DEACTION":s=new Pt(this.model,t);break;case"FETCH":case"FETCHTEMP":s=new yt(this.model,t);break;default:throw new i(t,"未支持的服务方法类型: ".concat(t.methodType))}return this.methodMap.set(e,s),s}exec(e,s,i={},a={}){const n=this.getMethod(e);if(n)return n.exec(s,i,a);throw new t("".concat(this.model.codeName,"未支持「").concat(e,"」方法"))}}),Tt=e("ControlVO",class e{get srfuf(){return v(this.$origin.srfuf)?this.srfkey?1:0:this.$origin.srfuf}get srfkey(){return this.$origin.srfkey}get srfmajortext(){return this.$origin.srfmajortext}get srfdeid(){return this.$origin.srfdeid}get srfdecodename(){return this.$origin.srfdecodename}get srfkeyfile(){return this.$origin.srfkeyfile}get srfmajorfile(){return this.$origin.srfmajorfile}constructor(e={},t=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:e||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:t||new Map}),this.$dataUIMap.forEach(((e,t)=>{const s=e.dataKey;this.linkProperty(t,s,e.isOriginField)})),Object.keys(e).forEach((e=>{Object.prototype.hasOwnProperty.call(this,e)||this.linkProperty(e,e)}))}linkProperty(e,t,s=!0){"srfuf"!==e&&(s||Object.prototype.hasOwnProperty.call(this.$origin,e)?Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get(){return this.$origin[t]},set(e){this.$origin[t]=e}}):Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(t){this.$origin=t instanceof e?t.getOrigin():t}}),_t=e("ControlService",class{constructor(e){this.dataUIMap=new Map,this.model=e}async init(e){this.app=ibiz.hub.getApp(null==e?void 0:e.srfappid),this.initUIDataMap()}initUIDataMap(){}async exec(e,t,s={},i={}){return await this.app.deService.exec(this.model.appDataEntityId,e,t,s,i)}handleResponse(e){return e}toUIData(e){return new Tt(e,this.dataUIMap)}}),Ct=(e("MDControlService",class extends _t{async fetch(e,t={}){var s;const i=(null==(s=this.model.fetchControlAction)?void 0:s.appDEMethodId)||"fetchdefault";let a=await this.exec(i,e,t);return a=this.handleResponse(a),a}async get(e,t={}){var s;const i=(null==(s=this.model.getControlAction)?void 0:s.appDEMethodId)||"get";let a=await this.exec(i,e,void 0,t);return a=this.handleResponse(a),a}async getDraft(e,t={}){var s;const i=(null==(s=this.model.getDraftControlAction)?void 0:s.appDEMethodId)||"getdraft";let a=await this.exec(i,e,void 0,t);return a=this.handleResponse(a),a}async remove(e,t={}){var s;const i=(null==(s=this.model.removeControlAction)?void 0:s.appDEMethodId)||"remove";return await this.exec(i,e,void 0,t)}async create(e,t){var s;const i=(null==(s=this.model.createControlAction)?void 0:s.appDEMethodId)||"create";let a=await this.exec(i,e,t.getOrigin());return a=this.handleResponse(a),a}async update(e,t){var s;const i=(null==(s=this.model.updateControlAction)?void 0:s.appDEMethodId)||"update";let a=await this.exec(i,e,t.getOrigin());return a=this.handleResponse(a),a}async exportData(e,s,i={}){throw new t("未实现")}handleResponse(e){const t=super.handleResponse(e);return t.headers&&(t.headers["x-page"]&&(t.page=Number(t.headers["x-page"])),t.headers["x-per-page"]&&(t.size=Number(t.headers["x-per-page"])),t.headers["x-total"]&&(t.total=Number(t.headers["x-total"]))),t.ok&&(w(t.data)?t.data=t.data.map((e=>this.toUIData(e))):t.data=this.toUIData(t.data)),t}}),e("DeAuthorityService",class{constructor(e){this.entityModel=e}async calcByDataAccessAction(e,t){if(t.srfopprivs&&!t.srfopprivs.includes(e))return!1;return!!await this.calcByDeMainState(e,t)}async calcByDeMainState(e,t){let s=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),s;ibiz.log.debug("操作标识".concat(e,"主状态计算开始"),t,i);const a=Y(i,t);if(a){ibiz.log.debug("匹配主状态",a);const t=q(a,i);ibiz.log.debug("允许的主状态权限集合",t),s=t.includes(e)}else ibiz.log.debug("没匹配主状态,返回false"),s=!1;return ibiz.log.debug("操作标识".concat(e,"权限计算结束:").concat(s)),s}})),bt=e("AuthorityService",class{constructor(e){this.appModel=e,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(e,t){this.constructorCache.set(e,t)}async getService(e){if(!this.cache.has(e)){const s=await ibiz.hub.getAppDataEntity(e,this.appModel.appId);if(!s)throw new t("未找到应用实体[".concat(e,"]"));const i=this.constructorCache.get(e);let a;a=i?await i(s):new Ct(s),this.cache.set(e,a)}return this.cache.get(e)}async init(e=ibiz.appData){if(!e)throw new t("没有appData数据");e.unires&&(this.resCodes=e.unires),!0===e.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0)}calcByResCode(e){return!this.enablePermission||this.resCodes.includes(e)}async calcByDataAccessAction(e,t,s){if(this.enablePermission){const t=await ibiz.hub.getApp(this.appModel.appId),i=await t.getOPPriv(e,s);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(t&&s){return(await this.getService(s)).calcByDataAccessAction(e,t)}return!0}}),Vt=e("AuthService",class{async v7login(e,t){return await ibiz.net.post("/v7/login",{loginname:e,password:t},{},{})}async v7logout(){return await ibiz.net.get("/v7/logout",{})}}),Lt=e("TreeNodeData",class{constructor(e,t,s){this.leaf=!1,this.leaf=!0===s.leaf,this.parent=t,this.parent&&(this.context={...this.parent.context}),s.navContext&&(this.context=Object.assign(this.context||{},s.navContext)),s.navParams&&(this.params={...s.navParams}),this.nodeId=e.id}}),Rt=(e("TreeCodeListNodeData",class extends Lt{constructor(e,t,s){super(e,t,s);const{data:i}=s;if(this.deData=i,this.text=i.text,this.value=i.value,this.id=t?"".concat(t.id,":").concat(e.id,"@").concat(this.value):e.id+this.value,this.id=this.id.toLowerCase(),e.appDataEntityId){const t=$(e.appDataEntityId);this.context=Object.assign(this.context||{},{[t]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text}}),e("TreeDataSetNodeData",class extends Lt{constructor(e,t,s){super(e,t,s);const{data:i}=s;if(this.deData=i,this.text=i.srfmajortext,this.value=i.srfkey,this.id=t?"".concat(t.id,":").concat(e.id,"@").concat(i.srfkey):e.id+i.srfkey,this.id=this.id.toLowerCase(),e.appDataEntityId){const t=$(e.appDataEntityId);this.context=Object.assign(this.context||{},{[t]:i.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext}}),e("TreeStaticNodeData",class extends Lt{constructor(e,t,s){var i,a;super(e,t,s);const n="root"===e.nodeValue?void 0:e.nodeValue;if(this.id=t?"".concat(t.id,":").concat(e.id):e.id,this.id=this.id.toLowerCase(),this.text=e.text,this.value=n,t&&s.parentValueLevel){let e=t;for(let t=1;t<s.parentValueLevel;t++)e=null==e?void 0:e.parent;(null==e?void 0:e.deData)&&(this.deData=e.deData),this.value=n||(null==e?void 0:e.value)}this.srfkey=(null==(i=this.deData)?void 0:i.srfkey)||this.value,this.srfmajortext=(null==(a=this.deData)?void 0:a.srfmajortext)||this.text}}),e("UIMapField",class{constructor(e,t,s={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=e,this.dataKey=t,v(s.isOriginField)||(this.isOriginField=s.isOriginField)}}),e("DEServiceUtil",class{constructor(e){this.appModel=e,this.cache=new Map,this.constructorCache=new Map}register(e,t){this.constructorCache.set(e,t)}async getService(e){if(!this.cache.has(e)){const s=await ibiz.hub.getAppDataEntity(e,this.appModel.appId);if(!s)throw new t("未找到应用实体[".concat(e,"]"));const i=this.constructorCache.get(e);let a;a=i?await i(s):new vt(s),this.cache.set(e,a)}return this.cache.get(e)}clearTempCache(e){this.cache.forEach((t=>{t.local.clear(e)}))}async exec(e,t,s,i,a){return(await this.getService(e)).exec(t,s,i,a)}})),Mt=e("Application",class{constructor(e){this.model=e,this.deName2DeCodeName=new Map,this.net=new n({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(e.appId)}),this.deService=new Rt(e),this.codeList=new Ye(e),this.authority=new bt(e)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle()}async loadAppModelStyle(){await this.net.get("".concat(ibiz.env.remoteModelUrl,"/PSSYSAPP.json.css")).then((e=>{const t=document.createElement("style");if(t.setAttribute("type","text/css"),e.request&&e.request.responseURL){const s=new URL(e.request.responseURL);t.id=s.pathname}t.innerHTML=e.data,document.head.appendChild(t)})).catch((e=>{ibiz.log.error("应用[".concat(this.appId,"]模型全局样式加载失败:").concat(e.message))}))}getAppFunc(e){return(this.model.appFuncs||[]).find((t=>t.id===e))||null}async getUIAction(e){const[,t]=e.split("@");if(t){const s=(await ibiz.hub.getAppDataEntity(t,this.model.appId)).appDEUIActions.find((t=>t.id===e));if(s)return s}return this.model.appDEUIActions.find((t=>t.id===e))}async getOPPriv(e,t){var s,i;let a=null==(s=this.model.deopprivs)?void 0:s.find((t=>t.name===e));if(!a&&t){a=null==(i=(await ibiz.hub.getAppDataEntity(t,this.model.appId)).deopprivs)?void 0:i.find((t=>t.name===e))}return a}async getDEUILogic(e,t){return(await ibiz.hub.getAppDataEntity(t,this.model.appId)).appDEUILogics.find((t=>t.id===e))}}),Ot=class{constructor(){this.convert=new class{constructor(){this.appMenu=new class{parse(e){return e}}}},this.appMap=new Map,this.apps=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new class{constructor(){this.view=new class{constructor(){this.viewConfigs=new Map}set(e,t){this.viewConfigs.set(e,t)}async get(e){if(!this.viewConfigs.has(e)){const s=await ibiz.hub.getAppView(e);if(!s)throw new t("视图[".concat(e,"]不存在"));this.set(s.id,{id:s.id,codeName:s.codeName,openMode:s.openMode,width:s.width,height:s.height,appDataEntityId:s.appDataEntityId,redirectView:s.redirectView})}return this.viewConfigs.get(e)}}}},this.defaultAppIndexViewName="Index"}calcAppViewId(e){let t="";if(-1!==e.indexOf(".")){const s=e.split(".");t=s[s.length-1]}else t=e.toLowerCase();return t}registerModelLoaderProvider(e){this.modelLoaderProvider=e}registerApp(e){this.apps.set(e.codeName,e)}registerAppView(e){this.views.set(e.codeName,e)}registerAppDataEntity(e,t=ibiz.env.appId){this.dataEntities.has(t)||this.dataEntities.set(t,new Map);this.dataEntities.get(t).set(e.id,e)}setAppView(e,t=ibiz.env.appId){const s=this.calcAppViewId(e);this.view2appMap.set(s,t)}hasAppView(e){const t=this.calcAppViewId(e);return this.view2appMap.has(t)}async getAppView(e){const s=this.calcAppViewId(e),i=this.view2appMap.get(s)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(s))return this.views.get(s);if(this.modelLoaderProvider){const e=await this.modelLoaderProvider.getAppView(i,s);return this.registerAppView(e),e}throw new t("视图[".concat(s,"]不存在"))}async getAppDataEntity(e,s=ibiz.env.appId){if(this.dataEntities.has(s)){const t=this.dataEntities.get(s);if(t.has(e))return t.get(e)}if(this.modelLoaderProvider){let t;return t=-1!==e.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(s,e):await this.modelLoaderProvider.getAppDataEntityByCodeName(s,e),this.registerAppDataEntity(t,s),t}throw new t("未找到应用实体[".concat(e,"]"))}async createApp(e){if(this.appMap.has(e))return this.appMap.get(e);let s;if(this.apps.has(e))s=this.apps.get(e);else{if(!this.modelLoaderProvider)throw new t("未找到应用[".concat(e,"]模型"));s=await this.modelLoaderProvider.getApp(e),this.registerApp(s)}const i=new Mt(s);return this.appMap.set(e,i),await i.init(),i}async getAppAsync(e=ibiz.env.appId){return this.createApp(e)}getApp(e){let t=null;return t=e?e instanceof Object?e.id:e:ibiz.env.appId,this.appMap.get(t)}},Wt=e("EngineFactory",class{constructor(){this.viewEngines=new Map}register(e,t){this.viewEngines.set(e,t)}unRegister(e){this.viewEngines.delete(e)}getEngine(e,...t){const{engineType:s,engineCat:i}=e,a="".concat(i,"_").concat(s),n=this.viewEngines.get(a);if(n)return n(...t);ibiz.log.error("没有".concat(a,"对应的引擎"),e)}}),Nt=e("ViewEngineBase",class{constructor(e){this.view=e,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:e}=this.view;e.push("captionbar","toolbar")}async onMounted(){var e,t;const{model:s,childNames:i}=this.view;ibiz.log.debug("".concat(s.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_header;t&&(t.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_footer;e&&(e.state.visible=!1)}}}async onDestroyed(){}async call(e,t){if("GetData"===e)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var e,t,s,i;let a=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_captionbar;t&&(t.state.visible=!1)}else a=!0;if(ibiz.env.isMob){if(this.leftToolbar)a=!0;else{const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.lefttoolbar;e&&(e.state.visible=!1)}if(this.rightToolbar)a=!0;else{const e=null==(s=this.viewLayoutPanel)?void 0:s.panelItems.righttoolbar;e&&(e.state.visible=!1)}}else if(this.toolbar)a=!0;else{const e=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;e&&(e.state.visible=!1)}return a}calcViewFooterVisible(){let e=!1;return this.footerToolbar&&(e=!0),e}async loadEntityData(){const{appDataEntityId:e}=this.view.model,{evt:s,context:i,params:a}=this.view;if(!e)throw new t("该视图没有实体,无法加载实体数据");const n=ibiz.hub.getApp(i.srfappid),r=await n.deService.exec(e,"get",i,a),{data:o}=r;o&&(this.view.state.srfactiveviewdata=o,s.emit("onDataChange",{actionType:"LOAD",data:[o]}),o.srfkey&&s.emit("onViewInfoChange",{dataInfo:o.srfmajortext||""}))}}),xt=(e("MDViewEngine",class extends Nt{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:e}=this.view;e.push(this.xdataControlName,"searchform","searchbar")}async onMounted(){await super.onMounted();const{model:e}=this.view;this.xdataControl.evt.on("onActive",(async e=>{await this.openData(e)})),this.xdataControl.evt.on("onSelectionChange",(async e=>{var t;null==(t=this.toolbar)||t.calcButtonState(e.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"SAVE"})}));const t=this.viewLayoutPanel.panelItems.view_searchform;if(t){const s=!!this.searchForm;t.state.keepAlive=s,t.state.visible=s&&!!e.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.refresh()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.refresh()})),!this.view.state.noLoadDefault&&e.loadDefault&&this.load()}async call(e,t){return"ToggleFilter"===e?(this.toggleFilter(),null):"Edit"===e||"View"===e?(this.openData(t),null):"New"===e?(this.newData(t),null):"Remove"===e?(await this.remove(t),null):"Import"===e?(await this.importData(),null):"Refresh"===e?(await this.refresh(),null):"ExportExcel"===e?(await this.exportData(t),null):"Copy"===e?(this.copy(t),null):super.call(e,t)}getData(){return this.xdataControl.getData()}async openData(e){var t,i;const{data:a,event:n}=e,r=this.view.context.clone();r[((null==(t=a[0].srfdecodename)?void 0:t.toLowerCase())||$(this.xdataControl.model.appDataEntityId)).toLowerCase()]=a[0].srfkey;if(-1===await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:r,params:this.view.params,data:a,event:n,view:this.view})))throw new s(this.view.model,"缺少opendata的视图逻辑")}async newData(e){var t,i,a;const{data:n,event:r,copyMode:o}=e;if(!(null==(i=null==(t=this.view.model.viewLayoutPanel)?void 0:t.appViewLogics)?void 0:i.find((e=>"newdata"===e.id))))throw new s(this.view.model,"缺少newdata的视图逻辑");const c=this.view.context.clone();o&&(c.srfcopymode=!0);if(-1===await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("newdata",{context:c,params:this.view.params,data:n,event:r,view:this.view})))throw new s(this.view.model,"缺少newdata的视图逻辑")}async remove(e){await this.xdataControl.remove(e)}async load(){await this.xdataControl.load({isInitialLoad:!0})}async refresh(){await this.xdataControl.refresh()}getSearchParams(){const e={};if(this.searchForm){const t=this.searchForm.getData()[0];Object.assign(e,t)}if(this.searchBar){const t={query:this.searchBar.state.query};Object.assign(e,t)}return e}async importData(){await this.xdataControl.importData()}async exportData(e){await this.xdataControl.exportData(e)}async copy(e){this.newData(Object.assign(e,{copyMode:!0}))}calcViewHeaderVisible(){let e=super.calcViewHeaderVisible();if(this.searchBar)e=!0;else{const e=this.viewLayoutPanel.panelItems.view_searchbar;e&&(e.state.visible=!1)}return e}toggleFilter(){if(this.searchForm){const e=this.viewLayoutPanel.panelItems.view_searchform;e&&(e.state.visible=!e.state.visible)}}}),class{constructor(){this.layoutPanel=new fe}}),St=e("CONTROL_PROVIDER_PREFIX","CONTROL");function Bt(e){return ibiz.register.get("".concat(St,"_").concat(e))}async function Ft(e){let t;const{controlType:s,controlStyle:i}=e;if(i&&"DEFAULT"!==i){t=Bt("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到部件类型:[".concat(s,"]的部件样式:[").concat(i,"]对应的适配器"),e)}return t||(t=Bt(s)),t||ibiz.log.error("找不到部件类型".concat(s,"对应的适配器")),t}var kt=e("EDITOR_PROVIDER_PREFIX","EDITOR");function Ut(e){return ibiz.register.get("".concat(kt,"_").concat(e))}var zt=e("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");var Gt=e("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");var jt=e("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Xt(e){return ibiz.register.get("".concat(jt,"_").concat(e.toUpperCase()))}var Kt=e("UIACTION_PROVIDER_PREFIX","UIACTION");function Ht(e,t){ibiz.register.register("".concat(Kt,"_").concat(e),t)}async function Yt(e){let s;const{uiactionMode:i}=e;var a;if(s||(a=i,s=ibiz.register.get("".concat(Kt,"_").concat(a))),!s)throw new t("找不界面行为模式".concat(i,"对应的适配器"));return s}var qt=e("VIEW_PROVIDER_PREFIX","VIEW");function $t(e){return ibiz.register.get("".concat(qt,"_").concat(e))}var Qt=e("PORTLET_PROVIDER_PREFIX","PORTLET");var Jt=class{},Zt=class extends Jt{constructor(e){super(),this.model=e,this.srcParam=e.srcLogicParamId,this.dstParam=e.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(e,t,a){const n=e.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const e=null!=a[this.value]?a[this.value]:t[this.value];return oe(n[this.dstField],this.op,e)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const t=e.params[this.srcParam];return oe(n[this.dstField],this.op,t[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return oe(n[this.dstField],this.op,this.value)}}},es=class e extends Jt{constructor(t){super(),this.model=t;const s=t.deuilogicLinkConds||[];this.conds=s.map((t=>"SINGLE"===t.logicType?new Zt(t):new e(t)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(e,t,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(e,t,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},ts=class{constructor(e){this.model=e,this.links=(e.deuilogicLinks||[]).map((e=>new class{constructor(e){this.model=e,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:t,deuilogicLinkGroupCond:s}=this.model;0===t&&s&&(this.groupCond=new es(s))}async exec(e){const{linkMode:t}=this.model,{context:s,data:a}=e;switch(t||0){case 0:return!this.groupCond||this.groupCond.test(e,s,a&&a.length>0?a[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(t))}}}(e)))}},ss=class extends ts{async exec(e){const{dstAppDataEntityId:t,dstAppDEActionId:i,dstDEUILogicParamId:a,retDEUILogicParamId:n}=this.model;if(!t)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=e.params[a],o=ibiz.hub.getApp(e.context.srfappid),c=await o.deService.exec(t,i,e.context,r,e.viewParams);c.ok&&(e.params[n]=c.data)}},is=class extends ts{async exec(e){const{dstAppDEUIActionId:t,dstDEUILogicParamId:i}=this.model,{data:a,parameters:n}=e;if(!t)throw new s(this.model,"未配置界面行为");let r=[a];if(i){const t=e.params[i];r=t instanceof Array?t:[t]}await hs.execAndResolved(t,{...n,data:r})}},as=class extends ts{async exec(e){}},ns=class extends ts{async exec(e){e.isEndNode=!0;const{returnType:t,rawValue:s,returnParamId:a}=this.model;switch(t){case"NONEVALUE":e.result=void 0;break;case"NULLVALUE":e.result=null;break;case"SRCVALUE":e.result=s;break;case"LOGICPARAM":e.result=e.params[a];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(t))}}};var rs=class extends ts{async exec(e){const t=this.model.deuilogicNodeParams;(null==t?void 0:t.length)&&await Promise.all(t.map((t=>{if("SETPARAMVALUE"===t.paramAction)return this.setParamValue(t,e);throw new i(t,"暂未支持逻辑处理参数操作".concat(t.paramAction))})))}setParamValue(e,t){const{dstFieldName:s,dstDEUILogicParamId:a}=e,n=null==s?void 0:s.toLowerCase(),r=function(e,t){const{srcDEUILogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=t;let o;switch(t.srcValueType||(t.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=e.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=e.viewParams;break;case"APPDATA":o=e.context;break;case"ENVPARAM":o=C(ibiz.env);break;default:throw new i(t,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}(t,e);n?t.params[a][n]=r:t.params[a]=r}},os=class extends ts{async exec(e){e.isEndNode=!0;const{invokeMethod:i,invokeCtrlId:a,invokeParamId:n}=this.model;if(!a)throw new s(this.model,"没有配置界面对象");if(!n)throw new s(this.model,"没有配置操作参数");if(!i)throw new s(this.model,"没有配置调用方法");const r=e.params[n];if(!r)throw new t("没有找到操作参数".concat(n));const o=e.params[a];if(!o)throw new t("没有找到界面对象".concat(a));if(!o[i]||!u(o[i]))throw new t("没有找到调用方法".concat(i));await o[i](r)}},cs=new Map;async function ls(e,a,n){const r=ibiz.hub.getApp(n.context.srfappid),o=await r.getDEUILogic(e,a);if(!o)throw new t("找不到实体".concat(a,"的界面逻辑").concat(e));cs.has(o)||cs.set(o,new class{constructor(e){var a;if(this.model=e,this.nodes=new Map,this.params=new Map,!(null==(a=e.deuilogicNodes)?void 0:a.length))throw new s(e,"界面逻辑没有配置逻辑节点");e.deuilogicNodes.forEach((e=>{const{logicNodeType:t}=e;let s;switch(t){case"BEGIN":s=new as(e);break;case"END":s=new ns(e);break;case"DEACTION":s=new ss(e);break;case"DEUIACTION":s=new is(e);break;case"PREPAREJSPARAM":s=new rs(e);break;case"RESETPARAM":case"COPYPARAM":case"BINDPARAM":case"VIEWCTRLINVOKE":s=new os(e);break;default:throw new i(e,"未支持的逻辑节点类型: ".concat(t))}this.nodes.set(e.id,s)})),e.deuilogicParams.forEach((e=>{this.params.set(e.id,new class{constructor(e){this.model=e}calc(e){const s=this.model.id,a=this.model,{context:n,viewParams:r,data:o,parameters:c}=e,l=ibiz.hub.getApp(n.srfappid);if(a.default)e.params[s]=o&&o.length>0?o[0]:{};else if(a.activeContainerParam)e.params[s]=c.ctrl||c.view;else if(a.activeCtrlParam)e.params[s]=c.ctrl;else if(a.ctrlParam){const i=c.view.getController(a.codeName.toLowerCase());if(!i)throw new t("没找到".concat(a.codeName,"指定部件对象"));e.params[s]=i}else if(a.activeViewParam)e.params[s]=c.view;else if(a.appGlobalParam)e.params[s]=ibiz.env;else if(a.applicationParam)e.params[s]=l;else if(a.entityListParam)e.params[s]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)e.params[s]={};else{if(a.lastReturnParam)throw new i(a,"未支持的逻辑参数类型: 上次调用返回");if(a.navContextParam)e.params[s]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)e.params[s]=[];else if(a.simpleParam)e.params[s]={};else if(a.viewNavDataParam)e.params[s]=r;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}}}renew(e){const t=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)e.params[t]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");e.params[t]={}}}}(e))})),this.nodes.forEach((e=>{e.links.forEach((t=>{t.srcNode=e,this.nodes.has(t.model.dstDEUILogicNodeId)&&(t.dstNode=this.nodes.get(t.model.dstDEUILogicNodeId))}))}))}initLogicParams(e){this.params.forEach((t=>{t.model.default&&(e.defaultParamName=t.model.id),t.calc(e)}))}async exec(e){const t=new class{constructor(e,t){this.deLogicParams=e,this.parameters=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get context(){return this.parameters.context}get data(){return this.parameters.data}get viewParams(){return this.parameters.params}resetParam(e){var t;null==(t=this.deLogicParams.get(e))||t.calc(this)}renewParam(e){var t;null==(t=this.deLogicParams.get(e))||t.renew(this)}}(this.params,e);this.initLogicParams(t);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new s(this.model,"未设置起始节点");{const e=this.nodes.get(i);await this.deepExec(e,t)}return t.isEndNode?t.result:t.params[t.defaultParamName]?t.params[t.defaultParamName]:null}async deepExec(e,t){await e.exec(t);const{links:s}=e;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(t)&&a.dstNode&&(await this.deepExec(a.dstNode,t),!1===e.model.parallelOutput))break}}}(o));const c=cs.get(o);return await c.exec(n),null}var hs=e("UIActionUtil",class{static async exec(e,s){const i=await ee(e);if(!i)throw new t("没找到".concat(e,"的界面行为模型"));return(await Yt(i)).exec(i,s)}static async execAndResolved(e,t){const s=await this.exec(e,t);s.closeView?t.view.closeView():s.refresh&&await t.view.callUIAction("Refresh")}}),ds=class{async exec(e,t){const{context:i,params:a,data:n}=t,r={refresh:e.reloadData,closeView:e.closeEditView},{appDEUILogicId:o,appDataEntityId:c,uilogicAttachMode:l}=e;if("REPLACE"===l){if(!o)throw new s(e,"没有配置实体界面逻辑");return await ls(o,c,t),r}if(!await this.isConfirm(e))return this.returnError(r);const h=await this.execAction(e,t);if(Object.assign(r,h),!0===r.cancel)return this.returnError(r);const d=await this.doNextAction(e,{...t,context:r.nextContext||i,data:r.data||n,params:r.nextParams||a});if(d&&(Object.assign(r,d),!0===d.cancel))return this.returnError(r);if("AFTER"===e.uilogicAttachMode){if(!o)throw new s(e,"没有配置实体界面逻辑");await ls(o,c,t)}return r}returnError(e){return Object.assign(e,{refresh:!1,closeView:!1})}async isConfirm(e){return!e.enableConfirm||!e.confirmMsg||ibiz.modal.confirm({title:e.confirmMsg})}async doNextAction(e,t){const s=e.nextId;if(s)return hs.exec(s,t)}async handleParams(e,t,s,i){let a=[];const n=$(e.appDataEntityId);switch(e.actionTarget){case"NONE":a=[];break;case"SINGLEDATA":a=[s[0]];break;case"MULTIDATA":a=s;break;case"MULTIKEY":a=n&&s.length>0?s.map((e=>({[n]:e.srfkey||e[n]}))):[{}];break;case"SINGLEKEY":{const e=s[0]||{};a=n?[{[n]:e.srfkey||e[n]}]:[{}]}}const r=t.clone(),o=[...e.navigateContexts||[]];if(n&&"NONE"!==e.actionTarget){const{valueItem:t,paramItem:s}=e,i=s||n,a=t||"srfkey";o.unshift({key:i,value:a,rawValue:!1})}const c=["MULTIKEY","MULTIDATA"].includes(e.actionTarget)&&s.length>0,l=z(o,t,i,c?K(o,s):s[0]||{});Object.assign(r,l);const h=e.navigateParams;return{resultContext:r,resultData:a,resultParams:z(h,r,i,c?K(h,s):s[0]||{})}}},us=e("BackendUIActionProvider",class extends ds{async execAction(e,t){const{context:i,params:a,data:n,event:r}=t,o={},c=e.appDataEntityId,l=e.appDEMethodId;if(!c||!l)throw new s(e,"未配置实体或实体行为");const{resultContext:h,resultParams:d,resultData:u}=await this.handleParams(e,i,n,a),p={...a,...d},E=e.frontAppViewId;if(E){const e=await ibiz.commands.execute(Ce.TAG,E,h,d,{event:r});if(!(null==e?void 0:e.ok))return o.cancel=!0,o;(null==e?void 0:e.ok)&&e.data&&(0===u.length&&u.push({}),u.forEach((t=>{t.srfactionparam=e.data})))}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),m=u.map((e=>{var t;return(null==(t=e.getOrigin)?void 0:t.call(e))||e||{}})),f=["MULTIKEY","MULTIDATA"].includes(e.actionTarget),I=await g.deService.exec(c,l,h,f?m:m[0],p);return I.ok&&e.successMsg&&ibiz.message.success(e.successMsg),Object.assign(o,{data:w(I.data)?I.data:[I.data],nextContext:h,nextParams:p}),o}}),ps=e("SysUIActionProvider",class extends ds{async execAction(e,t){const{view:s}=t,i=e.uiactionTag;if("Exit"===i)return{closeView:!0};return await s.callUIAction(i,t)||{}}}),Es=e("FrontUIActionProvider",class extends ds{async execAction(e,t){const{context:a,params:n,data:o,event:c,noWaitRoute:l}=t;let h={};switch(e.frontProcessType){case"OPENHTMLPAGE":{const t=r.fill(e.htmlPageUrl,a,null==o?void 0:o[0]);window.open(t,"_blank");break}case"TOP":case"WIZARD":{const t=e.frontAppViewId;if(!t)throw new s(e,"未配置打开视图");const{resultContext:i,resultParams:r}=await this.handleParams(e,a,o,n),d=await ibiz.commands.execute(Ce.TAG,t,i,r,{event:c,noWaitRoute:l});(null==d?void 0:d.ok)||(h.cancel=!0),(null==d?void 0:d.ok)&&d.data&&(h.data=d.data,h.nextContext=i,h.nextParams={...n,...r});break}case"OTHER":h=this.doOther(e,t);break;default:throw new i(e,"未支持的前台处理模式[".concat(e.frontProcessType,"]"))}return h}doOther(e,t){const{scriptCode:i}=e,{context:a,params:n,data:r,event:o}=t;if(i){return Ee.execScriptFn({context:a,params:n,data:r,el:null==o?void 0:o.target},i)||{}}throw new s(e,"自定义类型缺少配置脚本代码")}}),gs=e("WFWithdrawUIActionProvider",class extends ds{async execAction(e,t){const{view:s}=t;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&s&&(await s.call("WFWithdraw",t),i=!0),{refresh:!1,closeView:i}}});function ms(){const e=new Es;Ht("FRONT",(()=>e));const t=new us;Ht("BACKEND",(()=>t));const s=new ps;Ht("SYS",(()=>s));const i=new gs;Ht("DEUIACTION_WFWithdraw",(()=>i))}var fs=class{constructor(e,t){this.logic=e,this.scheduler=t,this.type=e.logicType}execute(e){throw new t("Method not implemented.")}destroy(){}},ws=class extends fs{constructor(){super(...arguments),this.isRowReturn=!1}convertScriptArgs(e){throw new t("未设置脚本执行参数转换方法")}init(e,t){this.convertScriptArgs=t;let s=this.logic.scriptCode;this.isRowReturn&&(s="return (".concat(s,")")),this.scriptFn=Ee.createScriptFn(e,s,{singleRowReturn:this.isRowReturn})}execute(e){const t=this.convertScriptArgs(e);return this.scriptFn.exec(t)}},Is=class extends fs{execute(e){const{appDEUILogicId:t,appDataEntityId:i}=this.logic;if(!t)throw new s(this.logic,"没有配置实体界面逻辑");ls(t,i,e)}},Ds=class{constructor(e){this.triggers=new Map,this.executors=new Map,this.logics=e,e.forEach((e=>{try{const t=this.createExecutor(e);this.executors.set(e.id,t);const s=this.createTrigger(e);this.triggers.set(e.id,s),s.bindExecutor(t)}catch(e){ibiz.log.error(e.message)}}))}destroy(){this.triggers.forEach((e=>e.destroy())),this.executors.forEach((e=>e.destroy()))}getExecuteParams(e){let t={};return this.defaultParamsCb&&(t=this.defaultParamsCb()),L(e,t)}createTrigger(e){return ibiz.scheduler.triggerFactory.createTrigger(e,this)}createExecutor(e){return ibiz.scheduler.executorFactory.createExecutor(e,this)}getMatchTriggers(e){const t=[];return this.triggers.forEach((s=>{s.match(e)&&t.push(s)})),t}triggerAndExecute(e,t={}){const s=this.getMatchTriggers(e);if(s.length>0){const e=this.getExecuteParams(t);return s.map((t=>t.execute(e)))}}triggerItemDynaLogic(e,t,s){const i={itemName:e,triggerType:t},a=this.triggerAndExecute(i,s);if(null==a?void 0:a.length)return a.pop()}triggerItemVisible(e,t){return this.triggerItemDynaLogic(e,"ITEMVISIBLE",t)}triggerItemEnable(e,t){return this.triggerItemDynaLogic(e,"ITEMENABLE",t)}triggerItemBlank(e,t){return this.triggerItemDynaLogic(e,"ITEMBLANK",t)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((e=>e.start()))}triggerCustom(e,t){const s=this.triggers.get(e);if(!s)return-1;const i=this.getExecuteParams(t);return s.execute(i)}},As=class extends Ds{constructor(e){super(e.filter((e=>"APPVIEWENGINE"!==e.triggerType)))}},Ps=class extends Ds{constructor(e){e.forEach((e=>{e.triggerType=e.logicTrigger})),super(e)}triggerViewEvent(e){const t={eventName:e.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(t,e)}},ys=class{constructor(){this.executorFactory=new class{constructor(){this.constructorMap=new Map}register(e,t){this.constructorMap.set(e,t)}createExecutor(e,t){const s=this.constructorMap.get(e.logicType);if(!s)throw new i(e,"逻辑类型 ".concat(e.logicType," 暂未支持!"));return s(e,t)}},this.triggerFactory=new class{constructor(){this.constructorMap=new Map}register(e,t){this.constructorMap.set(e,t)}createTrigger(e,t){const s=this.constructorMap.get(e.triggerType);if(!s)throw new i(e,"触发器类型 ".concat(e.triggerType," 暂未支持!"));return s(e,t)}}}createViewScheduler(e){return new Ps(e)}createControlScheduler(e){return new As(e)}},vs=class{constructor(e,t){this.logic=e,this.scheduler=t,this.type=e.triggerType}bindExecutor(e){this.executor=e}match(e){return e.triggerType===this.type}execute(e){if(this.executor)return this.executor.execute(e);throw new t("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},Ts=class extends vs{},_s=class extends vs{bindExecutor(e){if(super.bindExecutor(e),"SCRIPT"!==this.executor.type)throw new t("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"));this.executor.isRowReturn=!0,this.executor.init(["context","viewparams","data","env"],(e=>{const{context:t,params:s,data:i}=e;return{context:t,params:s,data:(null==i?void 0:i[0])||{},env:ibiz.env}}))}match(e){return super.match(e)&&e.itemName===this.logic.itemName}execute(e){const s=this.executor.execute(e);if("boolean"==typeof s)return s;throw new t("".concat(this.logic.id,"逻辑返回值不是布尔值"))}},Cs=class extends vs{constructor(){super(...arguments),this.timer=null}start(){this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new t("定时器缺少默认参数回调");const e=this.scheduler.defaultParamsCb();this.executor.execute(e)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},bs=class extends fs{execute(e){return"opendata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,e):"newdata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,e):void 0}async executeOpenDataAppUILogic(e,i){const{context:a,params:n,...r}=i,{data:o}=i;if(!(null==o?void 0:o[0]))throw new t("opendata没有可操作数据!");const c=e.openDataAppView;if(!c)throw new s(e,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new s(e,"opendata视图逻辑的默认打开视图没有实际引用视图");const h=c.navigateContexts||[],d=Object.assign(a,z(h,a,n,o[0]));let u={};const E=c.navigateParams;p(E)&&(u=z(E,n,a,o[0])),await ibiz.commands.execute(Ce.TAG,l,d,u,r)}async executeNewDataAppUILogic(e,t){const{context:a,params:n,...r}=t,{data:o}=t,{enableWizardAdd:c,enableBatchAdd:l,batchAddOnly:h,newDataAppView:d}=e;let u;if(c){if(u=await this.getWizardNewViewRef(e,t),!u)return}else{if(l)throw new i(e,"enableBatchAdd暂未支持");if(h)throw new i(e,"batchAddOnly暂未支持");if(u=d,!u||!u.refAppViewId)throw new s(e,"newdata视图逻辑没有配置默认新建数据视图")}let E={},g={};const m=(null==o?void 0:o[0])||{},f=u.navigateContexts;p(f)&&(E=z(f,a,n,m)),E=Object.assign(a,E);const w=u.navigateParams;p(w)&&(g=z(w,n,a,m)),a.srfcopymode&&(m.srfkey=void 0,g=Object.assign(g,m.$origin)),await ibiz.commands.execute(Ce.TAG,u.refAppViewId,E,g,r)}async getWizardNewViewRef(e,i){var a;const{wizardAppView:n,newDataAppViews:r}=e,{context:o,params:c,...l}=i;if(!n||!n.refAppViewId)throw new s(e,"缺少默认索引实体选择视图");const h=await ibiz.commands.execute(Ce.TAG,n.refAppViewId,o,c,{...l,openMode:"POPUPMODAL"});if(!h.ok)return;const d=null==(a=h.data)?void 0:a[0];if(!d)throw new t("请选中一条数据");const u=d.srfkey,p=null==r?void 0:r.find((e=>e.refMode===u));if(!p)throw new t("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}},Vs=class extends vs{constructor(e,t){super(e,t),this.logic=e,this.scheduler=t,this.listenEventNames=[];const s=e.eventNames.split(",");this.listenEventNames=s.map((e=>Pe[e]||e))}match(e){return super.match(e)&&this.listenEventNames.includes(e.eventName)}};var Ls=((e,t,s)=>(s=null!=e?O(S(e)):{},((e,t,s,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of x(t))B.call(e,a)||a===s||W(e,a,{get:()=>t[a],enumerable:!(i=N(t,a))||i.enumerable});return e})(!t&&e&&e.__esModule?s:W(s,"default",{value:e,enumerable:!0}),e)))(F(),1),Rs=(e("PluginStaticResource",class{constructor(e){this.styleElementMap=new Map,this.url=new URL(e);const t=Ls.default.dirname(this.url.pathname);this.baseDir=t}dir(e){return Ls.default.resolve(this.baseDir,e)}async loadStyle(e){const t=e.map((e=>{const t=this.dir(e);return!this.styleElementMap.has(t)&&(this.styleElementMap.set(t,null),new Promise(((e,s)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i.onload=e,i.onerror=s,document.head.appendChild(i)})))}));try{await Promise.all(t)}catch(e){ibiz.log.error(e)}}}),e("RemotePluginItem",class{constructor(e,t,s){this.tag=e,this.repo=t,this.config=s}}),e("FormNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Rs||{}))),Ms=e("GridNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Ms||{})),Os=e("PanelNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Os||{})),Ws=e("Counter",class{constructor(e){this.callback=e,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(e){if("Used"!==this.state){if(0===this.count)throw new t("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(e?e():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Ns=e("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Ws(o)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),xs=e("CTXState",class{}),Ss=e("CTX",class{constructor(e){this.parent=e,this.evt=new m,this.controllersMap=new Map,this.state=new xs}async init(e){this.view=e,this.registerController(e.model.name,e)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null}async setState(e){Object.assign(this.state,e)}startLoading(){this.view.startLoading()}endLoading(){this.view.endLoading()}registerController(e,t){this.controllersMap.set(e,t),this.evt.emit("onRegister",e,t)}getController(e,t=!1){return this.controllersMap.has(e)?this.controllersMap.get(e):this.parent&&t?this.parent.getController(e):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),Bs=e("ActivityCounter",class extends Ws{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(e){"Unused"!==this.state||this.registration.has(e)||(this.registration.set(e,!1),this.increment())}attend(e){this.registration.has(e)&&!1===this.registration.get(e)&&(this.registration.set(e,!0),this.decrement())}}),Fs=(e("UIActionButtonState",class{constructor(e,t,s){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.isInit=!1,this.name=e,this.uiActionId=s,this.appId=t}async init(){if(!this.uiActionId)return void(this.isInit=!0);const e=await ee(this.uiActionId);if([,this.appDeName]=this.uiActionId.split("@"),!e)return;const{dataAccessAction:t,noPrivDisplayMode:s,actionTarget:i,uiactionMode:a,uiactionTag:n}=e;this.dataAccessAction=t,1===s?this.noPermissionHidden=!1:6===s&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===a&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0),this.isInit=!0}async calcPermission(e,t){if(!this.dataAccessAction)return;const s=await ibiz.hub.getApp(this.appId);this.appDeName&&t&&!t.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(t,"不一致")),this.permitted=await s.authority.calcByDataAccessAction(this.dataAccessAction,e,t)}async update(e,t){this.isInit||await this.init(),await this.calcPermission(e,t),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&!e):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),e("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((e=>e.visible))})}addState(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t}),this.children.push(t)}setLoading(e){this.children.forEach((t=>{t.setLoading?t.setLoading(e):t.loading=!!e&&t.name===e}))}async update(e,t){await Promise.all(this.children.map((s=>s.update(e,t))))}}),e("QXEventEx",class extends m{constructor(){super(...arguments),this.anyEventFns=[]}onAll(e){this.anyEventFns.includes(e)||this.anyEventFns.push(e)}emit(e,...t){super.emit(e,...t),this.anyEventFns.forEach((s=>{s(e,...t)}))}async asyncEmit(e,...t){const s=super.asyncEmit(e,...t),i=this.anyEventFns.map((s=>s(e,...t))),a=Promise.all(i),n=await s,r=await a;return n.concat(...r)}reset(){super.reset(),I(this.anyEventFns)}})),ks=e("ControllerEvent",class{constructor(e){this.getBaseArgs=e,this.evt=new Fs}async emit(e,t){await this.evt.asyncEmit(e,{...this.getBaseArgs(),eventName:e,...t||{}})}on(e,t){this.evt.on(e,t)}onAll(e){this.evt.onAll(e)}destroy(){this.getBaseArgs=void 0,this.evt.reset()}});var Us="__self",zs=e("BaseController",class{constructor(e,t,s,i){this.model=e,this.context=t,this.params=s,this.ctx=i,this.state={},this.name="",this.evt=new ks(this.getEventArgs.bind(this)),this.mountCounter=new Bs(this.mounted.bind(this)),this.childNames=[],this.name=e.name||e.id,this.initState()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Us),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(e=>{this.childNames.includes(e)&&this.mountCounter.enroll(e)})),this.ctx.evt.on("onRegister",((e,t)=>{this.childNames.includes(e)&&t.evt.on("onMounted",(()=>{this.mountCounter.attend(e)}))}))}async mountSelf(){this.mountCounter.registration.get(Us)||this.mountCounter.attend(Us)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(e){}getController(e,t=!1){return this.ctx.getController(e,t)}getTopView(){return this.ctx.getTopView()}listenNewController(e){this.ctx.evt.on("onRegister",e)}}),Gs=e("ViewController",class extends zs{constructor(e,t,s,i){super(ibiz.util.layoutPanel.fill(e),a.create({},t),s||{},new Ss(i)),this.modal=new Te({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Ns,this.isCloseView=!1,this._isActive=!0,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var e;return null==(e=this.ctx.parent)?void 0:e.view}get isActive(){return this._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const e=ae(this.model);if(e.length)e.forEach((e=>{const t=ibiz.engine.getEngine(e,this);t&&this.engines.push(t)}));else{const e=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType},this);e&&this.engines.push(e)}}async initCounters(){const e=this.model.viewLayoutPanel,{appCounterRefs:t}=e;if(t&&t.length>0)try{await Promise.all(t.map((async e=>{const t=await qe.getCounterByRef(e,this.context);this.counters[e.id]=t})))}catch(e){console.error(e)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async e=>{await this._evt.emit("onCloseView",{...e})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const e=this.model.viewLayoutPanel;this.childNames.push(e.name);const t=await Ft(e);this.providers[e.name]=t;const s=se(this.model);s&&await Promise.all(s.map((async e=>{const t=await Ft(e);this.providers[e.name||e.id]=t}))),await this.initCounters();const i=ie(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.evt.onAll(((e,t)=>{this.scheduler.triggerViewEvent(t)}))),this.engines.length&&await Promise.all(this.engines.map((e=>e.onCreated())))}async onMounted(){var e;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((e=>e.onMounted()))),null==(e=this.scheduler)||e.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((e=>e.onDestroyed()))),this.ctx.destroy(),this.context.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){this.context.srfappid=this.model.appId,"ROUTE"===this.modal.mode&&(this.context.srfsessionid=f());const e=this.model.appViewNavContexts;let t={};p(e)&&(t=z(e,this.context,this.params)),Object.assign(this.context,t);const s=this.model.appViewNavParams;let i={};p(s)&&(i=z(s,this.context,this.params)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(e,t){let s;for(const i of this.engines)if(s=await i.call(e,t),void 0!==s)break;return s}async callUIAction(e,s){const i=this.call(e,s);if(void 0===i)throw new t("没有引擎支持预置界面行为".concat(e));return i}async closeView(e={ok:!1,data:[]}){await this.modal.dismiss(e)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(e){this.layoutPanel=e,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}}),js=(e("MobViewController",class extends Gs{}),e("EditorController",class{constructor(e,t){this.placeHolder="",this.editorParams={},this.model=e,this.parent=t,this.context=t.context,this.params=t.params}get readonly(){return!!this.model.readOnly}async init(){await this.onInit()}async onInit(){this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((e=>{this.editorParams[e.toLowerCase()]=this.model.editorParams[e]}))}handlePublicParams(e,t,s){const{navigateContexts:i,navigateParams:a}=this.model;let n={};i&&e&&(n=z(i,t,s,e));const r=Object.assign(t.clone(),n);let o={};a&&e&&(o=z(a,t,s,e));return{context:r,params:{...s,...o}}}toObj(e){if(!e)return;return new Function("return (".concat(e,");"))()}toBoolean(e){return Object.is("true",e)}})),Xs=(e("CodeListEditorController",class extends js{async loadCodeList(e){const{context:t,params:i}=this.handlePublicParams(e,this.context,this.params);if(this.model.appCodeListId){const e=await ibiz.hub.getApp(this.context.srfappid);let s=[];return s=await e.codeList.get(this.model.appCodeListId,t,i),s}throw new s(this.model,"请配置代码表")}}),e("ControlController",class extends zs{constructor(e,t,s,i){super(e,t,s,i),this.providers={},this.registerToCtx();const a=ibiz.util.layoutPanel.get("".concat(e.controlType,"_DEFAULT"));a&&(this.controlPanel=a)}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.isLoading=!1}async onCreated(){var e;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const e=await Ft(this.controlPanel);this.providers[this.controlPanel.name]=e}(null==(e=this.model.controlLogics)?void 0:e.length)&&(this.scheduler=ibiz.scheduler.createControlScheduler(this.model.controlLogics),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy()}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}handlerAbilityParams(e){return{context:this.context.clone(),params:{...this.params},data:(null==e?void 0:e.data)||this.getData()||[]}}setLayoutPanel(e){this.layoutPanel=e,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}}));e("MDControlController",class extends Xs{get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0}setSort(e,t){this.state.sortQuery="".concat(e,",").concat(t)}async getFetchParams(e){const{curPage:t,size:s,sortQuery:i,noSort:a}=this.state,n={...this.params};return s&&(n.page=t-1,n.size=s),!a&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),e&&Object.assign(n,e),n}async load(e={}){const t=!0===e.isInitialLoad,s=!0===e.isLoadMore;t?this.state.curPage=1:s&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(e),a=await this.getFetchParams(null==e?void 0:e.params);let n;await this.startLoading();try{n=await this.service.fetch(i,a),"number"==typeof n.total&&(this.state.total=n.total)}finally{await this.endLoading()}return s?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(e,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:t}),this.state.items}async afterLoad(e,t){return t}async refresh(){await this.load({isInitialLoad:!1})}async remove(e){const{context:s,params:i,data:a}=this.handlerAbilityParams(e);if(!(null==a?void 0:a.length))throw new t("未选中数据");if(await ibiz.modal.confirm({title:"数据删除",desc:"确认删除数据?"})){await this.startLoading();try{const e=$(this.model.appDataEntityId);await Promise.allSettled(a.map((async t=>{if(0!==t.srfuf){const a=s.clone();a[e]=t.srfkey,await this.service.remove(a,i)}this.afterRemove(a)}))),ibiz.notification.success({desc:"数据[".concat(a.map((e=>e.srfmajortext)).join("、"),"]删除成功!")}),this.refresh()}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}}afterRemove(e){const t=this.state.items.findIndex((t=>t.srfkey===e.srfkey));this.state.items.splice(t,1)}getData(){return this.state.selectedData||[]}setActive(e){return this._evt.emit("onActive",{data:[e]})}setSelection(e){const{selectedData:t}=this.state;c(t,e)||(this.state.selectedData=e,this._evt.emit("onSelectionChange",{data:e}))}async onRowClick(e){const{selectedData:t}=this.state,s=t.filter((t=>t.srfkey!==e.srfkey));s.length===t.length?this.setSelection(this.state.singleSelect?[e]:t.concat([e])):this.setSelection(s),1===this.state.mdctrlActiveMode&&await this.setActive(e)}async onDbRowClick(e){2===this.state.mdctrlActiveMode&&await this.setActive(e)}async importData(){}async exportData(e){}})}}}));
|
|
1
|
+
System.register(["@ibiz-template/core","lodash-es","qx-util","qs","ramda"],(function(e){"use strict";var t,s,i,a,n,r,o,c,l,h,d,u,p,E,g,m,f,w,I,D,A,P,y,v,T,_,b,C,V,L;return{setters:[function(e){t=e.RuntimeError,s=e.RuntimeModelError,i=e.ModelError,a=e.IBizContext,n=e.HttpResponse,r=e.HttpError,o=e.Net,c=e.StringUtil,l=e.NOOP,h=e.isElementSame},function(e){d=e.isEmpty,u=e.isFunction},function(e){p=e.notNilEmpty,E=e.isNilOrEmpty,g=e.AsyncSeriesHook,m=e.QXEvent,f=e.createUUID,w=e.isArray,I=e.clearAll,D=e.ascSort,A=e.descSort},function(e){P=e.default},function(e){y=e.isNotNil,v=e.isNil,T=e.mergeRight,_=e.isEmpty,b=e.clone,C=e.equals,V=e.where,L=e.mergeLeft}],execute:function(){e({calcContentAlignStyle:function(e){const{valignSelf:t,halignSelf:s}=e,i={};if(t||s){switch(Object.assign(i,{display:"flex"}),t){case"TOP":Object.assign(i,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(i,{"align-items":"center"});break;case"BOTTOM":Object.assign(i,{"align-items":"flex-end"})}switch(s){case"LEFT":Object.assign(i,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(i,{"justify-content":"center"});break;case"RIGHT":Object.assign(i,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(i,{"justify-content":"space-between"})}}return i},calcDeCodeNameById:$,calcDynaClass:function(e,t){return Ee.execScriptFn({data:t},e,{singleRowReturn:!0})},calcGridLayoutPos:function(e){const{layout:t,colXS:s,colXSOffset:i,colSM:a,colSMOffset:n,colMD:r,colMDOffset:o,colLG:c,colLGOffset:l}=e,h=(e,s)=>({span:(e&&-1!==e?e:"TABLE_24COL"===t?24:12)*("TABLE_24COL"===t?1:2),offset:s&&-1!==s?s:void 0});return{xs:h(s,i),sm:h(a,n),md:h(r,o),lg:h(c,l)}},calcLayoutHeightWidth:function(e){const{width:t,height:s,widthMode:i,heightMode:a}=e,n={width:"",height:""};"FULL"===i?n.width="100%":t&&t>0&&(n.width="".concat(t,"PERCENTAGE"===i?"%":"px"));"FULL"===a?n.height="100%":s&&s>0&&(n.height="".concat(s,"PERCENTAGE"===a?"%":"px"));return n},calcMainStateOPPrivsStrs:q,calcNavParams:function(e,t){const{deName:s,navFilter:i,pickupDEFName:a,navContexts:n,navParams:r}=e,{context:o,params:c,data:l,derValue:h}=t,d={},u={},p=h||l.srfkey;p&&(s&&(d[s]=p),i&&(u[i]=p),a&&(u["n_".concat(a.toLowerCase(),"_eq")]=p));const E=z(n,o,c,l),g=z(r,o,c,l);return Object.assign(d,E),Object.assign(u,g),{resultContext:d,resultParams:u}},calcResPath:Ke,calcRouteContext:function(e){let t=[];t=t.sort(((e,t)=>t.length-e.length));const[s]=t;if(s){const e={};return s.forEach((([t,s])=>{e[t]=s})),e}return{}},compare:ce,compareNumber:le,contains:he,convertNavData:z,convertNavDataByArray:G,convertNavDataByObject:j,convertObjectToNavParams:X,execDELogic:Dt,execDELogicAction:At,execDELogicById:async function(e,s,i,a,n){const r=await async function(e,t,s){const i=await ibiz.hub.getAppDataEntity(t,s);return Q(e,i)}(e,s,i.srfappid);if(!r)throw new t("".concat(s,"找不到实体逻辑").concat(e));return Dt(r,i,a,n)},execFieldLogics:Pt,execUILogic:ds,filterFieldLogics:J,filterValueRules:function(e,t){return e.filter((e=>{const{checkMode:s}=e,i=e.deformItemName||e.degridEditItemName;return 2!==s&&i===t}))},findChildFormDetails:function(e){let t;switch(e.detailType){case"TABPANEL":t=e.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":t=e.deformDetails}return t||[]},findDELogic:Q,findEditItem:function(e,t){var s;return null==(s=e.degridEditItems)?void 0:s.find((e=>e.codeName===t))},findFieldById:Z,findModelChild:H,formatMultiData:K,generateRules:function(e,s,i){const a=[];return e.forEach((e=>{const{valueRuleType:n}=e,r=e.sysValueRule,o=e.defvalueRule;if("SYSVALUERULE"===n&&r)"REG"===r.ruleType?a.push({pattern:new RegExp(r.regExCode),message:r.ruleInfo,trigger:"change blur"}):"SCRIPT"===r.ruleType&&a.push({validator:(e,t,s,i)=>{if(!t)return!0;try{Ee.execScriptFn({rule:e,value:t,callback:s,source:i},r.scriptCode)}catch(e){return console.error(e),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&o){const e=i||s;a.push({validator:(s,i,a,n)=>{if(E(n[e]))return!0;const{isPast:r,infoMessage:c}=ge(e,n,o.groupCond);return r||a(new t(c||o.ruleInfo)),!0},trigger:"change blur"})}})),a},getAppViewRef:function(e,t){var s,i;let a=e.appViewRefs||[];(null==(i=null==(s=e.viewLayoutPanel)?void 0:s.appViewRefs)?void 0:i.length)&&(a=a.concat(e.viewLayoutPanel.appViewRefs));return a.find((e=>e.name===t||e.id===t))},getChildNodeRSs:function(e,t){const s=t.parentId||te(e).id;return e.detreeNodeRSs.filter((e=>{return e.parentDETreeNodeId===s&&(i=e.searchMode,a=t.hasQuery,3===i||(a?1===i:2===i));var i,a}))},getControl:function(e,t){var s,i;let a=e.controls||[];(null==(i=null==(s=e.viewLayoutPanel)?void 0:s.controls)?void 0:i.length)&&(a=a.concat(e.viewLayoutPanel.controls));return a.find((e=>e.name===t||e.codeName===t||e.id===t))},getControlProvider:kt,getControlsByView:se,getDeACMode:async function(e,t,s){var i;const a=await ibiz.hub.getAppDataEntity(t,s);return null==(i=a.appDEACModes)?void 0:i.find((t=>t.id===e))},getEditorProvider:async function(e){let t;const{editorType:s,editorStyle:i}=e;if(i&&"DEFAULT"!==i){t=zt("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到编辑器类型:[".concat(s,"]的编辑器样式:[").concat(i,"]对应的适配器"),e)}t||(t=zt(s));t||ibiz.log.error("找不到编辑器类型".concat(s,"对应的适配器"));return t},getFormDetailProvider:async function(e){let t;const{detailType:s}=e;t||(i=s,t=ibiz.register.get("".concat(Gt,"_").concat(i)));var i;t||ibiz.log.error("找不到表单成员类型".concat(s,"对应的适配器"));return t},getGridColumnProvider:async function(e){let t;const{columnType:s,enableRowEdit:i}=e,a=i?"".concat(s,"_EDIT"):s;t||(t=function(e){return ibiz.register.get("".concat(jt,"_").concat(e))}(a));t||ibiz.log.error("找不到表格列类型".concat(a,"对应的适配器"));return t},getMatchResPath:Xe,getOriginData:function(e){let t=Array.isArray(e)?e[0]:e;t&&t instanceof _t&&(t=t.getOrigin());return t},getPanelItemProvider:async function(e){var t;let s;const{itemType:i}=e;if("CONTAINER"===i){const t=e.predefinedType||"DEFAULT";s=Kt("CONTAINER_".concat(t)),s||ibiz.log.error("找不到面板容器预置类型为".concat(t,"的适配器"))}if("RAWITEM"===i){const i=(null==(t=e.rawItem)?void 0:t.predefinedType)||"DEFAULT";s=Kt("RAWITEM_".concat(i)),s||ibiz.log.error("找不到面板成员直接内容预置类型为".concat(i,"的适配器"))}s||(s=Kt(i));s||ibiz.log.error("找不到面板成员类型".concat(i,"对应的适配器"));return s},getPortletProvider:async function(e){let t;const{portletType:s}=e;t||(i=s,t=ibiz.register.get("".concat(Jt,"_").concat(i)));var i;t||ibiz.log.error("找不到门户部件成员类型".concat(s,"对应的适配器"));return t},getRootNode:te,getTreeNode:function(e,t){return e.detreeNodes.find((e=>e.id===t))},getUIActionById:ee,getUIActionProvider:qt,getViewEngines:ae,getViewLogics:ie,getViewProvider:async function(e){let t;const{viewType:s,viewStyle:i}=e;if(i&&"DEFAULT"!==i){t=Qt("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到视图类型:[".concat(s,"]的视图样式:[").concat(i,"]对应的适配器"),e)}t||(t=Qt(s));t||(t=Qt("DEFAULT"));return t},getWFContext:function(e){const t={};e.param09&&(t.srfprocessinstanceid=e.param09);return t},getWFSubmitViewId:function(e,t){var s;const{type:i,sequenceFlowView:a,sequenceFlowMobView:n}=t,r=(null==(s=e.viewLayoutPanel)?void 0:s.appViewRefs)||e.appViewRefs,o=i?"WFUTILACTION@".concat(i.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:a),c=r.find((e=>e.name===o));return null==c?void 0:c.refAppViewId},hasDeCodeName:function(e,t){const s=$(t);return y(e[s])},install:function(){const{ibiz:e}=window;e.util=new St,e.hub=new Wt,e.register=new U,e.config=new k,e.auth=new Lt,e.engine=new Nt,Le(),ws(),ibiz.scheduler=new Ts,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((e,t)=>new Cs(e,t))),ibiz.scheduler.triggerFactory.register("TIMER",((e,t)=>new Vs(e,t))),ibiz.scheduler.triggerFactory.register("CUSTOM",((e,t)=>new bs(e,t))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((e,t)=>new Rs(e,t))),ibiz.scheduler.executorFactory.register("SCRIPT",((e,t)=>new Ds(e,t))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((e,t)=>new As(e,t))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((e,t)=>new As(e,t))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((e,t)=>new Ls(e,t)))},installCommand:Le,isValueChange:function(e,t){if((v(e)||""===e)&&(v(t)||""===t))return!1;return e!==t},matchMainState:Y,openRedirectView:ne,parseUserParams:function(e){const t={},s={},i={};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const n=e[a];if(-1!==a.indexOf(".")){const e=a.split(".");switch(e[0]){case"SRFNAVPARAM":Object.assign(t,{[e[1]]:n});break;case"SRFNAVCTX":Object.assign(s,{[e[1]]:n});break;default:Object.assign(i,{key:n})}}}return{navigateContexts:t,navigateParams:s,other:i}},presetUIActionProvider:ws,registerControlProvider:function(e,t){ibiz.register.register("".concat(Bt,"_").concat(e),t)},registerEditorProvider:function(e,t){ibiz.register.register("".concat(Ut,"_").concat(e),t)},registerFormDetailProvider:function(e,t){ibiz.register.register("".concat(Gt,"_").concat(e),t)},registerGridColumnProvider:function(e,t){ibiz.register.register("".concat(jt,"_").concat(e),t)},registerPanelItemProvider:function(e,t){ibiz.register.register("".concat(Xt,"_").concat(e.toUpperCase()),t)},registerPortletProvider:function(e,t){ibiz.register.register("".concat(Jt,"_").concat(e),t)},registerUIActionProvider:Yt,registerViewProvider:function(e,t){ibiz.register.register("".concat($t,"_").concat(e),t)},strContain:de,testCond:oe,toLocalOpenWFRedirectView:re,verifyDeRules:ge,verifyFormGroupLogic:function e(t,a){if(function(e){return"GROUP"===e.logicType}(a)){const i=a.defdlogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!e(t,s)))}else if("OR"===a.groupOP){n=void 0!==a.defdlogics.find((s=>e(t,s)))}return a.notMode?!n:n}if(function(e){return"SINGLE"===e.logicType}(a))return oe(t[a.defdname.toLowerCase()],a.condOP,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))},verifyPanelGroupLogic:function e(t,a){if(function(e){return"GROUP"===e.logicType}(a)){const i=a.panelItemLogics;if(!i||0===i.length)throw new s(a,"发现空逻辑组,逻辑无法正常执行!");let n=!0;if("AND"===a.groupOP){n=void 0===i.find((s=>!e(t,s)))}else if("OR"===a.groupOP){n=void 0!==a.panelItemLogics.find((s=>e(t,s)))}return a.notMode?!n:n}if(function(e){return"SINGLE"===e.logicType}(a))return oe(t[a.dstModelField.toLowerCase()],a.condOp,a.value);throw new i(a,"未支持的逻辑类型".concat(a.logicType))}});var R,M,O=Object.create,W=Object.defineProperty,N=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,S=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,F=(R={"../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js"(e,t){function s(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var s,i="",a=0,n=-1,r=0,o=0;o<=e.length;++o){if(o<e.length)s=e.charCodeAt(o);else{if(47===s)break;s=47}if(47===s){if(n===o-1||1===r);else if(n!==o-1&&2===r){if(i.length<2||2!==a||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",a=0):a=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),n=o,r=0;continue}}else if(2===i.length||1===i.length){i="",a=0,n=o,r=0;continue}t&&(i.length>0?i+="/..":i="..",a=2)}else i.length>0?i+="/"+e.slice(n+1,o):i=e.slice(n+1,o),a=o-n-1;n=o,r=0}else 46===s&&-1!==r?++r:r=-1}return i}var a={resolve:function(){for(var e,t="",a=!1,n=arguments.length-1;n>=-1&&!a;n--){var r;n>=0?r=arguments[n]:(void 0===e&&(e=process.cwd()),r=e),s(r),0!==r.length&&(t=r+"/"+t,a=47===r.charCodeAt(0))}return t=i(t,!a),a?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(s(e),0===e.length)return".";var t=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&a&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return s(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];s(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":a.normalize(e)},relative:function(e,t){if(s(e),s(t),e===t)return"";if((e=a.resolve(e))===(t=a.resolve(t)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var n=e.length,r=n-i,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var c=t.length-o,l=r<c?r:c,h=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===t.charCodeAt(o+d))return t.slice(o+d+1);if(0===d)return t.slice(o+d)}else r>l&&(47===e.charCodeAt(i+d)?h=d:0===d&&(h=0));break}var u=e.charCodeAt(i+d);if(u!==t.charCodeAt(o+d))break;47===u&&(h=d)}var p="";for(d=i+h+1;d<=n;++d)d!==n&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+t.slice(o+h):(o+=h,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(s(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,a=-1,n=!0,r=e.length-1;r>=1;--r)if(47===(t=e.charCodeAt(r))){if(!n){a=r;break}}else n=!1;return-1===a?i?"/":".":i&&1===a?"//":e.slice(0,a)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');s(e);var i,a=0,n=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!r){a=i+1;break}}else-1===c&&(r=!1,c=i+1),o>=0&&(l===t.charCodeAt(o)?-1==--o&&(n=i):(o=-1,n=c))}return a===n?n=c:-1===n&&(n=e.length),e.slice(a,n)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!r){a=i+1;break}}else-1===n&&(r=!1,n=i+1);return-1===n?"":e.slice(a,n)},extname:function(e){s(e);for(var t=-1,i=0,a=-1,n=!0,r=0,o=e.length-1;o>=0;--o){var c=e.charCodeAt(o);if(47!==c)-1===a&&(n=!1,a=o+1),46===c?-1===t?t=o:1!==r&&(r=1):-1!==t&&(r=-1);else if(!n){i=o+1;break}}return-1===t||-1===a||0===r||1===r&&t===a-1&&t===i+1?"":e.slice(t,a)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var s=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return s?s===t.root?s+i:s+e+i:i}("/",e)},parse:function(e){s(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,a=e.charCodeAt(0),n=47===a;n?(t.root="/",i=1):i=0;for(var r=-1,o=0,c=-1,l=!0,h=e.length-1,d=0;h>=i;--h)if(47!==(a=e.charCodeAt(h)))-1===c&&(l=!1,c=h+1),46===a?-1===r?r=h:1!==d&&(d=1):-1!==r&&(d=-1);else if(!l){o=h+1;break}return-1===r||-1===c||0===d||1===d&&r===c-1&&r===o+1?-1!==c&&(t.base=t.name=0===o&&n?e.slice(1,c):e.slice(o,c)):(0===o&&n?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(o,r),t.base=e.slice(o,c)),t.ext=e.slice(r,c)),o>0?t.dir=e.slice(0,o-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,t.exports=a}},function(){return M||(0,R[x(R)[0]])((M={exports:{}}).exports,M),M.exports}),k=class{constructor(){this.view={enableDataInfoBar:!0},this.grid={editShowMode:"cell",editSaveMode:"cell-blur"},this.appMenu={enableEcho:!1},this.codeList={timeout:36e5}}},U=e("RegisterCenter",class{constructor(){this.providers=new Map}register(e,t){this.providers.set(e,t)}unRegister(e){this.providers.delete(e)}get(e,...t){const s=this.providers.get(e);if(s)return s(...t)}});function z(e,...t){return!e||d(e)?{}:"[object Array]"===Object.prototype.toString.call(e)?G(e,...t):"[object Object]"===Object.prototype.toString.call(e)?j(e,...t):{}}function G(e,...t){const s={};for(const i of e)if(p(i.value)&&!i.rawValue){const e=t.find((e=>!E(e)&&(e[i.value]||Object.prototype.hasOwnProperty.call(e,i.value))));e&&(s[i.key.toLowerCase()]=e[i.value])}else s[i.key.toLowerCase()]=i.value||null;return s}function j(e,...t){const s={},i=/^%(.+)%$/;for(const a in e)if(p(e[a])&&i.test(e[a])){const i=e[a].substring(1,e[a].length-1),n=t.find((e=>Object.prototype.hasOwnProperty.call(e,i)));n&&(s[a.toLowerCase()]=n[i])}else s[a.toLowerCase()]=e[a]||null;return s}function X(e){const t=[],s=/^%(.+)%$/;for(const i in e){let a=!0,n=e[i];p(e[i])&&s.test(e[i])&&(a=!1,n=e[i].substring(1,e[i].length-1)),t.push({key:i.toLowerCase(),rawValue:a,value:n})}return t}function K(e,t){const s={};if(!e)return s;const i=Array.isArray(e)?e:X(e),a=t[0];return i.forEach((e=>{const{rawValue:i,value:n}=e;!i&&n&&Object.prototype.hasOwnProperty.call(a,n)&&(s[n]=t.map((e=>e[n])).join(";"))})),s}function H(e,t){if(e){const s=e.find((e=>e.id===t));if(s)return s}return null}function Y(e,t){const{mainStateAppDEFieldIds:s,demainStates:i}=e;if(s&&i){const e=[];return s.forEach((s=>{e.push(t[s])})),i.find((t=>{const{stateValue:s,state2Value:i,state3Value:a}=t;let n=!0;const r=[s,i,a];for(let t=0;t<e.length;t++)if("".concat(e[t])!=="".concat(r[t])){n=!1;break}return n}))}}function q(e,t){const s=ibiz.hub.getApp().model,{demainStateOPPrivs:i,opprivAllowMode:a}=e,n=(null==i?void 0:i.map((e=>e.name)))||[];let r=[];if(a)r=n;else{r=[...s.deopprivs,...t.deopprivs].filter((e=>!n.includes(e.name))).map((e=>e.name))}return r}function $(e){return e.split(".").pop()}function Q(e,t){var s;return null==(s=t.appDELogics)?void 0:s.find((t=>t.id===e))}function J(e,t){var s,i;const a=[];return null==(s=e.appDEFields)||s.forEach((e=>{"compute"===t&&e.computeAppDEFLogicId?a.push(e.computeAppDEFLogicId):"change"===t&&e.onChangeAppDEFLogicId?a.push(e.onChangeAppDEFLogicId):"default"===t&&e.defaultValueAppDEFLogicId&&a.push(e.defaultValueAppDEFLogicId)})),(null==(i=e.appDELogics)?void 0:i.filter((e=>a.includes(e.id))))||[]}function Z(e,t){var s;return null==(s=e.appDEFields)?void 0:s.find((e=>e.id===t))}async function ee(e){const[,,t]=e.split("@");return ibiz.hub.getApp(t).getUIAction(e)}function te(e){return e.detreeNodes.find((e=>e.rootNode))}function se(e){const{viewLayoutPanel:t}=e,s=e.controls||[];return t&&s.push(...t.controls||[]),s}function ie(e){const{viewLayoutPanel:t}=e,s=e.appViewLogics||[];return t&&s.push(...t.appViewLogics||[]),s}function ae(e){const{viewLayoutPanel:t}=e,s=e.appViewEngines||[];return t&&s.push(...t.appViewEngines||[]),s}async function ne(e,t,i={},a=[]){return async function(e,t,i={},a=[]){const n=e.appViewNavContexts||[],r=z(n,t,i);t=Object.assign(t.clone(),r);const o=e.appViewNavParams||[],c=z(o,t,i);Object.assign(i,c);const l=e.appDataEntityId,h=$(l);let d=a[0]||{};t[h]=d[h]||t[h]||i[h];const u=e.getDataAppDEActionId,g=ibiz.hub.getApp(e.appId),m=await g.deService.getService(l);ibiz.loading.showRedirect();try{const e=await m.exec(u||"get",t,i);if(e.ok){d=e.data;let s=d.linkurl;if(s)return t.srfprocessinstanceid&&(s+=";srfprocessinstanceid=".concat(t.srfprocessinstanceid)),ibiz.env.dev&&-1!==s.indexOf("appredirectview?")&&(s=s.slice(s.indexOf("appredirectview?"))),s.startsWith("http://")||s.startsWith("https://")?new Promise((e=>{const t=window.open(s,"_blank");t&&(t.callback=()=>{e({ok:!0,data:[]})})})):s.startsWith("appredirectview?")?(await re(t,s),{ok:!0,data:[]}):{ok:!1,data:[]}}}finally{ibiz.loading.hideRedirect()}const f=await ibiz.hub.getAppDataEntity(l,e.appId),w=await async function(e,t,s,i){let a="";const n=t.typeAppDEFieldId;if(n){const{codeName:t}=Z(e,n),s=i[t.toLowerCase()];if(p(s))return s}const r="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),o=s.srfwf;if(p(o))return p(s.wf)?"".concat(r,":").concat(o.toUpperCase(),":").concat(s.wf.toUpperCase()):"".concat(r,":").concat(o.toUpperCase());let c="";if(e.indexTypeAppDEFieldId){const{codeName:t}=Z(e,e.indexTypeAppDEFieldId);c=i[t.toLowerCase()]}if(E(c)&&e.formTypeAppDEFieldId){const{codeName:t}=Z(e,e.formTypeAppDEFieldId);c=i[t.toLowerCase()]}a=p(c)?"".concat(r,":").concat(c):"".concat(r);return a}(f,e,i,d),I=w.split(":"),D=2===I.length?w:I.slice(0,2).join(":"),A="".concat(f.name.toUpperCase(),":").concat(w),P=e.redirectAppViewRefs,y=null==P?void 0:P.find((e=>e.name===A||e.name===w||e.name===D));if(!y)throw ibiz.log.error("重定向视图引用有:",null==P?void 0:P.map((({refAppViewId:e,name:t,realTitle:s})=>({viewId:e,tag:t,title:s})))),new s(e,"未找到重定向标识[".concat(w,"]或[").concat(A,"]或[").concat(D,"]对应视图"));{const e=y.refAppViewId;if(!e)throw new s(y,"未配置实际引用视图");{const s=await ibiz.commands.execute(be.TAG,e,t,i,{data:[d]});if(s)return s}}return{ok:!0,data:[]}}(e,t,i,a)}async function re(e,s){const i=s.lastIndexOf("?"),a=decodeURIComponent(s.substring(i+1,s.length)),n=P.parse(a,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new t("重定向参数缺少实体名称");const o=ibiz.hub.getApp(e.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!o)throw new t("未找到指定实体的codeName: ".concat(r));n[o.toLowerCase()]=n[r.toLowerCase()];const c="".concat(o).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(c);if(delete n.srfdename,"undo"!==n.srfwf){const e=n.processDefinitionKey.split("-")[3],t=e.substring(0,e.lastIndexOf("v")),s=e.substring(e.lastIndexOf("v"));n.wf=t,n.wfVersion=s}n.srfprocessinstanceid&&(e.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),await ibiz.commands.execute(be.TAG,l.id,e,n)}function oe(e,s,i){if(Object.is(s,"IN"))return he(e,i);if(Object.is(s,"NOTIN"))return!he(e,i);switch(s){case"EQ":return"".concat(e)==="".concat(i);case"NOTEQ":return"".concat(e)!=="".concat(i);case"LT":return ce(e,i)<0;case"LTANDEQ":return ce(e,i)<=0;case"GT":return ce(e,i)>0;case"GTANDEQ":return ce(e,i)>=0;case"ISNULL":return E(e);case"ISNOTNULL":return p(e);case"TESTNULL":return v(e);case"IN":return he(e,i);case"NOTIN":return!he(e,i);case"LIKE":return de(e,i);case"LEFTLIKE":return de(e,i,"start");case"RIGHTLIKE":return de(e,i,"end");default:throw new t("值操作:".concat(s,",暂未支持"))}}function ce(e,s){const i=Number(e),a=Number(s);if(!Number.isNaN(i)&&!Number.isNaN(a))return le(i,a);const n=new Date(e).getTime(),r=new Date(s).getTime();if(!Number.isNaN(n)&&!Number.isNaN(r))return le(n,r);throw new t("".concat(e," 和 ").concat(s," 无法比较大小"))}function le(e,t){return Number.isNaN(e)&&(e=0),Number.isNaN(t)&&(t=0),e>t?1:e<t?-1:0}function he(e,s){if(!s||"string"!=typeof s)throw new t("范围比较的条件值不存或者不是字符串");if(e){return s.split(",").includes("".concat(e))}return!1}function de(e,t,s){if(!e||!t)return!1;const i="".concat(e).toUpperCase(),a="".concat(t).toUpperCase(),n=i.indexOf(a);switch(s){case"start":return 0===n;case"end":return n+a.length===i.length;default:return-1!==n}}var ue={singleRowReturn:!1},pe=e("ScriptFunction",class{constructor(e,t,s=ue){this.argKeys=[],this.options=s;const i=this.formatCode(t,s);this.calcArgKeys(e,s),this.scriptFn=new Function(...this.argKeys,i)}formatCode(e,t){let s=e;return t.singleRowReturn&&(s="return (".concat(s,")")),s}calcArgKeys(e,t){const s=t.presetParams?Object.keys(t.presetParams):[];s.push(...e),s.push("document","el","selector"),this.argKeys=Array.from(new Set(s))}convertArgs(e){const{presetParams:t}=this.options,s=t?T(t,e):e;s.document=document,s.selector=e=>document.getElementsByClassName(e);const i=[];return this.argKeys.forEach((e=>{i.push(s[e])})),i}exec(e){const t=this.convertArgs(e);return this.scriptFn(...t)}}),Ee=e("ScriptFactory",class{static createScriptFn(e,t,s){return new pe(e,t,s)}static execScriptFn(e,t,s){return this.createScriptFn(Object.keys(e),t,s).exec(e)}});function ge(e,s,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(e){return"GROUP"===e.condType}(i)){const t=i.conds;t&&t.length>0&&(a.isPast=function(e,t,s="AND",i=!1){if(!((null==e?void 0:e.length)>0))return!1;let a="AND"===s;for(let i=0,n=e.length;i<n;i++){const n=t(e[i],i);if("AND"===s){if(!n){a=!1;break}}else if("OR"===s&&n){a=!0;break}}return i?!a:a}(t,(t=>{const{isPast:i,infoMessage:n}=ge(e,s,t);return a.infoMessage=n,i}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{e=null==i?void 0:i.defname.toLowerCase();try{if(function(e){return"SIMPLE"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){Object.is(n,"CURTIME")&&(i="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){i=r[i=i?i.toLowerCase():""]?r[i]:i}(v(a)||_(a))&&(a="内容必须符合值规则");const c=oe(e,s,i);if(!c&&o)throw new t(a);return!c}(s[e],i.condOp,i.paramValue,i.ruleInfo,i.paramType,s,i.keyCond);else if(function(e){return"VALUERANGE2"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){E(r)&&(r="值必须符合值范围规则");if(E(e)){if(o)throw new t("值为空");return r="值为空",!0}if(me(e,/^-?\d*\.?\d+$/,"",o))return!0;const c=Number.parseFloat(e);if(null!==s)if(i){if(c<s){if(o)throw new t(r);return!0}}else if(c<=s){if(o)throw new t(r);return!0}if(null!=a)if(n){if(c>a){if(o)throw new t(r);return!0}}else if(c>=a){if(o)throw new t(r);return!0}return r="",!1}(s[e],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(e){return"REGEX"===e.condType}(i))a.isPast=!me(s[e],i.regExCode,i.ruleInfo,i.keyCond);else if(function(e){return"STRINGLENGTH"===e.condType}(i))a.isPast=!function(e,s,i,a,n,r,o){E(r)&&(r="内容长度必须符合范围规则");if(E(e)){if(o)throw new t("值为空");return r="值为空",!0}const c=e.length;if(null!==s)if(i){if(c<s){if(o)throw new t(r);return!0}}else if(c<=s){if(o)throw new t(r);return!0}if(null!==a)if(n){if(c>a){if(o)throw new t(r);return!0}}else if(c>=a){if(o)throw new t(r);return!0}return r="",!1}(s[e],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(e){return"SYSVALUERULE"===e.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:n,regExCode:r,scriptCode:o,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===n)a.isPast=!me(s[e],r,a.infoMessage,i.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:r}=function(e,s,i,a,n){E(a)&&(a="值必须符合脚本规则");const r=s;let o="",c=!0;const l=e=>{c=!1,(null==e?void 0:e.length)>0?e.forEach((e=>{(null==e?void 0:e.message)&&(o+=e.message)})):(null==e?void 0:e.message)&&(o=e.message)};try{const t=Ee.execScriptFn({value:e,data:r},i);"boolean"==typeof t&&(c=t)}catch(e){ibiz.log.error(e),l(e)}if(a="",!c&&n)throw new t(a);return{isPast:c,infoMessage:o||a}}(s[e],s,o,a.infoMessage,i.keyCond);a.isPast=n,a.infoMessage=r||a.infoMessage}}}catch(e){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function me(e,s,i,a){E(i)&&(i="值必须符合正则规则");if(E(e)){if(a)throw new t("值为空");return i="值为空",!0}if(!new RegExp(s).test(e)){if(a)throw new t(i);return!0}return i="",!1}var fe=e("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(e,t){this.cache.set(e,t)}get(e){return this.cache.get(e)}fill(e){const{viewLayoutPanel:t}=e;if(!t||!0===t.useDefaultLayout){const t=this.calcLayoutTag(e);if(this.cache.has(t)){const s=b(this.cache.get(t));e.viewLayoutPanel=s,e.appCounterRefs&&(s.appCounterRefs=e.appCounterRefs,delete e.appCounterRefs),e.appViewEngines&&(s.appViewEngines=e.appViewEngines,delete e.appViewEngines),e.appViewLogics&&(s.appViewLogics=e.appViewLogics,delete e.appViewLogics),e.appViewRefs&&(s.appViewRefs=e.appViewRefs,delete e.appViewRefs),e.controls&&(s.controls=e.controls,delete e.controls)}}return e}calcLayoutTag(e){const{viewType:t,viewStyle:s}=e;return"APPINDEXVIEW"===t?this.calcIndexViewLayoutTag(e):"".concat(t,"_").concat(s)}calcIndexViewLayoutTag(e){const{viewType:t,viewStyle:s,blankMode:i,mainMenuAlign:a}=e;let n="";return i?n="BLANK_MODE":a&&(n=a.toUpperCase()),""!==n?"".concat(t,"_").concat(s,"_").concat(n):"".concat(t,"_").concat(s)}});var we=e("ControlType",(e=>(e.APP_MENU="APPMENU",e.GRID="GRID",e.FORM="FORM",e.SEARCHFORM="SEARCHFORM",e.TOOLBAR="TOOLBAR",e.DRBAR="DRBAR",e.VIEWPANEL="VIEWPANEL",e.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",e.DATAVIEW="DATAVIEW",e.TREEGRID="TREEGRID",e.WF_EXPBAR="WFEXPBAR",e.TREEVIEW="TREEVIEW",e.TREE_EXP_BAR="TREEEXPBAR",e.TAB_VIEWPANEL="TABVIEWPANEL",e.DRTAB="DRTAB",e.CHART="CHART",e.REPORT_PANEL="REPORTPANEL",e.LIST="LIST",e.MOB_MDCTRL="MOBMDCTRL",e.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",e.WIZARD_PANEL="WIZARDPANEL",e.UPDATE_PANEL="UPDATEPANEL",e.SEARCHBAR="SEARCHBAR",e.DASHBOARD="DASHBOARD",e.CALENDAR="CALENDAR",e.PANEL="PANEL",e.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",e.MAP="MAP",e.GANTT="GANTT",e.TREE_GRIDEX="TREEGRIDEX",e.KANBAN="KANBAN",e.CALENDAR_EXPBAR="CALENDAREXPBAR",e.CHART_EXPBAR="CHARTEXPBAR",e.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",e.GANTT_EXPBAR="GANTTEXPBAR",e.GRID_EXPBAR="GRIDEXPBAR",e.LIST_EXPBAR="LISTEXPBAR",e.MAP_EXPBAR="MAPEXPBAR",e.STATE_WIZARD_PANEL="STATEWIZARDPANEL",e.TAB_EXP_PANEL="TABEXPPANEL",e.CUSTOM="CUSTOM",e.CAPTIONBAR="CAPTIONBAR",e))(we||{})),Ie=e("ViewType",(e=>(e.APP_INDEX_VIEW="APPINDEXVIEW",e.DE_GRID_VIEW="DEGRIDVIEW",e.DE_EDIT_VIEW="DEEDITVIEW",e.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",e.APP_ERROR_VIEW="APPERRORVIEW",e.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",e.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",e.APP_LOGIN_VIEW="APPLOGINVIEW",e.APP_LOGOUT_VIEW="APPLOGOUTVIEW",e.APP_PANEL_VIEW="APPPANELVIEW",e.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",e.APP_PORTAL_VIEW="APPPORTALVIEW",e.APP_REDIRECT_VIEW="APPREDIRECTVIEW",e.APP_START_VIEW="APPSTARTVIEW",e.APP_WELCOME_VIEW="APPWELCOMEVIEW",e.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",e.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",e.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",e.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",e.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",e.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",e.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",e.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",e.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",e.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",e.DE_CALENDAR_VIEW="DECALENDARVIEW",e.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",e.DE_CHART_VIEW="DECHARTVIEW",e.DE_CHART_VIEW9="DECHARTVIEW9",e.DE_CUSTOM_VIEW="DECUSTOMVIEW",e.DE_DATA_VIEW="DEDATAVIEW",e.DE_DATA_VIEW9="DEDATAVIEW9",e.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",e.DE_EDIT_VIEW2="DEEDITVIEW2",e.DE_EDIT_VIEW3="DEEDITVIEW3",e.DE_EDIT_VIEW4="DEEDITVIEW4",e.DE_EDIT_VIEW9="DEEDITVIEW9",e.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",e.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",e.DE_GANTT_VIEW="DEGANTTVIEW",e.DE_GANTT_VIEW9="DEGANTTVIEW9",e.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",e.DE_GRID_VIEW2="DEGRIDVIEW2",e.DE_GRID_VIEW4="DEGRIDVIEW4",e.DE_GRID_VIEW8="DEGRIDVIEW8",e.DE_GRID_VIEW9="DEGRIDVIEW9",e.DE_HTML_VIEW="DEHTMLVIEW",e.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",e.DE_INDEX_VIEW="DEINDEXVIEW",e.DE_KANBAN_VIEW="DEKANBANVIEW",e.DE_KANBAN_VIEW9="DEKANBANVIEW9",e.DE_LIST_EXP_VIEW="DELISTEXPVIEW",e.DE_LIST_VIEW="DELISTVIEW",e.DE_LIST_VIEW9="DELISTVIEW9",e.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",e.DE_MAP_VIEW="DEMAPVIEW",e.DE_MAP_VIEW9="DEMAPVIEW9",e.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",e.DE_MEDITVIEW9="DEMEDITVIEW9",e.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",e.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",e.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",e.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",e.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",e.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",e.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",e.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",e.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",e.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",e.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",e.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",e.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",e.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",e.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",e.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",e.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",e.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",e.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",e.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",e.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",e.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",e.DE_MOB_MDVIEW="DEMOBMDVIEW",e.DE_MOB_MDVIEW9="DEMOBMDVIEW9",e.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",e.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",e.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",e.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",e.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",e.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",e.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",e.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",e.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",e.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",e.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",e.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",e.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",e.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",e.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",e.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",e.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",e.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",e.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",e.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",e.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",e.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",e.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",e.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",e.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",e.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",e.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",e.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",e.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",e.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",e.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",e.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",e.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",e.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",e.DE_MPICKUP_VIEW="DEMPICKUPVIEW",e.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",e.DE_OPT_VIEW="DEOPTVIEW",e.DE_PANEL_VIEW="DEPANELVIEW",e.DE_PANEL_VIEW9="DEPANELVIEW9",e.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",e.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",e.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",e.DE_PICKUP_VIEW="DEPICKUPVIEW",e.DE_PICKUP_VIEW2="DEPICKUPVIEW2",e.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",e.DE_PORTAL_VIEW="DEPORTALVIEW",e.DE_PORTAL_VIEW9="DEPORTALVIEW9",e.DE_REDIRECT_VIEW="DEREDIRECTVIEW",e.DE_REPORT_VIEW="DEREPORTVIEW",e.DE_TAB_EXP_VIEW="DETABEXPVIEW",e.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",e.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",e.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",e.DE_TREE_EXP_VIEW="DETREEEXPVIEW",e.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",e.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",e.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",e.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",e.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",e.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",e.DE_TREE_VIEW="DETREEVIEW",e.DE_TREE_VIEW9="DETREEVIEW9",e.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",e.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",e.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",e.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",e.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",e.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",e.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",e.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",e.DE_WF_EDIT_VIEW="DEWFEDITVIEW",e.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",e.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",e.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",e.DE_WF_EXP_VIEW="DEWFEXPVIEW",e.DE_WF_GRID_VIEW="DEWFGRIDVIEW",e.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",e.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",e.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",e.DE_WF_START_VIEW="DEWFSTARTVIEW",e.DE_WIZARD_VIEW="DEWIZARDVIEW",e))(Ie||{})),De=e("ViewMode",(e=>(e.ROUTE="ROUTE",e.MODAL="MODAL",e.DRAWER="DRAWER",e.EMBED="EMBED",e.POPOVER="POPOVER",e))(De||{})),Ae=e("SysUIActionTag",(e=>(e.NEW="New",e.EDIT="Edit",e.REFRESH="Refresh",e.EXIT="Exit",e.SAVE_AND_EXIT="SaveAndExit",e.SAVE_AND_NEW="SaveAndNew",e.SAVE="Save",e.SAVE_ROW="SaveRow",e.REMOVE="Remove",e.REMOVE_AND_EXIT="RemoveAndExit",e.NEW_ROW="NewRow",e.TOGGLE_FILTER="ToggleFilter",e.IMPORT="Import",e.EXPORT_EXCEL="ExportExcel",e.SAVE_AND_START="SaveAndStart",e.VIEW_WF_STEP="ViewWFStep",e.NO="No",e.YES="Yes",e.CANCEL="Cancel",e.OK="Ok",e.SEARCH="Search",e.FINISH="Finish",e.NEXT_STEP="NextStep",e.PREV_STEP="PrevStep",e.ADD_SELECTION="AddSelection",e.REMOVE_SELECTION="RemoveSelection",e.REMOVE_ALL="RemoveAll",e.ADD_ALL="AddAll",e.LOGOUT="Logout",e.LOGIN="Login",e.CANCEL_CHANGES="CancelChanges",e.COPY="Copy",e.VIEW="View",e.TOGGLE_ROW_EDIT="ToggleRowEdit",e.LOAD_MORE="LoadMore",e))(Ae||{})),Pe=e("StudioViewEvents",class{});Pe.onViewMounted="onMounted",Pe.onViewDestroyed="onDestroyed";var ye=e("StudioPanelEvents",class{});ye.onClick="onClick",ye.onChange="onChange",ye.onEnter="onEnter",ye.onLeave="onLeave";var ve=e("StudioControlEvents",class{});ve.onBeforeLoad="onBeforeLoad",ve.onLoadSuccess="onLoadSuccess",ve.onLoadError="onLoadError",ve.onBeforeLoadDraft="onBeforeLoadDraft",ve.onLoadDraftSuccess="onLoadDraftSuccess",ve.onLoadDraftError="onLoadDraftError",ve.onBeforeSave="onBeforeSave",ve.onSaveSuccess="onSaveSuccess",ve.onSaveError="onSaveError",ve.onBeforeRemove="onBeforeRemove",ve.onRemoveSuccess="onRemoveSuccess",ve.onRemoveError="onRemoveError",ve.CLICK="onClick";var Te=e("Modal",class{constructor(e){this.mode="EMBED",this.viewUsage=4,this.hooks={shouldDismiss:new g,beforeDismiss:new g},this._dismiss=e=>{ibiz.log.error("外部关闭能力未注册",e)},e.mode&&(this.mode=e.mode),e.routeDepth&&(this.routeDepth=e.routeDepth),e.viewUsage&&(this.viewUsage=e.viewUsage),e.dismiss&&(this._dismiss=e.dismiss)}injectDismiss(e){this._dismiss=e}async dismiss(e={ok:!1,data:[]}){const t={allowClose:!0};return await this.hooks.shouldDismiss.call(t),t.allowClose?(await this.hooks.beforeDismiss.call(e),this._dismiss(e),this.destroy(),!0):(ibiz.log.debug("shouldDismiss结果为false,关闭中断。"),!1)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});var _e=class e{constructor(){ibiz.commands.register(e.TAG,this.exec.bind(this))}async exec(e,s,a={},n={}){const r=await ibiz.hub.config.view.get(e);if(!r)throw new t("应用视图[".concat(e,"]不存在"));if(s.srfkey&&r.appDataEntityId){s[$(r.appDataEntityId)]=s.srfkey,s.srfkey=void 0}if(r.redirectView){return ne(await ibiz.hub.getAppView(e),s,a,n.data)}const{openMode:o="INDEXVIEWTAB"}=r;switch(n.openMode||o){case"INDEXVIEWTAB":return n.noWaitRoute?void this.openIndexViewTab(r,s,a):this.openIndexViewTab(r,s,a);case"POPUP":throw new i(r,"未支持的视图打开模式: POPUP");case"POPUPMODAL":return this.openModal(r,s,a);case"POPUPAPP":throw new i(r,"未支持的视图打开模式: POPUPAPP");case"POPOVER":return this.openPopover(r,n.event,s,a);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,s,a);case"USER":return this.openUserCustom(r,s,a);default:return this.openIndexViewTab(r,s,a)}}openIndexViewTab(e,t,s={}){return ibiz.openView.root(e,t,s)}async openModal(e,t,s={}){return ibiz.openView.modal(e,t,s)}async openPopover(e,t,s,i={}){return ibiz.openView.popover(e,t,s,i)}async openDrawer(e,t,s={}){return ibiz.openView.drawer(e,t,s)}async openUserCustom(e,t,s={}){return ibiz.openView.custom(e,t,s)}};_e.TAG="ibiz.app-view.open";var be=e("OpenAppViewCommand",_e),Ce=class e{constructor(){ibiz.commands.register(e.TAG,this.exec.bind(this))}async exec(e,s,a={},n={}){const r=ibiz.hub.getApp(s.srfappid).getAppFunc(e);if(!r)throw new t("找不到叫".concat(e,"的应用功能"));const{navigateContexts:o,navigateParams:c,appFuncType:l}=r,h=s.clone();Object.assign(h,z(o,s,a));const d=z(c,s,a);switch(l){case"APPVIEW":return this.openAppView(r,h,d,n);case"OPENHTMLPAGE":return this.openHtmlPage(r);case"PDTAPPFUNC":return this.openPdAppFunc(r,h,d);case"JAVASCRIPT":return this.executeJavaScript(r,h,d);case"CUSTOM":return this.custom(r,h,d);default:throw new i(r,"未支持的应用功能类型: ".concat(l))}}async openAppView(e,s,i,a){if(!e.appViewId)throw new t("应用视图[".concat(e.appViewId,"]不存在"));return ibiz.commands.execute(be.TAG,e.appViewId,s,i,a)}openHtmlPage(e){const t=e.htmlPageUrl;window.open(t,"_blank")}openPdAppFunc(e,s,i){throw ibiz.log.warn("openPdAppFunc",e,s,i),new t("未实现")}executeJavaScript(e,s,i){throw ibiz.log.warn("executeJavaScript",e,s,i),new t("未实现")}custom(e,s,i){throw ibiz.log.warn("custom",e,s,i),new t("未实现")}};Ce.TAG="ibiz.app-func.exec";var Ve=e("AppFuncCommand",Ce);function Le(){new Ve,new be}var Re=e("AppCounter",class{constructor(e){this.model=e,this.destroyed=!1,this.context=a.create(),this.params={},this.evt=new m,this.data={}}get isDestroyed(){return this.destroyed}async init(e,t){this.setParams(e,t),this.appDataEntityId=this.model.appDataEntityId;const i=this.model.getAppDEActionId;if(!i)throw new s(this.model,"未找到获取计数器行为!");this.action=i,this.interval(),await this.load()}setParams(e,t){e&&(this.context=b(e)),t&&(this.params=b(t))}interval(){this.destroyInterval(),this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){const e=ibiz.hub.getApp(this.context.srfappid),t=await e.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return t.ok&&(this.data=t.data,this.evt.emit("change",this.data)),this.data}refresh(e,t){return this.setParams(e,t),this.load()}onChange(e,t=!0){this.evt.on("change",e),t&&p(this.data)&&e(this.data)}offChange(e){this.evt.off("change",e)}getCounter(e){return this.data[e.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset()}}),Me=class{constructor(){this.psModelGroupCondBase=null}parse(e){if(e instanceof Array){const t=this.createPSModelGroupCond();t.parse(e),this.psModelGroupCondBase=t}}testSingleCond(e,t,s){try{if("ISNULL"===e)return null==t;if("ISNOTNULL"===e)return null!=t;if("EQ"===e||"ABSEQ"===e||"GT"===e||"GTANDEQ"===e||"LT"===e||"LTANDEQ"===e||"NOTEQ"===e){let i=-1;if(t==s?i=0:t>s&&(i=1),"EQ"===e||"ABSEQ"===e)return 0===i;if("GT"===e)return i>0;if("GTANDEQ"===e)return i>=0;if("LT"===e)return i<0;if("LTANDEQ"===e)return i<=0;if("NOTEQ"===e)return 0!==i}if("LIKE"===e)return null!=t&&null!=s&&-1!==t.toString().toUpperCase().indexOf(s.toString().toUpperCase());if("LEFTLIKE"===e)return null!=t&&null!=s&&0===t.toString().toUpperCase().indexOf(s.toString().toUpperCase())}catch(e){ibiz.log.error(e)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Oe=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(e){this.strCondOp=e}},We=class extends Oe{parse(e){const t=e.length;let s=!0,i=!1,a=!1;for(let n=0;n<t;n++)if(s){const t=e[n];this.setCondOp(t),s=!1,i=!0}else if(i){const t=e[n];this.setParam(t),i=!1,a=!0}else if(a){const t=e[n];if(t instanceof Object&&!(t instanceof Array)){const e=t;null!=e.type&&this.setValueType(e.type.toString()),null!=e.value&&this.setValue(e.value.toString())}else this.setValue(t);break}}getValueType(){return this.strValueType}setValueType(e){this.strValueType=e}getValue(){return this.strValue}setValue(e){this.strValue=e}getParamType(){return this.strParamType}setParamType(e){this.strParamType=e}getParam(){return this.strParam}setParam(e){this.strParam=e}},Ne=class e extends Oe{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(s){const i=s.length;let a=!0,n=!0,r=!1;for(let o=0;o<i;o++){if(a&&n){if("!"===s[o]){this.setNotMode(!0),a=!1;continue}}if(n){const e=s[o];this.setCondOp(e),n=!1,a=!1,r=!0}else if(r){const i=s[o];if(!(i instanceof Array))throw new t("值必须为数组");i.forEach((t=>{if(t.length>0){const s=t[0].toString();if("!"===s||"OR"===s||"AND"===s){const s=new e;s.parse(t),this.childCondList.push(s)}else{const e=new We;e.parse(t),this.childCondList.push(e)}}}))}}}setNotMode(e){this.bNotMode=e}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},xe=class extends Ne{},Se=class extends We{},Be=class e extends Me{test(e,t){return this.testCond(this.getPSModelGroupCondBase(),e,t)}testCond(t,s,i){if(t instanceof Ne){const e=t.getChildPSModelCondBases();if(null==e||_(e))return!t.isNotMode();const a="AND"===t.getCondOp();let n=a;for(let t=0;t<e.length;t++){const r=e[t];if(this.testCond(r,s,i)){if(!a){n=!0;break}}else if(a){n=!1;break}}return t.isNotMode()?!n:n}if(t instanceof We){_(t.getParam())&&ibiz.log.warn("没有指定属性名称",t);const a=s[t.getParam().toLowerCase()];let n=null;const r=t.getValueType(),o=t.getValue();return null==r||_(r)?n=t.getValue():(_(o)&&ibiz.log.warn("没有指定上下文参数名称"),e.PARAMTYPE_WEBCONTEXT===r?n=i.data[o.toLowerCase()]:e.PARAMTYPE_DATACONTEXT===r&&(n=i.getValue(o.toLowerCase()))),this.testSingleCond(t.getCondOp(),a,n)}return ibiz.log.warn("无法识别的条件对象",t),!1}createPSModelSingleCond(){return new Se}createPSModelGroupCond(){return new xe}};Be.PARAMTYPE_DATACONTEXT="DATACONTEXT",Be.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Fe=e("PSDEDQCondEngine",Be);e("DEDQCondUtil",class{static getCond(e){if(this.map.has(e))return this.map.get(e);const t=e.dedqgroupConditions;if(t){const s=new Fe;return s.parse(["OR",this.calcCond(t)]),this.map.set(e,s),s}return null}static calcCond(e){const t=[];return e.forEach((e=>{const s=[];if("GROUP"===e.condType){const t=e;t.notMode&&s.push("!"),s.push(e.condOp);const i=t.dedqconditions;if(i){const e=this.calcCond(i);s.push(e)}}else{if("SINGLE"!==e.condType)throw new i(e,"暂未支持的查询条件类型: ".concat(e.condType));{const t=e;s.push(t.fieldName),t.condValue||s.push("")}}t.push(s)})),t}}).map=new WeakMap;var ke=e("DynamicCodeListCache",class{constructor(e){this.cache=new Map,this.isPredefined=!1,this.codeList=e}async init(){return this.initPromise=(async()=>{const{predefinedType:e}=this.codeList;if(e){if(this.isPredefined=!0,!["OPERATOR","RUNTIME"].includes(e))throw new i(this.codeList,"预定义类型".concat(e,"暂不支持"))}else this.initPromise=void 0})(),this.initPromise}convertData(e){const t={},{valueAppDEFieldId:s,textAppDEFieldId:i}=this.codeList,a=s?e[s]:e.srfkey;return t.id=a,t.value=a,t.text=i?e[i]:e.srfmajortext,Object.freeze(t)}async load(e={},t={}){const i=ibiz.hub.getApp(e.srfappid);if(this.isPredefined){t.size||(t.size=1e4);const e=await i.net.get("/dictionaries/codelist/".concat(this.codeList.codeName),t);return Object.freeze(e.data.items)}const{appDataEntityId:a,appDEDataSetId:n}=this.codeList;if(!a)throw new s(this.codeList,"未配置应用实体");if(!n)throw new s(this.codeList,"未配置数据集");const r=await i.deService.exec(a,n,e,{},t);let o=[];return r.data.length&&(o=r.data.map((e=>this.convertData(e)))),o}async get(e={},t={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(e,t);const s=JSON.stringify(e)+JSON.stringify(t);if(this.cache.has(s)){const e=this.cache.get(s);if(e.expirationTime>(new Date).getTime())return e.promise?e.promise:e.items;this.cache.delete(s)}const i=this.load(e,t),{cacheTimeout:a}=this.codeList,n=-1===a||v(a)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,r={expirationTime:(new Date).getTime()+n,promise:i};this.cache.set(s,r);const o=await i;return r.items=o,delete r.promise,o}});function Ue(e,s){if(null!=s){const{srfkey:e}=s;if(!v(e)&&!_(e))return!0}throw new t("执行「".concat(e,"」不存在「srfkey」无法处理"))}function ze(e,s){const{srfsessionid:i}=s;if(!v(i)&&!_(i))return!0;throw new t("执行「".concat(e,"」不存在「srfsessionid」无法处理"))}var Ge=e("DECache",class{constructor(){this.cacheMap=new Map}forceAdd(e,t){const s=this.getCacheByTag(e).get(t.srfkey);s&&(s.assign(t),ibiz.log.warn("forceAdd",t.srfkey,t))}forceUpdate(e,t){this.getCacheByTag(e).set(t.srfkey,b(t)),ibiz.log.warn("forceUpdate",t.srfkey,t)}forceDelete(e,t){this.getCacheByTag(e).delete(t),ibiz.log.warn("forceDelete",t)}add(e,t){try{ze("add",e),(v(t.srfkey)||_(t.srfkey))&&(t.srfkey=f()),t.srftempdate=(new Date).getTime();return this.getCacheByTag(e).set(t.srfkey,b(t)),ibiz.log.warn("add",t.srfkey,t),t}catch(e){return ibiz.log.error(e),null}}get(e,t){try{ze("get",e);const s=this.getCacheByTag(e).get(t);return ibiz.log.warn("get",t,s),b(s)}catch(e){return ibiz.log.error(e),null}}update(e,t){try{ze("update",e),Ue("update",t),t.srftempdate=(new Date).getTime();const s=this.getCacheByTag(e),i=s.get(t.srfkey);if(i)return i.assign(t),s.set(t.srfkey,i),ibiz.log.warn("update",t.srfkey,t),b(i);throw new Error("数据不存在,无法更新!")}catch(e){return ibiz.log.error(e),null}}delete(e,t){try{ze("delete",e);const s=this.getCacheByTag(e),i=t;if(s.has(i)){const e=s.get(i);return e.srftempdate=(new Date).getTime(),s.delete(i),ibiz.log.warn("delete",i),e}return null}catch(e){return ibiz.log.error(e),null}}createBatch(e,t){try{ze("add",e);const s=this.getCacheByTag(e);for(let e=0;e<t.length;e++){const i=t[e];(v(i.srfkey)||_(i.srfkey))&&(i.srfkey=f()),i.srftempdate=(new Date).getTime();const a=b(i);s.set(i.srfkey,a),t[e]=a,ibiz.log.warn("add",i.srfkey,i)}return t}catch(e){ibiz.log.error(e)}return[]}updateBatch(e,t){try{ze("update",e);const s=this.getCacheByTag(e);for(let e=0;e<t.length;e++){const i=t[e];Ue("update",i),i.srftempdate=(new Date).getTime();const a=s.get(i.srfkey);if(!a)throw new Error("数据[".concat(i.srfdename,"-").concat(i.srfmajortext,"(").concat(i.srfkey,")]不存在,无法更新!"));a.assign(i),s.set(i.srfkey,a),ibiz.log.warn("update",i.srfkey,i),t[e]=b(a)}return t}catch(e){return ibiz.log.error(e),null}}deleteBatch(e,t){try{ze("delete",e)}catch(e){return ibiz.log.error(e),t}const s=this.getCacheByTag(e),i=[];for(let e=0;e<t.length;e++){const a=t[e];s.has(a)||i.push(a)}if(i.length>0)throw new Error("未找到以下数据「".concat(i.join("、"),"」,无法删除!"));for(let e=0;e<t.length;e++){const i=t[e];s.delete(i),ibiz.log.warn("delete",i)}return[]}checkData(e,t){return-1!==this.getList(e).findIndex((e=>e.srfkey===t))}getList(e){try{ze("getList",e);const t=this.getCacheByTag(e);if(!t)return[];const s=t.values();return Array.from(s)}catch(e){return ibiz.log.error(e),[]}}generatePred(e={}){const t={};e.srfkey&&(t.srfkey=C(e.srfkey)),delete e.srfkey;for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const i=e[s];t[s]=C(i)}return V(t)}clear(e){const t=e.srfsessionid;this.cacheMap.size>0&&this.cacheMap.delete(t)}getCacheByTag(e){const t=e.srfsessionid;return this.cacheMap.has(t)||this.cacheMap.set(t,new Map),this.cacheMap.get(t)}}),je=new RegExp("(?<=\\$\\{)(.*?)(?=\\})","g");function Xe(e,t){const s=(t.requestPaths||[]).map((e=>({path:e,keys:e.match(je)||[]}))).filter((t=>{const{keys:s}=t;return 0===s.length||s.every(((t,i)=>i===s.length-1||null!=e[t]))})).sort(((e,t)=>t.keys.length-e.keys.length));if(s.length>0)return s[0]}function Ke(e,t){const s=Xe(e,t);if(s){if(s.keys.length>0){let{path:t}=s;return s.keys.forEach(((i,a)=>{t=a===s.keys.length-1?t.replace(new RegExp("/[^/]+/\\$\\{".concat(i,"\\}")),""):t.replace("${".concat(i,"}"),e[i])})),t}return s.path}return""}var He=e("SearchFilter",class{constructor(e,t){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=e,t){if(v(t.page)||_(t.page)||(this.page=t.page),v(t.size)||_(t.size)||(this.size=t.size),v(t.query)||_(t.query)||(this.query=t.query),!v(t.sort)&&!_(t.sort)){const e=t.sort.split(",");e.length>=1&&([this.sortField]=e),e.length>=2&&(this.sortMode=e[1].toUpperCase())}v(t.srfparentkey)||_(t.srfparentkey)||(this.srfparentkey=t.srfparentkey),v(t.srfparentdename)||_(t.srfparentdename)||(this.srfparentdename=t.srfparentdename),this.data={...t},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort,delete this.data.srfparentkey,delete this.data.srfparentdename}}getValue(e){return this.data[e]?this.data[e]:this.context[e]}}),Ye=e("CodeListService",class{constructor(e){this.appModel=e,this.allCodeLists=new Map,this.cache=new Map}getStatic(e){const t=e.codeName;if(this.cache.has(t))return this.cache.get(t);const s=e.codeItems;let i=[];return(null==s?void 0:s.length)&&(i=this.formatStaticItems(s,e.codeItemValueNumber)),this.cache.set(t,Object.freeze(i)),i}setCodeList(e){const{id:t,codeName:s}=e;this.allCodeLists.set(t,e),this.allCodeLists.set(s,e)}getCodeList(e){return this.allCodeLists.get(e)}formatStaticItems(e,t){return e.map((e=>{var s;const i={text:e.text,value:t?Number(e.value):e.value,color:e.color,id:e.codeName};return(null==(s=e.codeItems)?void 0:s.length)&&(i.children=this.formatStaticItems(e.codeItems,t)),Object.freeze(i)}))}async getDynamicCodeList(e,t={},s={}){let i;const a=e.codeName;return this.cache.has(a)?i=this.cache.get(a):(i=new ke(e),this.cache.set(a,i),await i.init()),i.get(t,s)}async get(e,s,i){const a=this.allCodeLists.get(e);if(!a)throw new t("找不到".concat(e,"代码表"));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,s,i):[]}}),qe=e("CounterService",class{static async getCounter(e,t,s){const i=e.id;if(this.counterMap.has(i)){const e=this.counterMap.get(i);if(!1===e.isDestroyed)return e;this.counterMap.delete(i)}const a=new Re(e);return await a.init(t,s),this.counterMap.set(i,a),a}static async getCounterByRef(e,t,i){const{appCounter:a}=e;if(!a)throw new s(e,"未配置应用计数器!");return this.getCounter(a,t,i)}});qe.counterMap=new Map;var $e=e("WorkFlowService",class{constructor(e){this.model=e,this.commonBaseUrl="",this.app=ibiz.hub.getApp(e.appId);const t=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(t.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(e,t){return t.srfprocessinstanceid&&(e.srfprocessinstanceid=t.srfprocessinstanceid),e}async getWFStep(e){const{processDefinitionKey:t,taskDefinitionKey:s}=e;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(t,"/usertasks/").concat(s))}async getWFLink(e,t){const s=e[this.model.codeName.toLowerCase()],{taskDefinitionKey:i}=e;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(s,"/usertasks/").concat(i,"/ways"),{activedata:this.getActiveData(t,e)})}async getWFHistory(e){const t=e[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(t,"/process-instances/alls/history"))}async getWFProcessDiagram(e){const t=e[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(t,"/process-instances/alls/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(){return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions2"))}async wfStart(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/process-instances"),{...t,activedata:this.getActiveData(s,e)})}async wfSubmit(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId),{...t,activedata:this.getActiveData(s,e)})}async wfWithdraw(e,t,s){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/withdraw"),{...t,activedata:this.getActiveData(s,e)})}async wfReassign(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/transfer"),{...t,activedata:this.getActiveData(s,e)})}async wfAddStepBefore(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/beforesign"),{...t,activedata:this.getActiveData(s,e)})}async wfSendBack(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/sendback"),{...t,activedata:this.getActiveData(s,e)})}async wfSendCopy(e,t,s){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(e[this.model.codeName.toLowerCase()],"/tasks/").concat(t.taskId,"/sendcopy"),{...t,activedata:this.getActiveData(s,e)})}async exec(e,s,i={},a={}){switch(e){case"wfstart":return this.wfStart(s,i,a);case"wfsubmit":return this.wfSubmit(s,i,a);case"reassign":return this.wfReassign(s,i,a);case"addstepbefore":return this.wfAddStepBefore(s,i,a);case"sendback":return this.wfSendBack(s,i,a);case"sendcopy":return this.wfSendCopy(s,i,a);default:throw new t("「".concat(e,"」未实现"))}}}),Qe=e("Srfuf",(e=>(e[e.CREATE=0]="CREATE",e[e.UPDATE=1]="UPDATE",e))(Qe||{})),Je=e("AppDataEntity",class e{get srfuf(){return this.srfkey?1:0}constructor(t,s){let i;Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:t}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:b(s instanceof e?s._data:s)}),Object.defineProperty(this,"srfdeid",{get:()=>t.id}),Object.defineProperty(this,"srfdecodename",{get:()=>t.codeName});const a=H(t.appDEFields||[],t.keyAppDEFieldId);if(a){const e=a.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfile",{get:()=>e}),Object.defineProperty(this,"srfkey",{set(t){i=t,this._data[e]=t},get(){return this._data[e]||i}})}else ibiz.log.warn("实体[".concat(t.codeName,"]未配置主键字段"));const n=H(t.appDEFields||[],t.majorAppDEFieldId);if(n){const e=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfile",{get:()=>e}),Object.defineProperty(this,"srfmajortext",{set(t){this._data[e]=t},get(){return this._data[e]}})}else ibiz.log.warn("实体[".concat(t.codeName,"]未配置主文本字段"));this.defineProperties()}defineProperties(){var e;const{_data:t}=this,s={},i=Object.keys(t);i.forEach((e=>{s[e]={enumerable:!0,set(s){t[e]=s},get:()=>t[e]}})),null==(e=this._entity.appDEFields)||e.forEach((e=>{const a=e.codeName.toLowerCase();i.includes(a)||(s[a]={enumerable:!0,set(e){t[a]=e},get:()=>t[a]})})),Object.defineProperties(this,s)}clone(){return new e(this._entity,this._data)}assign(t){return t instanceof e?Object.assign(this._data,t._data):Object.assign(this._data,t),this}}),Ze=e("MethodDto",class e{constructor(e,t){this.entity=e,this.dto=t,this.dtoMap=new Map,t?(this.app=ibiz.hub.getApp(e.appId),this.fields=t.appDEMethodDTOFields||[]):this.fields=[]}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async get(e,t){const s={};for(let a=0;a<this.fields.length;a++){const n=this.fields[a],r=n.codeName.toLowerCase();switch(n.type){case"SIMPLE":{const e=t[r];E(e)?s[r]=null:s[r]=e;break}case"DTOS":{const t=await this.getFieldDto(n),i=(await this.app.deService.getService(n.refAppDataEntityId)).local.getList(e);if(i){const a=[];for(let s=0;s<i.length;s++)a.push(await t.get(e,i[s]));s[r]=a}break}default:throw new i(n,"未支持的应用实体方法输入属性类型: ".concat(n.type))}}return s}async sets(e,t){const s=await this.app.deService.getService(this.entity.id);return s.local.clear(e),Promise.all(t.map((async t=>{const i=this.fields.filter((e=>"DTOS"===e.type)).map((async s=>{const i=s.codeName.toLowerCase(),a=await this.getFieldDto(s),n=t[i];n&&await a.sets(e,n)}));for(let e=0;e<i.length;e++)await i[e];const a=new Je(this.entity,t);return this.isLocalMode&&await s.local.add(e,a),a})))}async getFieldDto(t){if(this.dtoMap.has(t.codeName))return this.dtoMap.get(t.codeName);const s=await ibiz.hub.getAppDataEntity(t.refAppDataEntityId,this.entity.appId),i=H(s.appDEMethodDTOs||[],t.refAppDEMethodDTOId),a=new e(s,i);return this.dtoMap.set(t.codeName,a),a}}),et=class{constructor(e,t){this.entity=e,this.method=t,this.app=ibiz.hub.getApp(e.appId),this.input=new class{constructor(e,t){if(this.entity=e,this.input=t,t){const s=H(e.appDEMethodDTOs||[],t.appDEMethodDTOId);s&&(this.dto=new Ze(e,s))}}async handle(e,t){return this.dto?this.dto.get(e,t):t}}(e,t.appDEMethodInput),this.result=new class{constructor(e,t){if(this.entity=e,this.output=t,t){const s=H(e.appDEMethodDTOs||[],t.appDEMethodDTOId);s&&(this.dto=new Ze(e,s))}}async handle(e,t){return this.dto?(await this.dto.sets(e,[t]))[0]:new Je(this.entity,t)}}(e,t.appDEMethodReturn)}get isLocalMode(){return 1===this.entity.storageMode||4===this.entity.storageMode}async request(e,t,i,a){const{actionType:n,requestMethod:r}=this.method;if("REMOTE"===n){const t=this.method.codeName.toLowerCase();let n=null;switch(r){case"POST":n=await this.app.net.post("".concat(e,"/").concat(t),i,a);break;case"GET":n=await this.app.net.get("".concat(e,"/").concat(t),i,a);break;case"PUT":n=await this.app.net.put("".concat(e,"/").concat(t),i,a);break;case"DELETE":n=await this.app.net.delete("".concat(e,"/").concat(t),i,a);break;default:throw new s(this.method,r?"未支持的请求方式: ".concat(r):"未配置请求方式")}return n}throw new s(this.method,"未支持的行为类型[".concat(n,"]"))}calcPath(e){const t="/".concat(this.entity.codeName2.toLowerCase());return Ke(e,this.entity)+t}async getService(){return this.service||(this.service=await this.app.deService.getService(this.entity.id)),this.service}createEntity(e){return new Je(this.entity,e)}},tt=class{},st=class extends tt{constructor(e){super(),this.model=e,this.srcParam=e.srcLogicParamId,this.dstParam=e.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(e,t,a){const n=e.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const e=null!=a[this.value]?a[this.value]:t[this.value];return oe(n[this.dstField],this.op,e)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const t=e.params[this.srcParam];return oe(n[this.dstField],this.op,t[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return oe(n[this.dstField],this.op,this.value)}}},it=class e extends tt{constructor(t){super(),this.model=t;const s=t.conds||[];this.conds=s.map((t=>"SINGLE"===t.logicType?new st(t):new e(t)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(e,t,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(e,t,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},at=class{constructor(e){var t;this.model=e,this.links=null==(t=e.links||[])?void 0:t.map((e=>new class{constructor(e){this.model=e,this.srcNode=null,this.dstNode=null,this.groupCond=null;const t=this.model.delogicLinkGroupCond;t&&(this.groupCond=new it(t))}async exec(e){const{defaultLink:t}=this.model;return!(!t&&this.groupCond)||this.groupCond.test(e,e.context,e.data||{})}}(e)))}},nt=class extends at{async exec(e){const{dstAppDataEntityId:t,dstAppDEActionId:i,dstDELogicParamId:a,retDELogicParamId:n}=this.model;if(!t)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=e.params[a],o=ibiz.hub.getApp(e.context.srfappid),c=await o.deService.exec(t,i,e.context,r,e.viewParams);c.ok&&(e.params[n]=c.data)}},rt=class extends at{async exec(e){}},ot=class extends at{async exec(e){e.isEndNode=!0;const{returnParamId:t,returnType:s,rawValue:a}=this.model;switch(s){case"NONEVALUE":e.result=void 0;break;case"NULLVALUE":e.result=null;break;case"SRCVALUE":e.result=a;break;case"LOGICPARAM":e.result=e.params[t];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(s))}}};function ct(e,t){const{srcDELogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=t;let o;switch(t.srcValueType||(t.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=e.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=e.viewParams;break;case"APPDATA":o=e.context;break;case"ENVPARAM":o=b(ibiz.env);break;default:throw new i(t,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}var lt=class extends at{async exec(e){const t=this.model.delogicNodeParams;(null==t?void 0:t.length)&&await Promise.all(t.map((t=>{switch(t.paramAction){case"SETPARAMVALUE":return this.setParamValue(t,e);case"RESETPARAM":return this.resetParam(t,e);case"COPYPARAM":return this.copyParam(t,e);case"BINDPARAM":return this.bindParam(t,e);case"RENEWPARAM":return this.renewParam(t,e);case"APPENDPARAM":return this.appendParam(t,e);case"SORTPARAM":return this.sortParam(t,e);default:throw new i(t,"暂未支持逻辑处理参数操作".concat(t.paramAction))}})))}copyParam(e,t){const{dstDELogicParamId:s}=e,i=ct(t,e);t.params[s]=b(i)}bindParam(e,t){const s=ct(t,e);t.params[e.dstDELogicParamId]=s}setParamValue(e,t){const{dstFieldName:s,dstDELogicParamId:i}=e,a=null==s?void 0:s.toLowerCase(),n=ct(t,e);a?t.params[i][a]=n:t.params[i]=n}resetParam(e,t){const{dstDELogicParamId:s}=e;t.resetParam(s)}renewParam(e,t){const{dstDELogicParamId:s}=e;t.renewParam(s)}appendParam(e,t){const{dstDELogicParamId:s,dstIndex:i,srcIndex:a,srcSize:n}=e,r=ct(t,e),o=i||0,c=a||0,l=n||r.length;t.params[s].splice(o,0,...r.slice(c,l))}sortParam(e,t){const{dstDELogicParamId:s,dstFieldName:i,dstSortDir:a}=e,n=i.toLowerCase();t.params[s].sort(((e,t)=>"ASC"===a?e[n]-t[n]:t[n]-e[n]))}},ht=class extends at{async exec(e){const{dstAppDEDataSetId:t,dstAppDataEntityId:s,dstDELogicParamId:i,retDELogicParamId:a}=this.model,n=e.params[i],r=ibiz.hub.getApp(e.context.srfappid),o=await r.deService.exec(s,t,e.context,n,e.viewParams);o.ok&&(e.params[a]=o.data)}},dt=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ct(e,this.model);e.params[t]=a}},ut=class extends at{async exec(e){const{dstDELogicParamId:t}=this.model;if(!t)throw new s(this.model,"缺少目标参数对象配置");e.resetParam(t)}},pt=class extends at{async exec(e){const{dstDELogicParamId:t}=this.model;if(!t)throw new s(this.model,"缺少目标参数对象配置");e.renewParam(t)}},Et=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const a=ct(e,this.model);e.params[t]=b(a)}},gt=class extends at{async exec(e){const{dstDELogicParamId:t,dstSortDir:i,dstFieldName:a}=this.model;if(!t||!a)throw new s(this.model,"缺少目标参数对象或目标属性配置");const n=a.toLowerCase();e.params[t].sort(((e,t)=>"ASC"===i?e[n]-t[n]:t[n]-e[n]))}},mt=class extends at{async exec(e){const{dstDELogicParamId:t,srcDELogicParamId:i,dstIndex:a,srcIndex:n,srcSize:r}=this.model;if(!t||!i)throw new s(this.model,"缺少目标参数对象或者源参数对象配置");const o=ct(e,this.model),c=a||0,l=n||0,h=r||o.length;e.params[t].splice(c,0,...o.slice(l,h))}},ft=class extends at{async exec(e){const{errorCode:t,errorInfo:s}=this.model;throw new r({response:{status:t,statusText:s}})}},wt=class{constructor(e){var t,a;if(this.model=e,this.nodes=new Map,this.params=new Map,!(null==(t=e.delogicNodes)?void 0:t.length))throw new s(e,"实体逻辑没有配置逻辑节点");e.delogicNodes.forEach((e=>{const{logicNodeType:t}=e;let s;switch(t){case"BEGIN":s=new rt(e);break;case"END":s=new ot(e);break;case"DEACTION":s=new nt(e);break;case"PREPAREPARAM":s=new lt(e);break;case"DEDATASET":s=new ht(e);break;case"THROWEXCEPTION":s=new ft(e);break;case"BINDPARAM":s=new dt(e);break;case"RESETPARAM":s=new ut(e);break;case"COPYPARAM":s=new Et(e);break;case"RENEWPARAM":s=new pt(e);break;case"APPENDPARAM":s=new mt(e);break;case"SORTPARAM":s=new gt(e);break;default:throw new i(e,"未支持的逻辑节点类型: ".concat(t))}this.nodes.set(e.id,s)})),null==(a=e.delogicParams)||a.forEach((e=>{this.params.set(e.id,new class{constructor(e){this.model=e}calc(e){const t=this.model.id,s=this.model;if(s.default)e.params[t]=e.data||{};else if(s.appGlobalParam)e.params[t]=b(ibiz.env);else if(s.entityListParam)e.params[t]=[];else{if(s.entityPageParam)throw new i(s,"未支持的逻辑参数类型: 分页查询结果");if(s.entityParam)e.params[t]={};else{if(s.lastReturnParam)throw new i(s,"未支持的逻辑参数类型: 上次调用返回");if(s.appContextParam)e.params[t]=e.context;else if(s.simpleListParam)e.params[t]=[];else if(s.simpleParam)e.params[t]={};else if(s.cloneParam)e.params[t]=b(e.data||{});else{if(s.envParam)throw new i(s,"未支持的逻辑参数类型: 系统环境变量");if(s.fileListParam)throw new i(s,"未支持的逻辑参数类型: 文件对象列表变量");if(s.fileParam)throw new i(s,"未支持的逻辑参数类型: 文件对象变量");if(s.filterParam)throw new i(s,"未支持的逻辑参数类型: 过滤器对象变量");if(s.lastParam)throw new i(s,"未支持的逻辑参数类型: 最后数据变量");if(s.originEntity)throw new i(s,"未支持的逻辑参数类型: 原始数据对象");if(s.sessionParam)throw new i(s,"未支持的逻辑参数类型: 操作会话变量")}}}}renew(e){const t=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)e.params[t]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");e.params[t]={}}}}(e))})),this.nodes.forEach((e=>{e.links.forEach((t=>{t.srcNode=e,this.nodes.has(t.model.thenId)&&(t.dstNode=this.nodes.get(t.model.thenId))}))}))}initLogicParams(e){this.params.forEach((t=>{t.model.default&&(e.defaultParamName=t.model.id),t.calc(e)}))}async exec(e,t,i){const a=new class{constructor(e,t,s,i){this.deLogicParams=e,this.context=t,this.data=s,this.viewParams=i,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}resetParam(e){var t;null==(t=this.deLogicParams.get(e))||t.calc(this)}renewParam(e){var t;null==(t=this.deLogicParams.get(e))||t.renew(this)}}(this.params,e,t,i);this.initLogicParams(a);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new s(this.model,"未设置起始节点");{const e=this.nodes.get(n);await this.deepExec(e,a)}return a.isEndNode?a.result:a.params[a.defaultParamName]?a.params[a.defaultParamName]:null}async deepExec(e,t){await e.exec(t);const{links:s}=e;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(t)&&a.dstNode&&(await this.deepExec(a.dstNode,t),!1===e.model.parallelOutput))break}}},It=new Map;async function Dt(e,t,s,i){It.has(e)||It.set(e,new wt(e));return It.get(e).exec(t,s,i)}async function At(e,t,s,i){try{const a=await Dt(e,t,s,i);return new n(a)}catch(e){if(e instanceof r)return new n(e,500);throw e}}async function Pt(e,t,s,i,a){const n=J(e,t);if(n.length){(await Promise.all(n.map((e=>Dt(e,s,i,a))))).forEach((e=>{Object.assign(i,e)}))}}var yt=class extends et{async exec(e,t,i){if("DELOGIC"===this.method.actionType){const a=Q(this.method.appDELogicId,this.entity);if(!a)throw new s(this.method,"缺少实体处理逻辑");return At(a,e,t,i)}let a;switch(this.isLocalMode||(t=await this.input.handle(e,t)),["READ","GETDRAFT"].includes(this.method.actionMode)||await Pt(this.entity,"change",e,t,i),this.method.codeName){case"Create":a=await this.create(e,t,i);break;case"Get":a=await this.get(e,i);break;case"GetDraft":a=await this.getDraft(e,i);break;case"Remove":a=await this.remove(e,i);break;case"Update":a=await this.update(e,t,i);break;case"CreateTemp":a=await this.createTemp(e,t);break;case"GetTemp":a=await this.getTemp(e,t);break;case"GetDraftTemp":a=await this.getDraftTemp(e,i);break;case"RemoveTemp":a=await this.removeTemp(e,t);break;case"UpdateTemp":a=await this.updateTemp(e,t);break;default:{let s=this.calcPath(e);this.method.needResourceKey&&(s="".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]||t[this.entity.keyAppDEFieldId]));const n=await this.request(s,e,t,i);n.data=await this.result.handle(e,n.data),a=n}}return await Pt(this.entity,"compute",e,a.data,i),a}async create(e,t,s){if(this.isLocalMode)return this.createTemp(e,this.createEntity(t));const i=this.calcPath(e),a=await this.app.net.post(i,t,s);return a.data=await this.result.handle(e,a.data),a}async remove(e,t){if(this.isLocalMode)return this.removeTemp(e,t);const s=this.calcPath(e);return await this.app.net.delete("".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]),t)}async update(e,t,s={}){if(this.isLocalMode)return this.updateTemp(e,this.createEntity(t));const i=this.calcPath(e),a=await this.app.net.put("".concat(i,"/").concat(e[this.entity.codeName.toLowerCase()]),t,s);return a.data=await this.result.handle(e,a.data),a}async get(e,t={}){if(this.isLocalMode)return this.getTemp(e,t);const s=this.calcPath(e),i=await this.app.net.get("".concat(s,"/").concat(e[this.entity.codeName.toLowerCase()]),t);return i.data=await this.result.handle(e,i.data),i}async getDraft(e,t){if(this.isLocalMode)return this.getDraftTemp(e,t);const s=this.calcPath(e),i=await this.app.net.get("".concat(s,"/getdraft"),t);return i.data=await this.result.handle(e,i.data),i}async createTemp(e,t){try{const s=await this.getService(),i=await s.local.add(e,this.createEntity(t));return new n(i)}catch(e){return new n(e,500)}}async getDraftTemp(e,t){try{const e=this.createEntity({});return e?new n(e):new n(e,500)}catch(e){return new n(e,500)}}async removeTemp(e,t){try{let t=null;!t&&e&&(t=e[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.delete(e,t);return s?new n(s):new n(s,500)}catch(e){return new n(e,500)}}async updateTemp(e,t){try{const s=(await this.getService()).local.update(e,this.createEntity(t));return s?new n(s):new n(s,500)}catch(e){return new n(e,500)}}async getTemp(e,t){try{let t=null;!t&&e&&(t=e[this.entity.codeName.toLowerCase()]);const s=(await this.getService()).local.get(e,t);return s?new n(s):new n(s,500)}catch(e){return new n(e,500)}}async removeBatchTemp(e,t){return new n(!0)}},vt=class extends et{async exec(e,t,s){if(this.isLocalMode){const s=await this.searchLocal(null,new He(e,t));return new n(s,200)}let a;switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":a=await this.fetchCodeListSet(e,s);break;case"REMOTE":{const i=this.calcPath(e);a=await this.request(i,e,t,s)}break;default:throw new i(this.method,"数据来源类型".concat(this.method.dataSetType,"暂未支持"))}const r=a.data||[];return a.data=r.map((e=>this.createEntity(e))),a.data.length&&await Promise.all(a.data.map((t=>Pt(this.entity,"compute",e,t,s)))),a}async selectLocal(e,t={}){let s=(await this.getService()).local.getList(e);s=D(s,"srfordervalue");const i={},a={},n={},r={};t.srfkey&&(i.srfkey=C(t.srfkey),delete t.srfkey);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const s=t[e];null==s?(a[e]=C(null),n[e]=C(void 0),r[e]=C("")):i[e]=C(s)}if(!_(i)){const e=V(i),t=V(a),o=V(n),c=V(r);s=s.filter((s=>{if(_(a)){if(e(s))return!0}else if(e(s)&&(t(s)||o(s)||c(s)))return!0;return!1}))}return s.map((e=>e.clone()))}async searchLocal(e,t,s=this.entity.quickSearchAppDEFieldIds){const i=await this.getService();let a=[];e?(a=i.local.getList(t.context),a.length>0&&(a=a.filter((s=>e.test(s,t))))):(a=await this.selectLocal(t.context),a.length>0&&t.query&&""!==t.query&&s&&(a=a.filter((e=>{const i=new RegExp(t.query);for(let t=0;t<s.length;t+=1){const a=e[s[t]];if(i.test(a))return!0}return!1})))),v(t.sortField)||_(t.sortField)||(a="DESC"===t.sortMode?A(a,t.sortField):D(a,t.sortField));const{page:n,size:r}=t,o=n*r,c=(n+1)*r-1;return a.slice(o,c).map((e=>b(e)))}async fetchCodeListSet(e,t){const{appCodeListId:i}=this.method;if(!i)throw new s(this.method,"没有指定数据来源代码表");const a=await this.app.codeList.get(i,e,t),{keyAppDEFieldId:r,majorAppDEFieldId:o}=this.entity,c=a.map((e=>({[r]:e.value,[o]:e.text})));return new n(c,200)}},Tt=e("DEService",class{constructor(e){this.model=e,this.methodMap=new Map,this.local=new Ge,this.wf=new $e(e),this.file=new class{constructor(e){this.model=e}exportData(e,t,s,i){const a=Ke(s,this.model),n="".concat(a,"/").concat(this.model.codeName2.toLowerCase(),"/exportdata/").concat(t.toLowerCase(),"/?srfexporttag=").concat(e.codeName);return ibiz.net.request(n,{method:"post",data:i,responseType:"blob"})}}(e)}getMethod(e){if(this.methodMap.has(e))return this.methodMap.get(e);const t=H(this.model.appDEMethods,e);let s=null;switch(t.methodType){case"DEACTION":s=new yt(this.model,t);break;case"FETCH":case"FETCHTEMP":s=new vt(this.model,t);break;default:throw new i(t,"未支持的服务方法类型: ".concat(t.methodType))}return this.methodMap.set(e,s),s}exec(e,s,i={},a={}){const n=this.getMethod(e);if(n)return n.exec(s,i,a);throw new t("".concat(this.model.codeName,"未支持「").concat(e,"」方法"))}}),_t=e("ControlVO",class e{get srfuf(){return v(this.$origin.srfuf)?this.srfkey?1:0:this.$origin.srfuf}get srfkey(){return this.$origin.srfkey}get srfmajortext(){return this.$origin.srfmajortext}get srfdeid(){return this.$origin.srfdeid}get srfdecodename(){return this.$origin.srfdecodename}get srfkeyfile(){return this.$origin.srfkeyfile}get srfmajorfile(){return this.$origin.srfmajorfile}constructor(e={},t=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:e||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:t||new Map}),this.$dataUIMap.forEach(((e,t)=>{const s=e.dataKey;this.linkProperty(t,s,e.isOriginField)})),Object.keys(e).forEach((e=>{Object.prototype.hasOwnProperty.call(this,e)||this.linkProperty(e,e)}))}linkProperty(e,t,s=!0){"srfuf"!==e&&(s||Object.prototype.hasOwnProperty.call(this.$origin,e)?Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get(){return this.$origin[t]},set(e){this.$origin[t]=e}}):Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(t){this.$origin=t instanceof e?t.getOrigin():t}}),bt=e("ControlService",class{constructor(e){this.dataUIMap=new Map,this.model=e}async init(e){this.app=ibiz.hub.getApp(null==e?void 0:e.srfappid),this.initUIDataMap()}initUIDataMap(){}async exec(e,t,s={},i={}){return await this.app.deService.exec(this.model.appDataEntityId,e,t,s,i)}handleResponse(e){return e}toUIData(e){return new _t(e,this.dataUIMap)}}),Ct=(e("MDControlService",class extends bt{async fetch(e,t={}){var s;const i=(null==(s=this.model.fetchControlAction)?void 0:s.appDEMethodId)||"fetchdefault";let a=await this.exec(i,e,t);return a=this.handleResponse(a),a}async get(e,t={}){var s;const i=(null==(s=this.model.getControlAction)?void 0:s.appDEMethodId)||"get";let a=await this.exec(i,e,void 0,t);return a=this.handleResponse(a),a}async getDraft(e,t={}){var s;const i=(null==(s=this.model.getDraftControlAction)?void 0:s.appDEMethodId)||"getdraft";let a=await this.exec(i,e,void 0,t);return a=this.handleResponse(a),a}async remove(e,t={}){var s;const i=(null==(s=this.model.removeControlAction)?void 0:s.appDEMethodId)||"remove";return await this.exec(i,e,void 0,t)}async create(e,t){var s;const i=(null==(s=this.model.createControlAction)?void 0:s.appDEMethodId)||"create";let a=await this.exec(i,e,t.getOrigin());return a=this.handleResponse(a),a}async update(e,t){var s;const i=(null==(s=this.model.updateControlAction)?void 0:s.appDEMethodId)||"update";let a=await this.exec(i,e,t.getOrigin());return a=this.handleResponse(a),a}async exportData(e,s,i={}){throw new t("未实现")}handleResponse(e){const t=super.handleResponse(e);return t.headers&&(t.headers["x-page"]&&(t.page=Number(t.headers["x-page"])),t.headers["x-per-page"]&&(t.size=Number(t.headers["x-per-page"])),t.headers["x-total"]&&(t.total=Number(t.headers["x-total"]))),t.ok&&(w(t.data)?t.data=t.data.map((e=>this.toUIData(e))):t.data=this.toUIData(t.data)),t}}),e("DeAuthorityService",class{constructor(e){this.entityModel=e}async calcByDataAccessAction(e,t){if(t.srfopprivs&&!t.srfopprivs.includes(e))return!1;return!!await this.calcByDeMainState(e,t)}async calcByDeMainState(e,t){let s=!0;const i=this.entityModel;if(!i.enableDEMainState)return ibiz.log.debug("".concat(i.codeName,"实体不存在或者为启用主状态,返回true")),s;ibiz.log.debug("操作标识".concat(e,"主状态计算开始"),t,i);const a=Y(i,t);if(a){ibiz.log.debug("匹配主状态",a);const t=q(a,i);ibiz.log.debug("允许的主状态权限集合",t),s=t.includes(e)}else ibiz.log.debug("没匹配主状态,返回false"),s=!1;return ibiz.log.debug("操作标识".concat(e,"权限计算结束:").concat(s)),s}})),Vt=e("AuthorityService",class{constructor(e){this.appModel=e,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(e,t){this.constructorCache.set(e,t)}async getService(e){if(!this.cache.has(e)){const s=await ibiz.hub.getAppDataEntity(e,this.appModel.appId);if(!s)throw new t("未找到应用实体[".concat(e,"]"));const i=this.constructorCache.get(e);let a;a=i?await i(s):new Ct(s),this.cache.set(e,a)}return this.cache.get(e)}async init(e=ibiz.appData){if(!e)throw new t("没有appData数据");e.unires&&(this.resCodes=e.unires),!0===e.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0)}calcByResCode(e){return!this.enablePermission||this.resCodes.includes(e)}async calcByDataAccessAction(e,t,s){if(this.enablePermission){const t=await ibiz.hub.getApp(this.appModel.appId),i=await t.getOPPriv(e,s);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(t&&s){return(await this.getService(s)).calcByDataAccessAction(e,t)}return!0}}),Lt=e("AuthService",class{async v7login(e,t){return await ibiz.net.post("/v7/login",{loginname:e,password:t},{},{})}async v7logout(){return await ibiz.net.get("/v7/logout",{})}}),Rt=e("TreeNodeData",class{constructor(e,t,s){this.leaf=!1,this.leaf=!0===s.leaf,this.parent=t,this.parent&&(this.context={...this.parent.context}),s.navContext&&(this.context=Object.assign(this.context||{},s.navContext)),s.navParams&&(this.params={...s.navParams}),this.nodeId=e.id}}),Mt=(e("TreeCodeListNodeData",class extends Rt{constructor(e,t,s){super(e,t,s);const{data:i}=s;if(this.deData=i,this.text=i.text,this.value=i.value,this.id=t?"".concat(t.id,":").concat(e.id,"@").concat(this.value):e.id+this.value,this.id=this.id.toLowerCase(),e.appDataEntityId){const t=$(e.appDataEntityId);this.context=Object.assign(this.context||{},{[t]:this.value})}this.srfkey=this.value,this.srfmajortext=this.text}}),e("TreeDataSetNodeData",class extends Rt{constructor(e,t,s){super(e,t,s);const{data:i}=s;if(this.deData=i,this.text=i.srfmajortext,this.value=i.srfkey,this.id=t?"".concat(t.id,":").concat(e.id,"@").concat(i.srfkey):e.id+i.srfkey,this.id=this.id.toLowerCase(),e.appDataEntityId){const t=$(e.appDataEntityId);this.context=Object.assign(this.context||{},{[t]:i.srfkey})}this.srfkey=this.deData.srfkey,this.srfmajortext=this.deData.srfmajortext}}),e("TreeStaticNodeData",class extends Rt{constructor(e,t,s){var i,a;super(e,t,s);const n="root"===e.nodeValue?void 0:e.nodeValue;if(this.id=t?"".concat(t.id,":").concat(e.id):e.id,this.id=this.id.toLowerCase(),this.text=e.text,this.value=n,t&&s.parentValueLevel){let e=t;for(let t=1;t<s.parentValueLevel;t++)e=null==e?void 0:e.parent;(null==e?void 0:e.deData)&&(this.deData=e.deData),this.value=n||(null==e?void 0:e.value)}this.srfkey=(null==(i=this.deData)?void 0:i.srfkey)||this.value,this.srfmajortext=(null==(a=this.deData)?void 0:a.srfmajortext)||this.text}}),e("UIMapField",class{constructor(e,t,s={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=e,this.dataKey=t,v(s.isOriginField)||(this.isOriginField=s.isOriginField)}}),e("DEServiceUtil",class{constructor(e){this.appModel=e,this.cache=new Map,this.constructorCache=new Map}register(e,t){this.constructorCache.set(e,t)}async getService(e){if(!this.cache.has(e)){const s=await ibiz.hub.getAppDataEntity(e,this.appModel.appId);if(!s)throw new t("未找到应用实体[".concat(e,"]"));const i=this.constructorCache.get(e);let a;a=i?await i(s):new Tt(s),this.cache.set(e,a)}return this.cache.get(e)}clearTempCache(e){this.cache.forEach((t=>{t.local.clear(e)}))}async exec(e,t,s,i,a){return(await this.getService(e)).exec(t,s,i,a)}})),Ot=e("Application",class{constructor(e){this.model=e,this.deName2DeCodeName=new Map,this.net=new o({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(e.appId)}),this.deService=new Mt(e),this.codeList=new Ye(e),this.authority=new Vt(e)}get appId(){return this.model.appId}async init(){await this.authority.init(),await this.loadAppModelStyle()}async loadAppModelStyle(){await this.net.get("".concat(ibiz.env.remoteModelUrl,"/PSSYSAPP.json.css")).then((e=>{const t=document.createElement("style");if(t.setAttribute("type","text/css"),e.request&&e.request.responseURL){const s=new URL(e.request.responseURL);t.id=s.pathname}t.innerHTML=e.data,document.head.appendChild(t)})).catch((e=>{ibiz.log.error("应用[".concat(this.appId,"]模型全局样式加载失败:").concat(e.message))}))}getAppFunc(e){return(this.model.appFuncs||[]).find((t=>t.id===e))||null}async getUIAction(e){const[,t]=e.split("@");if(t){const s=(await ibiz.hub.getAppDataEntity(t,this.model.appId)).appDEUIActions.find((t=>t.id===e));if(s)return s}return this.model.appDEUIActions.find((t=>t.id===e))}async getOPPriv(e,t){var s,i;let a=null==(s=this.model.deopprivs)?void 0:s.find((t=>t.name===e));if(!a&&t){a=null==(i=(await ibiz.hub.getAppDataEntity(t,this.model.appId)).deopprivs)?void 0:i.find((t=>t.name===e))}return a}async getDEUILogic(e,t){return(await ibiz.hub.getAppDataEntity(t,this.model.appId)).appDEUILogics.find((t=>t.id===e))}}),Wt=class{constructor(){this.convert=new class{constructor(){this.appMenu=new class{parse(e){return e}}}},this.appMap=new Map,this.apps=new Map,this.view2appMap=new Map,this.views=new Map,this.dataEntities=new Map,this.config=new class{constructor(){this.view=new class{constructor(){this.viewConfigs=new Map}set(e,t){this.viewConfigs.set(e,t)}async get(e){if(!this.viewConfigs.has(e)){const s=await ibiz.hub.getAppView(e);if(!s)throw new t("视图[".concat(e,"]不存在"));this.set(s.id,{id:s.id,codeName:s.codeName,openMode:s.openMode,width:s.width,height:s.height,appDataEntityId:s.appDataEntityId,redirectView:s.redirectView})}return this.viewConfigs.get(e)}}}},this.defaultAppIndexViewName="Index"}calcAppViewId(e){let t="";if(-1!==e.indexOf(".")){const s=e.split(".");t=s[s.length-1]}else t=e.toLowerCase();return t}registerModelLoaderProvider(e){this.modelLoaderProvider=e}registerApp(e){this.apps.set(e.codeName,e)}registerAppView(e){this.views.set(e.codeName,e)}registerAppDataEntity(e,t=ibiz.env.appId){this.dataEntities.has(t)||this.dataEntities.set(t,new Map);this.dataEntities.get(t).set(e.id,e)}setAppView(e,t=ibiz.env.appId){const s=this.calcAppViewId(e);this.view2appMap.set(s,t)}hasAppView(e){const t=this.calcAppViewId(e);return this.view2appMap.has(t)}async getAppView(e){const s=this.calcAppViewId(e),i=this.view2appMap.get(s)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(s))return this.views.get(s);if(this.modelLoaderProvider){const e=await this.modelLoaderProvider.getAppView(i,s);return this.registerAppView(e),e}throw new t("视图[".concat(s,"]不存在"))}async getAppDataEntity(e,s=ibiz.env.appId){if(this.dataEntities.has(s)){const t=this.dataEntities.get(s);if(t.has(e))return t.get(e)}if(this.modelLoaderProvider){let t;return t=-1!==e.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(s,e):await this.modelLoaderProvider.getAppDataEntityByCodeName(s,e),this.registerAppDataEntity(t,s),t}throw new t("未找到应用实体[".concat(e,"]"))}async createApp(e){if(this.appMap.has(e))return this.appMap.get(e);let s;if(this.apps.has(e))s=this.apps.get(e);else{if(!this.modelLoaderProvider)throw new t("未找到应用[".concat(e,"]模型"));s=await this.modelLoaderProvider.getApp(e),this.registerApp(s)}const i=new Ot(s);return this.appMap.set(e,i),await i.init(),i}async getAppAsync(e=ibiz.env.appId){return this.createApp(e)}getApp(e){let t=null;return t=e?e instanceof Object?e.id:e:ibiz.env.appId,this.appMap.get(t)}},Nt=e("EngineFactory",class{constructor(){this.viewEngines=new Map}register(e,t){this.viewEngines.set(e,t)}unRegister(e){this.viewEngines.delete(e)}getEngine(e,...t){const{engineType:s,engineCat:i}=e,a="".concat(i,"_").concat(s),n=this.viewEngines.get(a);if(n)return n(...t);ibiz.log.error("没有".concat(a,"对应的引擎"),e)}}),xt=e("ViewEngineBase",class{constructor(e){this.view=e,this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}async onCreated(){const{childNames:e}=this.view;e.push("captionbar","toolbar")}async onMounted(){var e,t;const{model:s,childNames:i}=this.view;ibiz.log.debug("".concat(s.id,"的子组件:").concat(i.join(";"),"都已mounted"));if(!this.calcViewHeaderVisible()){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_header;t&&(t.state.visible=!1)}if(ibiz.env.isMob){if(!this.calcViewFooterVisible()){const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.view_footer;e&&(e.state.visible=!1)}}}async onDestroyed(){}async call(e,t){if("GetData"===e)return this.getData()}initViewState(){}getData(){return[]}calcViewHeaderVisible(){var e,t,s,i;let a=!1;const{model:n}=this.view;if(!1===n.showCaptionBar){const t=null==(e=this.viewLayoutPanel)?void 0:e.panelItems.view_captionbar;t&&(t.state.visible=!1)}else a=!0;if(ibiz.env.isMob){if(this.leftToolbar)a=!0;else{const e=null==(t=this.viewLayoutPanel)?void 0:t.panelItems.lefttoolbar;e&&(e.state.visible=!1)}if(this.rightToolbar)a=!0;else{const e=null==(s=this.viewLayoutPanel)?void 0:s.panelItems.righttoolbar;e&&(e.state.visible=!1)}}else if(this.toolbar)a=!0;else{const e=null==(i=this.viewLayoutPanel)?void 0:i.panelItems.view_toolbar;e&&(e.state.visible=!1)}return a}calcViewFooterVisible(){let e=!1;return this.footerToolbar&&(e=!0),e}async loadEntityData(){const{appDataEntityId:e}=this.view.model,{evt:s,context:i,params:a}=this.view;if(!e)throw new t("该视图没有实体,无法加载实体数据");const n=ibiz.hub.getApp(i.srfappid),r=await n.deService.exec(e,"get",i,a),{data:o}=r;o&&(this.view.state.srfactiveviewdata=o,s.emit("onDataChange",{actionType:"LOAD",data:[o]}),o.srfkey&&s.emit("onViewInfoChange",{dataInfo:o.srfmajortext||""}))}}),St=(e("MDViewEngine",class extends xt{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:e}=this.view;e.push(this.xdataControlName,"searchform","searchbar")}async onMounted(){await super.onMounted();const{model:e}=this.view;this.xdataControl.evt.on("onActive",(async e=>{await this.openData(e)})),this.xdataControl.evt.on("onSelectionChange",(async e=>{var t;null==(t=this.toolbar)||t.calcButtonState(e.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(e=>{this.view.evt.emit("onDataChange",{...e,actionType:"SAVE"})}));const t=this.viewLayoutPanel.panelItems.view_searchform;if(t){const s=!!this.searchForm;t.state.keepAlive=s,t.state.visible=s&&!!e.expandSearchForm}this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.refresh()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.refresh()})),!this.view.state.noLoadDefault&&e.loadDefault&&this.load()}async call(e,t){return"ToggleFilter"===e?(this.toggleFilter(),null):"Edit"===e||"View"===e?(this.openData(t),null):"New"===e?(this.newData(t),null):"Remove"===e?(await this.remove(t),null):"Import"===e?(await this.importData(),null):"Refresh"===e?(await this.refresh(),null):"ExportExcel"===e?(await this.exportData(t),null):"Copy"===e?(this.copy(t),null):"load"===e?(this.load(t),null):super.call(e,t)}getData(){return this.xdataControl.getData()}async openData(e){var t,i;const{data:a,event:n}=e,r=this.view.context.clone();r[((null==(t=a[0].srfdecodename)?void 0:t.toLowerCase())||$(this.xdataControl.model.appDataEntityId)).toLowerCase()]=a[0].srfkey;if(-1===await(null==(i=this.view.scheduler)?void 0:i.triggerCustom("opendata",{context:r,params:this.view.params,data:a,event:n,view:this.view})))throw new s(this.view.model,"缺少opendata的视图逻辑")}async newData(e){var t,i,a;const{data:n,event:r,copyMode:o}=e;if(!(null==(i=null==(t=this.view.model.viewLayoutPanel)?void 0:t.appViewLogics)?void 0:i.find((e=>"newdata"===e.id))))throw new s(this.view.model,"缺少newdata的视图逻辑");const c=this.view.context.clone();o&&(c.srfcopymode=!0);if(-1===await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("newdata",{context:c,params:this.view.params,data:n,event:r,view:this.view})))throw new s(this.view.model,"缺少newdata的视图逻辑")}async remove(e){await this.xdataControl.remove(e)}async load(e={}){await this.xdataControl.load({isInitialLoad:!0,...e})}async refresh(){await this.xdataControl.refresh()}getSearchParams(){const e={};if(this.searchForm){const t=this.searchForm.getData()[0];Object.assign(e,t)}if(this.searchBar){const t={query:this.searchBar.state.query};Object.assign(e,t)}return e}async importData(){await this.xdataControl.importData()}async exportData(e){await this.xdataControl.exportData(e)}async copy(e){this.newData(Object.assign(e,{copyMode:!0}))}calcViewHeaderVisible(){let e=super.calcViewHeaderVisible();if(this.searchBar)e=!0;else{const e=this.viewLayoutPanel.panelItems.view_searchbar;e&&(e.state.visible=!1)}return e}toggleFilter(){if(this.searchForm){const e=this.viewLayoutPanel.panelItems.view_searchform;e&&(e.state.visible=!e.state.visible)}}}),class{constructor(){this.layoutPanel=new fe}}),Bt=e("CONTROL_PROVIDER_PREFIX","CONTROL");function Ft(e){return ibiz.register.get("".concat(Bt,"_").concat(e))}async function kt(e){let t;const{controlType:s,controlStyle:i}=e;if(i&&"DEFAULT"!==i){t=Ft("".concat(s,"_").concat(i)),t||ibiz.log.error("找不到部件类型:[".concat(s,"]的部件样式:[").concat(i,"]对应的适配器"),e)}return t||(t=Ft(s)),t||ibiz.log.error("找不到部件类型".concat(s,"对应的适配器")),t}var Ut=e("EDITOR_PROVIDER_PREFIX","EDITOR");function zt(e){return ibiz.register.get("".concat(Ut,"_").concat(e))}var Gt=e("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");var jt=e("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");var Xt=e("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Kt(e){return ibiz.register.get("".concat(Xt,"_").concat(e.toUpperCase()))}var Ht=e("UIACTION_PROVIDER_PREFIX","UIACTION");function Yt(e,t){ibiz.register.register("".concat(Ht,"_").concat(e),t)}async function qt(e){let s;const{uiactionMode:i}=e;var a;if(s||(a=i,s=ibiz.register.get("".concat(Ht,"_").concat(a))),!s)throw new t("找不界面行为模式".concat(i,"对应的适配器"));return s}var $t=e("VIEW_PROVIDER_PREFIX","VIEW");function Qt(e){return ibiz.register.get("".concat($t,"_").concat(e))}var Jt=e("PORTLET_PROVIDER_PREFIX","PORTLET");var Zt=class{},es=class extends Zt{constructor(e){super(),this.model=e,this.srcParam=e.srcLogicParamId,this.dstParam=e.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(e,t,a){const n=e.params[this.dstParam];switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[数据对象属性],缺少配置条件值");const e=null!=a[this.value]?a[this.value]:t[this.value];return oe(n[this.dstField],this.op,e)}case"SRCENTITYFIELD":{if(!this.value)throw new s(this.model,"当前条件值类型为[源数据对象属性],缺少配置条件值");const t=e.params[this.srcParam];return oe(n[this.dstField],this.op,t[this.value])}case"CURTIME":throw new i(this.model,"暂未支持条件值类型为[当前时间]");default:return oe(n[this.dstField],this.op,this.value)}}},ts=class e extends Zt{constructor(t){super(),this.model=t;const s=t.deuilogicLinkConds||[];this.conds=s.map((t=>"SINGLE"===t.logicType?new es(t):new e(t)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(e,t,i){let a=!0;if(0===this.conds.length)throw new s(this.model,"界面连接条件逻辑组未配置逻辑项");for(let s=0;s<this.conds.length;s++){const n=this.conds[s].test(e,t,i);if("AND"===this.op&&!1===n){a=!1;break}if("OR"===this.op&&!0===n){a=!0;break}}return this.notMode?!a:a}},ss=class{constructor(e){this.model=e,this.links=(e.deuilogicLinks||[]).map((e=>new class{constructor(e){this.model=e,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:t,deuilogicLinkGroupCond:s}=this.model;0===t&&s&&(this.groupCond=new ts(s))}async exec(e){const{linkMode:t}=this.model,{context:s,data:a}=e;switch(t||0){case 0:return!this.groupCond||this.groupCond.test(e,s,a&&a.length>0?a[0]:{});case 1:return!0;case 2:throw new i(this.model,"未支持的逻辑连接类型: 异步结束");case 3:throw new i(this.model,"未支持的逻辑连接类型: 异步拒绝");case 9:throw new i(this.model,"未支持的逻辑连接类型: 异常处理");default:throw new i(this.model,"未支持的逻辑连接类型:".concat(t))}}}(e)))}},is=class extends ss{async exec(e){const{dstAppDataEntityId:t,dstAppDEActionId:i,dstDEUILogicParamId:a,retDEUILogicParamId:n}=this.model;if(!t)throw new s(this.model,"未指定应用实体");if(!i)throw new s(this.model,"未指定实体行为");const r=e.params[a],o=ibiz.hub.getApp(e.context.srfappid),c=await o.deService.exec(t,i,e.context,r,e.viewParams);c.ok&&(e.params[n]=c.data)}},as=class extends ss{async exec(e){const{dstAppDEUIActionId:t,dstDEUILogicParamId:i}=this.model,{data:a,parameters:n}=e;if(!t)throw new s(this.model,"未配置界面行为");let r=[a];if(i){const t=e.params[i];r=t instanceof Array?t:[t]}await us.execAndResolved(t,{...n,data:r})}},ns=class extends ss{async exec(e){}},rs=class extends ss{async exec(e){e.isEndNode=!0;const{returnType:t,rawValue:s,returnParamId:a}=this.model;switch(t){case"NONEVALUE":e.result=void 0;break;case"NULLVALUE":e.result=null;break;case"SRCVALUE":e.result=s;break;case"LOGICPARAM":e.result=e.params[a];break;default:throw new i(this.model,"暂未支持的结束节点返回值类型: ".concat(t))}}};var os=class extends ss{async exec(e){const t=this.model.deuilogicNodeParams;(null==t?void 0:t.length)&&await Promise.all(t.map((t=>{if("SETPARAMVALUE"===t.paramAction)return this.setParamValue(t,e);throw new i(t,"暂未支持逻辑处理参数操作".concat(t.paramAction))})))}setParamValue(e,t){const{dstFieldName:s,dstDEUILogicParamId:a}=e,n=null==s?void 0:s.toLowerCase(),r=function(e,t){const{srcDEUILogicParamId:s,srcValueType:a,srcFieldName:n,srcValue:r}=t;let o;switch(t.srcValueType||(t.srcValueType="SRCDLPARAM"),a){case"SRCDLPARAM":o=e.params[s];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return r;case"VIEWPARAM":o=e.viewParams;break;case"APPDATA":o=e.context;break;case"ENVPARAM":o=b(ibiz.env);break;default:throw new i(t,"暂未支持源值类型".concat(a))}const c=null==n?void 0:n.toLowerCase();return o&&c&&(o=o[c]),o}(t,e);n?t.params[a][n]=r:t.params[a]=r}},cs=class extends ss{async exec(e){e.isEndNode=!0;const{invokeMethod:i,invokeCtrlId:a,invokeParamId:n}=this.model;if(!a)throw new s(this.model,"没有配置界面对象");if(!n)throw new s(this.model,"没有配置操作参数");if(!i)throw new s(this.model,"没有配置调用方法");const r=e.params[n];if(!r)throw new t("没有找到操作参数".concat(n));const o=e.params[a];if(!o)throw new t("没有找到界面对象".concat(a));if(!o[i]||!u(o[i]))throw new t("没有找到调用方法".concat(i));await o[i](r)}},ls=class{constructor(e){var a;if(this.model=e,this.nodes=new Map,this.params=new Map,!(null==(a=e.deuilogicNodes)?void 0:a.length))throw new s(e,"界面逻辑没有配置逻辑节点");e.deuilogicNodes.forEach((e=>{const{logicNodeType:t}=e;let s;switch(t){case"BEGIN":s=new ns(e);break;case"END":s=new rs(e);break;case"DEACTION":s=new is(e);break;case"DEUIACTION":s=new as(e);break;case"PREPAREJSPARAM":s=new os(e);break;case"RESETPARAM":case"COPYPARAM":case"BINDPARAM":case"VIEWCTRLINVOKE":s=new cs(e);break;default:throw new i(e,"未支持的逻辑节点类型: ".concat(t))}this.nodes.set(e.id,s)})),e.deuilogicParams.forEach((e=>{this.params.set(e.id,new class{constructor(e){this.model=e}calc(e){const s=this.model.id,a=this.model,{context:n,viewParams:r,data:o,parameters:c}=e,l=ibiz.hub.getApp(n.srfappid);if(a.default)e.params[s]=o&&o.length>0?o[0]:{};else if(a.activeContainerParam)e.params[s]=c.ctrl||c.view;else if(a.activeCtrlParam)e.params[s]=c.ctrl;else if(a.ctrlParam){const i=c.view.getController(a.codeName.toLowerCase());if(!i)throw new t("没找到".concat(a.codeName,"指定部件对象"));e.params[s]=i}else if(a.activeViewParam)e.params[s]=c.view;else if(a.appGlobalParam)e.params[s]=ibiz.env;else if(a.applicationParam)e.params[s]=l;else if(a.entityListParam)e.params[s]=[];else{if(a.entityPageParam)throw new i(a,"未支持的逻辑参数类型: 分页查询结果");if(a.entityParam)e.params[s]={};else{if(a.lastReturnParam)throw new i(a,"未支持的逻辑参数类型: 上次调用返回");if(a.navContextParam)e.params[s]=n;else{if(a.navViewParamParam)throw new i(a,"未支持的逻辑参数类型: 视图路由参数");if(a.routeViewSessionParam)throw new i(a,"未支持的逻辑参数类型: 路由视图会话");if(a.simpleListParam)e.params[s]=[];else if(a.simpleParam)e.params[s]={};else if(a.viewNavDataParam)e.params[s]=r;else if(a.viewSessionParam)throw new i(a,"未支持的逻辑参数类型: 当前视图会话")}}}}renew(e){const t=this.model.id,s=this.model;if(s.entityListParam||s.simpleListParam||s.entityPageParam)e.params[t]=[];else{if(!s.simpleParam&&!s.entityParam)throw new i(s,"未支持的逻辑参数类型重新建立变量");e.params[t]={}}}}(e))})),this.nodes.forEach((e=>{e.links.forEach((t=>{t.srcNode=e,this.nodes.has(t.model.dstDEUILogicNodeId)&&(t.dstNode=this.nodes.get(t.model.dstDEUILogicNodeId))}))}))}initLogicParams(e){this.params.forEach((t=>{t.model.default&&(e.defaultParamName=t.model.id),t.calc(e)}))}async exec(e){const t=new class{constructor(e,t){this.deLogicParams=e,this.parameters=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get context(){return this.parameters.context}get data(){return this.parameters.data}get viewParams(){return this.parameters.params}resetParam(e){var t;null==(t=this.deLogicParams.get(e))||t.calc(this)}renewParam(e){var t;null==(t=this.deLogicParams.get(e))||t.renew(this)}}(this.params,e);this.initLogicParams(t);const{startDEUILogicNodeId:i}=this.model;if(!i||!this.nodes.has(i))throw new s(this.model,"未设置起始节点");{const e=this.nodes.get(i);await this.deepExec(e,t)}return t.isEndNode?t.result:t.params[t.defaultParamName]?t.params[t.defaultParamName]:null}async deepExec(e,t){await e.exec(t);const{links:s}=e;for(let i=0;i<s.length;i++){const a=s[i];if(await a.exec(t)&&a.dstNode&&(await this.deepExec(a.dstNode,t),!1===e.model.parallelOutput))break}}},hs=new Map;async function ds(e,s,i){const a=ibiz.hub.getApp(i.context.srfappid),n=await a.getDEUILogic(e,s);if(!n)throw new t("找不到实体".concat(s,"的界面逻辑").concat(e));hs.has(n)||hs.set(n,new ls(n));const r=hs.get(n);return await r.exec(i),null}var us=e("UIActionUtil",class{static async exec(e,s){const i=await ee(e);if(!i)throw new t("没找到".concat(e,"的界面行为模型"));return(await qt(i)).exec(i,s)}static async execAndResolved(e,t){const s=await this.exec(e,t);s.closeView?t.view.closeView():s.refresh&&await t.view.callUIAction("Refresh")}}),ps=class{async exec(e,t){const{context:i,params:a,data:n}=t,r={refresh:e.reloadData,closeView:e.closeEditView},{appDEUILogicId:o,appDataEntityId:c,uilogicAttachMode:l}=e;if("REPLACE"===l){if(!o)throw new s(e,"没有配置实体界面逻辑");return await ds(o,c,t),r}if(!await this.isConfirm(e))return this.returnError(r);const h=await this.execAction(e,t);if(Object.assign(r,h),!0===r.cancel)return this.returnError(r);const d=await this.doNextAction(e,{...t,context:r.nextContext||i,data:r.data||n,params:r.nextParams||a});if(d&&(Object.assign(r,d),!0===d.cancel))return this.returnError(r);if("AFTER"===e.uilogicAttachMode){if(!o)throw new s(e,"没有配置实体界面逻辑");await ds(o,c,t)}return r}returnError(e){return Object.assign(e,{refresh:!1,closeView:!1})}async isConfirm(e){return!e.enableConfirm||!e.confirmMsg||ibiz.modal.confirm({title:e.confirmMsg})}async doNextAction(e,t){const s=e.nextId;if(s)return us.exec(s,t)}async handleParams(e,t,s,i){let a=[];const n=$(e.appDataEntityId);switch(e.actionTarget){case"NONE":a=[];break;case"SINGLEDATA":a=[s[0]];break;case"MULTIDATA":a=s;break;case"MULTIKEY":a=n&&s.length>0?s.map((e=>({[n]:e.srfkey||e[n]}))):[{}];break;case"SINGLEKEY":{const e=s[0]||{};a=n?[{[n]:e.srfkey||e[n]}]:[{}]}}const r=t.clone(),o=[...e.navigateContexts||[]];if(n&&"NONE"!==e.actionTarget){const{valueItem:t,paramItem:s}=e,i=s||n,a=t||"srfkey";o.unshift({key:i,value:a,rawValue:!1})}const c=["MULTIKEY","MULTIDATA"].includes(e.actionTarget)&&s.length>0,l=z(o,t,i,c?K(o,s):s[0]||{});Object.assign(r,l);const h=e.navigateParams;return{resultContext:r,resultData:a,resultParams:z(h,r,i,c?K(h,s):s[0]||{})}}},Es=e("BackendUIActionProvider",class extends ps{async execAction(e,t){const{context:i,params:a,data:n,event:r}=t,o={},c=e.appDataEntityId,l=e.appDEMethodId;if(!c||!l)throw new s(e,"未配置实体或实体行为");const{resultContext:h,resultParams:d,resultData:u}=await this.handleParams(e,i,n,a),p={...a,...d},E=e.frontAppViewId;if(E){const e=await ibiz.commands.execute(be.TAG,E,h,d,{event:r});if(!(null==e?void 0:e.ok))return o.cancel=!0,o;(null==e?void 0:e.ok)&&e.data&&(0===u.length&&u.push({}),u.forEach((t=>{t.srfactionparam=e.data})))}const g=ibiz.hub.getApp(null==i?void 0:i.srfappid),m=u.map((e=>{var t;return(null==(t=e.getOrigin)?void 0:t.call(e))||e||{}})),f=["MULTIKEY","MULTIDATA"].includes(e.actionTarget),I=await g.deService.exec(c,l,h,f?m:m[0],p);return I.ok&&e.successMsg&&ibiz.message.success(e.successMsg),Object.assign(o,{data:w(I.data)?I.data:[I.data],nextContext:h,nextParams:p}),o}}),gs=e("SysUIActionProvider",class extends ps{async execAction(e,t){const{view:s}=t,i=e.uiactionTag;if("Exit"===i)return{closeView:!0};return await s.callUIAction(i,t)||{}}}),ms=e("FrontUIActionProvider",class extends ps{async execAction(e,t){const{context:a,params:n,data:r,event:o,noWaitRoute:l}=t;let h={};switch(e.frontProcessType){case"OPENHTMLPAGE":{const t=c.fill(e.htmlPageUrl,a,null==r?void 0:r[0]);window.open(t,"_blank");break}case"TOP":case"WIZARD":{const t=e.frontAppViewId;if(!t)throw new s(e,"未配置打开视图");const{resultContext:i,resultParams:c}=await this.handleParams(e,a,r,n),d=await ibiz.commands.execute(be.TAG,t,i,c,{event:o,noWaitRoute:l});(null==d?void 0:d.ok)||(h.cancel=!0),(null==d?void 0:d.ok)&&d.data&&(h.data=d.data,h.nextContext=i,h.nextParams={...n,...c});break}case"OTHER":h=this.doOther(e,t);break;default:throw new i(e,"未支持的前台处理模式[".concat(e.frontProcessType,"]"))}return h}doOther(e,t){const{scriptCode:i}=e,{context:a,params:n,data:r,event:o}=t;if(i){return Ee.execScriptFn({context:a,params:n,data:r,el:null==o?void 0:o.target},i)||{}}throw new s(e,"自定义类型缺少配置脚本代码")}}),fs=e("WFWithdrawUIActionProvider",class extends ps{async execAction(e,t){const{view:s}=t;let i=!1;return await ibiz.modal.confirm({title:"提示",desc:"是否确认执行撤回操作?"})&&s&&(await s.call("WFWithdraw",t),i=!0),{refresh:!1,closeView:i}}});function ws(){const e=new ms;Yt("FRONT",(()=>e));const t=new Es;Yt("BACKEND",(()=>t));const s=new gs;Yt("SYS",(()=>s));const i=new fs;Yt("DEUIACTION_WFWithdraw",(()=>i))}var Is=class{constructor(e,t){this.logic=e,this.scheduler=t,this.type=e.logicType}execute(e){throw new t("Method not implemented.")}destroy(){}},Ds=class extends Is{constructor(){super(...arguments),this.isRowReturn=!1}convertScriptArgs(e){throw new t("未设置脚本执行参数转换方法")}init(e,t){this.convertScriptArgs=t;let s=this.logic.scriptCode;this.isRowReturn&&(s="return (".concat(s,")")),this.scriptFn=Ee.createScriptFn(e,s,{singleRowReturn:this.isRowReturn})}execute(e){const t=this.convertScriptArgs(e);return this.scriptFn.exec(t)}},As=class extends Is{execute(e){const{appDEUILogicId:t,appDataEntityId:i}=this.logic;if(!t)throw new s(this.logic,"没有配置实体界面逻辑");ds(t,i,e)}},Ps=class{constructor(e){this.triggers=new Map,this.executors=new Map,this.logics=e,e.forEach((e=>{try{const t=this.createExecutor(e);this.executors.set(e.id,t);const s=this.createTrigger(e);this.triggers.set(e.id,s),s.bindExecutor(t)}catch(e){ibiz.log.error(e.message)}}))}destroy(){this.triggers.forEach((e=>e.destroy())),this.executors.forEach((e=>e.destroy()))}getExecuteParams(e){let t={};return this.defaultParamsCb&&(t=this.defaultParamsCb()),L(e,t)}createTrigger(e){return ibiz.scheduler.triggerFactory.createTrigger(e,this)}createExecutor(e){return ibiz.scheduler.executorFactory.createExecutor(e,this)}getMatchTriggers(e){const t=[];return this.triggers.forEach((s=>{s.match(e)&&t.push(s)})),t}triggerAndExecute(e,t={}){const s=this.getMatchTriggers(e);if(s.length>0){const e=this.getExecuteParams(t);return s.map((t=>t.execute(e)))}}triggerItemDynaLogic(e,t,s){const i={itemName:e,triggerType:t},a=this.triggerAndExecute(i,s);if(null==a?void 0:a.length)return a.pop()}triggerItemVisible(e,t){return this.triggerItemDynaLogic(e,"ITEMVISIBLE",t)}triggerItemEnable(e,t){return this.triggerItemDynaLogic(e,"ITEMENABLE",t)}triggerItemBlank(e,t){return this.triggerItemDynaLogic(e,"ITEMBLANK",t)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((e=>e.start()))}triggerCustom(e,t){const s=this.triggers.get(e);if(!s)return-1;const i=this.getExecuteParams(t);return s.execute(i)}},ys=class extends Ps{constructor(e){super(e.filter((e=>"APPVIEWENGINE"!==e.triggerType)))}},vs=class extends Ps{constructor(e){e.forEach((e=>{e.triggerType=e.logicTrigger})),super(e)}triggerViewEvent(e){const t={eventName:e.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(t,e)}},Ts=class{constructor(){this.executorFactory=new class{constructor(){this.constructorMap=new Map}register(e,t){this.constructorMap.set(e,t)}createExecutor(e,t){const s=this.constructorMap.get(e.logicType);if(!s)throw new i(e,"逻辑类型 ".concat(e.logicType," 暂未支持!"));return s(e,t)}},this.triggerFactory=new class{constructor(){this.constructorMap=new Map}register(e,t){this.constructorMap.set(e,t)}createTrigger(e,t){const s=this.constructorMap.get(e.triggerType);if(!s)throw new i(e,"触发器类型 ".concat(e.triggerType," 暂未支持!"));return s(e,t)}}}createViewScheduler(e){return new vs(e)}createControlScheduler(e){return new ys(e)}},_s=class{constructor(e,t){this.logic=e,this.scheduler=t,this.type=e.triggerType}bindExecutor(e){this.executor=e}match(e){return e.triggerType===this.type}execute(e){if(this.executor)return this.executor.execute(e);throw new t("".concat(this.logic.id,"没有绑定executor"))}destroy(){this.executor=void 0}},bs=class extends _s{},Cs=class extends _s{bindExecutor(e){if(super.bindExecutor(e),"SCRIPT"!==this.executor.type)throw new t("预定义逻辑类型".concat(this.type,"的触发器类型只能是脚本"));this.executor.isRowReturn=!0,this.executor.init(["context","viewparams","data","env"],(e=>{const{context:t,params:s,data:i}=e;return{context:t,params:s,data:(null==i?void 0:i[0])||{},env:ibiz.env}}))}match(e){return super.match(e)&&e.itemName===this.logic.itemName}execute(e){const s=this.executor.execute(e);if("boolean"==typeof s)return s;throw new t("".concat(this.logic.id,"逻辑返回值不是布尔值"))}},Vs=class extends _s{constructor(){super(...arguments),this.timer=null}start(){this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new t("定时器缺少默认参数回调");const e=this.scheduler.defaultParamsCb();this.executor.execute(e)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Ls=class extends Is{execute(e){return"opendata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,e):"newdata"===this.logic.id&&this.logic.builtinAppUILogic?this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,e):void 0}async executeOpenDataAppUILogic(e,i){const{context:a,params:n,...r}=i,{data:o}=i;if(!(null==o?void 0:o[0]))throw new t("opendata没有可操作数据!");const c=e.openDataAppView;if(!c)throw new s(e,"opendata视图逻辑没有配置默认打开视图");const l=c.refAppViewId;if(!l)throw new s(e,"opendata视图逻辑的默认打开视图没有实际引用视图");const h=c.navigateContexts||[],d=Object.assign(a,z(h,a,n,o[0]));let u={};const E=c.navigateParams;p(E)&&(u=z(E,n,a,o[0])),await ibiz.commands.execute(be.TAG,l,d,u,r)}async executeNewDataAppUILogic(e,t){const{context:a,params:n,...r}=t,{data:o}=t,{enableWizardAdd:c,enableBatchAdd:l,batchAddOnly:h,newDataAppView:d}=e;let u;if(c){if(u=await this.getWizardNewViewRef(e,t),!u)return}else{if(l)throw new i(e,"enableBatchAdd暂未支持");if(h)throw new i(e,"batchAddOnly暂未支持");if(u=d,!u||!u.refAppViewId)throw new s(e,"newdata视图逻辑没有配置默认新建数据视图")}let E={},g={};const m=(null==o?void 0:o[0])||{},f=u.navigateContexts;p(f)&&(E=z(f,a,n,m)),E=Object.assign(a,E);const w=u.navigateParams;p(w)&&(g=z(w,n,a,m)),a.srfcopymode&&(m.srfkey=void 0,g=Object.assign(g,m.$origin)),await ibiz.commands.execute(be.TAG,u.refAppViewId,E,g,r)}async getWizardNewViewRef(e,i){var a;const{wizardAppView:n,newDataAppViews:r}=e,{context:o,params:c,...l}=i;if(!n||!n.refAppViewId)throw new s(e,"缺少默认索引实体选择视图");const h=await ibiz.commands.execute(be.TAG,n.refAppViewId,o,c,{...l,openMode:"POPUPMODAL"});if(!h.ok)return;const d=null==(a=h.data)?void 0:a[0];if(!d)throw new t("请选中一条数据");const u=d.srfkey,p=null==r?void 0:r.find((e=>e.refMode===u));if(!p)throw new t("没有找到与索引类型".concat(u,"相关的实体的编辑视图"));return p}},Rs=class extends _s{constructor(e,t){super(e,t),this.logic=e,this.scheduler=t,this.listenEventNames=[];const s=e.eventNames.split(",");this.listenEventNames=s.map((e=>Pe[e]||e))}match(e){return super.match(e)&&this.listenEventNames.includes(e.eventName)}};var Ms=((e,t,s)=>(s=null!=e?O(S(e)):{},((e,t,s,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of x(t))B.call(e,a)||a===s||W(e,a,{get:()=>t[a],enumerable:!(i=N(t,a))||i.enumerable});return e})(!t&&e&&e.__esModule?s:W(s,"default",{value:e,enumerable:!0}),e)))(F(),1),Os=(e("PluginStaticResource",class{constructor(e){this.styleElementMap=new Map,this.url=new URL(e);const t=Ms.default.dirname(this.url.pathname);this.baseDir=t}dir(e){return Ms.default.resolve(this.baseDir,e)}async loadStyle(e){const t=e.map((e=>{const t=this.dir(e);return!this.styleElementMap.has(t)&&(this.styleElementMap.set(t,null),new Promise(((e,s)=>{const i=document.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i.onload=e,i.onerror=s,document.head.appendChild(i)})))}));try{await Promise.all(t)}catch(e){ibiz.log.error(e)}}}),e("RemotePluginItem",class{constructor(e,t,s){this.tag=e,this.repo=t,this.config=s}}),e("FormNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Os||{}))),Ws=e("GridNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Ws||{})),Ns=e("PanelNotifyState",(e=>(e.LOAD="LOAD",e.DRAFT="DRAFT",e.SAVE="SAVE",e))(Ns||{})),xs=e("Counter",class{constructor(e){this.callback=e,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(e){if("Used"!==this.state){if(0===this.count)throw new t("错误的调用!decrement不能对count为0调用");this.count-=1,0===this.count&&(e?e():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),Ss=e("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new xs(l)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),Bs=e("CTXState",class{}),Fs=e("CTX",class{constructor(e){this.parent=e,this.evt=new m,this.controllersMap=new Map,this.state=new Bs}async init(e){this.view=e,this.registerController(e.model.name,e)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null}async setState(e){Object.assign(this.state,e)}startLoading(){this.view.startLoading()}endLoading(){this.view.endLoading()}registerController(e,t){this.controllersMap.set(e,t),this.evt.emit("onRegister",e,t)}getController(e,t=!1){return this.controllersMap.has(e)?this.controllersMap.get(e):this.parent&&t?this.parent.getController(e):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),ks=e("ActivityCounter",class extends xs{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(e){"Unused"!==this.state||this.registration.has(e)||(this.registration.set(e,!1),this.increment())}attend(e){this.registration.has(e)&&!1===this.registration.get(e)&&(this.registration.set(e,!0),this.decrement())}}),Us=(e("UIActionButtonState",class{constructor(e,t,s){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.isInit=!1,this.name=e,this.uiActionId=s,this.appId=t}async init(){if(!this.uiActionId)return void(this.isInit=!0);const e=await ee(this.uiActionId);if([,this.appDeName]=this.uiActionId.split("@"),!e)return;const{dataAccessAction:t,noPrivDisplayMode:s,actionTarget:i,uiactionMode:a,uiactionTag:n}=e;this.dataAccessAction=t,1===s?this.noPermissionHidden=!1:6===s&&(this.visible=!1),(i&&"NONE"!==i||"SYS"===a&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0),this.isInit=!0}async calcPermission(e,t){if(!this.dataAccessAction)return;const s=await ibiz.hub.getApp(this.appId);this.appDeName&&t&&!t.includes(this.appDeName)&&ibiz.log.warn("".concat(this.uiActionId,"界面行为的实体").concat(this.appDeName,"和数据的实体").concat(t,"不一致")),this.permitted=await s.authority.calcByDataAccessAction(this.dataAccessAction,e,t)}async update(e,t){this.isInit||await this.init(),await this.calcPermission(e,t),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&!e):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),e("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((e=>e.visible))})}addState(e,t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t}),this.children.push(t)}setLoading(e){this.children.forEach((t=>{t.setLoading?t.setLoading(e):t.loading=!!e&&t.name===e}))}async update(e,t){await Promise.all(this.children.map((s=>s.update(e,t))))}}),e("QXEventEx",class extends m{constructor(){super(...arguments),this.anyEventFns=[]}onAll(e){this.anyEventFns.includes(e)||this.anyEventFns.push(e)}emit(e,...t){super.emit(e,...t),this.anyEventFns.forEach((s=>{s(e,...t)}))}async asyncEmit(e,...t){const s=super.asyncEmit(e,...t),i=this.anyEventFns.map((s=>s(e,...t))),a=Promise.all(i),n=await s,r=await a;return n.concat(...r)}reset(){super.reset(),I(this.anyEventFns)}})),zs=e("ControllerEvent",class{constructor(e){this.getBaseArgs=e,this.evt=new Us}async emit(e,t){await this.evt.asyncEmit(e,{...this.getBaseArgs(),eventName:e,...t||{}})}on(e,t){this.evt.on(e,t)}onAll(e){this.evt.onAll(e)}destroy(){this.getBaseArgs=void 0,this.evt.reset()}});var Gs="__self",js=e("BaseController",class{constructor(e,t,s,i){this.model=e,this.context=t,this.params=s,this.ctx=i,this.state={},this.name="",this.evt=new zs(this.getEventArgs.bind(this)),this.mountCounter=new ks(this.mounted.bind(this)),this.childNames=[],this.name=e.name||e.id,this.initState()}get _evt(){return this.evt}initState(){this.state.isCreated=!1,this.state.isMounted=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Gs),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(e=>{this.childNames.includes(e)&&this.mountCounter.enroll(e)})),this.ctx.evt.on("onRegister",((e,t)=>{this.childNames.includes(e)&&t.evt.on("onMounted",(()=>{this.mountCounter.attend(e)}))}))}async mountSelf(){this.mountCounter.registration.get(Gs)||this.mountCounter.attend(Gs)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(e){}getController(e,t=!1){return this.ctx.getController(e,t)}getTopView(){return this.ctx.getTopView()}listenNewController(e){this.ctx.evt.on("onRegister",e)}}),Xs=e("ViewController",class extends js{constructor(e,t,s,i){super(ibiz.util.layoutPanel.fill(e),a.create({},t),s||{},new Fs(i)),this.modal=new Te({}),this.providers={},this.engines=[],this.slotProps={},this.counters={},this.viewLoading=new Ss,this.isCloseView=!1,this._isActive=!0,i&&i.registerController(this.model.name,this),this.ctx.init(this),this.initEngines()}get _evt(){return this.evt}get parentView(){var e;return null==(e=this.ctx.parent)?void 0:e.view}get isActive(){return this._isActive}onActivated(){this._isActive=!0,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")激活"))}onDeactivated(){this._isActive=!1,ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")暂停"))}initEngines(){const e=ae(this.model);if(e.length)e.forEach((e=>{const t=ibiz.engine.getEngine(e,this);t&&this.engines.push(t)}));else{const e=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType},this);e&&this.engines.push(e)}}async initCounters(){const e=this.model.viewLayoutPanel,{appCounterRefs:t}=e;if(t&&t.length>0)try{await Promise.all(t.map((async e=>{const t=await qe.getCounterByRef(e,this.context);this.counters[e.id]=t})))}catch(e){console.error(e)}}initState(){super.initState(),this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async e=>{await this._evt.emit("onCloseView",{...e})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const e=this.model.viewLayoutPanel;this.childNames.push(e.name);const t=await kt(e);this.providers[e.name]=t;const s=se(this.model);s&&await Promise.all(s.map((async e=>{const t=await kt(e);this.providers[e.name||e.id]=t}))),await this.initCounters();const i=ie(this.model);i.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(i),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.evt.onAll(((e,t)=>{this.scheduler.triggerViewEvent(t)}))),this.engines.length&&await Promise.all(this.engines.map((e=>e.onCreated())))}async onMounted(){var e;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((e=>e.onMounted()))),null==(e=this.scheduler)||e.startTimerTrigger()}async onDestroyed(){await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((e=>e.onDestroyed()))),this.ctx.destroy(),this.context.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),ibiz.log.debug("视图[".concat(this.model.name,"](").concat(this.model.id,")销毁"))}handleContextParams(){this.context.srfappid=this.model.appId,"ROUTE"===this.modal.mode&&(this.context.srfsessionid=f());const e=this.model.appViewNavContexts;let t={};p(e)&&(t=z(e,this.context,this.params)),Object.assign(this.context,t);const s=this.model.appViewNavParams;let i={};p(s)&&(i=z(s,this.context,this.params)),Object.assign(this.params,i),this.state.isMounted&&this.callUIAction("Refresh")}async call(e,t){let s;for(const i of this.engines)if(s=await i.call(e,t),void 0!==s)break;return s}async callUIAction(e,s){const i=this.call(e,s);if(void 0===i)throw new t("没有引擎支持预置界面行为".concat(e));return i}async closeView(e={ok:!1,data:[]}){await this.modal.dismiss(e)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(e){this.layoutPanel=e,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}}),Ks=(e("MobViewController",class extends Xs{}),e("EditorController",class{constructor(e,t){this.placeHolder="",this.editorParams={},this.model=e,this.parent=t,this.context=t.context,this.params=t.params}get readonly(){return!!this.model.readOnly}async init(){await this.onInit()}async onInit(){this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((e=>{this.editorParams[e.toLowerCase()]=this.model.editorParams[e]}))}handlePublicParams(e,t,s){const{navigateContexts:i,navigateParams:a}=this.model;let n={};i&&e&&(n=z(i,t,s,e));const r=Object.assign(t.clone(),n);let o={};a&&e&&(o=z(a,t,s,e));return{context:r,params:{...s,...o}}}toObj(e){if(!e)return;return new Function("return (".concat(e,");"))()}toBoolean(e){return Object.is("true",e)}})),Hs=(e("CodeListEditorController",class extends Ks{async loadCodeList(e){const{context:t,params:i}=this.handlePublicParams(e,this.context,this.params);if(this.model.appCodeListId){const e=await ibiz.hub.getApp(this.context.srfappid);let s=[];return s=await e.codeList.get(this.model.appCodeListId,t,i),s}throw new s(this.model,"请配置代码表")}}),e("ControlController",class extends js{constructor(e,t,s,i){super(e,t,s,i),this.providers={},this.registerToCtx();const a=ibiz.util.layoutPanel.get("".concat(e.controlType,"_DEFAULT"));a&&(this.controlPanel=a)}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.isLoading=!1}async onCreated(){var e;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const e=await kt(this.controlPanel);this.providers[this.controlPanel.name]=e}(null==(e=this.model.controlLogics)?void 0:e.length)&&(this.scheduler=ibiz.scheduler.createControlScheduler(this.model.controlLogics),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}async onDestroyed(){await super.onDestroyed(),this.scheduler&&this.scheduler.destroy()}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}handlerAbilityParams(e){return{context:this.context.clone(),params:{...this.params},data:(null==e?void 0:e.data)||this.getData()||[]}}setLayoutPanel(e){this.layoutPanel=e,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}}));e("MDControlController",class extends Hs{get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0}setSort(e,t){this.state.sortQuery="".concat(e,",").concat(t)}async getFetchParams(e){const{curPage:t,size:s,sortQuery:i,noSort:a}=this.state,n={...this.params};return s&&(n.page=t-1,n.size=s),!a&&i&&(n.sort=i),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),e&&Object.assign(n,e),n}async load(e={}){const t=!0===e.isInitialLoad,s=!0===e.isLoadMore;t?this.state.curPage=1:s&&(this.state.curPage+=1);const{context:i}=this.handlerAbilityParams(e),a=await this.getFetchParams(null==e?void 0:e.params);let n;await this.startLoading();try{n=await this.service.fetch(i,a),"number"==typeof n.total&&(this.state.total=n.total)}finally{await this.endLoading()}return s?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(e,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:t}),this.state.items}async afterLoad(e,t){return t}async refresh(){await this.load({isInitialLoad:!1})}async remove(e){const{context:s,params:i,data:a}=this.handlerAbilityParams(e);if(!(null==a?void 0:a.length))throw new t("未选中数据");if(await ibiz.modal.confirm({title:"数据删除",desc:"确认删除数据?"})){await this.startLoading();try{const e=$(this.model.appDataEntityId);await Promise.allSettled(a.map((async t=>{if(0!==t.srfuf){const a=s.clone();a[e]=t.srfkey,await this.service.remove(a,i)}this.afterRemove(a)}))),ibiz.notification.success({desc:"数据[".concat(a.map((e=>e.srfmajortext)).join("、"),"]删除成功!")}),this.refresh()}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0)}}afterRemove(e){const t=this.state.items.findIndex((t=>t.srfkey===e.srfkey));this.state.items.splice(t,1)}getData(){return this.state.selectedData||[]}setActive(e){return this._evt.emit("onActive",{data:[e]})}setSelection(e){const{selectedData:t}=this.state;h(t,e)||(this.state.selectedData=e,this._evt.emit("onSelectionChange",{data:e}))}async onRowClick(e){const{selectedData:t}=this.state,s=t.filter((t=>t.srfkey!==e.srfkey));s.length===t.length?this.setSelection(this.state.singleSelect?[e]:t.concat([e])):this.setSelection(s),1===this.state.mdctrlActiveMode&&await this.setActive(e)}async onDbRowClick(e){2===this.state.mdctrlActiveMode&&await this.setActive(e)}async importData(){}async exportData(e){}})}}}));
|
|
2
2
|
//# sourceMappingURL=index.system.min.js.map
|