← Back
Editing: index-legacy423.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,u=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.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 h(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,a=Object.create(o.prototype),i=new C(n||[]);return u(a,"_invoke",{value:P(t,r,i)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var d="suspendedStart",v="suspendedYield",m="executing",y="completed",g={};function w(){}function x(){}function b(){}var _={};f(_,c,(function(){return this}));var L=Object.getPrototypeOf,E=L&&L(L(G([])));E&&E!==o&&a.call(E,c)&&(_=E);var j=b.prototype=w.prototype=Object.create(_);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,u,i,c){var l=p(e[o],e,u);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,i,c)}),(function(t){n("throw",t,i,c)})):r.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return n("throw",t,i,c)}))}c(l.arg)}var o;u(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 P(t,e,n){var o=d;return function(a,u){if(o===m)throw Error("Generator is already running");if(o===y){if("throw"===a)throw u;return{value:r,done:!0}}for(n.method=a,n.arg=u;;){var i=n.delegate;if(i){var c=D(i,n);if(c){if(c===g)continue;return c}}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=m;var l=p(t,e,n);if("normal"===l.type){if(o=n.done?y:v,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=p(o,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,g;var u=a.arg;return u?u.done?(e[t.resultName]=u.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):u:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function V(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(V,this),this.reset(!0)}function G(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,u=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 u.next=u}}throw new TypeError(t(e)+" is not iterable")}return x.prototype=b,u(j,"constructor",{value:b,configurable:!0}),u(b,"constructor",{value:x,configurable:!0}),x.displayName=f(b,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,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 u=new S(h(t,e,r,o),a);return n.isGeneratorFunction(e)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},k(j),f(j,s,"Generator"),f(j,c,(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=G,C.prototype={constructor:C,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(O),!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 i.type="throw",i.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],i=u.completion;if("root"===u.tryLoc)return n("end");if(u.tryLoc<=this.prev){var c=a.call(u,"catchLoc"),l=a.call(u,"finallyLoc");if(c&&l){if(this.prev<u.catchLoc)return n(u.catchLoc,!0);if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return n(u.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return n(u.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 u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(u)},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),O(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;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},n}function r(t,e,r,n,o,a,u){try{var i=t[a](u),c=i.value}catch(t){return void r(t)}i.done?e(c):Promise.resolve(c).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var u=t.apply(e,n);function i(t){r(u,o,a,i,c,"next",t)}function c(t){r(u,o,a,i,c,"throw",t)}i(void 0)}))}}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./index-legacy103.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./database-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,u,i,c,l,s,f,h,p,d,v,m,y,g,w,x,b,_,L,E,j,k,S,P,D,V,O,C,G,F,M,U,A,N,q,I,T,B,H,Y;return{setters:[function(t){o=t.A,a=t.n,u=t.L,i=t.M,c=t.p,l=t.K,s=t.J,f=t.l,h=t.j,p=t.W},function(t){d=t._},function(t){v=t.c,m=t.r,y=t.k,g=t.aB,w=t.p,x=t.G,b=t.q,_=t.v,L=t.e,E=t.A,j=t.B,k=t.x,S=t.P,P=t.F,D=t.a_,V=t.M,O=t.H,C=t.y,G=t.z,F=t.D,M=t.ai,U=t.aj,A=t.au,N=t.aw,q=t.ce},function(t){I=t.u},function(t){T=t.exportUserData,B=t.delMysqlUser,H=t.getUserData,Y=t.getMysqlCloudServer},null,null],execute:function(){var z={class:"break-words flex items-center justify-center w-full text-[#666]"},J=["title"],K={class:"p-20px"},R={class:"p-20px"};t("default",v({__name:"index",setup:function(t,v){var W=v.expose,Q=m(0),X=m(!1),Z=m(""),$=m([]),tt=m(!0),et=m([]),rt=y({associatedPopup:!1,associatedData:[],associatedDataColumn:[{label:"数据库",prop:"database"},{label:"表",prop:"table"},{label:"权限",render:function(t){return t.access.map((function(t){return"".concat(t.title,":").concat(t.access)})).join("\n")}}]}),nt=m({resultMsg:"",resultData:"",resultStatus:!1}),ot=y({authPopup:!1,authData:[],authDataColumn:[{label:"权限",render:function(t){return t.map((function(t){return g("div","".concat(t.title,":").concat(t.access))}))}}]}),at=[{content:"说明:此处用户数据为连接mysql直接获取,未与面板数据库连接,建议仅对此处新建的用户进行操作,以防出现意外"},{content:"访问权限:localhost/127.0.0.1:仅限本机访问 %:允许任何人访问 IP地址:仅限此IP地址访问(不含本机)"},{content:"全局权限:全局权限是指对所有数据库拥有的权限 ALL PRIVILEGES即root最高权限,USAGE为普通用户,拥有指定数据库指定权限(关联数据库权限)"}],ut=function(t){a({title:"添加用户",area:60,component:function(){return u((function(){return r.import("./add-user-legacy2.js?v=VERSION_NUMBER")}),void 0,r.meta.url)},compData:{refreshFn:function(){return ht()},serverList:et},showFooter:!0})},it=function(){var t=n(e().mark((function t(r){var n,o,a;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.host,o=r.user,t.prev=1,t.next=4,T({username:o,host:n,sid:Q.value});case 4:a=t.sent,nt.value.resultMsg=a.data,nt.value.resultStatus=!0,X.value=!0,t.next=13;break;case 10:t.prev=10,t.t0=t.catch(1);case 13:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e){return t.apply(this,arguments)}}(),ct=function(){var t=n(e().mark((function t(r){var n,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.host,o=r.user,t.prev=1,t.next=4,c({title:"删除用户",content:"删除用户后,该用户将无法访问数据库,是否继续操作?",icon:"warning-filled"});case 4:return t.next=6,l({loading:"正在删除用户,请稍后...",request:B({username:o,host:n,sid:Q.value}),message:!0,success:lt});case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1);case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e){return t.apply(this,arguments)}}(),lt=function(){var t=n(e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r={sid:Q.value},Z.value&&(r.search=Z.value),t.next=5,l({loading:tt,request:H(r),data:{data:[Array,$],status:Boolean}});case 5:if((n=t.sent).status){t.next=11;break}return $.value=[],t.abrupt("return",i.error(n.msg||"获取用户数据失败"));case 11:$.value.forEach((function(t){t.list.forEach((function(e){e.user=t.user}))}));case 12:return t.abrupt("return",n);case 15:t.prev=15,t.t0=t.catch(0);case 18:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return t.apply(this,arguments)}}(),st=function(){var t=n(e().mark((function t(){var r,n;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l({loading:"正在获取服务器数据,请稍后...",request:Y(),data:[Array,et]});case 2:et.value=null===(r=et.value)||void 0===r?void 0:r.filter((function(t){return""!==t.id})),Q.value=null===(n=et.value[0])||void 0===n?void 0:n.id;case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ft=m([{label:"访问权限",render:function(t){return g("span","".concat(t.host).concat("%"==t.host?" - 所有人":"localhost"==t.host||"127.0.0.1"==t.host?" - 本地":""))}},{prop:"password",label:"密码",width:50},{prop:"password_last_changed",label:"密码修改时间",width:160},I([{onClick:function(t){a({title:"数据库权限",area:80,component:function(){return u((function(){return r.import("./user-auth-legacy.js?v=VERSION_NUMBER")}),void 0,r.meta.url)},compData:{row:t,sid:Q.value,refreshEvent:lt}})},title:"权限"},{onClick:function(t){var e=t.user,n=t.host;if("root"===e&&"localhost"===n)return i.error("该用户不允许改密");a({title:"修改密码",area:42,compData:{username:e,host:n,sid:Q.value},component:function(){return u((function(){return r.import("./user-pwd-legacy.js?v=VERSION_NUMBER")}),void 0,r.meta.url)},showFooter:!0})},title:"改密"},{onClick:it,title:"导出"},{onClick:ct,title:"删除"}])]),ht=function(){var t=n(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:lt(),st();case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return w(ht),W({init:ht}),function(t,e){var r=F,n=M,a=U,u=s,i=f,c=A,l=N,v=q,m=h,y=d,g=p,w=x("bt-loading");return b(),_("div",null,[L(y,null,{"header-left":E((function(){return[L(r,{type:"primary",onClick:ut},{default:E((function(){return e[6]||(e[6]=[j("添加用户")])})),_:1})]})),"header-right":E((function(){return[L(a,{modelValue:k(Q),"onUpdate:modelValue":e[0]||(e[0]=function(t){return S(Q)?Q.value=t:null}),class:"mr-[1.5rem] !w-[16rem]",placeholder:"请选择",onChange:lt},{default:E((function(){return[(b(!0),_(P,null,D(k(et),(function(t){return b(),V(n,{key:t.value,label:t.ps,value:t.id},null,8,["label","value"])})),128))]})),_:1},8,["modelValue"]),L(u,{modelValue:k(Z),"onUpdate:modelValue":e[1]||(e[1]=function(t){return S(Z)?Z.value=t:null}),placeholder:"请输入用户名",class:"!w-[20rem]",onSearch:lt},null,8,["modelValue"])]})),content:E((function(){return[L(l,{data:k($),"max-height":"400"},{default:E((function(){return[L(c,{type:"expand"},{default:E((function(t){return[O(L(i,{column:k(ft),data:t.row.list},null,8,["column","data"]),[[w,k(tt)]])]})),_:1}),L(c,{label:"用户",prop:"user"})]})),_:1},8,["data"])]})),popup:E((function(){return[L(m,{title:"导出结果",modelValue:k(X),"onUpdate:modelValue":e[3]||(e[3]=function(t){return S(X)?X.value=t:null}),area:38},{default:E((function(){return[L(v,{icon:k(nt).resultStatus?"success":"error",title:k(nt).resultStatus?"导出成功":"导出失败"},{extra:E((function(){return[C("div",z,[C("span",{class:"max-w-[28rem] truncate",title:k(nt).resultMsg},G(k(nt).resultMsg),9,J),L(r,{type:"text",onClick:e[2]||(e[2]=function(t){return e=k(nt).resultMsg,o({value:e});var e})},{default:E((function(){return e[7]||(e[7]=[j("复制")])})),_:1})])]})),_:1},8,["icon","title"])]})),_:1},8,["modelValue"]),L(m,{title:"关联数据库",modelValue:k(rt).associatedPopup,"onUpdate:modelValue":e[4]||(e[4]=function(t){return k(rt).associatedPopup=t}),area:80},{default:E((function(){return[C("div",K,[L(i,{"max-height":"300",data:k(rt).associatedData,column:k(rt).associatedDataColumn,"default-sort":{prop:"user",order:"descending"}},null,8,["data","column"]),L(i,{"max-height":"300",data:k(rt).associatedData,column:k(rt).associatedDataColumn},null,8,["data","column"])])]})),_:1},8,["modelValue"]),L(m,{title:"全局权限",modelValue:k(ot).authPopup,"onUpdate:modelValue":e[5]||(e[5]=function(t){return k(ot).authPopup=t}),area:40},{default:E((function(){return[C("div",R,[L(i,{"max-height":"300",data:k(ot).authData,column:k(ot).authDataColumn},null,8,["data","column"])])]})),_:1},8,["modelValue"])]})),_:1}),L(g,{options:at,"list-style":"disc",class:"ml-20px mt-12px"})])}}}))}}}))}();
Save File
Cancel