← Back
Editing: index-legacy182.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 r};var n,r={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(n){f=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),u=new q(r||[]);return i(a,"_invoke",{value:O(t,n,u)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var m="suspendedStart",y="suspendedYield",d="executing",v="completed",b={};function g(){}function w(){}function x(){}var _={};f(_,l,(function(){return this}));var k=Object.getPrototypeOf,L=k&&k(k(z([])));L&&L!==o&&a.call(L,l)&&(_=L);var j=x.prototype=g.prototype=Object.create(_);function S(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(e,n){function r(o,i,u,l){var c=h(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==t(f)&&a.call(f,"__await")?n.resolve(f.__await).then((function(t){r("next",t,u,l)}),(function(t){r("throw",t,u,l)})):n.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,l)}))}l(c.arg)}var o;i(this,"_invoke",{value:function(t,e){function a(){return new n((function(n,o){r(t,e,n,o)}))}return o=o?o.then(a,a):a()}})}function O(t,e,r){var o=m;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:n,done:!0}}for(r.method=a,r.arg=i;;){var u=r.delegate;if(u){var l=I(u,r);if(l){if(l===b)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===m)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=h(t,e,r);if("normal"===c.type){if(o=r.done?v:y,c.arg===b)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function I(t,e){var r=e.method,o=t.iterator[r];if(o===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=n,I(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var a=h(o,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,b;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=n),e.delegate=null,b):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b)}function M(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(M,this),this.reset(!0)}function z(e){if(e||""===e){var r=e[l];if(r)return r.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=n,t.done=!0,t};return i.next=i}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=x,i(j,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,f(t,s,"GeneratorFunction")),t.prototype=Object.create(j),t},r.awrap=function(t){return{__await:t}},S(E.prototype),f(E.prototype,c,(function(){return this})),r.AsyncIterator=E,r.async=function(t,e,n,o,a){void 0===a&&(a=Promise);var i=new E(p(t,e,n,o),a);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},S(j),f(j,s,"Generator"),f(j,l,(function(){return this})),f(j,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},r.values=z,q.prototype={constructor:q,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},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 r(r,o){return u.type="throw",u.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;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,b):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),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:z(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),b}},r}function n(t,e,n,r,o,a,i){try{var u=t[a](i),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,o)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(o,a){var i=t.apply(e,r);function u(t){n(i,o,a,u,l,"next",t)}function l(t){n(i,o,a,u,l,"throw",t)}u(void 0)}))}}System.register(["./index-legacy103.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./index-legacy101.js?v=VERSION_NUMBER","./database-legacy.js?v=VERSION_NUMBER","./useStore-legacy2.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./validator-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER"],(function(t,n){"use strict";var o,a,i,u,l,c,s,f,p,h,m,y,d,v,b,g,w,x,_,k,L,j,S,E,O,I,M,T,q,z,A,D,P,C,N,R,G,V,B,F,H;return{setters:[function(t){o=t._},function(t){a=t.M,i=t.K,u=t.w,l=t.l,c=t.a0,s=t.j,f=t.at},function(t){p=t.c,h=t.r,m=t.k,y=t.p,d=t.G,v=t.q,b=t.v,g=t.e,w=t._,x=t.x,_=t.A,k=t.H,L=t.M,j=t.C,S=t.P,E=t.y,O=t.aW,I=t.a9,M=t.a7},function(t){T=t._},function(t){q=t.exportTableStr,z=t.getTableInfo,A=t.getModulesTableInfo,D=t.conversionTable,P=t.optimizeTable,C=t.repairTable,N=t.modifyTableComment},function(t){R=t.g},function(t){G=t.a,V=t.g,B=t.u,F=t.c},function(t){H=t.f},null,null],execute:function(){var n={class:"p-[16px]"},J={key:0,class:"mt-[8px] ml-[16px] leading-8 text-[1.2rem] list-disc"};t("default",p({__name:"index",props:{compData:{default:function(){return{name:""}}}},setup:function(t){var p=t,U=R().refs.tabActive,Y=h(),K=h(!1),W=h("暂无数据"),Z=h([]),Q=h(!1),X=h(),$=m({db_name:"",table_name:"",filename:""}),tt=m({filename:[{required:!0,message:"请输入导出文件路径",trigger:["blur","input"]}]}),et=function(){var t=r(e().mark((function t(n,o,a,i){var u,l,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u={Repair:["修复",""],Optimization:["优化",",将回收未释放的磁盘空间,"],InnoDB:["转换引擎","为【InnoDB】"],MyISAM:["转换引擎","为【MyISAM】"]},l=i.label,c=i.value,t.next=4,n({title:"批量".concat(l),content:"批量".concat(u[c][0],"已选数据库表").concat(u[c][1],",是否继续?"),column:[{prop:"table_name",label:"表名"},F()],onConfirm:function(){var t=r(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o((function(t){return nt(t,c)}));case 2:return st(),t.abrupt("return",!1);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()});case 4:case"end":return t.stop()}}),t)})));return function(e,n,r,o){return t.apply(this,arguments)}}(),nt=function(){var t=r(e().mark((function t(n,r){var o,a;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.table_name,t.prev=1,a={db_name:p.compData.name,tables:JSON.stringify([o]),table_type:r},"Repair"!==r&&"Optimization"!==r||delete a.table_type,t.t0=r,t.next="Repair"===t.t0?7:"Optimization"===t.t0?10:"InnoDB"===t.t0||"MyISAM"===t.t0?13:16;break;case 7:return t.next=9,C(a);case 9:return t.abrupt("return",t.sent);case 10:return t.next=12,P(a);case 12:return t.abrupt("return",t.sent);case 13:return t.next=15,D(a);case 15:return t.abrupt("return",t.sent);case 16:t.next=21;break;case 18:t.prev=18,t.t1=t.catch(1),f(t.t1,"tools-handleOperateRequest");case 21:case"end":return t.stop()}}),t,null,[[1,18]])})));return function(e,n){return t.apply(this,arguments)}}(),rt=function(){var t=r(e().mark((function t(n,r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i({loading:"正在修改中,请稍后...",request:N({db_name:p.compData.name,table_name:n.table_name,comment:r}),message:!0});case 2:st();case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ot=function(){H({type:"dir",change:function(t){$.filename=t+"/"+$.db_name+"_"+$.table_name+".sql"}})},at=function(){var t=r(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,""!==$.filename){t.next=4;break}return a.error("请填写导出文件路径"),t.abrupt("return",!1);case 4:return t.next=6,i({loading:"正在导出中,请稍候...",request:q($),message:!0,success:function(){$.table_name="",$.filename="",X.value.clearValidate(),Q.value=!1}});case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}(),it=function(){var t=r(e().mark((function t(n,r){var o,i;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=a.load("正在操作表【".concat(n.table_name,"】,请稍后...")),t.next=3,nt(n,r);case 3:i=t.sent,o.close(),a.request(i),st();case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),ut=[G({key:"table_name"}),{label:"表名",prop:"table_name",showOverflowTooltip:!0},V({request:function(t,e){return rt(t,e)},prop:"comment"}),{label:"引擎",prop:"type",width:80},{label:"字符集",prop:"collation",showOverflowTooltip:!0},{label:"行数",align:"center",width:60,prop:"rows_count"},{label:"大小",prop:"data_size"},B([{onClick:function(t){$.db_name=p.compData.name,$.table_name=t.table_name,Q.value=!0},title:"导出表结构",width:70},{onClick:function(t){return it(t,"Repair")},title:"修复"},{onClick:function(t){return it(t,"Optimization")},title:"优化"},{onClick:function(t){return it(t,"MyISAM"===t.type?"InnoDB":"MyISAM")},title:"转换引擎",width:70}])],lt=[{label:"集合名称",prop:"collection_name"},{label:"文档数量",prop:"count"},{label:"内存中的大小",render:function(t){return u(t.size)}},{label:"对象平均大小",render:function(t){return u(t.avg_obj_size)}},{label:"存储大小",render:function(t){return u(t.storage_size)}},{label:"索引数量",prop:"nindexes"},{label:"索引大小",render:function(t){return u(t.total_index_size)}}],ct=[{label:"修复",value:"Repair",event:et},{label:"优化",value:"Optimization",event:et},{label:"转为InnoDB",value:"InnoDB",event:et},{label:"转为MyISAM",value:"MyISAM",event:et}],st=function(){var t=r(e().mark((function t(){var n,r,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={db_name:p.compData.name},t.next=3,i({loading:K,request:"mysql"==U.value?z(n):A({data:JSON.stringify(n)},U.value)});case 3:r=t.sent,o=r.data,"mysql"===U.value?Z.value=o.tables:Z.value=o.data.collection_list,"mysql"==U.value?W.value="数据库名称: ".concat(o.database," 大小: ").concat(o.data_size||0):W.value="数据库名称: ".concat(o.data.db,"\n\t\t\t 集合数量: ").concat(o.data.collections||0,"\n\t\t\t 存储大小: ").concat(u(o.data.totalSize)||0,"\n\t\t\t 索引大小: ").concat(u(o.data.indexSize)||0);case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return y((function(){st()})),function(t,e){var r=O,a=l,i=c,u=T,f=I,p=M,h=s,m=o,y=d("bt-loading"),q=d("trim");return v(),b("div",n,[g(m,null,w({"header-left":_((function(){return[g(r,{class:"font-bold",title:x(W),type:"info",closable:!1},null,8,["title"])]})),content:_((function(){return["mysql"===x(U)?k((v(),L(a,{key:0,"max-height":"300",ref_key:"mysqlToolsRef",ref:Y,column:x(ut),data:x(Z)},null,8,["column","data"])),[[y,x(K)],[y,"正在查询中,请稍后...","title"]]):j("",!0),"mysql"!==x(U)?(v(),L(a,{key:1,"max-height":"300",ref:"modulesToolsRef",column:x(lt),data:x(Z)},null,8,["column","data"])):j("",!0)]})),popup:_((function(){return[g(h,{title:"导出表【".concat(x($).table_name,"】结构"),modelValue:x(Q),"onUpdate:modelValue":e[1]||(e[1]=function(t){return S(Q)?Q.value=t:null}),area:[50],"show-footer":"",onConfirm:e[2]||(e[2]=function(t){return at()}),onCancel:e[3]||(e[3]=function(t){return Q.value=!1,X.value.resetFields(),void X.value.clearValidate()})},{default:_((function(){return[g(p,{ref_key:"exportTableForm",ref:X,class:"px-2rem py-3rem",model:x($),rules:x(tt)},{default:_((function(){return[g(f,{label:"导出文件路径",prop:"filename"},{default:_((function(){return[k(g(u,{icon:"icon-file_mode",modelValue:x($).filename,"onUpdate:modelValue":e[0]||(e[0]=function(t){return x($).filename=t}),name:"filename",onIconClick:ot,width:"32rem"},null,8,["modelValue"]),[[q]])]})),_:1})]})),_:1},8,["model","rules"])]})),_:1},8,["title","modelValue"])]})),_:2},["mysql"==x(U)?{name:"footer-left",fn:_((function(){return[g(i,{options:ct,"table-ref":x(Y)},null,8,["table-ref"])]})),key:"0"}:void 0]),1024),"mysql"===x(U)?(v(),b("ul",J,e[4]||(e[4]=[E("li",null,"【优化】执行OPTIMIZE命令,可回收未释放的磁盘空间,建议每月执行一次",-1),E("li",null,"【修复】尝试使用REPAIR命令修复损坏的表,仅能做简单修复,若修复不成功请考虑使用myisamchk工具",-1),E("li",null,"【MyISAM】转换数据表引擎,建议将所有表转为InnoDB",-1),E("li",null,"数据库大小是从数据库表中读取,会与数据库配额容量中获取存在些许误差,请注意",-1)]))):j("",!0)])}}}))}}}))}();
Save File
Cancel