← Back
Editing: edit-group-popup-legacy.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},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",s=c.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 w?e:w,a=Object.create(o.prototype),c=new P(n||[]);return i(a,"_invoke",{value:O(t,r,c)}),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",m="suspendedYield",v="executing",y="completed",g={};function w(){}function b(){}function L(){}var x={};f(x,u,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(V([])));E&&E!==o&&a.call(E,u)&&(x=E);var j=L.prototype=w.prototype=Object.create(x);function k(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,c,u){var l=h(e[o],e,i);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,c,u)}),(function(t){n("throw",t,c,u)})):r.resolve(f).then((function(t){s.value=t,c(s)}),(function(t){return n("throw",t,c,u)}))}u(l.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 O(t,e,n){var o=d;return function(a,i){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:r,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var u=D(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(t,e,n);if("normal"===l.type){if(o=n.done?y:m,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function D(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,D(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,g;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,g):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function N(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 P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function V(e){if(e||""===e){var n=e[u];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 b.prototype=L,i(j,"constructor",{value:L,configurable:!0}),i(L,"constructor",{value:b,configurable:!0}),b.displayName=f(L,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,L):(t.__proto__=L,f(t,s,"GeneratorFunction")),t.prototype=Object.create(j),t},n.awrap=function(t){return{__await:t}},k(S.prototype),f(S.prototype,l,(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()}))},k(j),f(j,s,"Generator"),f(j,u,(function(){return this})),f(j,"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=V,P.prototype={constructor:P,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 c.type="throw",c.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],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),l=a.call(i,"finallyLoc");if(u&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)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,g):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),g},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),g}},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:V(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},n}function r(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var i=t.apply(e,n);function c(t){r(i,o,a,c,u,"next",t)}function u(t){r(i,o,a,c,u,"throw",t)}c(void 0)}))}}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./useStore-legacy4.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER"],(function(t,r){"use strict";var o,a,i,c,u,l,s,f,p,h,d,m,v,y,g,w,b,L,x,_,E,j,k,S,O,D,N,T,P,V,C,F,G,I,q,A;return{setters:[function(t){o=t.ab,a=t.I,i=t.al,c=t.M,u=t.j,l=t.k,s=t.h,f=t.e},function(t){p=t.c,h=t.h,d=t.r,m=t.o,v=t.B,y=t.k,g=t.l,w=t.e,b=t.x,L=t.p,x=t.y,_=t.C,E=t.D,j=t.F,k=t.q,S=t.N,O=t.v,D=t.az,N=t.n,T=t.ar,P=t.a7,V=t.A,C=t.a4},function(t){F=t.b$,G=t.c0,I=t.c1},function(t){q=t.b,A=t.g},null,null],execute:function(){var r={class:"p-[1.6rem]"},U={class:"list-disc mt-[1.5rem] pl-[2rem]"},R={class:"p-[1.6rem]"},Y={class:"pl-[2rem] list-disc text-[#ff0000] mt-[1.5rem]"},$=p({__name:"edit-group-popup",props:{compData:{default:function(){return{}}}},setup:function(t,f){var p=f.expose,$=t,z=$.compData.isEdit,B=h({name:"",interval:"",conList:[]}),H=h({show:!1}),M=h({loading:!1,list:[]}),J=function(t){var e=[{label:"容器名",prop:"name"},q({prop:"status",event:function(){},data:["已停止","运行中"]})];return"sort"===t.type?[].concat(e,[A([{onClick:t.deleteConEvent,title:"移除"},{render:function(){return D("i",{class:"svgtofont-icon-drag cursor-move mover align-middle",props:{title:"拖拽排序"}})}}],{fixed:!1})]):[{type:"selection",selectable:function(e){return""===e.group||e.group===t.groupName},width:36}].concat(e,[{label:"分组",prop:"group",render:function(t){return D("span",{},t.group?"已在分组【".concat(t.group,"】内"):"--")}}])},K=function(){H.show=!0,et(B.conList,!0)},Q=J({type:"sort",deleteConEvent:function(t){B.conList=B.conList.filter((function(e){return e.name!==t.name})),et(B.conList)}}),W=d(),X=d(),Z={name:[{trigger:["blur","change"],required:!0,message:"请输入组名"}],interval:[{validator:function(t,e,r){/^[1-9]\d*$/.test(e)||""===e?r():r(new Error("请输入正整数"))},trigger:"blur"}]},tt=h({selectList:[]}),et=function(t,e){tt.selectList=t,!0===e&&N((function(){tt.selectList.map((function(t){var e=M.list.find((function(e){return e.name===t.name}));if(e){var r=W.value.getTable();null==r||r.toggleRowSelection(e,!0)}}))}))},rt=function(){var t,r=document.querySelector(".groupSortTable .el-table__body-wrapper tbody");o.create(r,{animation:500,onEnd:(t=n(e().mark((function t(r){var n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=B.conList.splice(r.oldIndex,1)[0],B.conList.splice(r.newIndex,0,n);case 2:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})})},nt=function(){B.conList=tt.selectList,H.show=!1,rt()},ot=function(){var t=n(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return M.loading=!0,t.next=3,a({request:F(),loading:T(M,"loading"),success:function(t){var e=i(t.data.data,"array",[]);M.list=e.sort((function(t,e){return""===t.group&&""!==e.group?-1:""!==t.group&&""===e.group?1:0}))},error:function(t){c.error(t)}});case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),at=function(){var t=n(e().mark((function t(r){var o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,X.value.validate();case 3:return o={group_name:B.name,interval:B.interval,container_info:B.conList.map((function(t){return t.name})).join(",")},z&&(o.id=$.compData.id),t.next=7,a({loading:"正在设置,请稍后...",message:!0,request:z?G(o):I(o),success:function(){var t=n(e().mark((function t(n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.status&&(r(),$.compData.refreshEvent&&$.compData.refreshEvent());case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()});case 7:t.next=11;break;case 9:t.prev=9,t.t0=t.catch(0);case 11:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(e){return t.apply(this,arguments)}}(),it=J({type:"select",groupName:$.compData.group_name||""});return m(n(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ot();case 2:$.compData.isEdit&&(B.interval=$.compData.interval,B.name=$.compData.group_name,tt.selectList=$.compData.order.map((function(t){return{name:t,group:$.compData.group_name}})),B.conList=$.compData.order.map((function(t){return M.list.find((function(e){return e.name===t}))}))),rt();case 4:case"end":return t.stop()}}),t)})))),p({onConfirm:at}),function(t,e){var n=u,o=P,a=l,i=V,c=C,f=s,p=v("bt-loading");return y(),g("div",r,[w(c,{ref_key:"cmdFormRef",ref:X,model:L(B),rules:Z,onSubmit:e[2]||(e[2]=S((function(){}),["prevent"]))},{default:b((function(){return[w(o,{prop:"name",label:"组名",class:"min-w-[3rem]"},{default:b((function(){return[w(n,{modelValue:L(B).name,"onUpdate:modelValue":e[0]||(e[0]=function(t){return L(B).name=t}),width:"26rem",placeholder:"请输入组名"},null,8,["modelValue"])]})),_:1}),w(o,{prop:"interval",label:"启动间隔"},{default:b((function(){return[w(n,{modelValue:L(B).interval,"onUpdate:modelValue":e[1]||(e[1]=function(t){return L(B).interval=t}),width:"26rem",type:"number",min:0,placeholder:"请输入启动间隔",textType:"秒"},{append:b((function(){return e[4]||(e[4]=[x(" 秒 ")])})),_:1},8,["modelValue"])]})),_:1}),w(o,{prop:"conList",label:"容器"},{default:b((function(){return[_(w(a,{class:"groupSortTable","row-key":"name",column:L(Q),"max-height":330,data:L(B).conList,description:"容器列表为空"},null,8,["column","data"]),[[E,L(B).conList.length],[p,L(M).loading],[p,"正在加载容器列表,请稍后...","title"]]),w(i,{class:j(L(B).conList.length?"!mt-[1rem]":""),type:"default",onClick:K},{default:b((function(){return e[5]||(e[5]=[x(" 添加容器 ")])})),_:1},8,["class"])]})),_:1}),k("ul",U,[k("li",null,[e[6]||(e[6]=x(" 启动顺序:从上到下。可拖拽排序。 ")),_(k("span",null,"【当前组容器为空】",512),[[E,!L(B).conList.length]])])])]})),_:1},8,["model"]),w(f,{ref:"popup",title:"新增容器",area:62,modelValue:L(H).show,"onUpdate:modelValue":e[3]||(e[3]=function(t){return L(H).show=t}),showFooter:"",onConfirm:nt},{default:b((function(){return[k("div",R,[_(w(a,{column:L(it),"max-height":330,ref_key:"sortTable",ref:W,"row-key":"name","reserve-selection":"",data:L(M).list,description:"容器列表为空",onSelectionChange:et},null,8,["column","data"]),[[p,L(M).loading],[p,"正在加载容器列表,请稍后...","title"]]),k("ul",Y,[k("li",null,"已选中:"+O(L(tt).selectList.length)+"个",1)])])]})),_:1},8,["modelValue"])])}}});t("default",f($,[["__scopeId","data-v-e6dac9b4"]]))}}}))}();
Save File
Cancel