File: /www/server/panel/BTPanel/static/js/index214.js
import{aI as q,aJ as A,r as w,H as y,V as D,e as o,c as P,I as S,j as L,k as H,v as r,q as p,L as v,p as s,J as m,K as b,aV as W,ad as J,z as M,ab as N}from"./base-lib.js?v=1777008528";import{dm as f,Q as g,w as O,k as $,M as j,db as z,d3 as U,b as K,cZ as Q}from"./utils-lib.js?v=1777008528";import{_ as Z}from"./index116.js?v=1777008528";import{g as h}from"./useStore4.js?v=1777008528";import{batchEditMysqlPassword as G}from"./database.js?v=1777008528";import{c as X,v as Y}from"./index3.js?v=1777008528";import"./__commonjsHelpers__.js?v=1777008528";import"./index119.js?v=1777008528";const ee=A("FTP-BATCH-EDIT-PAW",()=>{const e=w(),t=y({type:"0",password:f(12)}),a=w([{label:"使用统一密码",value:"0"},{label:"单独设置密码",value:"1"}]);return{updateFtpInfoRef:e,ftpForm:t,typeOptions:a}}),x=()=>q(ee()),{refs:{mysqlSelectData:i,isRefreshTable:te}}=h(),{ftpForm:u,updateFtpInfoRef:se}=x(),ae=y({password:[{validator:(e,t,a)=>{t.length>=1||u.value.type!=="0"?a():a(new Error("数据库密码长度不能少于1位!"))},trigger:["blur"]}]}),oe=()=>{u.value.password=f(12)},le=()=>{g({value:u.value.password})},ne=()=>{var e;i.value.selectedList.length>0&&g({value:(e=i.value.selectedList.map(t=>"".concat(t.name,"--").concat(t.password)))==null?void 0:e.join("\n")})},re=()=>{i.value.selectedList.forEach(t=>{t.password=f(12)});const e=document.querySelector(".refreshAllBtn");e==null||e.blur()},pe=()=>{const e=i.value.selectedList.map(t=>({id:t.id,name:t.name,data_name:t.name,password:u.value.type=="0"?u.value.password:t.password}));return{database_list:JSON.stringify(e)}},ie=async e=>{try{await se.value.validate(),await O({title:"提示",width:"35rem",content:"修改数据库密码后,旧密码将无法登录数据库,是否继续操作?"});const t=await $({loading:"正在修改数据库密码,请稍候...",request:G(pe())}),a=X(t);Y(a.data,{title:"修改数据库密码"}),i.value.clearSelection(),te.value=!0,e&&e()}catch(t){}},ue=D([{label:"数据库名",prop:"name",fixed:!0,minWidth:100,width:120},{label:"数据库用户",prop:"username",fixed:!0,minWidth:100,width:120},{label:"密码",fixed:!0,width:190,isCustom:!0,render:e=>{const t={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return e.password=e.password.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(a,l){return t[l]}),o("input",{type:"text",value:e.password,class:"bt-table-input !w-[18rem]",placeholder:"点击编辑密码",title:"点击编辑密码",onBlur:a=>{if(a.target.value.length<1&&(j.error("数据库密码长度不能少于1位!"),a.target.value=e.password),e.password===a.target.value)return!1;e.password=a.target.value}},null)}}]),ce={class:"mt-[1.6rem] flex"},de={class:"flex items-center"},me=P({__name:"index",setup(e,{expose:t}){const{refs:{mysqlSelectData:a}}=h(),{ftpForm:l,typeOptions:C,updateFtpInfoRef:F}=x();return t({onConfirm:ie}),(fe,n)=>{const B=W,k=z,c=J,I=U,_=M,E=Z,R=K,V=N,T=S("bt-loading");return L(),H("div",{class:v(s(l).type=="1"?"pt-2rem pr-2rem":"p-2rem")},[o(B,{class:v(["!w-full",s(l).type=="1"?"warn":""]),icon:"svgtofont-el-warning",type:"warning",closable:!1},{title:r(()=>[...n[2]||(n[2]=[p("span",null,"批量改密已选mysql数据库,默认自动化改密,支持自定义",-1)])]),_:1},8,["class"]),o(V,{ref_key:"updateFtpInfoRef",ref:F,rules:s(ae),model:s(l),class:"bt-custom-form"},{default:r(()=>[o(c,{label:"类型",class:"typeClass"},{default:r(()=>[o(k,{type:"button",class:"!flex",modelValue:s(l).type,"onUpdate:modelValue":n[0]||(n[0]=d=>s(l).type=d),options:s(C)},null,8,["modelValue","options"])]),_:1}),m(o(c,{label:" ",class:"typeClass"},{default:r(()=>[m(o(I,{"max-height":200,ref:"showFtpTableRef",column:s(ue),data:s(a).selectedList,description:"列表为空"},null,8,["column","data"]),[[T,"正在加载列表,请稍后...","title"]]),p("div",ce,[o(_,{type:"default",onClick:s(ne),class:"inline-block flex items-center"},{default:r(()=>[...n[3]||(n[3]=[p("i",{class:"svgtofont-icon-copy"},null,-1),p("span",{class:"mb-[2px] ml-[4px]"},"复制所有",-1)])]),_:1},8,["onClick"]),o(_,{type:"default",onClick:s(re),class:"refreshAllBtn"},{default:r(()=>[...n[4]||(n[4]=[p("i",{class:"svgtofont-el-refresh"},null,-1),p("span",{class:"mb-[2px] ml-[4px]"},"刷新所有",-1)])]),_:1},8,["onClick"])])]),_:1},512),[[b,s(l).type==="1"]]),m(o(c,{label:"密码",class:"relative mt-[16px] typeClass",prop:"password"},{default:r(()=>[p("div",de,[o(E,{modelValue:s(l).password,"onUpdate:modelValue":n[1]||(n[1]=d=>s(l).password=d),style:{width:"26rem"},name:"password",icon:"el-refresh",onIconClick:s(oe)},null,8,["modelValue","onIconClick"]),o(R,{icon:"icon-copy",class:"w-1.8rem h-1.8rem cursor-pointer ml-[1rem]",onClick:s(le)},null,8,["onClick"])])]),_:1},512),[[b,s(l).type=="0"]])]),_:1},8,["rules","model"])],2)}}}),Ce=Q(me,[["__scopeId","data-v-9bed89e3"]]);export{Ce as default};