vesh-cli
Version:
码农村nodejs版本VESH框架脚手架搭建器
1 lines • 88 kB
JavaScript
window.console=console||{log:function(e){}},Array.prototype.forEach=Array.prototype.forEach||function(e){VJ.each(this,e,null,!0)},top.location==location?window.VJ=window.top.VJ||{load:!1,cross:!1}:window.VJ=window.VJ||{load:!1,cross:!0},VJ.load||function(V,$){V.load=!0,V.isValid=function(e){return void 0!==e&&null!=e&&"null"!=e&&!1!==e&&(e.replace&&0<e.replace(/\s/g,"").length||null==e.replace)},V.getValue=function(e,t){return V.isValid(e)?e:t},V.isDebug=!0,V.showException=function(e,t){V.isDebug&&(e=e,V.isValid(t)&&(e+="\r\nmessage:"+t.message+(t.stack?"\r\nstack:"+t.stack+(t.fileName?"\r\nfile:"+t.fileName:"")+(t.lineNumber?"\r\nlineNumber:"+t.lineNumber:""):t.description?"\r\ndescription:"+t.description:"")),console.log("未捕获异常:"+e+"\r\n"))};var showException2=function(e){V.showException("",e)};V.tryC=function(e,n){n=n||showException2;try{return e()}catch(t){try{n(t)}catch(e){showException2(t)}return!1}},V.tryC2=function(e,t,n){return e?(n||showException2)(e):V.tryC(t,n)};var start=null,funrep1=function(e,t){return e.replace(/<%=[^(%>)]+%>/gi,function(e){e=e.replace(/<%=/g,"").replace(/%>/g,"");return V.isValid(t[e])?t[e]:""})},funrep2=function(e,t){return e.replace(/\{[^(})]+\}/gi,function(e){e=e.replace(/\{/g,"").replace(/\}/g,"");return V.isValid(t[e])?t[e]:""})};V.format=function(e,t){return e&&t?(e.indexOf(!1)&&(e=funrep1(e,t)),e.indexOf(!1)&&(e=funrep2(e,t)),e):V.getValue(e,"")};var sb=function(){var t=this;t.data=[],t._length=0,t._append=function(e){t.data.push(e),t._length+=e.length}};sb.prototype.append=function(e){return e=e?this._append(e):"",this},sb.prototype.appendFormat=function(e,t){return this.append(V.format(e,t))},sb.prototype.insert=function(e,t){var n=this.toString();return t=t||"",this.data=[n.substr(0,e),t,n.substr(e)],this._length=n.length+t.length,this},sb.prototype.insertFormat=function(e,t,n){return this.insert(e,V.format(t,n))},sb.prototype.remove=function(e,t){var n=this.toString();return this.data=[n.substr(0,e),n.substr(e+t)],this._length=Math.max(0,n.length-t),this},sb.prototype.toString=function(){return this.data=[this.data.join("")],this.data[0]},sb.prototype.clear=function(){var e=this.toString();return this.data=[],this._length=0,e},sb.prototype.length=function(){return this._length},V.sb=function(){return new sb},V.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},V.once=function(e,t){t=t||1,e.timeoutID&&window.clearTimeout(e.timeoutID),e.timeoutID=window.setTimeout(function(){V.tryC(e)},t)};var emptyfunc=function(){return!1},syncfunc=function(e,t,n,a){for(;a;){try{t(a)}catch(e){showException2(e)}a=e()}try{n&&n()}catch(e){showException2(e)}},asyncfunc=function(t,n,a,o){V.once(function(){var e=o?{func:n,val:t(),next:asyncfunc}:{func:a||emptyfunc,next:emptyfunc};try{e.func(o)}catch(e){showException2(e)}e.next(t,n,a,e.val)})};V.whileC=function(e,t,n,a){(a?syncfunc:asyncfunc)(e,t,n,e())};var syncfunc2=function(e,t,n,a){for(var o=!1;a;){try{o=t(a,function(){syncfunc2(e,t,n,e())})}catch(e){showException2(e)}a=!0===o||void 0===o?null:e()}try{n&&void 0!==o&&n()}catch(e){showException2(e)}},asyncfunc2=function(a,o,r,i){V.once(function(){var t=i?{func:o,val:a(),next:asyncfunc2}:{func:r||emptyfunc,next:emptyfunc};try{function e(){t.next(a,o,r,t.val)}var n=t.func(i,e);!0===n?t.next(a,o,r,!1):void 0!==n&&e()}catch(e){V.showException("",e),t.next(a,o,r,t.val)}})};V.whileC2=function(e,t,n,a){(a?syncfunc2:asyncfunc2)(e,t,n,e())},V.each=function(e,t,n,a){if(a){for(var o in V.isArray(e)||(e=Array.prototype.slice.call(e,0)),e)try{t&&t(e[o],o)}catch(e){showException2(e)}try{n&&n()}catch(e){showException2(e)}}else e=Array.prototype.slice.call(e,0),V.whileC(function(){return e.shift()},t,n,a)},V.each2=function(e,t,n,a){e=Array.prototype.slice.call(e,0),V.whileC2(function(){return e.shift()},t,n,a)},V.forC=function(e,t,n,a){if(a){for(var o in e)try{t(o,e[o])}catch(e){showException2(e)}try{n&&n()}catch(e){showException2(e)}}else{var r=[];for(o in e)r.push({key:o,value:e[o]});a=t?function(){return r.shift()}:emptyfunc;V.whileC(a,function(e){return t(e.key,e.value)},n,!1)}},V.forC2=function(e,n,t,a){var o,r=[];for(o in e)r.push({key:o,value:e[o]});var i=n?function(){return r.shift()}:emptyfunc;V.whileC2(i,function(e,t){return n(e.key,e.value,t)},t,a)},V.finalC=function(){for(var a,o,r,i,e=[],t=0;t<arguments.length;t++)"function"==typeof arguments[t]&&e.push({key:e.length,func:arguments[t]});1<e.length?(a={},o=0<e.length?e.pop().func:null,r=e.length,i={},V.each(e,function(e){var t=e;t.func.apply(null,[a,function(){!function(e){i[e]=!0;var t,n=0;for(t in i)n++;n==r&&o.apply(null,[a])}(t.key)}])})):o.apply(null,[{}])},V.next=function(){var e=0,t=arguments,n={};V.whileC2(function(){return t[e++]},function(e,t){return(e||t||emptyfunc)(n,t)})},V.tnext=function(){function a(){var e=0;V.whileC2(function(){return i[e++]},function(e,t){return(e||t||emptyfunc)(r,t)})}var o=0,e=arguments,r={},i=[];V.whileC2(function(){return e[o++]},function(t,n){try{var e=(t.g||t.go||function(){throw new Error("请在第"+o+"个对象定义g或者go方法")}).apply(t,[r,function(e){try{if(e&&e.__proto__&&"Error"==e.__proto__.name)throw e;if(i.unshift(t.r||t.rollback||function(){throw new Error("请在第"+o+"个对象定义r或者rollback方法")}()),e){if("string"==typeof e)throw new Error(e);throw new Error("第"+o+"个对象条件不满足开始回滚!")}n()}catch(e){i.push(function(){throw e}),a()}}])}catch(e){a()}return e})};var emptyfunc=function(){};V.callback=function(n,a,o){V.tryC(function(){var e=o||emptyfunc;(a=a||[]).push(e);var t=n.apply(null,a);switch(typeof t){case"function":t(null,e);break;case"undefined":break;default:e.apply(null,t.length?t:[null,t])}},o)},V.getType=function(e){if(null==e)return"null";var t=typeof e;if("object"!=t&&"Object"!=t)return t;if(V.isArray(e))return"Array";t=Object.prototype.toString.apply(e);return"Object"!=(t=t.substring(8,t.length-1))||e.constructor==Object?t:e.prototype&&"classname"in e.prototype.constructor&&"string"==typeof e.prototype.constructor.classname?e.constructor.prototype.classname:"ukObject"},V.inherit=function(e,t){var n=((a.prototype=e.prototype).isF=!0,new a);function a(){}n.constructor=e,this.prototype?(console.log("如果失败,需要配合子类构造函数中使用parent.apply(this,[***])"),this.prototype=n):(e.apply(this,t),this.__proto__&&!this.__proto__.isF&&(this.__proto__.constructor.prototype=n.__proto__.constructor.prototype),this.__proto__=n,this.base=this.__proto__.constructor.prototype)},V.inherit2=function(e,t,n){function a(){}for(var o in a.prototype=t.prototype,e.prototype=new a,e.inherits2=!0,t.prototype)e[o]=t.prototype[o];for(o in n)e.prototype[o]=n[o]},V.create2=function(e,t){if("function"==typeof e)return t=V.isArray(t)?t:[t],V.inherit2(n,e,{}),new n;function n(){e.apply(this,t)}V.showException("请传入类定义")},V.create3=function(type,args){var ret="(new "+type+"(";if(V.isArray(args)){for(var i in args)ret+="args["+i+"],";0<args.length&&(ret=ret.substr(0,ret.length-1))}return eval(ret+"))")};var _clone=function(e){switch(V.getType(e)){case"Object":case"object":case"ukObject":return _merge({},e);case"array":case"Array":var t,n=[];for(t in e)n.push(_clone(e[t]));return n;default:return e}},_merge=function(e,t,n){if(null==e)return _clone(t);switch(V.getType(t)){case"Array":for(var a=!1,o=0,r=t[o];o<t.length;r=t[++o])null!=r&&("number"==typeof r.mergeIndex?(a=!0,e.length<r.mergeIndex+1?e.push(r):e[o]=_merge(e[o],r,n)):"number"==typeof r.moveIndex&&(a=!0,e.splice(r.moveIndex,0,r)));return a||(e=_clone(t)),e;case"object":case"Object":case"ukObject":if("string"==typeof e)return t;for(var i in t)e[i]=n?_clone(t[i]):_merge(e[i],t[i]);return e;case"null":return void 0===t?e:t;default:return t}};V.merge=function(){var e=arguments;if(e.length<2)return e[0]||{};if(0<e.length&&1==e[e.length-1]){for(var t=e[0],n=1;n<e.length-1;n++)t=_merge(t,e[n]);return t}for(t={},n=0;n<e.length;n++)t=_merge(t,e[n]);return t},V.lightMerge=function(){var e=arguments;if(e.length<2)return e[0]||{};if(0<e.length&&1==e[e.length-1]){for(var t=e[0],n=1;n<e.length-1;n++)t=_merge(t,e[n],!0);return t}for(t={},n=0;n<e.length;n++)t=_merge(t,e[n],!0);return t},V.userAgent={ie:!1,firefox:!1,chrome:!1,safari:!1,opera:!1,mobile:!1,pc:!1,pad:!1,iphone:!1,android:!1,refresh:function(){V.userAgent.width=(document.body&&0<document.body.clientWidth?document.body:document.documentElement).clientWidth,V.userAgent.height=(document.body&&0<document.body.clientHeight?document.body:document.documentElement).clientHeight}},V.userAgent.refresh();var ua=navigator.userAgent.toLowerCase(),s,key,ver;for(key in(s=ua.match(/msie ([\d]+)/))?V.userAgent.ie=s[1]:(s=ua.match(/firefox\/([\d.]+)/))?V.userAgent.firefox=s[1]:(s=ua.match(/chrome\/([\d.]+)/))?V.userAgent.chrome=s[1]:(s=ua.match(/opera.([\d.]+)/))?V.userAgent.opera=s[1]:(s=ua.match(/version\/([\d.]+).*safari/))&&(V.userAgent.safari=s[1]),(s=ua.match(/(mobile)/))&&(V.userAgent.mobile=!0),(s=ua.match(/(ipad)|(mediapad)/))&&(V.userAgent.pad=!0,V.userAgent.mobile=!1),(s=ua.match(/(android)|(linux)/))&&(V.userAgent.android=!0),(s=ua.match(/(iphone)|(mac)/))&&(V.userAgent.iphone=!0),V.userAgent.pc=!(V.userAgent.mobile||V.userAgent.pad),V.userAgent)"pc"!=key&&"width"!=key&&"height"!=key&&"refresh"!=key&&V.getValue(V.userAgent[key],!1)&&(V.userAgent.name=key);console.log("VJ.userAgent:"+V.userAgent.name),V.getValue(V.userAgent.ie,!1)&&(ver=V.userAgent.ie,eval("VJ.userAgent.ie"+ver+" = true;V.userAgent.name='ie"+ver+"';"));var __s=null;function _V_(){}function _V_AppendScript(e,t){var n=navigator.userAgent.toLowerCase(),a=!(-1<n.indexOf("opera"))&&-1<n.indexOf("msie"),o=document.getElementsByTagName("head")[0]||document.documentElement,n=document.createElement("script");n.type="text/javascript",a?n.text=e:n.appendChild(document.createTextNode(e)),o.insertBefore(n,o.firstChild),o.removeChild(n),t&&t(n)}V.watch=function(e){return!__s||e?(__s=new Date,console.log("VJ.watch开始"+__s)):console.log("VJ.watch 持续了:"+__s.diff("ms",new Date)),__s.diff("ms",new Date)},V.newEl=function(e,t,n){e=$(document.createElement(e));return""!=n&&e.html(n),""!=t&&e.addClass(t),e},V.encHtml=function(e){var t={"(":"%28",")":"%29","*":"%2a","'":"%27",".":"%2e","-":"%2d",_:"%5f"};return(V.getValue(e,"").match(/[ a-zA-Z0-9\u4E00-\u9FA5\uF900-\uFA2D]|[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]|<|>|~|(\r\n)|!|@|#|\$|%|\^|;|\*|\(|\)|_|\+|\{|\}|\||:|\"|\?|`|\-|=|\[|\]|\\|;|\'|,|\.|\/|,|;|\s/g)||[]).join("").replace(/<|>|~|(\r\n)|!|@|#|\$|%|\^|;|\*|\(|\)|_|\+|\{|\}|\||:|\"|\?|`|\-|=|\[|\]|\\|;|\'|,|\.|\/|,|;|\s/g,function(e){return t[e]||encodeURIComponent(e)})},V.decHtml=function(e){return decodeURIComponent(e||"")},V.setChecked=function(e,n){function a(e,t){$(e).attr("checked",t),(V.userAgent.ie6||V.userAgent.ie7)&&(e=$(e),V.isValid(e.get(0))&&(e.get(0).defaultChecked=t,e.get(0).checked=t))}e.length?$(e).each(function(e,t){a(t,n)}):a(e,n)},V.getChecked=function(e){return V.userAgent.ie6||V.userAgent.ie7?V.isValid(e.get(0))?e.get(0).checked:null:e.prop?e.prop("checked"):e.attr("checked")},V.maxlength=function(){$("textarea[maxlength]").unbind("change").change(function(e){var t=$(this);t.val(t.val.substring(0,t.attr("maxlength")))})},V._settings={},V._exSettings={},V.getSettings=function(e,t){return V.isValid(V._settings[e])||(V.isValid(V._exSettings[e])?(V._settings[e]=V.merge(V.getValue(t,{}),V._exSettings[e]),delete V._exSettings[e]):V._settings[e]=V.getValue(t,{})),V._settings[e]},V.extendSettings=function(e,t){V.isValid(V._settings[e])?V._settings[e]=V.merge(V._settings[e],t):V.exSettings[e]?V._exSettings[e]=V.merge(V._exSettings[e],V.getValue(t,{})):V._exSettings[e]=V.getValue(t,{})},V.evalTJson=function(e){var t,n=[];for(t in e=e[0]){var a=e[t];n[t]=function(a){var o=[];return a.forEach&&a.forEach(function(e,t){var n;0!=t&&(n={},e.forEach&&e.forEach(function(e,t){n[a[0][t]]=e}),o[t-1]=n)}),o}(a)}return n},V.ajax=function(data){var funcsucc=V.merge(V.getSettings("ajax",{async:!0,type:"POST",dataType:"text",cache:!1,beforeSend:function(e){},success:function(data,status){var _this=this,Ld;try{var hasFalse=!1;switch(typeof data){case"string":data=data.replace(/[\r\n]+/g,""),data.startWith("{")?(_this.filtData=function(e){return e[0]},data="["+data+"]"):_this.filtData=function(e){return V.evalTJson(e)[0][0]},hasFalse=0===data.replace(/^(\[+\]+)/g,"").length||0<=data.toLowerCase().indexOf("[false")&&(!(0<=data.toLowerCase().indexOf("[false:"))||(Ld=data.toLowerCase().match(/\[false:[^\]]+\]/g),!(Ld&&0<Ld.length)||Ld[0].substr(7,Ld[0].length-8))),hasFalse||V.tryC(function(){_this.bindData.apply(_this,[_this.filtData(eval(data))])});break;case"object":data&&data.length?data.forEach(function(e){e+="",hasFalse=hasFalse||"False"==e||"false"==e}):hasFalse=!0,hasFalse||V.tryC(function(){_this.bindData.apply(_this,[data])});break;case"undefined":default:V.showException("V.Query success方法 name:typeof错误 type:"+typeof data),hasFalse=!0}hasFalse&&V.tryC(function(){_this.noData(!0)})}catch(e){V.showException("V._ajaxOption success方法",e)}},error:function(e,t,n){V.showException("V._ajaxOption error方法 status:"+t,n)},complete:function(e,t){0},filtData:function(e){return V.evalTJson(e)[0][0]},bindData:function(e){},noData:function(){}}),data),random;data.jsonp?(V._ajaxcall||(V._ajaxcall={}),random=V.random(),V._ajaxcall[random]=function(e){delete V._ajaxcall[random],funcsucc.success(e,null)},V.getRemoteJSON(data.url+(0<=data.url.indexOf("?")?"&":"?")+(1==data.jsonp?"_bk":data.jsonp)+"=VJ._ajaxcall["+random+"]&"+$.param(data.data))):(data.cross&&funcsucc&&(funcsucc.crossDomain=!0,funcsucc.xhrFields={withCredentials:!0}),$.ajax(funcsucc))},V.getRemoteJSON=function(e){var t={filtURI:function(e){return e}};V.userAgent.ie?window.setTimeout(function(){$.getScript(V.getSettings("getRemote",t).filtURI(e),function(){})},500):$.getScript(V.getSettings("getRemote",t).filtURI(e),function(){})},_V_.prototype.create=function(e,t,n,a,o){if(this.type=null,this.responseObj=null,this.xmlURL=e||null,this.xmlFun=t||"get",this.postStr=n||"",this.xmlURL)if(this.xhReq=this.getXMLReq(),null!=this.xhReq){if(!a||1!=a&&"true"!=a||3==this.type||(this.xhReq.onreadystatechange=function(){if(4==this.readyState&&(200==this.status||0==this.status)){if(!o)return this.responseXML.documentElement;o(this.responseXML.documentElement)}}),3!=this.type?(this.xhReq.open(this.xmlFun,this.xmlURL,!(!a||1!=a&&"true"!=a)),this.xhReq.send(this.xmlFun&&"post"==this.xmlFun.toLowerCase()?this.postStr:null),this.responseObj=this.xhReq.responseText):3==this.type&&(this.xhReq.open("get",this.xmlURL,"false"),this.responseObj=this.xhReq),null!=a&&(0==a||"false"==a)||3==this.type){if(!o)return this.responseObj;o(this.responseObj)}}else alert("Your browser does not support XMLHTTP.")},_V_.prototype.getXMLReq=function(){var e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest,this.type=1):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP"),this.type=2),(document.location.href.indexOf("http://")<0||document.location.href.indexOf("https://")<0)&&window.ActiveXObject&&(e=new ActiveXObject("Microsoft._V_"),this.type=3),e},_V_.prototype.abort=function(){this.xhReq.abort()};var getHost=function(e){e=(e+"").match(/http[s]?:\/\/[^\/]+/g)+"";return e&&0<e.length?e.substr(7):""};V.isCrossdomain=function(e){e=getHost(e);return!(e.eq("")||e.eq(getHost(window.location.href)+""))},V.includeversion="",V.include=function(e,t,n){var a,o;(e||"").startWith("~")&&V.getSettings("include").last&&((o=V.getSettings("include").last.split("/")).pop(),e=o.join("/")+e.replace(/~/,"")),V.getSettings("include")[e]||(V.getSettings("include")[e]=!0,V.getSettings("include").last=e,V.includeversion&&e.indexOf("?")<0&&(e=e+(0<e.indexOf("?")?"&":"?")+V.includeversion),null==t&&(t="head"),a=document.getElementsByTagName(t).item(0),0<=(t=(o=e.split("."))[o.length-1].toLowerCase()).indexOf("?")&&(t=t.substr(0,t.indexOf("?"))),"js"==t&&(V.isCrossdomain(e)&&"undefined"!=typeof XDomainRequest?(V.showException("跨域同步加载仅支持Chrome40以上,IE10以上版本,而且js跨域加载的IIS返回头部添加Access-Control-Allow-Origin: * 版本,如果仍然不可用请在config.js中将可能跨域请求path路径上的js的转入头部,或者在页面onStart时先获取原需要异步获取的对象!"),(o=new XDomainRequest).open("GET",e),o.timeout=5e3,o.send(),console.log("xdomainrequest"),_V_AppendScript(o.responseText,n)):(new _V_).create(e,"get",null,!1,function(e){_V_AppendScript(e,n)}),n&&n()),"css"==t&&(new_element=document.createElement("link"),new_element.setAttribute("type","text/css"),new_element.setAttribute("rel","stylesheet"),new_element.setAttribute("href",e),new_element.setAttribute("media","screen"),a.appendChild(new_element),n&&n()))},V.applyCommandAndEvent=function(i){i._settings={},i._exSettings={},i.getSettings=function(e,t){return V.isValid(i._settings[e])||(V.isValid(i._exSettings[e])?(i._settings[e]=V.merge(V.getValue(t,{}),i._exSettings[e]),delete i._exSettings[e]):i._settings[e]=V.getValue(t,{})),i._settings[e]},i.extendSettings=function(e,t){V.isValid(i._settings[e])?i._settings[e]=V.merge(i._settings[e],t):i.exSettings[e]?i._exSettings[e]=V.merge(i._exSettings[e],V.getValue(t,{})):i._exSettings[e]=V.getValue(t,{})},i.clearSettings=function(){i._settings={}},i.registCommand=function(e,t){var n=i.getSettings("comms",[]),a=n[e];V.isValid(a)&&"function"!=typeof a&&t.apply(null,a),n[e]=t},i.callCommand=function(e){var t=arguments.caller,n=i.getSettings("comms",[]),a=n[e],o=Array.prototype.slice.apply(arguments,[1]);V.isArray(o[0])&&1==o.length&&(o=o[0]),V.isValid(a)&&"function"==typeof a?V.once(function(){var n=[];o.forEach(function(t){try{n.push("object".eq(V.getType(t))?JSON.parse(JSON.stringify(t)):t)}catch(e){n.push(t)}}),a.apply(t,n)}):n[e]=o},i.hasCommand=function(e){e=i.getSettings("comms",[])[e];return V.isValid(e)&&"function"==typeof e},i.cleanCommand=function(e){delete i.getSettings("comms",[])[e]},i.registEvent=function(e,t,n){function a(e,t,n){var a,o=i.getSettings("events",[]),r=o[e];V.isValid(r)||(r=[],o[e]=r),"function"==typeof t&&(n&&!r.top?(r.top=t,r.unshift(t)):(n&&r.top&&V.showException("S.registEvent:"+e+" 事件已经有订阅者被置顶!"),r.push(t)),(a=(a=i.getSettings("eventcall",{}))[e]||{}).time&&a.time>=(new Date).getTime()&&V.once(function(){t.apply(a.caller,a.data)}))}V.isArray(e)?e.forEach(function(e){a(e,t,n)}):a(e,t,n)},i.callEvent=function(e){var t=arguments.caller,n=i.getSettings("events",[])[e],a=Array.prototype.slice.apply(arguments,[1]);V.isArray(a[0])&&1==a.length&&(a=a[0]),V.isValid(n)&&V.isArray(n)&&V.each(n,function(e){V.tryC(function(){var n=[];a.forEach(function(t){try{n.push("object".eq(V.getType(t))?JSON.parse(JSON.stringify(t)):t)}catch(e){n.push(t)}}),e.apply(t,n)})});n=i.getSettings("eventcall",{});n[e]||(n[e]={}),(n=n[e]).time=(new Date).add("n",1).getTime(),n.data=a,n.caller=t},i.hasEvent=function(e){e=i.getSettings("events",[])[e];return!(!V.isValid(e)||!V.isArray(e))},i.cleanEvent=function(e){delete i.getSettings("events",[])[e]}},V.applyCommandAndEvent(V),V.getEvent=function(e){return e||window[e]},V.getTarget=function(e){return e.target||e.srcElement},V.cancel=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},V.stopProp=function(e){e.stopPropagation?e.stopPropagation():e.cancelBobble=!0},V.formatPrice=function(e,t,n,a){e=(e+"").replace(/[^0-9+-Ee.]/g,"");var o=isFinite(+e)?+e:0,e=isFinite(+t)?Math.abs(t):2,t=void 0===a?",":a,a=void 0===n?".":n,n="";return 3<(n=(e?function(e,t){t=Math.pow(10,t);return""+Math.round(e*t)/t}(o,e):""+Math.round(o)).split("."))[0].length&&(n[0]=n[0].replace(/B(?=(?:d{3})+(?!d))/g,t)),(n[1]||"").length<e&&(n[1]=n[1]||"",n[1]+=new Array(e-n[1].length+1).join("0")),n.join(a)},V.qs=new function(e){if(this.params={},null==e&&(e=location.search.substring(1,location.search.length)),this.get=function(e,t){e=this.params[e];return null!=e?e:t},this.contains=function(e){return null!=this.params[e]},0!=e.length)for(var t=(e=e.replace(/\+/g," ")).split("&"),n=0;n<t.length;n++){var a=t[n].split("="),o=decodeURIComponent(a[0]),a=2==a.length?decodeURIComponent(a[1]):o;this.params[o]=a}},V.hash=function(e,t){(t=V.getValue(t,!1))||(e=e.toLowerCase());for(var n=1315423911,a=e.length-1;0<=a;a--)n^=(n<<5)+e.charCodeAt(a)+(n>>2);return 2147483647&n};var index=0;V.random=function(){return""+index+++(new Date).getTime()},["toJsonString","json"].forEach(function(e){var t=e;V[e]=function(e){return JSON||V.include("/Scripts/json.js"),V.toJsonString=function(){return JSON.stringify.apply(JSON,arguments)},V.json=function(){return JSON.parse.apply(JSON,arguments)},V[t](e)}})}(VJ,jQuery),function(V,$){V.config={};var C=V.config;C.Configs={ConfigConverts:{AppSettings:{type:"VJ.config.AppSettingsConfigConvert"}}},C.Config=function(){var n=this;n.data={},n.getValue=function(e){return n.data[e]},n.setValue=function(e,t){n.data[e]=t},n.merge=function(e){n.data=V.merge(n.data,e.data)}},C.ConfigConvert=function(){this.toConfig=function(e){return null},this.toStrings=function(e){return""},this.needConfig=!1},C.AppSettingsConfigConvert=function(){V.inherit.apply(this,[C.ConfigConvert,[]]),this.toConfig=function(e){var t,n=new C.Config;for(t in e=V.getValue(e,{}))n.data[t]=e[t];return n}},C.ConfigManager=function(o,e){var r=this,i={},t={},a=!1;r.getConfig=function(e){return V.isValid(t[e])||(t[e]=new C.ProxyConfig(r,e)),t},r.getConfigValue=function(e,t){function n(){return o?o.getConfigValue(e,t):null}if(i[e]){var a=i[e].getValue(t);return a||n.apply(r,[])}return n.apply(r,[])},r.setConfigValue=function(e,t,n){a=!0;i[e]?i[e].setValue(t,n):function(){o&&o.setConfigValue(e,t,n)}.apply(r,[])},r.update=function(){a&&r.adapter.update(r,i,e)};null==o&&(i.ConfigConverts=new function(){V.inherit.apply(this,[C.Config,[]]),this.data.ConfigConverts=new function(){this.toConfig=function(n){return new function(){var e,t;for(e in V.inherit.apply(this,[C.Config,[]]),n)this.data[e]=(t=void 0,(t=n[e]).path&&V.include(t.path),V.create3(t.type,[]))}},this.toStrings=function(e){V.showException("基础解析器不支持此功能")}}}),r.adapter=C.ConfigAdapter.prototype.getInstance(),r.adapter.fill(r,i,e)},C.ProxyConfig=function(n,a){V.inhert(C.Config,[]),this.getValue=function(e){return n.getConfigValue(a,e)},this.setValue=function(e,t){return n.setConfigValue(a,e,t)},this.merge=function(e){V.showException("不支持的功能")}},C.ConfigAdapter=function(){var _=this;_.fill=function(cm,dic,resource){for(var i in resource=resource.load(),"string"==typeof resource&&(resource=eval("("+resource+")")),resource){var convert=cm.getConfigValue("ConfigConverts",i),val;convert?(val=convert.toConfig(resource[i],convert.needConfig?cm:null),val?dic[i]?dic[i].merge(val):dic[i]=val:(console.log("ConfigConverts 解析失败"+i+":"),console.log(resource[i]))):V.showException("ConfigConverts 没有找到对应的解析器"+i)}},_.update=function(e,t,n){var a,o={};for(a in t){var r=e.getConfigValue("ConfigConverts",a);r?(r=r.toString(t[a]))?o[a]=r:(console.log("ConfigConverts 解析失败"+a+":"),console.log(t[a])):V.showException("ConfigConverts 没有找到对应的解析器"+a)}n.save(function(){var e,t="{";for(e in o)t=t+e+":"+o[e]+",";return","==t.substr(t.length-1)&&(t=t.substr(0,t.length-1)),t+"}"}())}},C.ConfigAdapter.prototype.getInstance=function(){return C.ConfigAdapter.prototype.instance||(C.ConfigAdapter.prototype.instance=new C.ConfigAdapter),C.ConfigAdapter.prototype.instance},C.getConfigManagerFromObj=function(cm,obj){return obj?new C.ConfigManager(cm,function(){return new function(){var _=this;"string"==typeof obj&&(obj=eval("("+obj+")")),_.load=function(){return obj},_.save=function(){V.showException("getConfigManagerFromObj不支持此方式")}}}()):cm},C.getConfigManagerFromJS=function(cm,name,path){if(!name)return cm;if(path)if("string"==typeof path&&0<=path.indexOf(";")&&(path=path.split(";")),V.isArray(path))for(var i in path)V.include(path[i]);else V.include(path);return new C.ConfigManager(cm,function(){return new function(){var _=this;"string"==typeof name&&(name=eval("("+name+")")),_.load=function(){return name},_.save=function(){V.showException("getConfigManagerFromJS不支持此方式")}}}())},C.getBaseConfigManager=function(){return C.baseConfig||(C.baseConfig=C.getConfigManagerFromObj(null,C.Configs)),C.baseConfig},C.getApplicationConfigManagerFromJS=function(e,t){return C.getConfigManagerFromJS(C.getBaseConfigManager(),e,t)},C.getApplicationConfigManagerFromObj=function(e){return C.getConfigManagerFromObj(C.getBaseConfigManager(),e)}}(VJ,jQuery),Date.prototype.add=function(interval,number){var d=new Date(this.getTime()),k={y:"FullYear",q:"Month",m:"Month",w:"Date",d:"Date",h:"Hours",n:"Minutes",s:"Seconds",ms:"MilliSeconds"},n={q:3,w:7};return eval("d.set"+k[interval]+"(d.get"+k[interval]+"()+"+(n[interval]||1)*number+")"),d},Date.prototype.diff=function(e,t){var n=this,a={},o=n.getTime(),r=t.getTime();return a.y=t.getFullYear()-n.getFullYear(),a.q=4*a.y+Math.floor(t.getMonth()/4)-Math.floor(n.getMonth()/4),a.m=12*a.y+t.getMonth()-n.getMonth(),a.ms=t.getTime()-n.getTime(),a.w=Math.floor((r-o)/6048e5),a.d=Math.floor((r-o)/864e5),a.h=Math.floor((r-o)/36e5),a.n=Math.floor((r-o)/6e4),a.s=Math.floor((r-o)/1e3),a[e]},Date.prototype.sub=function(e,t){return Date.prototype.diff.apply(t,[e,this])},Date.prototype.toString=function(e){var t,n={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12==0?12:this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(t in/(y+)/.test(e=e||"yyyy/MM/dd HH:mm:ss")&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),/(E+)/.test(e)&&(e=e.replace(RegExp.$1,(1<RegExp.$1.length?2<RegExp.$1.length?"/u661f/u671f":"/u5468":"")+{0:"/u65e5",1:"/u4e00",2:"/u4e8c",3:"/u4e09",4:"/u56db",5:"/u4e94",6:"/u516d"}[this.getDay()+""])),n)new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?n[t]:("00"+n[t]).substr((""+n[t]).length)));return e},String.prototype.endWith=function(e){return!(null==e||""==e||0==this.length||e.length>this.length)&&this.substring(this.length-e.length)==e},String.prototype.startWith=function(e){return!(null==e||""==e||0==this.length||e.length>this.length)&&this.substr(0,e.length)==e},String.prototype.eq=function(e,t){return e+="",t?this==e:this.toLowerCase()==e.toLowerCase()},String.prototype.trim=function(e){switch(e){case"/":case"\\":case"?":case"[":case"]":case".":case"*":case"(":case")":case"{":case"}":case"|":case"^":case"$":case"+":e="\\"+e}return this.replace(VJ.isValid(e)?new RegExp("(^("+e+")+)|(("+e+")+$)","g"):/(^\s+)|(\s+$)/g,"")},String.prototype.loadVJ=!0,Math.A=function(){var e,t=[];for(e in arguments)t.push(arguments[e]);let n=1e3*t.shift();for(;t.length;)n+=1e3*t.shift();return n/1e3},Math.S=function(){var e,t=[];for(e in arguments)t.push(arguments[e]);let n=1e3*t.shift();for(;t.length;)n-=1e3*t.shift();return n/1e3},Math.X=function(){var e,t=[];for(e in arguments)t.push(arguments[e]);let n=1e3*t.shift();for(;t.length;)n*=t.shift();return n/1e3},Math.D=function(){var e,t=[];for(e in arguments)t.push(arguments[e]);let n=1e3*t.shift();for(;t.length;)n/=t.shift();return n/1e3},function(V,$){V.middler={},V.config.Configs=V.merge(V.config.Configs,{ConfigConverts:{Middler:{type:"VJ.middler.MiddlerConfigConvert"}}});var M=V.middler;M.Middler=function(o){var r="Middler";this.getObjectByAppName=function(t,n){try{return o.getConfigValue(r,new function(){this.getValue=function(e){return e.getValueByName(t,n)}})}catch(e){V.showException(t+":"+n,e)}},this.setObjectByAppName=function(n,a,e){try{return o.setConfigValue(r,new function(){this.setValue=function(e,t){return e.setValueByName(n,a,t)}},e)}catch(e){V.showException(n+":"+a,e)}},this.getTypeByAppName=function(t,n){try{return o.getConfigValue(r,new function(){this.getValue=function(e){return e.getTypeByName(t,n)}})}catch(e){V.showException(t+":"+n,e)}}},M.MiddlerConfig=function(){var a=this;V.inherit.apply(a,[V.config.Config,[]]),a.getValue=function(e){return e.getValue(a)},a.setValue=function(e,t){return e.setValue(a,t)},a.merge=function(e){if(e.data)for(var t in a.data={},e.data)a.data[t]=e.data[t]},a.getValueByName=function(e,t){return a.data[e]?a.data[e][t]?a.data[e][t].getValue():a.data[e].getValue(t):null},a.setValueByName=function(e,t,n){return a.data[e]&&a.data[e][t]?a.data[e][t].setValue(n):null},a.getTypeByName=function(e,t){return a.data[e]?a.data[e][t]?a.data[e][t].getType():a.data[e].getType(t):null}},M.MiddlerConfigConvert=function(){var _=this,__={};V.inherit.apply(_,[V.config.ConfigConvert,[]]),__.scripts={},__.spascripts=[],__.loadScript=function(e){__.scripts[e]?console.log(e+"代码已经注入"):__.scripts._skey?console.log(__.scripts._skey+"已注册但是尚未有代码注入"):0<__.spascripts.length?__.scripts[e]=__.spascripts.pop():__.scripts._skey=e},__.clearload=function(){delete __.scripts._skey},__.hasScript=function(e){return __.scripts[e]},__.getScript=function(e,t){var n=__.scripts[e];return n&&n.path&&V.each(n.path.replace(/,/g,";").split(";"),function(e){V.include(e)},function(){delete n.path},!0),n&&n.func?{inherit:n.inherit,func:n.func}:null},V.registScript=__.registScript=function(){var e,t=2<arguments.length?{path:arguments[0],inherit:arguments[1].replace(/,/g,";").split(";"),func:arguments[2],regist:!0}:1<arguments.length?{path:arguments[0],func:arguments[1],regist:!0}:{func:arguments[0],regist:!0};__.scripts._skey?(e=__.scripts._skey,delete __.scripts._skey,__.scripts[e]=t):__.spascripts.push(t)},_.needConfig=!0,__.convertParas=function(a,e,t,n,o){var r,i=[];for(r in e=V.getValue(e,[])){var s,c,l=e[r];"object"==typeof l?null==l?i.push(null):l.ref?(c=(s=0<=(c=0<=l.ref.indexOf("/")?l.ref.indexOf("/"):0<=l.ref.indexOf("\\")?l.ref.indexOf("\\"):-1)?l.ref.substr(0,c):t.app)?l.ref.substr(c+1):l.ref,i.push({ref:s,name:c})):l.type||l.path?(n[c=V.random()+""]=__.convertContainer(a,l,t,n,o),i.push({ref:t.app,name:c})):l.self?i.push(o):l.middler?i.push(new M.Middler(o)):l.params&&l.param?(n[c=V.random()+""]=__.convertContainer(a,l,t,n,o),i.push({ref:t.app,name:c,param:l.param})):V.isArray(l)?(n[c=V.random()+""]=__.convertContainer(a,{params:l},t,n,o),i.push({ref:t.app,name:c})):i.push(l):i.push(l)}return new function(){this.getParas=function(){var e,t=[];for(e in i){var n=i[e];null!=n&&n.ref&&(n=a.getValueByName(n.ref,n.name)),t.push(n)}return t}}},__.createValue=function(e,t,n){var a=__.hasScript(e);return a.regist&&!t.length&&(t=[null,null]),(a=__.getScript(e)).inherit&&a.inherit.forEach(function(e){t.push(n.Middler.getTypeByAppName(V.view.APP||"VESH.view",e))}),a=a.func,V.create2(a,t)},__.convertCreater=function(config,v,defParam,app,pcm){var method=V.getValue(v.method,defParam.method),path=V.getValue(v.path,defParam.path),spapath=V.getValue(v.spapath,!1),host=V.getValue(v.host,defParam.host),type=(V.isValid(v.type)&&0==v.type.indexOf(".")?defParam.pack:"")+v.type;"undefined"!=type||V.isValid(v.ref)||(V.isValid(v.path)||V.isValid(v.spapath)?type=v.type=""+V.random():method=V.isValid(v.params)?"objects":"self");var constructorparalength=V.getValue(v.constructorparalength,defParam.constructorparalength),para=__.convertParas(config,v.params,V.merge(defParam,{path:path,pack:defParam.pack,host:host}),app,pcm);return spapath&&(__.spaloadScript(type),__.clearload()),new function(){var _=this;_.getType=function(){path?(__.loadScript(type),V.each(path.split(";"),function(e){defParam.host&&e.toLowerCase().indexOf("../")<0&&e.toLowerCase().indexOf("http://")<0&&e.toLowerCase().indexOf("https://")<0&&(e=defParam.host+e),V.include(e)},function(){__.clearload()},!0)):spapath&&__.spaloadScript(type);var paras=para.getParas();return __.hasScript(type)?__.getScript(type).func:eval("("+type+")")},_.getValue=function(){path?(__.loadScript(type),V.each(path.split(";"),function(e){defParam.host&&e.toLowerCase().indexOf("../")<0&&e.toLowerCase().indexOf("http://")<0&&e.toLowerCase().indexOf("https://")<0&&(e=defParam.host+e),V.include(e)},function(){__.clearload()},!0)):spapath&&__.spaloadScript(type);var paras=para.getParas();switch(method){case"self":return v;case"objects":return paras;default:case"constructor":return __.hasScript(type)?__.createValue(type,paras,pcm):V.create3(type,paras);case"bean":var val=__.hasScript(type)?__.createValue(type,[],pcm):eval("(new "+type+"())");if(val&¶s)for(var i in paras)"object"==typeof paras[i]&&(v.params[i].name&&val["set"+v.params[i].name]?val["set"+v.params[i].name].apply(val,[paras[i]]):v.params[i].param&&val["set"+v.params[i].param]?val["set"+v.params[i].param].apply(val,paras[i]):val=V.merge(val,paras[i]));return val;case"factory":var script=__.hasScript(type);return script&&(script.regist&&!paras.length&&(paras=[null,null]),script=__.getScript(type),script.inherit&&script.inherit.forEach(function(e){paras.push(pcm.Middler.getTypeByAppName(V.view||"VESH.view",e))}),script=script.func),script?script.apply(script,paras):eval("("+type+".apply("+type+",paras))");case"factorybean":var script=__.hasScript(type);script&&(script.regist&&!paras.length&&(paras=[null,null]),script=__.getScript(type),script.inherit&&script.inherit.forEach(function(e){paras.push(pcm.Middler.getTypeByAppName(V.view||"VESH.view",e))}),script=script.func);var val=script?script.apply(script,paras):eval("("+type+".apply("+type+",paras))");if(paras&&val)for(var i in paras)(!constructorparalength||constructorparalength<=i)&&"object"==typeof paras[i]&&(v.params[i].name&&val["set"+v.params[i].name]?val["set"+v.params[i].name].apply(val,[paras[i]]):v.params[i].param&&val["set"+v.params[i].param]?val["set"+v.params[i].param].apply(val,paras[i]):val=V.merge(val,paras[i]));return val;case"constructorbean":var val=__.hasScript(type)?__.createValue(type,paras,pcm):V.create3(type,paras);if(paras&&val)for(var i in paras)(!constructorparalength||constructorparalength<=i)&&"object"==typeof paras[i]&&(v.params[i].name&&val["set"+v.params[i].name]?val["set"+v.params[i].name].apply(val,[paras[i]]):v.params[i].param&&val["set"+v.params[i].param]?val["set"+v.params[i].param].apply(val,paras[i]):val=V.merge(val,paras[i]));return val}}}},__.convertContainer=function(e,t,n,a,o){function r(){return c.getType()}var i=V.getValue(t.mode,n.mode),s=V.getValue(t.size,n.size),c=__.convertCreater(e,t,n,a,o);switch(i){default:case"static":return new function(){var t=null;this.getType=r,this.getValue=function(){return null==t&&(t=c.getValue()),t},this.setValue=function(e){t===e||(e=null)}};case"instance":return new function(){this.getType=r,this.getValue=function(){return c.getValue()},this.setValue=function(e){e.dispose&&V.tryC(e.dispose)}};case"pool":return new function(){this.getType=r,V.collection&&V.include("/scripts/VJ.collection.min.js");var t=new V.collection.Pool(s,function(){return c.getValue()});this.getValue=function(){return t.getValue()},this.setValue=function(e){t.setValue(e)}}}},__.convertApp=function(a,o,r,i){var s={method:"constructor",mode:"static",path:!1,pack:!1,constructorparalength:!1,size:50,app:r,host:""};return new function(){var e,t=this,n={};for(e in s)n[e]=V.getValue(o[e],s[e]);for(e in n.app=r,o)s[e]||0==s[e]||(t[e]=__.convertContainer(a,o[e],n,t,i));t.getValue=function(e){return t[e]=__.convertContainer(a,{path:e.replace(/[\._]/g,"/")+".js"},n,t,i),t[e].getValue()},t.getType=function(e){return t[e]=__.convertContainer(a,{path:e.replace(/[\._]/g,"/")+".js"},n,t,i),t[e].getType()}}},_.toConfig=function(e,t){var n,a=new M.MiddlerConfig;for(n in t.Middler||(t.Middler=new M.Middler(t)),e){var o=__.convertApp(a,e[n],n,t);a.data[n]=o}return a},_.toStrings=function(e){V.showException("Middler 不支持此操作")}},M.getMiddlerFromJS=function(e,t){return new M.Middler(V.config.getApplicationConfigManagerFromJS(e,t))},M.getMiddlerFromObj=function(e){return new M.Middler(V.config.getApplicationConfigManagerFromObj(e))},M.getObjectByAppName=function(e,t,n){return V.middlers||(V.middlers={}),e.randomid||(e.randomid=V.random(),V.middlers[e.randomid]=new M.Middler(e)),V.middlers[e.randomid].getObjectByAppName(t,n)},M.getTypeByAppName=function(e,t,n){return V.middlers||(V.middlers={}),e.randomid||(e.randomid=V.random(),V.middlers[e.randomid]=new M.Middler(e)),V.middlers[e.randomid].getTypeByAppName(t,n)}}(VJ,jQuery),function(V,$){V.ni={};var N=V.ni;V.config.Configs=V.merge(V.config.Configs,{ConfigConverts:{Ni:{type:"VJ.ni.NiDataConfigConvert"}}}),N.NiDataConfig=function(){var t={};V.inherit.apply(this,[V.config.Config,[]]),t.getValue=this.getValue,this.getValue=function(){var e=t.getValue.apply(this,arguments);return e&&(e.merge=V.getValue(e.merge,V.merge)),e}},N.NiDataConfigConvert=function(){V.inherit.apply(this,[V.config.ConfigConvert,[]]),this.toConfig=function(e){var t=new N.NiDataConfig;if(e&&"object"==typeof e)for(var n in e)e[n]&&(t.data[n]=VJ.merge({params:{}},e[n]));return t},this.toStrings=function(e){V.showException("VJ.ni.NiDataConfigConvert不支持此功能")}},N.NiTemplate=function(e,t,n,a){var o=this;o.lstCmd=[],o.KEY="Ni",o.result=new N.NiDataResult,o.transaction=!1,o.res=e,o.cm=t,o.defExt=n||".tjson?_n=MT",o.dbtype=o.defExt.split("?")[0].trim("."),o.jsonp=0<=o.dbtype.indexOf("p")&&"_bk",o.dbtype=0<=o.dbtype.indexOf("tjson")?"tjson":"json",o.merge=a||function(){var e=VJ.merge.apply(this,arguments);return!e.hasMarge&&e.PageIndex&&(e.hasMarge=!0,e.PageIndex=e.PageIndex*e.PageSize),e}},N.NiTemplate.inherit2=!0,V.merge(N.NiTemplate.prototype,{_addCommand:function(e,t,n){var a=this,o=a.cm.getConfigValue(a.KEY,e);o?a.lstCmd.push(V.merge(o,{name:o.command,params:(o.merge||a.merge)(o.params,V.getValue(t,{})),func:n,key:e,jsonp:o.jsonp||a.jsonp,dbtype:o.dbtype||a.dbtype})):a.lstCmd.push({name:e.indexOf("http")<0||e.startWith("/")?e.replace(/[\.\/\\]/g,"/")+a.defExt:e||"",params:a.merge(V.getValue(t,{})),func:n,key:e,jsonp:a.jsonp,dbtype:a.dbtype})},_execute:function(){var r=this,a=r.lstCmd;return r.lstCmd=[],0<a.length?V.tryC(function(){var e=r.res.getDBConnection();1<a.length&&(e.transaction=!0);var t=r.res.getDBCommand();t.connection=e;var n=0;delete r.result.error,V.whileC2(function(){return a[n++]},function(n,a){t.command=n.name,t.params=n.params,t.dbtype=n.dbtype,t.jsonp=n.jsonp;var o=n.func;t.execute(r.result,function(e,t){t&&(r.result.error=t),r.result.add(!(!e||V.isArray(e)&&0==e.length)&&e,n.key),V.tryC(function(){o(r.result)}),a()})},function(){e.transaction&&e.commit&&e.commit(),r.res.backDBConnection(e)})}):V.showException("不能调用空的命令对象!"),r.result},execute:function(e,t,n){return this._addCommand(e,t,n),this.transaction||this.commit(),this.result},excute:function(){return this.execute.apply(this,arguments)},commit:function(){return this._execute()}},!0),N.NiTemplateManager=function(e,t){this.KEY=V.getValue(t,"Ni"),this.middler=new V.middler.Middler(e)},N.NiTemplateManager.prototype.execute=function(t,e,n,a){var o=this,r=this,i=r.middler.getObjectByAppName(o.KEY,t);if(!i)throw new Error("没有找到Template:"+t);i.execute(e,n,function(e){V.tryC(function(){a(e)}),r.middler.setObjectByAppName(o.KEY,t,i)})},N.NiTemplateManager.prototype.excute=N.NiTemplateManager.prototype.execute,N.NiDataResult=function(){this.data={},this.kv={},this.datas=[]},V.merge(N.NiDataResult.prototype,{get:function(e){return this.data[e]||(this.kv[e]?this.kv[e][1]:null)},add:function(e,t){var n,a=this;e&&!a.kv[t]?(a.data[a.datas.length]=e,a.kv[t]=[a.datas.length,e],a.datas.push(e)):a.kv[t]&&(n=a.kv[t][0],a.data[n]=e,a.kv[t]=[a.datas.length,e],a.datas[n]=e)},single:function(){var e=this,t=this;return e.hasData()?(t=e.get(t.datas.length-1))[0]&&t[0][0]?t[0][0]:{}:null},last:function(){return this.get(this.datas.length-1)},each:function(e,t){e=this.get(e);e&&V.isArray(e)&&V.each(e,t)},clear:function(){this.datas=[],this.data={},this.kv={}},hasData:function(n){var a,o=this,e=this;return n?function(){var e=o.get(n);if(e)for(var t in e)return!0;return!1}():0<e.datas.length&&(a=!1,e.datas.forEach(function(e){if(!a&&e)for(var t in e)a=!0}),a)}},!0),N.NiDataResource=function(e,t){var n=this;n.fac=e,n.params=V.getValue(t,{}),n.getDBConnection=function(){var e=n.fac.createDBConnection();return e.params=V.merge(e.params,n.params),e.params.resource=V.getValue(n.params.resource,e.params.resource),e.isOpen||e.open(),e},n.backDBConnection=function(e){n.fac.backDBConnection(e)},n.getDBCommand=function(){return n.fac.createDBCommand()}},N.NiInstanceDataResource=function(e,t){V.inherit.apply(this,[N.NiDataResource,[e,t]])},N.NiStaticDataResource=function(e,t){var n={conn:null};V.inherit.apply(this,[N.NiDataResource,[e,t]]),n.getDBConnection=this.getDBConnection,this.getDBConnection=function(){return n.conn||(n.conn=n.getDBConnection()),n.conn},this.backDBConnection=function(e){e!=n.conn&&e.isOpen&&e.close&&e.close()}},N.NiPoolDataResource=function(e,t,n){var a={};V.inherit.apply(this,[N.NiDataResource,[e,t]]),a.getDBConnection=this.getDBConnection,n=V.getValue(n,50),a.pool=new VJ.collection.Pool(n,function(){var e=a.getDBConnection();return e.dispose=e.close,e}),this.getDBConnection=function(){return a.pool.getValue()},this.backDBConnection=function(e){a.pool.setValue(e)}},N.NiDataFactory=function(){this.createDBConnection=function(){return new NiDataConnection},this.createDBCommand=function(){return new N.NiDataCommand},this.backDBConnection=function(e){e.isOpen&&e.close()}},N.NiDataConnection=function(){var e=this;e.isOpen=!1,e.params={},e.open=function(){e.isOpen=!0},e.close=function(){e.isOpen=!1},e.invoke=function(e,t){t(!1)}},N.NiDataCommand=function(){var _=this,__={};_.connection=null,_.command="",_.params={dbtype:"json"},_.execute=function(result,func){_.connection&&_.connection.isOpen?_.connection.invoke(_,function(data,error){try{var hasFalse=!1;switch(typeof data){case"string":if(data=data.replace(/[\r\n]+/g,""),data.startWith("{")&&(_.dbtype="json",data="[["+data+"]]"),hasFalse=0===data.replace(/^(\[+\]+)/g,"").length||0<=data.toLowerCase().indexOf("[false")&&(!(0<=data.toLowerCase().indexOf("[false:"))||(Dl=data.toLowerCase().match(/\[false:[^\]]+\]/g),!(Dl&&0<Dl.length)||Dl[0].substr(7,Dl[0].length-8))),!hasFalse)try{data=eval("("+data.replace(/[\r\n]+/g,"")+")")}catch(e){console.log(data)}break;case"object":data?$(data).each(function(e,t){t+="",hasFalse=hasFalse||"False"==t||"false"==t}):hasFalse=!0;break;case"undefined":default:V.showException("V.NiDataCommand success方法 name:typeof错误 type:"+data),hasFalse=!0}if(hasFalse)data=1!=hasFalse&&hasFalse;else switch(_.dbtype){default:case"json":break;case"tjson":data=V.evalTJson(data)}func&&func(data,data&&data[0]&&data[0][0]&&data[0][0].error||error)}catch(e){V.showException("V._ajaxOption success方法",e),func&&func(!1)}var Dl}):(V.showException("数据库未连接"),func&&func(!1))},_.excute=_.execute},N.NiTemplateDecorator=function(e,t,n,a,o,r){N.NiTemplate.apply(this,[e,n,o,r]),this.KEY="Ni",this.lstCmd2={},this.params=V.getValue(a,{}),this.cacheres=t},V.inherit2(N.NiTemplateDecorator,N.NiTemplate,{setCommand:function(t,n){n=V.merge(this.params,n);try{t.setItem?t.setItem(n.cacheKey,V.toJsonString({data:n.cacheValue,date:!!n.timeout&&(new Date).add(n.timeout.interval,n.timeout.number).getTime()})):t[n.cacheKey]=V.toJsonString({data:n.cacheValue,date:!!n.timeout&&(new Date).add(n.timeout.interval,n.timeout.number).getTime()})}catch(t){console.log("localStorage/sessionStorage可能不被支持或者跨域:"+e.message)}return null},clearCommand:function(t,n){try{return t.removeItem?t.removeItem(n.cacheKey,null):t[n.cacheKey]&&delete t[n.cacheKey],null}catch(t){console.log("localStorage/sessionStorage可能不被支持或者跨域:"+e.message)}},cacheCommand:function(t,n){try{var a=null;return t.getItem?a=V.json(t.getItem(n.cacheKey)):t[n.cacheKey]&&(a=V.json(t[n.cacheKey])),a?a.date&&parseFloat(a.date)<(new Date).getTime()?(delete t[n.cacheKey],null):a.data:null}catch(t){console.log("localStorage/sessionStorage可能不被支持或者跨域:"+e.message)}},_addCommand:function(e,t,n){var a=this,o=a.lstCmd.length;N.NiTemplateDecorator._addCommand.apply(a,[e,t,n]),a.lstCmd.length!=o&&(t=null,(n=a.cm.getConfigValue(a.KEY,e+".Cache"))?t=n.command||a.cacheCommand:(n=a.cm.getConfigValue(a.KEY,e+".Clear"))&&(t=n.command||a.clearCommand),n&&(a.lstCmd2[o]={name:t,key:e,params:n.merge(a.lstCmd[a.lstCmd.length-1].params,{cacheKey:V.hash(e+".Set."+V.toJsonString(a.lstCmd[a.lstCmd.length-1].params))})}))},_execute:function(){var u=this,t=u.lstCmd;return u.lstCmd=[],0<t.length?V.tryC(function(){var e=_res.getDBConnection(),c=u.res.getDBCommand();c.connection=e,delete u.result.error;function r(r,i){c.command=r.name,c.params=r.params,c.dbtype=r.dbtype,c.jsonp=r.jsonp;var s=r.func;c.execute(u.result,function(e,t){var n,a,o;V.tryC(function(){t&&(u.result.error=t),u.result.add(e||!1,r.key),s&&V.tryC(function(){s(u.result)})}),!(e&&0<e.length)||1==e.length&&0==e[0].length||(n=cm.getConfigValue(u.KEY,r.key+".Set"))&&(a=u.cacheres.getDBConnection(),(o=u.cacheres.getDBCommand()).connection=a,o.command=V.getValue(n.command,u.setCommand),o.params=n.merge(n.params,c.params,{cacheKey:V.hash(r.key+".Set."+V.toJsonString(c.params)),cacheValue:e}),o.execute(u.result,function(e){V.tryC(function(){u.cacheres.backDBConnection(a)})})),l++,i()})}var l=0;V.whileC2(function(){return t.shift()},function(n,a){var o,e,t=u.lstCmd2[l];t?(l++,o=u.cacheres.getDBConnection(),(e=u.cacheres.getDBCommand()).connection=o,e.command=t.name,e.params=V.merge(t.params,n.params),delete u.result.error,e.execute(u.result,function(e,t){V.tryC(function(){try{u.cacheres.backDBConnection(o)}catch(e){}t&&(u.result.error=t),e?(u.result.add(e,n.key),n.func&&V.tryC(function(){n.func(u.result)}),a()):r(n,a)})})):(l++,r(n,a))},function(){u.res.backDBConnection(e)})}):V.showException("不能调用空的命令对象!"),u.result}}),N.NiTemplateCacheDecorator=function(e,t,n,a,o,r,i,s){N.NiTemplateDecorator.apply(_,[e,t,n,o,r]),_.cachecommand=i,_.setcommand=s},V.inherit2(N.NiTemplateCacheDecorator,N.NiTemplateDecorator,{_addCommand:function(e,t,n){var a=this,o=a.lstCmd.length;N.NiTemplate._addCommand.apply(a,[e,t,n]),a.lstCmd.length!=o&&(t=null,(n=a.cm.getConfigValue(a.KEY,a.cachecommand))&&(t=n.command||a.cacheCommand,a.lstCmd2[o]={name:t,key:e,params:n.merge(a.lstCmd[a.lstCmd.length-1].params,{cacheKey:V.hash(e+".Set."+V.toJsonString(a.lstCmd[a.lstCmd.length-1].params))})}))},_execute:function(){var u=this,t=u.lstCmd;return u.lstCmd=[],0<t.length?V.tryC(function(){var e=_res.getDBConnection(),c=u.res.getDBCommand();c.connection=e,delete u.result.error;function r(r,i){c.command=r.name,c.params=r.params,c.dbtype=r.dbtype,c.jsonp=r.jsonp;var s=r.func;c.execute(u.result,function(e,t){var n,a,o;V.tryC(function(){t&&(u.result.error=t),u.result.add(e||!1,r.key),s&&V.tryC(function(){s(u.result)})}),!(e&&0<e.length)||1==e.length&&0==e[0].length||(n=cm.getConfigValue(u.KEY,u.setcommand))&&(a=u.cacheres.getDBConnection(),(o=u.cacheres.getDBCommand()).connection=a,o.command=V.getValue(n.command,u.setCommand),o.params=n.merge(n.params,c.params,{cacheKey:V.hash(r.key+".Set."+V.toJsonString(c.params)),cacheValue:e}),o.execute(u.result,function(e){V.tryC(function(){u.cacheres.backDBConnection(a)})})),l++,i()})}var l=0;V.whileC2(function(){return t.shift()},function(n,a){var o,e,t=u.lstCmd2[l];t?(l++,o=u.cacheres.getDBConnection(),(e=u.cacheres.getDBCommand()).connection=o,e.command=t.name,e.params=V.merge(t.params,n.params),delete u.result.error,e.execute(u.result,function(e,t){V.tryC(function(){try{t&&(u.result.error=t),u.cacheres.backDBConnection(o)}catch(e){}e?(u.result.add(e,n.key),n.func&&V.tryC(function(){n.func(u.result)}),a()):r(n,a)})})):(l++,r(n,a))},function(){u.res.backDBConnection(e)})}):V.showException("不能调用空的命令对象!"),u.result}}),N.NiLazyTemplateDecorator=function(e,t,n,a,o,r){this.lazyExp=V.getValue(a.lazyExp,function(e){return!0}),(a=V.merge({},a))&&a.lazyExp&&delete a.lazyExp,N.NiTemplateDecorator.apply(this,[e,t,n,a,o,r])},V.inherit2(N.NiLazyTemplateDecorator,N.NiTemplateDecorator,{_execute:function(){var c=this,l=this,t=c.lstCmd;return c.lstCmd=[],0<t.length?V.tryC(function(){var e=c.res.getDBConnection(),s=c.res.getDBCommand();s.connection=e;var r=0;delete c.result.error;function i(r){s.command=r.name,s.params=r.params,s.dbtype=r.dbtype,s.jsonp=r.jsonp;var i=r.func;s.execute(c.result,function(e,t){var n,a,o;V.tryC(function(){t&&(c.result.error=t),e=e||!1,c.result.add(e,r.key),i&&V.tryC(function(){i(c.result)})}),e&&0<e.length&&(1!=e.length||0!=e[0].length)&&l.lazyExp(r.params)&&((n=c.cm.getConfigValue(c.KEY,r.key+".Set"))&&(a=c.cacheres.getDBConnection(),(o=c.cacheres.getDBCommand()).connection=a,o.command=V.getValue(n.command,c.setCommand),o.params=n.merge(n.params,s.params,{cacheKey:V.hash(r.key+".Set."+V.toJsonString(s.params)),cacheValue:e}),o.execute(c.result,function(e){V.tryC(function(){cacheres.backDBConnection(a)})})))})}V.whileC2(function(){return t.shift()},function(n,e){var a,t,o=c.lstCmd2[r];o&&l.lazyExp(n.params)?(r++,a=c.cacheres.getDBConnection(),(t=c.cacheres.getDBCommand()).connection=a,t.command=o.name,t.params=V.merge(o.params,n.params),delete c.result.error,t.execute(c.result,function(e,t){V.tryC(function(){try{t&&(c.result.error=t),c.cacheres.backDBConnection(a)}catch(e){}(e=e||!1)&&(c.result.add(e,n.key),n.func&&V.tryC(function(){n.func(c.result)})),i(n)})})):(r++,i(n))},function(){c.res.backDBConnection(e)})}):V.showException("不能调用空的命令对象!"),c.result}}),N.NiMultiTemplateDecorator=function(e,t,n,a,o,r,i){N.NiTemplate.apply(this,[e,t,o,r]),this.KEY=V.getValue(a,"Ni"),this.ni=new N.NiTemplateManager(n,this.KEY),this.lstCmd2={},this.template=i||!1},V.inherit2(N.NiMultiTemplateDecorator,N.NiTemplate,{_addCommand:function(e,t,n){var a=this,o=a.lstCmd.length;N.NiMultiTemplateDecorator._addCommand.apply(a,[e,t,n]),a.lstCmd.length!=o&&((n=a.lstCmd[a.lstCmd.length-1]).template=n.template||a.template,n.template&&(this.lstCmd2[o]=!0))},_execute:function(){var i=this,s=this,t=i.lstCmd;return i.lstCmd=[],0<t.length?V.tryC(function(){var e=i.res.getDBConnection(),r=i.res.getDBCommand();r.connection=e,delete i.result.error;var a=0,o=s.lstCmd2;s.lstCmd2={},V.whileC2(function(){return t.shift()},function(e,t){var n=e;o[a]?(a++,s.ni.execute(n.template,n.key,n.params,function(e){V.tryC(function(){i.result.add(e&&e.get(n.key)?e.get(n.key):[],n.key),n.func(i.result)}),t()})):(a++,function(n,a){r.command=n.name,r.params=n.params,r.dbtype=n.dbtype,r.jsonp=n.