← Back
Editing: index-legacy15.js
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e=function(){return n};var r,n={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",s=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(r){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),u=new q(n||[]);return i(a,"_invoke",{value:E(t,r,u)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function _(){}var x={};f(x,c,(function(){return this}));var j=Object.getPrototypeOf,O=j&&j(j(N([])));O&&O!==o&&a.call(O,c)&&(x=O);var k=_.prototype=b.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function S(e,r){function n(o,i,u,c){var s=h(e[o],e,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):r.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return n("throw",t,u,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(t,e){function a(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(a,a):a()}})}function E(t,e,n){var o=d;return function(a,i){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===a)throw i;return{value:r,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=P(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(t,e,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function P(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,P(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=h(o,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,m;var i=a.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,m):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function t(){for(;++o<e.length;)if(a.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return i.next=i}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=_,i(k,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,l,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,f(t,l,"GeneratorFunction")),t.prototype=Object.create(k),t},n.awrap=function(t){return{__await:t}},L(S.prototype),f(S.prototype,s,(function(){return this})),n.AsyncIterator=S,n.async=function(t,e,r,o,a){void 0===a&&(a=Promise);var i=new S(p(t,e,r,o),a);return n.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(k),f(k,l,"Generator"),f(k,c,(function(){return this})),f(k,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},n.values=N,q.prototype={constructor:q,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),m}},n}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){o(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,c,"next",t)}function c(t){a(i,n,o,u,c,"throw",t)}u(void 0)}))}}System.register(["./index-legacy103.js?v=VERSION_NUMBER","./index-legacy112.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./useController-legacy3.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER"],(function(t,r){"use strict";var o,a,u,c,s,l,f,p,h,d,y,v,g,m,b,w,_,x,j,O,k,L,S,E,P,C,T,q,N,A,D,G,F,V,I,M,U,R,Y,J,z,B,X,H,K,$,Q,W;return{setters:[function(t){o=t._},function(t){a=t._},function(t){u=t.K,c=t.S,s=t.R,l=t.u,f=t.n,p=t.L,h=t.p,d=t.M,y=t.al,v=t.J,g=t.l,m=t.a0,b=t.e},function(t){w=t.j,_=t.r,x=t.k,j=t.e,O=t.s,k=t.U,L=t.c,S=t.p,E=t.a4,P=t.G,C=t.H,T=t.x,q=t.q,N=t.v,A=t.A,D=t.F,G=t.a_,F=t.y,V=t.B,I=t.D,M=t.M,U=t.aA},function(t){R=t.t,Y=t.u,J=t.v,z=t.w,B=t.x,X=t.y,H=t.z,K=t.q},function(t){$=t.a,Q=t.u,W=t.c}],execute:function(){var Z=t("C",w("CRONTAB-STORE",(function(){var t=_({}),r=_(!1),o=_([]),a=x({p:1,rows:10}),l=_(0),f=function(){var s=i(e().mark((function i(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u({loading:r,request:t.value.request(n(n({},t.value.data),a)),data:{data:[Array,o],page:c(l)}});case 2:case"end":return e.stop()}}),i)})));return function(){return s.apply(this,arguments)}}();return{logCompData:t,total:l,tableParam:a,tableLoading:r,tableColumns:[{label:"执行时间",width:148,render:function(t){return s(t.start_time)}},{label:"耗时",render:function(t){var e=t.end_time-t.start_time;return"".concat(e<1?"小于1":e,"秒")}},{label:"执行结果",render:function(t){return j("span",{style:"color: ".concat(t.status?"#20a53a":"#ef0808",";")},[t.status?"成功":"失败"])}},{label:"返回内容",width:400,render:function(t){var e=t.status?t.result_succ:t.result_err;return j("pre",{class:"max-h-[14rem] overflow-y-hidden overflow-x-hidden w-full",onMouseenter:function(t){var e=t.target;e.style.overflowX="auto",e.style.overflowY="auto"},onMouseleave:function(t){var e=t.target;e.style.overflowX="hidden",e.style.overflowY="hidden"}},[e])}}],tableData:o,getLogList:f}})));l();var tt,et=Z(),rt=O(et).logCompData,nt=x({p:1,rows:20,search:"",type_id:""}),ot=_(),at=_(!1),it=_(0),ut=_([]),ct=_(!1),st=_([]),lt=function(){var t=i(e().mark((function t(n,o){var a,u,c,s,l;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=n.is_args,u=n.args_title,c=n.name,s=n.args_ps,l=n.script_id,Object.assign(wt,{script_id:l,name:c,form:{args:"",placeholder:"端口检测"===c?"127.0.0.1:433":s},title:u}),!a){t.next=7;break}return f({title:"执行脚本参数",component:function(){return p((function(){return r.import("./index-legacy125.js?v=VERSION_NUMBER")}),void 0,r.meta.url)},showFooter:!0,area:42,onConfirm:function(){var t=i(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,bt.value.validate();case 2:return t.abrupt("return",ft());case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()}),t.abrupt("return");case 7:ft();case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),ft=function(){var t=i(e().mark((function t(){var r,n,o,a,i,u,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=wt.name,n=wt.script_id,o=wt.form,a={script_id:n,args:o.args},t.next=4,h({title:"执行脚本",icon:"warning-filled",content:"立即执行【".concat(r,"】脚本任务,执行过程可能等待时间较长,请耐心等待。是否继续?")});case 4:return i=d.load("正在执行脚本,请稍后..."),t.prev=5,t.next=8,J({data:JSON.stringify(a)});case 8:return u=t.sent,c=u.data,i.close(),c.status&&kt(),f({title:"执行结果",area:[60,40],component:{render:function(t){return j("pre",{class:"h-full w-full bg-[#333] !overflow-auto whitespace-pre-line text-white break-all p-12px"},[c.msg])}}}),t.abrupt("return",c.status);case 16:return t.prev=16,t.t0=t.catch(5),i.close(),t.abrupt("return",!1);case 21:case"end":return t.stop()}}),t,null,[[5,16]])})));return function(){return t.apply(this,arguments)}}(),pt=function(){var t=i(e().mark((function t(r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h({title:"删除脚本",icon:"warning-filled",content:"删除后脚本信息不可恢复,是否继续操作?"});case 2:return t.next=4,u({loading:"正在删除脚本,请稍后...",request:B(r),message:!0,success:dt});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ht=function(){var t=i(e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,R();case 2:r=t.sent,st.value=r,st.value.length&&(nt.type_id=String(st.value[0].type_id));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),dt=function(){var t=i(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u({loading:ct,request:Y(nt),data:{data:[Array,ut],page:c(it)}});case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),yt=function(t){nt.type_id=t.props.name,dt()},vt=function(t,e){if(kt(),jt.type_id=nt.type_id,t){var n=e.script_id,o=e.name,a=e.return_type,i=e.is_args,u=e.ps,c=e.script,s=e.args_title,l=e.args_ps,h=e.type_id;Object.assign(jt,{name:o,return_type:a,is_args:String(i),ps:u,script:c,type_id:h,script_id:n}),"1"==i&&Object.assign(xt,{args_title:s,args_ps:l})}f({title:(t?"编辑":"创建")+"脚本",area:57,component:function(){return p((function(){return r.import("./index-legacy127.js?v=VERSION_NUMBER")}),void 0,r.meta.url)},onConfirm:function(){return Ot(!!t)},showFooter:!0})},gt=k([$({key:"script_id"}),{label:"名称",prop:"name"},{label:"类型",prop:"script_type"},{label:"返回类型",prop:"return_type"},{label:"备注",prop:"ps",showOverflowTooltip:!0},{label:"创建时间",render:function(t){return s(t.create_time)}},{label:"上次执行时间",render:function(t){return Array.isArray(t.last_exec_time)?"--":s(t.last_exec_time)}},Q([{onClick:function(t){return lt(t)},title:"执行"},{onClick:function(t){return vt(!0,t)},title:"编辑"},{onClick:function(t){rt.value={request:z,data:{script_id:t.script_id}},f({title:"执行日志",area:86,compData:{request:z,data:{script_id:t.script_id}},component:function(){return p((function(){return r.import("./index-legacy126.js?v=VERSION_NUMBER")}),void 0,r.meta.url)}})},title:"日志"},{onClick:pt,title:"删除"}])]),mt=[{label:"删除脚本",value:"delete",event:(tt=i(e().mark((function t(r,n){var o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=function(){var t=i(e().mark((function t(r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,B({script_id:r.script_id});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.next=3,r({title:"批量删除",content:"即将删除所选中的数据,是否继续操作?",column:[{prop:"name",label:"脚本名称"},W()],onConfirm:function(){var t=i(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n(o);case 2:return dt(),t.abrupt("return",!1);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()});case 3:case"end":return t.stop()}}),t)}))),function(t,e){return tt.apply(this,arguments)})}],bt=t("b",_()),wt=t("a",x({title:"脚本参数",form:{args:"",placeholder:"请输入脚本参数"},name:"",script_id:""})),_t=(t("r",{args:[{required:!0,message:"请输入脚本参数",trigger:"blur"},{validator:function(t,e,r){if("端口检测"===wt.name){/^(\d{1,3}\.){3}\d{1,3}:\d{1,5}$/.test(e)?r():r(new Error("请输入正确的IP:端口格式"))}else r()}}]}),t("e",_())),xt=t("d",x({args_title:"",args_ps:""})),jt=t("c",x({name:"",return_type:"string",is_args:"0",ps:"",script:"",type_id:"",script_id:""})),Ot=(t("h",[{content:"当前仅支持Python和Shell脚本"},{content:"请根据返回类型在脚本执行结束时输出符合预期的值"},{content:"如果选择需要脚本参数,使用当前脚本时需传递一个参数,在脚本中的第一个参数中接收"},{content:"Python 脚本需指定编码(如 #coding: utf-8);Shell 脚本可以用 #!/bin/bash 或 #!/bin/sh 开头,未指定类型时默认按 Shell 脚本执行。"}]),t("f",x({name:[{required:!0,message:"请输入脚本名称",trigger:"blur"}],script:[{required:!0,message:"请输入脚本内容",trigger:"blur"}]})),function(){var t=i(e().mark((function t(r){var o,a,i;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_t.value.validate();case 2:return o=n({},jt),"1"==jt.is_args&&(o=n(n({},jt),xt)),r||delete o.type_id,o={data:JSON.stringify(o)},a=r?X:H,t.next=9,u({loading:"正在".concat(r?"编辑":"创建","脚本,请稍后..."),request:a(o),message:!0,success:function(t){t.status&&kt(),dt()}});case 9:return i=t.sent,t.abrupt("return",i.status);case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),kt=function(){Object.assign(jt,{name:"",return_type:"string",is_args:"0",ps:"",script:"",type_id:"",script_id:""}),Object.assign(xt,{args_title:"",args_ps:""}),Object.assign(wt,{title:"脚本参数",form:{args:"",placeholder:"请输入脚本参数"},name:"",script_id:""})},Lt=function(){ut.value=[],st.value=[]},St={class:"flex items-center"},Et={class:"flex items-center"},Pt=L({__name:"index",setup:function(t){return l(),S(i(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ht();case 2:dt();case 3:case"end":return t.stop()}}),t)})))),E(Lt),function(t,e){var r=U,n=y,i=I,u=v,c=g,s=m,l=a,f=o,p=P("bt-loading");return C((q(),N("div",null,[j(n,{modelValue:T(nt).type_id,"onUpdate:modelValue":e[0]||(e[0]=function(t){return T(nt).type_id=t}),type:"card",onTabClick:T(yt)},{default:A((function(){return[(q(!0),N(D,null,G(T(st),(function(t,e){return q(),M(r,{class:"h-0",key:e,label:t.name,name:String(t.type_id)},null,8,["label","name"])})),128))]})),_:1},8,["modelValue","onTabClick"]),j(f,null,{"header-left":A((function(){return[F("div",St,[j(i,{onClick:e[1]||(e[1]=function(t){return T(vt)()}),type:"primary"},{default:A((function(){return e[6]||(e[6]=[V("创建脚本")])})),_:1}),F("div",{class:"flex items-center ml-4px",onClick:e[2]||(e[2]=function(t){return T(K)()})},e[7]||(e[7]=[F("i",{class:"svgtofont-desired text-[1.6rem]"},null,-1),F("span",{class:"bt-link"},"需求反馈",-1)]))])]})),"header-right":A((function(){return[F("div",Et,[j(u,{modelValue:T(nt).search,"onUpdate:modelValue":e[3]||(e[3]=function(t){return T(nt).search=t}),class:"ml-12px !w-[32rem]",placeholder:"请输入搜索关键字",onSearch:T(dt)},null,8,["modelValue","onSearch"])])]})),content:A((function(){return[C(j(c,{ref_key:"scriptTableRef",ref:ot,column:T(gt),data:T(ut)},null,8,["column","data"]),[[p,T(ct)],[p,"正在加载中,请稍后...","title"]])]})),"footer-left":A((function(){return[j(s,{"table-ref":T(ot),options:T(mt)},null,8,["table-ref","options"])]})),"footer-right":A((function(){return[j(l,{total:T(it),page:T(nt).p,"onUpdate:page":e[4]||(e[4]=function(t){return T(nt).p=t}),row:T(nt).rows,"onUpdate:row":e[5]||(e[5]=function(t){return T(nt).rows=t}),onChange:T(dt)},null,8,["total","page","row","onChange"])]})),_:1})])),[[p,T(at)]])}}}),Ct=b(Pt,[["__scopeId","data-v-e808d3da"]]),Tt=Object.freeze(Object.defineProperty({__proto__:null,default:Ct},Symbol.toStringTag,{value:"Module"}));t("i",Tt)}}}))}();
Save File
Cancel