crabatool 1.0.13 → 1.0.18
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/.vscode/launch.json +17 -0
- package/{test/config.js → 8/craba.js} +41 -29
- package/8/package.json +17 -0
- package/8/readme.md +20 -0
- package/8/www/_Sys/UI/Grid/GridConfig.gspx +27 -0
- package/8/www/_Sys/UI/Grid/GridConfig.js +652 -0
- package/8/www/_Sys/UI/IFrame.gspx +7 -0
- package/8/www/_Sys/UI/IFrame.js +57 -0
- package/8/www/_Sys/UI/PanelConfig.gspx +55 -0
- package/8/www/_Sys/UI/PanelConfig.js +268 -0
- package/8/www/_Sys/UI/Print/ClientSelector.gspx +39 -0
- package/8/www/_Sys/UI/Print/ClientSelector.js +152 -0
- package/8/www/js/agency.js +2 -0
- package/8/www/js/craba.min.js +12 -0
- package/8/www/js/crabaEx.min.js +7 -0
- package/8/www/js/crabaNgp.js +1 -0
- package/8/www/js/echarts-all.js +1 -0
- package/8/www/js/math.min.js +10 -0
- package/8/www/skins/craba.min.css +174 -0
- package/8/www/skins/font/iconfont.eot +0 -0
- package/8/www/skins/font/iconfont.svg +1281 -0
- package/8/www/skins/font/iconfont.ttf +0 -0
- package/8/www/skins/font/iconfont.woff +0 -0
- package/8/www/skins/ui/icons/backTop.gif +0 -0
- package/8/www/skins/ui/icons/blank.gif +0 -0
- package/8/www/skins/ui/icons/browsers.jpg +0 -0
- package/8/www/skins/ui/icons/grid.png +0 -0
- package/8/www/skins/ui/icons/nodata.png +0 -0
- package/8/www/skins/ui/print/new.png +0 -0
- package/8/www/skins/ui/print/old.png +0 -0
- package/8/www/skins/ui/print/settings.gif +0 -0
- package/8/www/skins/ui/tree/first.gif +0 -0
- package/8/www/skins/ui/tree/firstNo.gif +0 -0
- package/8/www/skins/ui/tree/last.gif +0 -0
- package/8/www/skins/ui/tree/line.gif +0 -0
- package/8/www/skins/ui/tree/node.gif +0 -0
- package/8/www/skins/ui/tree/node0.gif +0 -0
- package/8/www/skins/ui/tree/none.gif +0 -0
- package/index.js +71 -28
- package/lib/config.js +19 -2
- package/lib/server.js +12 -10
- package/lib/utils.js +99 -21
- package/package.json +5 -3
- package/test/ngp.js +38 -3
- package/test/readme.md +10 -10
- package/test/test.js +38 -0
- package/tool/checkjs.js +93 -0
- package/{client → tool}/client.js +2 -2
- package/{merge → tool}/merge.js +11 -11
- package/{lib → tool}/ngptool.js +26 -26
- package/tool/progressbar.js +10 -6
- package/{lib → tool}/sockettool.js +9 -10
- package/tool/upgrade.js +121 -39
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.initMs=function(e){$settings.UseBigNumber=!0,$ms=function(){var r=function(e){e&&!e.endsWith("/")&&(e+="/"),this._url=e,this._requestInterceptor=null,this._responseInterceptor=null,this._enableShowWaiting=!0,this._isCallBackOnDisposed=$settings.IsCallbackOnDispose,this._reponseGlobalErrorInterceptor=null,$common._waitCounter===undefined&&($common._waitCounter=0)};r.prototype={getUrl:function(){return this._url?this._url:""},setUrl:function(e){this._url=e},setToken:function(e){localStorage.setItem("Authorization",e)},getToken:function(){return localStorage.getItem("Authorization")},setResponseInterceptor:function(e){this._responseInterceptor=e},set_isCallBackOnDisposed:function(e){this._isCallBackOnDisposed=e},getResponseInterceptor:function(e,t,r){return this._responseInterceptor},setReponseGlobalErrorInterceptor:function(e){this._reponseGlobalErrorInterceptor=e},getReponseGlobalErrorInterceptor:function(){return this._reponseGlobalErrorInterceptor},set_owner:function(e){this._owner=e},get_enableShowWaiting:function(){return this._enableShowWaiting},set_enableShowWaiting:function(e){this._enableShowWaiting=e},showWaiting:function(e,t){this._enableShowWaiting=!0,this._waitingText=t,this.set_owner(e),$common._waitCounter++},_showWaiting:function(){var e=this._owner;if(!($common._waitCounter<=0)&&this._waitingText){var t=null;if(e==window)t=window;else if(void 0!==e){if(Sys.UI.CustomForm.isInstanceOfType(e)&&e.get_isDisposed())return}$common.showWaiting(t,this._waitingText)}},hideWaiting:function(e){e&&clearTimeout(e),this.get_enableShowWaiting()&&$common._waitCounter>0&&($common._waitCounter--,$common._waitCounter<1&&$common.hideWaiting(!0)),this._setOwnerEnabled(!0)},_setOwnerEnabled:function(e){var t=this._owner;t&&t.set_enabled&&t.get_isDisposed&&!t.get_isDisposed()&&(t.set_enabled(e),e&&(this._owner=null))},_startWaitingTimer:function(){if(this._enableShowWaiting&&!$common.isWaiting()){var e=this;return setTimeout(function(){e._showWaiting()},$settings.WaitingTimerValue)}return null},_bindCustomHeader:function(e,t){if(e&&t&&"Object"!=typeof e)for(var r=Object.keys(e),n=0;n<r.length;n++){var o=r[n];t[o]=e[o]}},ajax:function(e){return this._convert(e),$common.ajax(e)},ajaxSync:function(e){return this._convert(e),$common.ajaxSync(e)},_convert:function(e){var t=e.url;$common.checkAlert(!t,"get_servcie().ajax必须传url参数"),e.router="ngp",e.waiting=e.waiting||this._waitingText,e.owner=e.owner||this._owner,e.form=e.form||this.action?this.action.get_form(!0):this._owner?this._owner.get_form(!0):null,e.dispose=e.dispose||this._isCallBackOnDisposed},get:function(e,t,r,n){if("function"==typeof t)r=t;else{e.indexOf("?")<0&&(e+="?");var o="";for(var i in t)o+="&"+i+"="+t[i];e+=o.length>0?o.substr(1):""}var a={url:e,type:"GET",headers:t?t.headers:null,async:!0,success:r,error:n};return this.ajax(a)},post:function(e,t,r,n){t&&"function"==typeof t&&(r=t,t={});var o={url:e,data:t,type:"POST",headers:t?t.headers:null,async:!0,success:r,error:n};return this.ajax(o)},customHeaders:function(){return{"content-type":"application/json"}},bindHeaders:function(e){e||(e={});for(var t=Object.keys(e),r=0;r<t.length;r++){if("content-type"==t[r].toLowerCase())return e}return e["Content-Type"]="application/json",e},apiHeaders:function(){return this.bindHeaders(this.customHeaders())}};var n={append:function(e,r){if(e&&r){if("function"!=typeof e)throw Error.invalidOperation("error: 被附加对象cl,请传入函数对象"+e);for(var n in e.prototype){if("function"==typeof t&&r[n]){var o="error: 不能追加已有的属性 "+n;throw Error.invalidOperation(o)}r[n]=e.prototype[n]}e.prototype=r}},getServerName:function(e){return e},getServerNameUrl:function(e,t,r){if(!t)return"~/"+e;if(t.startsWith("http"))return t+e;return $common.getPathParam(e,$settings.StaticVersionName)||t==$settings.cwModName?$craba.joinPath(n.getServerName(t,r),e):(e=$common.addUrlVersion(e,t),$craba.joinPath(n.getServerName(t,r),e))},injectBusinessControl:function(e,t){},getAPIServiceUrl:function(e){return e},getRealUrlAndServerName:function(e,t){n.interceptServerName&&(e=n.interceptServerName(e)),(e=e.replace(/\\/g,"/")).startsWith("/")&&(e=e.substring(1));var r=e.indexOf("/");if(r<0)throw new Error("请配置服务模块地址 "+e);var o=e.substring(0,r),i={url:e=e.substring(r),serverName:o};return $fc.inited?(n.loadServerInit({serverName:i.serverName,url:e}),i):i},loadServerInit:function(e){if(!$ms.router)return!0;var t=e.serverName;if(t.startsWith("http"))return!0;if(t===$settings.cwModName&&(t=$settings.cwjavaName||"cwjava"),n.initMap||(n.initMap={}),n.initMap[t])return!0;var r="/js/init.js";if(e.url&&"shell"!=t){if(e.url.indexOf(".gspx")<0)return!1;if(e.url==r)return!1}if(n.initMap[t]=!0,$ms.noInitServerNames&&Array.contains($ms.noInitServerNames,t))return!1;var o,i=$ms.router["ngp-skinName"]||"blueSky";if($skin.loadCss(n.getServerNameUrl("/skins/"+i+"/skin.css",t),t,function(){r=n.getServerNameUrl(r,t),$common.loadScript(r,function(){e.cb&&e.cb(e.businessName,e.businessData)},null,!0)},function(e,t){var r=new _Z_217(!1,t.get_json());o=r.get_message()},!0),o)throw n.initMap[t]=!1,Error.message(o);return!1},getBusinessInfo:function(e,t){var r=e,o={};if(e.startsWith("{")){if(e=e.replace(new RegExp("'","gm"),'"'),!(o=JSON.parse(e)).Name)throw new Error("采用json格式传递业务控件,请设置业务控件的Name");r=o.Name}var i=r.indexOf("."),a="";return i>=0&&(a=r.substr(0,i)),a?n.loadServerInit({serverName:a,cb:t,businessName:r,businessData:o})&&t&&t(r,o):t&&t(r,o),{business:r,serverName:a,businessData:o}},loadVersions:function(e){$common.ajax({url:"shell/version/get",router:"ngp",success:function(t){if(200!=t.code||!t.data)return console.error("初始化失败:"+t.message),void(e&&e());var r=t.data.versions?t.data.versions:[];$ms.financeConsole=t.data.financeConsole,$ms.financeCloudState=t.data.financeCloudState,$ms.crmProductId=t.data.crmProductId,$ms.crmProductName=t.data.crmProductName,null!=$ms.crmProductId&&46===$ms.crmProductId&&($ms.router["ngp-skinName"]="ngpfina"),Array.forEach(r,function(e){var t=e.projectArtifactId.split("-")[0];$ms._modList||($ms._modList=[]),$ms._modList.push(t),e.time&&$craba.addVersion({name:t,version:Date.strToDateTime(e.time).getTime()})}),e&&e()},error:function(t){console.error("拉取各模块的版本信息失败"),e&&e()}})},getLocalAndRemotePrinters:function(){var e=this.getLocalPrinters(),t=this.getRemotePrinters(),r=[];return Array.addRange(r,e),Array.addRange(r,t),r},getLocalPrinters:function(){var e=[];if($print.checkRun()){var t=this;$print.getLocalPrinters().forEach(function(r){var n=t._buildPrinterNameText(r.clientId,r.printerName,!1,!0,!0);n&&e.push(n)})}return e},getRemotePrinters:function(e){var t=[],r=$common.ajaxSync({url:"eprint/config/printer",type:"GET",router:"ngp"});if(!r||!r.code||200!=r.code)return t;var n=r.data;if(!n||0==n.length)return t;for(var o=0;o<n.length;o++){var i=n[o],a=i.clientId,s=i.printerName,u=i.printerAlias,c=i.useful,p=this._buildPrinterNameText(a,s,u,!1,c);p&&t.push(p)}return t},_buildPrinterNameText:function(e,t,r,n,o){if(Object.isUndefinedOrNull(e)||!t)return null;var i={};i.clientId=e?e+"|"+t:t,n||(i.clientId+="|");var a=r||t;return a+=n?"(本地)":"(远程)",a+=o?"(在线)":"(离线)",i.printerName=a,i.enable=!!o,i}};(function(){var e=_Z_277.prototype.checkConfig;_Z_277.prototype.checkConfig=function(t,r,n,o){if(o){var i=o.getBaseForm().get_action(!0);if(i&&Object.getTypeName(i).startsWith($settings.cwDefaultName))return!1}return e.apply(this,arguments)};var t=Sys.UI.PageAction.prototype.get_service;Sys.UI.PageAction.prototype.get_service=function(){var e=Object.getTypeName(this);if(e.startsWith($settings.cwDefaultName))return t.apply(this,arguments);var o=n.getServerName(e);n.getAPIServiceUrl&&(o=n.getAPIServiceUrl(o)),o&&!o.endsWith("/")&&(o+="/");var i=new r(o);return i.action=this,i};var o=Craba.UI.Page.prototype.set_actionType;Craba.UI.Page.prototype.set_actionType=function(e){if(!e)return o.apply(this,[e]);if((e=e.trim()).startsWith($settings.cwDefaultName))return o.apply(this,arguments);var t=e.split(","),r=[];r.push(t[0]);var i=this.Context.scriptPath;i||(i="");var a="";i.toLowerCase().startsWith("http")||(a=n.getRealUrlAndServerName(i));for(var s=1;s<t.length;s++){var u=t[s].trim(),c=n.getRealUrlAndServerName(u);a&&a.serverName!=c.serverName?u.startsWith("/")||(u="/"+u):u=c.url,r.push(n.getServerNameUrl(u,c.serverName))}e=r.join(","),o.apply(this,[e])};var i=Craba.UI.Page.prototype.initActionType;Craba.UI.Page.prototype.initActionType=function(){if(this._actionType&&this._actionType.startsWith($settings.cwDefaultName)){var e=$settings.cwModName;this.host&&(e=this.host=$craba.joinPath(this.host,e));var t=this.Context.scriptIncludePath.trim();this.Context.scriptIncludePath=$craba.joinPath(e,t),this.Context.webMethodBasePath&&(this.Context.webMethodBasePath=$craba.joinPath(e,this.Context.webMethodBasePath))}i.apply(this,arguments)};var a=Sys.UI.CustomForm.prototype.convertUrl;Sys.UI.CustomForm.prototype.convertUrl=function(e){return e?e.trimStartChar("/").startsWith($settings.cwModName)?e:(e=a.apply(this,arguments),e=$common.convertCWURL(this,e)):e};var s=Sys.UI.CustomForm.prototype.doInit;Sys.UI.CustomForm.prototype.doInit=function(e){e&&!e._init?(e._init=!0,e._path=$common.convertCWURL(this,e._path),e._path.startsWith($settings.cwModName)?(e._enableUnsafeHeader=!0,this.modName=$settings.cwModName):this.modName=""):this.modName="",s.apply(this,arguments)};var u=_Z_59.prototype.addUrlVersion;_Z_59.prototype.addUrlVersion=function(e,t){if($settings.cwModName){if(t==$settings.cwModName)return e;if(!e)return e;if(e.indexOf("/"+$settings.cwModName+"/")>1)return e}return u.apply(this,arguments)};var c=_Z_59.prototype.loadScript;_Z_59.prototype.loadScript=function(){var e=arguments[0];if("object"==typeof e&&e.form){form=e.form;var t=e.srcs;"string"==typeof t&&(t=t.split(",")),t.forEach(function(e,r){e=$common.convertCWURL(form,e),t[r]=e}),e.srcs=t}return c.apply(this,arguments)},$common.convertCWURL=function(e,t){if(!e)return t;if(!t||t.startsWith("http"))return t;var r=e.get_action(!0);return r||(r=e.getBaseForm().get_action(!0)),r&&Object.getTypeName(r).startsWith($settings.cwDefaultName)&&((t=t.trimStartChar("~").trimStartChar("/")).startsWith($settings.cwModName)||(t=$craba.joinPath($settings.cwModName,t))),t},Craba.UI.ReportAction.prototype.typeName=function(){var e=this.get_rootPage();return e.actionType&&e.actionType.startsWith($settings.cwDefaultName)?this._useService?"ReportPrintService":"ReportPrintClound":this._useWebTool?"ReportPrintWeb":this._useService?"ReportPrintService":"ReportPrintClound"};var p=Sys.Net.WebServiceProxy.prototype._getPath;Sys.Net.WebServiceProxy.prototype._getPath=function(){var e=p.apply(this,arguments);return e.trimStartChar("/").startsWith("Craba.Web")&&$settings.cwModName&&(e=$craba.joinPath($settings.cwModName,e),this._enableUnsafeHeader=!0),e},_Z_100.prototype.get_dataUrl=function(e){if(this._dataUrl)return this._dataUrl;if(!e)return null;var t=e.get_service().get_path(),r=n.getRealUrlAndServerName(t);return $craba.joinPath(n.getServerNameUrl(r.url,r.serverName,!0),"GetPagerData")};var l=Sys.UI.Form.prototype.showModal;Sys.UI.Form.prototype.showModal=function(e,t){if(e){e=this._parentForm?this._parentForm.convertUrl(e,!0):$common.convertCWURL(this,e);var r=n.getRealUrlAndServerName(e);l.apply(this,[n.getServerNameUrl(r.url,r.serverName),t])}else l.apply(this)};var f=_Z_59.prototype.showModalDialog;_Z_59.prototype.showModalDialog=function(e,t,r,o){if(e){var i=n.getRealUrlAndServerName(e);f.apply(this,[n.getServerNameUrl(i.url,i.serverName),t,r,o])}};var g=_Z_59.prototype.showDialog;_Z_59.prototype.showDialog=function(e,t,r,o,i){if(e){var a=n.getRealUrlAndServerName(e);g.apply(this,[n.getServerNameUrl(a.url,a.serverName),t,r,o,i])}};var m=_Z_59.prototype.showPage;_Z_59.prototype.showPage=function(e,t,r,o,i){if(t){var a=e.findForm();a&&(t=a.convertUrl(t,!0));var s=n.getRealUrlAndServerName(t);return m.apply(this,[e,n.getServerNameUrl(s.url,s.serverName),r,o,i])}};var h=_Z_59.prototype.ajax;_Z_59.prototype.ajax=function(e){if("ngp"!=e.router)return h.apply(this,arguments);var t=e.url;if(t.indexOf("://")<0){var r=n.getRealUrlAndServerName(t);e.url=n.getServerNameUrl(r.url,r.serverName,!0),e.responseInterceptor=function(e){var t=e,n=$common.getMSAPI().getResponseInterceptor(r.serverName,r.url,e);return n&&(t=n(e)),t}}return h.apply(this,[e])},_Z_59.prototype.getMSAPI=function(){return this._msAPI?this._msAPI:this._msAPI=new r},_Z_59.prototype.getSysUIBaseURI=function(e){return $getRootURI()+this.getSysUIPath(e)};var d=_Z_91.prototype.doShowStartPage;_Z_91.prototype.doShowStartPage=function(){if(this._showPage){if(this._showPage.startsWith("http")){var e=$common.getUrlHost(this._showPage);this._showPage=this._showPage.trimStartChar(e)}var t=n.getRealUrlAndServerName(this._showPage);this._showPage=n.getServerNameUrl(t.url,t.serverName)}d.apply(this)};var v=Sys.UI.Controls.TabPage.prototype._initFrozenPage;Sys.UI.Controls.TabPage.prototype._initFrozenPage=function(){if(this._cacheInfo){var e=this._cacheInfo.url;if(e.startsWith("http")){var t=$common.getUrlHost(e);e=e.replace(t,"");var r=n.getRealUrlAndServerName(e);this._cacheInfo.url=n.getServerNameUrl(r.url,r.serverName,!0)}v.apply(this,arguments)}},_Z_233.prototype.set_business=function(e){e&&("object"==typeof e&&(e=JSON.stringify(e)),this._business=e.trim())},_Z_233.prototype.get_business=function(){return this._business};var _=_Z_233.prototype.endUpdate;_Z_233.prototype.endUpdate=function(){_.apply(this);var e=this.findForm();if(n.injectBusinessControl&&e&&this.get_business()&&e.get_action()){var t=this;n.getBusinessInfo(this.get_business(),function(r,o){n.injectBusinessControl.apply(t,[r,e.get_action(),o])})}},Craba.UI.Image.prototype.set_serverName=function(e){this.serverName=e},Sys.UI.Controls.Image.set_serverName=function(e){this.serverName=e},Sys.UI.Controls.Image.get_serverName=function(){return this.serverName};var y=Sys.UI.Controls.FileUpload.prototype.set_webMethodPath;Sys.UI.Controls.FileUpload.prototype.set_webMethodPath=function(e){var t=n.getRealUrlAndServerName(e);e=n.getServerNameUrl(t.url,t.serverName,!0),y.apply(this,[e])};var b=Sys.UI.Controls.Column.prototype._initEditorControl;Sys.UI.Controls.Column.prototype._initEditorControl=function(e){b.apply(this,[e]);var t=this.findForm(),r=this.get_control(),o=this.get_business();t&&r&&o&&!r[o]&&t.get_action()&&n.getBusinessInfo(this.get_business(),function(e,o){n.injectBusinessControl.apply(r,[e,t.get_action(),o])})};var w=_Z_1.prototype._getData;_Z_1.prototype._getData=function(e,t,r,n,o,i){var a=this._form;if(a){var s=a.get_action(!0);if(s&&Object.getTypeName(s).startsWith($settings.cwDefaultName))return w.apply(this,arguments)}return{refresh:null!=t,pageSize:i,pageIndex:o/i+1,sorts:r,filter:n,queryParams:t}};var N=_Z_1.prototype._todoData;_Z_1.prototype._todoData=function(e,t){N.apply(this,[e,t]),e&&("object"!=typeof e.queryParams&&(e.queryParams={}),delete e.queryParams.gridFilter,e.filter&&e.filter.items&&(e.queryParams.gridFilter=e.filter.items),delete e.filter)};var S=Sys.Net.WebRequest.prototype.get_headers;Sys.Net.WebRequest.prototype.get_headers=function(){if(this._setedHeaders)return S.apply(this,[]);var e=(new r).apiHeaders();return e&&this._headers&&(Object.copyTo(e,this._headers),this._setedHeaders=!0),S.apply(this,[])};var I=Sys.Net.WebRequest._resolveUrl;Sys.Net.WebRequest._resolveUrl=function(e,t){if(e.indexOf("//")>=0)return e;var r=n.getRealUrlAndServerName(e);e=n.getServerNameUrl(r.url,r.serverName);var o=I.apply(this,[e,t]);if(e.indexOf("://")>=0)return o;if((o=o.substr(0,o.indexOf(e))).indexOf("/")>=0){var i=o.indexOf("://"),a=o.substr(0,i);(i=(o=o.substr(i+3)).indexOf("/"))>=0&&(o=o.substr(0,i)),o=a+"://"+o}return $craba.joinPath(o,e)},Sys.Net.PageRequest.prototype._resolveBody=function(e){var t=e.url;t.startsWith("/"+$settings.cwModName+"/")||t.startsWith($settings.cwModName+"/")||t.indexOf("/"+$settings.cwModName+"/")>-1||(e.body=null)};var P=_Z_100.prototype.appendCookie;_Z_100.prototype.appendCookie=function(e){var t=(new r).apiHeaders();e.headers=t,e.headers&&(e.headers.reporting=!0),P.apply(this,[e])};var $=_Z_100.prototype.set_dataUrl;_Z_100.prototype.set_dataUrl=function(e){if(e){var t=n.getRealUrlAndServerName(e);e.toLocaleLowerCase().trim().startsWith("http")||(e=n.getServerNameUrl(t.url,t.serverName,!0)).toLocaleLowerCase().trim().startsWith("http")||(e.startsWith("/")||(e="/"+e),e=$common.getHostUrl()+e)}$.apply(this,[e])};var C=_Z_100.prototype._buildDetailParams;_Z_100.prototype._buildDetailParams=function(e,t,r,n,o){var i=C.apply(this,arguments),a=i.queryParams;return n||((a=t.get_queryParams())||(a={}),o.fullDataMode=!0,i.queryParams=a),t._lastFilter&&t._lastFilter.items&&(a.gridFilter=t._lastFilter.items),i.pageIndex=0,i.pageSize=0,i.reporting=!0,i.sorts=t.getLastSort(),i},_Z_4.prototype._JsonSerialize=function(e){return"string"==typeof e?e:JSON.stringify(e)},_Z_140.prototype.customResolveProp=function(e,t){if(("enabled"==e||"visible"==e||"rightIconVisible"==e)&&t.indexOf&&t.indexOf(".")>=0&&!t.trim().startsWith("$")){if(t.indexOf(".")<0)throw new Error("请指定"+e+'="'+t+'"的模块名称【key='+e+"】");t=!!n.getPower&&n.getPower(t)}return t};var U=Sys.UI.Controls._MDIChild.prototype.set_caption;Sys.UI.Controls._MDIChild.prototype.set_caption=function(e,t){!t&&this._isSetCaption&&this.get_isLoading()||t&&this._isSetCaption&&this._clickMenuItem||(t&&(this._clickMenuItem=!Object.isUndefinedOrNull($craba._curMenuItem),this._isSetCaption=!0),U.apply(this,arguments))};var j=Craba.UI.Page.prototype.getCrabaResourceUrl;Craba.UI.Page.prototype.getCrabaResourceUrl=function(e){if(this.page){var t=this.page.actionType;if(t){if(t.startsWith($settings.cwDefaultName))return e=$settings.cwModName+$craba.joinPath("/R.axd?v="+this.Context.version+"&r=aprac",e),$common.addUrlVersion(e,$settings.cwjavaName)}else t=this.page.xmlNode.Attributes.ActionType;return e.includes("echarts-all.js")&&(t="shell"),$craba.joinPath(n.getServerName(t),e)}return j.apply(this,[e])};var R=Craba.UI.Page.prototype.convertUrl;Craba.UI.Page.prototype.convertUrl=function(e,t){if(!(e=R.apply(this,[e])))return e;if(e.startsWith("http"))return e;if(this.page&&this.page.actionType&&this.page.actionType.startsWith($settings.cwDefaultName))return $craba.joinPath($settings.cwModName,e);if(!t)return e;if(e.indexOf("/")<0)return e;var r=n.getRealUrlAndServerName(e);return e=n.getServerNameUrl(r.url,r.serverName,!0)};var x=Sys.UI.CustomForm.prototype.saveData;Sys.UI.CustomForm.prototype.saveData=function(e){var t=x.apply(this,[e]),r=this._controls;if(!r)return t;for(var n=0;n<r.length;n++){var o=r[n];if(o.get_business&&o.get_business()&&o[o.get_business()]&&(u=o[o.get_business()])&&u.bindData&&u.bindData(t),"Sys.UI.Controls.Grid"==Object.getTypeName(o))for(var i=o.get_columns(),a=0;a<i.length;a++){var s=i[a];if(s.get_business&&s.get_business()&&s[s.get_business()]){var u=s[s.get_business()];u&&u.bindData&&u.bindData(t)}}}return t};var W=Sys.UI.Controls.ImageColumn.prototype.initialize;Sys.UI.Controls.ImageColumn.prototype.initialize=function(){W.apply(this,arguments);var e=$settings.ImageColumnImageSrc;if(e==this._imageUrl&&e&&!e.startsWith("http")){var t=n.getRealUrlAndServerName(e);this._imageUrl=n.getServerNameUrl(t.url,t.serverName,!0)}},_Z_282.prototype._checkRemotePrint=function(e,t){if(this._clientId=null,"Print"!=e)return!1;var r=this._getProp("_printerName");if(!r)return!1;var n=r.split("|");if(n.length<2)return!1;var o=n[0],i=n[1];if(!o||!o.match(/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/gi))return this._setProp("_printerName",i),!1;var a=$print.getVersion();if(a&&$print._compareVersion(a,"1.2.0.6")>=0){var s=$print.getLocalPrinters();if(s.length>0&&s[0].clientId==o)return this._setProp("_printerName",i),!1}return this._clientId=o,this._printerName=i,this._checkOnline(t),!0},_Z_282.prototype._checkOnline=function(e){var t=this;$common.ajax({url:"/eprint/config/check/online",data:{clientId:this._clientId,printerName:this._printerName},waiting:"请稍等,正检查打印机是否在线",router:"ngp",success:function(r){200!=r.code||1!=r.data?t.printEnd(String.format("打印失败!{0}","打印机不在线,请重新选择打印机再试。"),"alertError"):e.apply(t)},error:function(e){t.printEnd(String.format("打印失败!{0}",e?e.message:"打印机不在线"),"alertError")}})};var E=_Z_282.prototype.doRequestPrint;_Z_282.prototype.doRequestPrint=function(e,t){if("Print"!=e)return!1;if(!this._clientId)return E.apply(this,arguments),!0;t.clientId=this._clientId,t.params.printerName=this._printerName;var r=this;return $common.ajax({url:"/eprint/action/print",data:t,router:"ngp",success:function(e){200==e.code?(r.printing=!0,r.showProgress(e.data.jobId),r.timer=setTimeout(function(){r.timer=null,r.printEnd("温馨提示:系统"+$settings.RemotePrintWaitingTime+"秒还没获取到打印结果,请检查打印机是否在工作状态","showWarn")},1e3*$settings.RemotePrintWaitingTime)):r.printEnd("远程打印失败:"+e.message,"alertError")},error:function(e){r.printEnd("打印失败!请重新选择打印机再试","alertError")}}),!0},_Z_282.prototype.clearTimer=function(){this.timer&&(clearTimeout(this.timer),delete this.timer)},_Z_282.prototype.printEnd=function(e,t){this.printing=!1,this.clearTimer(),$common.hideProgress(),this._target.doAfterExecute&&this._target.doAfterExecute.apply(this._target),$common[t].apply($common,[e])},_Z_282.prototype.showProgress=function(e){if(this.printing){var t=$common.showProgress({className:"ValueFloat",opacity:50});t.set_value(Math.min(t.get_value()+10,99)),t.set_text("远程打印进度");var r=this,n="/eprint/config/job/get/"+e;return $common.ajax({url:n,type:"get",router:"ngp",success:function(n){if(200==n.code)if(3==n.data.status)r.printEnd("远程打印成功","showOk");else if(10==n.data.status)r.printEnd("远程打印失败,远程打印机执行异常:"+n.data.comment,"alertError");else{var o=t.get_value()+Math.floor(20*Math.random())+5;t.set_value(Math.min(o,99)),setTimeout(function(){r.showProgress(e)},1e3)}else r.printEnd("远程打印失败:"+n.message,"alertError")},error:function(e){r.printEnd("获取打印进度失败,请检查是否完成打印。","alertError")}}),!0}},$craba._getPageInternalId=function(e){if($ms.router&&$ms.router.crabaConfigConvertNames&&$ms.router.crabaConfigConvertNames.length>0){var t=e.split("/"),r=t[1];$ms.router.crabaConfigConvertNames.includes(r)&&(t.splice(1,1),e=t.join("/"))}return $craba.getHashCode(e)}}).call(n);var o={loadVersions:function(e){n.loadVersions(e)},getLocalAndRemotePrinters:function(){return n.getLocalAndRemotePrinters()},getRemotePrinters:function(){return n.getRemotePrinters()},getLocalPrinters:function(e){return n.getLocalPrinters(e)},get_service:function(){return $common.getMSAPI()},get_url:function(e,t){var r=n.getRealUrlAndServerName(e);return e=n.getServerNameUrl(r.url,r.serverName,t)},getPower:function(e){return!!n.getPower&&n.getPower(e)}},i=e(o);return i&&("function"==typeof i.apiHeaders&&(!0,r.prototype.customHeaders=i.apiHeaders),"function"==typeof i.responseInterceptor&&(r.prototype.getResponseInterceptor=i.responseInterceptor),"function"==typeof i.globalErrorInterceptor&&(r.prototype.getReponseGlobalErrorInterceptor=i.globalErrorInterceptor),"function"==typeof i.serverName&&(n.getServerName=i.serverName),"function"==typeof i.interceptServerName&&(n.interceptServerName=i.interceptServerName),"function"==typeof i.injectBusinessControl&&(n.injectBusinessControl=i.injectBusinessControl),"function"==typeof i.getAPIServiceUrl&&(n.getAPIServiceUrl=i.getAPIServiceUrl),"function"==typeof i.getSaveGridConfigUrl&&(n.getSaveGridConfigUrl=i.getSaveGridConfigUrl),"function"==typeof i.getPower&&(n.getPower=i.getPower)),o}()},$settings.GspxResolveCache=!0,initMs(function(e){function t(e){return e?"string"==typeof e?e.split(".")[0]:e.constructor.__typeName.split(".")[0]:""}if(e){var r={forEach:function(e,t){if(e){var r=typeof e;if("function"==r)return e;if("string"==r){for(o=0;o<e.length&&!t(e.substr(o,1),o);o++);return e}if("object"==r){if(e.length===undefined)for(var n=Object.keys(e),o=0;o<n.length&&!t(n[o],o);o++);else for(o=0;o<e.length&&!t(e[o],o);o++);return e}return e}}};r.forEach(r,function(t){e[t]=r[t]}),e.setBusinessControlFullNameFun=function(t,r){if("function"!=typeof r)throw new Error("第二个参数getBusinessControlFullFun(传入业务控件名称)必须是一个返回字符串的函数");e.businessFun||(e.businessFun={}),e.businessFun[t]=r};var n={};e.ngpConfig={unlockConfig:function(e){delete n[e]},saveConfig:function(e,t){var r=this["_"+e];if(e&&e.indexOf(".")>=0)throw new Error("暂不支持带.的配置保存");if(!r)throw new Error("未指定"+e+"对应的保存地址");if(200!=(t=$common.ajaxSync({url:r,data:t,router:"ngp"})).code){var n=t.message?t.message:"保存配置出错,请重试";throw Error.abort(n)}$ms.ngpConfig[e]=t},setConfig:function(t,r,o,i,a,s){if(!r)throw new Error("请配置"+t+"的请求地址!");if(n[t])console.log("重复加载"+t);else{this["_"+t]=s;var u=t.split(".");if(u.length>1&&"."==u[u.length-1])throw new Error("【"+u+"】 最后一位不能是.");for(var c=e.ngpConfig,p=0;p<u.length-1;p++){var l=u[p];c[l]||(c[l]={}),c=c[l]}var f=u.length>0&&u[u.length-1]?u[u.length-1]:t,g=r,m=$common.ajaxSync({url:g,data:o,router:"ngp"});if(200!=m.code){var h=m.message?m.message:"账号登录异常,请联系管理员处理";throw Error.abort(h)}if(n[t]=m.data,!c[f]){var d=t;Object.defineProperty(c,f,{configurable:!1,enumerable:!1,get:function(){return n&&n[d]?n[d]:i||{}}})}a&&a(c[f])}}},e.bus=function(){var e={};return{add:function(t,r){if("function"!=typeof r)throw new Error("总线通知第二个参数当前只支持传入函数");var n=e[t];n||(e[t]=[],n=e[t]),n.push(r)},notifyOnce:function(t,r){if(e[t]){for(var n=e[t],o=0;o<n.length;o++){(0,n[o])(r)}delete e[t]}}}}(),e.register={businessControl:function(e,t,r){if(!e)throw new Error("请先设置业务控件的名");e=e.trim(),t?"string"!=typeof t&&(r=t,t="Sys.Control.BusinessControl"):t="Sys.Control.BusinessControl";var n="%s=function(){%s.initializeBase(this);};%s.prototype = {};%s.registerClass('%s', "+t+"); return %s;",o=new Function(n.replaceAll("%s",e))();$craba.copyPrototype(r,o)}},e.power={};var o={};e.create=function(e,t,r){function n(t){if(!t||t.length<=0)setTimeout(function(){for(var t=0;t<o[e].loadedTask.length;t++){var r=o[e].loadedTask[t];r.cb&&r.cb.apply(r.cb,r.params)}delete o[e].loadedTask});else{var r=t.splice(0,1)[0];0==r.trim().length?n(t):$common.loadScript(r,function(){n(t)},null,!0)}}if(!e)throw new Error("模块名不能为空");if(o[e])throw new Error("重复定义模块名称"+e);return o[e]={loadedTask:[]},"string"==typeof t&&setTimeout(function(){n(t.split(","))}),r},e.setResponseInterceptorFun=function(t,r){if("function"!=typeof r)throw new Error("第二个参数getResponseInterceptorFun(传入API拦截器)必须是一个的函数");e.responseInterceptor||(e.responseInterceptor={}),e.responseInterceptor[t]=r};var i=e;return{apiHeaders:function(){if(!i.router)return{};var e=i.router,t=e.debugMs,r={};return r=t?{"ngp-authorization":e["ngp-authorization"],"ngp-router":JSON.stringify({profileId:t.profileId,employeeId:t.employeeId,serverId:t.serverId,deloyId:t.deloyId,deploy:t.deploy,productId:t.productId,adminStatus:!!($ms.ngpConfig&&$ms.ngpConfig.Sys&&$ms.ngpConfig.Sys.userInfo)&&$ms.ngpConfig.Sys.userInfo.isadmin,routes:t.routes}),isdebug:!0}:{"ngp-authorization":e["ngp-authorization"],"ngp-router":e["ngp-router"]},$ms.server&&(r["ngp-debug-router"]=JSON.stringify($ms.server)),r},serverName:function(e,r){var n=i.router;if(!n)return e.indexOf(".")>=0&&(e=e.substr(0,e.indexOf("."))),e;var o=n.debugMs,a=t(e);return o?a.startsWith(o.aloneDeploy)?r?$craba.joinPath(o.aloneServer,a):$craba.joinPath($common.getHostUrl(),a):o.gateway?$craba.joinPath(o.gateway,a):$craba.joinPath($common.getHostUrl(),a):$craba.joinPath($common.getHostUrl(),a)},injectBusinessControl:function(e,r,n){var a=e.split("."),s=e.indexOf(".");s>=0?(a=e.substr(0,s),e=e.substr(s+1)):a=t(r);var u=i.businessFun?i.businessFun[a]:"";if(u&&"function"==typeof u){var c=u(e);if(c)if(evil2(c))this[e]=evil2("new "+c+"();"),this[e].bindActionAndControl(r,this,n);else if(o[a]&&o[a].loadedTask){var p={params:[e,c,r,this],cb:function(e,t,r,o){o[e]=evil2("new "+t+"();"),o[e].bindActionAndControl(r,o,n)}};o[a].loadedTask.push(p)}}else console.log("未设置服务"+a+"对应的【业务控件全名获取】方法/r/n请调用$ms.setBusinessControlFullNameFun("+a+", function(business){return ***.business});")},getAPIServiceUrl:function(e){return!e&&i&&i.router&&i.router.debugMs&&i.router.debugMs.aloneDeploy?i.router.debugMs.aloneServer+"/":(e&&i&&i.router&&i.router.debugMs&&(i.router.debugMs.aloneServer&&e==i.router.debugMs.aloneDeploy?e=i.router.debugMs.aloneServer+"/"+e+"/":i.router.debugMs.gateway?e=i.router.debugMs.gateway+"/"+e+"/":console.log("调试模式下,未设置gateway地址")),e)},responseInterceptor:function(e,t,r){if(t&&t.indexOf("pm/getMenu")>=0&&r&&"200"==r.code){var n=r.data.permissions,o={};i.power=$ms.power={};for(var a=0;a<n.length;a++){var s=n[a],u=s.serverKey.split(".")[0],c=i.power[u];c||(o[u]={},Object.defineProperty(i.power,u,{configurable:!1,enumerable:!1,writable:!1,value:o[u]}),c=o[u]),c[s.serverKey]||Object.defineProperty(c,s.serverKey,{configurable:!1,enumerable:!1,writable:!1,value:{name:s.name,value:s.value,msg:s.msg}})}}if(i.responseInterceptor)return i.responseInterceptor[e]},getPower:function(e){var t=e.indexOf(".");if(t<=0)throw new Error("权限获取格式必须是:模块名.关键字");var r=e.substr(0,t);if(!e.substr(t+1))throw new Error("权限key不能为空");return!!(i.power[r]&&i.power[r][e]&&i.power[r][e].value)},interceptServerName:function(e){if(!e)return e;var t="shell";window.__rootRouter&&(t=window.__rootRouter);var r=e.indexOf("_Sys/UI/");return r>=0&&e.indexOf(t+"/_Sys/UI/")<0&&(e=e.substr(r),e=$craba.joinPath(t,e)),e}}}}),$ms.appendFunToMainAction=function(e,t){var r=Sys.Application._forms;if(0==r.length)throw new Error("未找到页面");var n=r[0].get_action();if(!n)throw new Error("未找到页面对应的action");if(!n[e])throw new Error(n+"已定义方法"+e);n[e]=t},delete window.initMs;Sys.UI.PageAction.prototype.get_businessModel=function(){return this.$businessModel||(this.$businessModel=new Sys.Control.BusinessModel(this)),this.$businessModel},Type.registerNamespace("Sys.Control"),Sys.Control.BusinessModel=function(t){this.action=t,t.$businessControls||(t.$businessControls=[])},Sys.Control.BusinessModel.prototype={bus:function(t,s,n,e){var i=t,o={};if(!this.action)return o;var r=this.action.get_root(),l=r.$businessControls;if(!l)return o;e=e&&e.length&&"string"!=typeof e?e:[];for(var c=r.get_form(),h=0;h<e.length;h++){var a=e[h];if(c[a]){var u=c[a];if(u&&u.get_visible())if(u.get_business()){if((g=u[this._getBusinessName(u.get_business())])[i]&&!1===g[i](s,n,o))return o}else console.log("未验证控件"+a)}}for(var d=0;d<l.length;d++){var g=l[d];if(g[i]&&(g.control&&g.control.get_visible())){if(g.control){var _=g.control.get_id();if(e.indexOf(_)>=0)continue}if(!1===g[i](s,n,o))return o}}return o},_findControl:function(t,s,n){if(!s)return null;var e=s[t],i=t.indexOf(".");if(i<0)return!e&&n&&s.get_isChildForm()?this._findControl(t.substring(i+1),s.get_parentForm(),!1):e;var o=t.split("."),r=s[o[0]];return r?(Sys.UI.CustomForm.isInstanceOfType(r)?e=this._findControl(t.substring(i+1),r,!1):Sys.UI.Controls.Grid.isInstanceOfType(r)&&(e=r.findColumn(o[1])),e):void 0},_getBusinessName:function(t){try{return t=t.replaceAll("'",'"'),JSON.parse(t).Name}catch(s){return t}},limit:function(t,s,n){if(t)for(var e=this.action.get_form(),i=Object.keys(t),o=0;o<i.length;o++){var r=i[o],l=this._findControl(r,e,!0);if(l&&l.get_business()){var c=l[this._getBusinessName(l.get_business())];if(c){var h=c[t[r]];h&&h.apply(c,[s,n])}}}},registerToModel:function(t){this.action.$businessControls.push(t);var s=this.action.get_form();if(s&&s.get_isChildForm()){var n=s.get_parentForm();if(n){var e=n.get_action();e&&(e.$businessControls||(e.$businessControls=[]),e.$businessControls.push(t))}}}},Sys.Control.BusinessControl=function(){this.control=null,this.businessModel=null,this._bindedEvents={},this._actionEvents=[],this.businessData={}},Sys.Control.BusinessControl.prototype={bindActionAndControl:function(t,s,n){this.control=s,s._bizControl=this,this.businessModel=t.get_businessModel(),this.businessModel.registerToModel(this),this.businessData=n;var e=this.controlInfo?this.controlInfo():"";e&&(this._bindProperty(e.property),this._bindEvents(e.events))},disposing:function(){if(this._bindedEvents)for(var t=Object.keys(this._bindedEvents),s=0;s<t.length;s++){var n=t[s],e=this._bindedEvents[n];this.control.get_events().removeHandler(n,e)}var i=this.get_form().get_action(!0);i&&!i.get_isDisposed()&&this._actionEvents.forEach(function(t){delete i[t]}),this.control&&this.control.remove_disposing&&this.control.remove_disposing(this.disposing),this.control&&(this.control._allEvents=null),this.control=null,this.businessModel=null,this._bindedEvents=null},_bindProperty:function(t){if(this.control&&t)for(var s=Object.keys(t),n=0;n<s.length;n++){var e=s[n],i="set_"+e[0].toLocaleLowerCase()+e.substring(1);this.control[i]&&"function"==typeof this.control[i]&&this.control[i](t[e])}},_bindEvents:function(t){if(this.control&&t){this.control.add_disposing($createDelegate(this,this.disposing));var s=Object.keys(t);this.control._allEvents||(this.control._allEvents={});for(var n=["focus","change","blur","click"],e=0;e<s.length;e++){var i=s[e];if(!i.startsWith("On"))throw new Error("绑定事件请用On开头, 如OnClick");if(i.length<3)throw new Error("事件名称错误");var o=i.substring(2);o=o[0].toLocaleLowerCase()+o.substring(1),n.indexOf(o)>=0&&!Sys.UI.Controls.Column.isInstanceOfType(this.control)&&(o="_"+o);var r=this.get_form().get_action();if(this.control._allEvents[o])this.control.get_events().getHandler(o)||this.control.get_events().addHandler(o,this.control._allEvents[o]);else{if(this.control.get_column){var l=this.control.get_column();if(l&&l._allEvents[o]){this.control.get_events().getHandler(o)||this.control.get_events().addHandler(o,this.control._allEvents[o]);continue}}this.control.get_events().getHandler(o)||("function"==typeof t[i]?(this._bindedEvents[o]=$createDelegate(this,t[i]),this.control.get_events().addHandler(o,this._bindedEvents[o])):"function"==typeof r[t[i]]&&(this._bindedEvents[o]=$createDelegate(this,r[t[i]]),this.control.get_events().addHandler(o,this._bindedEvents[o])),this.control._allEvents[o]=this._bindedEvents[o])}}}},determine:function(t,s,n){return this.businessModel.limit(t,s,n)},notify:function(t,s,n,e){return this.businessModel.bus(t,s,n,e)},getEventPre:function(t){var s="$";if(this.control.get_grid&&this.control.get_grid()&&(s+=this.control.get_grid().get_id()+"$"),this.control.get_id()&&(s+=this.control.get_id()+"$"),this.control.get_dataField&&this.control.get_dataField()){var n=this.control.get_dataField();s+=(n=n.replace(/\./g,"_"))+"$"}return"_"+s+"_"+t},bindControlEvent:function(t){if(!this[t]||"function"!=typeof this[t])throw new Error(Object.getTypeName(this)+" 业务控件未找到方法 "+t);var s=this.get_form().get_action(),n=this.getEventPre(t);return s[n]?n:(s[n]=$createDelegate(this,t),this._actionEvents.push(n),n)},get_form:function(){return this.control?this.control.get_form():null},get_service:function(){var t=this.get_form();return t?t.get_action().get_service():null}},Sys.Control.BusinessControl.registerClass("Sys.Control.BusinessControl");
|