import{s as e,j as a,r as s,o as t,V as l,e as o,c as r,H as n,v as p,x as i,B as u,z as d,K as c,y as m,I as f,J as w,aY as v,ab as y,G as b,a9 as _}from"./base-lib.js?v=1761009159";import{y as g,B as h,p as x,P as F,M as C,ag as T,l as P,d as j,_ as k}from"./utils-lib.js?v=1761009159";import{_ as I}from"./index103.js?v=1761009159";import{u as L,L as V}from"./useStore8.js?v=1761009159";import{h as B,i as R,o as A}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./column.js?v=1761009159";import"./index106.js?v=1761009159";const q=a("FTP-BATCH-EDIT-PAW",()=>({updateFtpInfoRef:s(),ftpForm:t({type:"0",password:g(12)}),typeOptions:s([{label:"所有密码一致",value:"0"},{label:"所有密码不一致",value:"1"}])})),S=()=>e(q()),{rowData:D,isRefreshFtpList:E}=L(),{ftpForm:H,updateFtpInfoRef:O}=S(),J=t({password:[{validator:(e,a,s)=>{a.length>=6||"0"!==H.value.type?s():s(new Error("FTP密码长度不能少于6位！"))},trigger:["blur"]}]}),U=()=>{H.value.password=g(12)},W=()=>{h({value:H.value.password})},z=()=>{var e;D.value.selectedList.length>0&&h({value:null==(e=D.value.selectedList.map(e=>"".concat(e.name,"--").concat(e.password)))?void 0:e.join("\n")})},G=()=>{D.value.selectedList.forEach(e=>{e.password=g(12)});const e=document.querySelector(".refreshAllBtn");null==e||e.blur()},K=()=>{const e=D.value.selectedList.map(e=>({id:e.id,ftp_username:e.name,new_password:"0"==H.value.type?H.value.password:e.password}));return{ftp_list:JSON.stringify(e)}},M=async e=>{try{await O.value.validate(),await x({title:"提示",width:"35rem",content:"修改FTP密码后，旧密码将无法登录FTP账号，是否继续操作？"});const{config:a}=D.value,{enable:s,exclude:t}=a,l=B(!1,t,s,{params:K()}),o=await F({loading:"正在修改FTP密码，请稍候...",request:V(l),data:Array});let{data:r}=R(o);r=r.map(e=>({...e,name:e.ftp_username})),A(r,{title:"修改FTP密码"}),D.value.clearSelection(),E.value=!0,e&&e()}catch(a){}},N=l([{label:"用户名",prop:"name",fixed:!0,minWidth:100,width:120},{label:"密码",fixed:!0,width:190,isCustom:!0,render:e=>{const a={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return e.password=e.password.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(e,s){return a[s]}),o("input",{type:"text",value:e.password,class:"bt-table-input !w-[18rem]",placeholder:"点击编辑密码",title:"点击编辑密码",onBlur:a=>{if(a.target.value.length<6&&(C.error("FTP密码长度不能少于6位！"),a.target.value=e.password),e.password===a.target.value)return!1;e.password=a.target.value}},null)}}]),Y={class:"mt-[1.6rem] flex"},Q={class:"flex items-center"},X=k(r({__name:"index",setup(e,{expose:a}){const{rowData:s}=L(),{ftpForm:t,typeOptions:l,updateFtpInfoRef:r}=S();return a({onConfirm:M}),(e,a)=>{const g=v,h=T,x=y,F=P,C=b,k=I,L=j,V=_,B=n("bt-loading");return p(),i("div",{class:c("1"==m(t).type?"pt-2rem pr-2rem":"p-2rem")},[o(g,{class:c(["!w-full","1"==m(t).type?"warn":""]),icon:"svgtofont-el-warning",type:"warning",closable:!1},{title:u(()=>a[2]||(a[2]=[d("span",null,"批量改密已选FTP用户，默认自动化改密，支持自定义",-1)])),_:1},8,["class"]),o(V,{ref_key:"updateFtpInfoRef",ref:r,rules:m(J),model:m(t),class:"bt-custom-form"},{default:u(()=>[o(x,{label:"类型",class:"typeClass"},{default:u(()=>[o(h,{type:"button",class:"!flex",modelValue:m(t).type,"onUpdate:modelValue":a[0]||(a[0]=e=>m(t).type=e),options:m(l)},null,8,["modelValue","options"])]),_:1}),f(o(x,{label:" ",class:"typeClass"},{default:u(()=>[f(o(F,{"max-height":200,ref:"showFtpTableRef",column:m(N),data:m(s).selectedList,description:"FTP列表为空"},null,8,["column","data"]),[[B,"正在加载FTP列表，请稍后...","title"]]),d("div",Y,[o(C,{type:"default",onClick:m(z),class:"inline-block flex items-center"},{default:u(()=>a[3]||(a[3]=[d("i",{class:"svgtofont-icon-copy"},null,-1),d("span",{class:"mb-[2px] ml-[4px]"},"复制所有",-1)])),_:1,__:[3]},8,["onClick"]),o(C,{type:"default",onClick:m(G),class:"refreshAllBtn"},{default:u(()=>a[4]||(a[4]=[d("i",{class:"svgtofont-el-refresh"},null,-1),d("span",{class:"mb-[2px] ml-[4px]"},"刷新所有",-1)])),_:1,__:[4]},8,["onClick"])])]),_:1},512),[[w,"1"===m(t).type]]),f(o(x,{label:"密码",class:"relative mt-[16px] typeClass",prop:"password"},{default:u(()=>[d("div",Q,[o(k,{modelValue:m(t).password,"onUpdate:modelValue":a[1]||(a[1]=e=>m(t).password=e),style:{width:"26rem"},name:"password",icon:"el-refresh",onIconClick:m(U)},null,8,["modelValue","onIconClick"]),o(L,{icon:"icon-copy",class:"w-1.8rem h-1.8rem cursor-pointer ml-[1rem]",onClick:m(W)},null,8,["onClick"])])]),_:1},512),[[w,"0"==m(t).type]])]),_:1},8,["rules","model"])],2)}}}),[["__scopeId","data-v-3012681d"]]);export{X as default};
