← Back
Editing: index309.js
import{s as e,j as a,r as s,k as t,U as l,e as o,c as r,G as n,q as p,v as i,A as u,y as d,J as c,x as m,H as f,I as v,aW as w,a9 as y,D as b,a7 as g}from"./base-lib.js?v=VERSION_NUMBER";import{x as _,A as h,p as x,K as F,M as C,$ as T,l as j,_ as k,e as P}from"./utils-lib.js?v=VERSION_NUMBER";import{_ as I}from"./index101.js?v=VERSION_NUMBER";import{u as A,L}from"./useStore8.js?v=VERSION_NUMBER";import{h as R,i as V,o as q}from"./validator.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";import"./column.js?v=VERSION_NUMBER";import"./index104.js?v=VERSION_NUMBER";const B=a("FTP-BATCH-EDIT-PAW",(()=>({updateFtpInfoRef:s(),ftpForm:t({type:"0",password:_(12)}),typeOptions:s([{label:"所有密码一致",value:"0"},{label:"所有密码不一致",value:"1"}])}))),D=()=>e(B()),{rowData:S,isRefreshFtpList:W}=A(),{ftpForm:E,updateFtpInfoRef:H}=D(),O=t({password:[{validator:(e,a,s)=>{a.length>=6||"0"!==E.value.type?s():s(new Error("FTP密码长度不能少于6位!"))},trigger:["blur"]}]}),U=()=>{E.value.password=_(12)},J=()=>{h({value:E.value.password})},G=()=>{var e;S.value.selectedList.length>0&&h({value:null==(e=S.value.selectedList.map((e=>"".concat(e.name,"--").concat(e.password))))?void 0:e.join("\n")})},K=()=>{S.value.selectedList.forEach((e=>{e.password=_(12)}));const e=document.querySelector(".refreshAllBtn");null==e||e.blur()},M=()=>{const e=S.value.selectedList.map((e=>({id:e.id,ftp_username:e.name,new_password:"0"==E.value.type?E.value.password:e.password})));return{ftp_list:JSON.stringify(e)}},N=async e=>{try{await H.value.validate(),await x({title:"提示",width:"35rem",content:"修改FTP密码后,旧密码将无法登录FTP账号,是否继续操作?"});const{config:a}=S.value,{enable:s,exclude:t}=a,l=R(!1,t,s,{params:M()}),o=await F({loading:"正在修改FTP密码,请稍候...",request:L(l),data:Array});let{data:r}=V(o);r=r.map((e=>({...e,name:e.ftp_username}))),q(r,{title:"修改FTP密码"}),S.value.clearSelection(),W.value=!0,e&&e()}catch(a){}},$=l([{label:"用户名",prop:"name",fixed:!0,minWidth:100},{label:"密码",fixed:!0,minWidth:200,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)}}]),z={class:"mt-[1.6rem] flex"},Q=P(r({__name:"index",setup(e,{expose:a}){const{rowData:s}=A(),{ftpForm:t,typeOptions:l,updateFtpInfoRef:r}=D();return a({onConfirm:N}),(e,a)=>{const _=w,h=T,x=y,F=j,C=b,P=I,A=k,L=g,R=n("bt-loading");return p(),i("div",{class:c("1"==m(t).type?"pt-2rem pr-2rem":"p-2rem")},[o(_,{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(L,{ref_key:"updateFtpInfoRef",ref:r,rules:m(O),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($),data:m(s).selectedList,description:"FTP列表为空"},null,8,["column","data"]),[[R,"正在加载FTP列表,请稍后...","title"]]),d("div",z,[o(C,{type:"default",onClick:m(G),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},8,["onClick"]),o(C,{type:"default",onClick:m(K),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},8,["onClick"])])])),_:1},512),[[v,"1"===m(t).type]]),f(o(x,{label:"密码",class:"relative mt-[16px] typeClass",prop:"password"},{default:u((()=>[o(P,{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(A,{icon:"icon-copy",class:"w-1.8rem h-1.8rem cursor-pointer absolute top-0 right-16",onClick:m(J)},null,8,["onClick"])])),_:1},512),[[v,"0"==m(t).type]])])),_:1},8,["rules","model"])],2)}}}),[["__scopeId","data-v-78d50617"]]);export{Q as default};
Save File
Cancel