← Back
Editing: index292.js
import{hT as a,hU as e,bT as r,G as t}from"./utils-lib.js?v=1765440387";import{r as s,c as o,g as l,q as p,v as n,e as u,x as i}from"./base-lib.js?v=1765440387";import{a as m,u as d,q as w}from"./useStore7.js?v=1765440387";import{b as c,m as h,k as v}from"./form-item.js?v=1765440387";import{f}from"./validator.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./column.js?v=1765440387";import"./index94.js?v=1765440387";const{isEdit:_,addFtpRef:g,ftpForm:b,defaultPath:j}=m(),{rowData:F}=d();s({name:[{validator:(a,e,r)=>{0===e.length?r(new Error("FTP用户名不能为空!")):/^[a-zA-Z0-9_]+$/g.test(e)?e.length<=3?r(new Error("FTP用户名长度错误,需要大于3个字符!")):r():r(new Error("FTP用户名只能包含字母、数字和下划线!"))},required:!0,trigger:["blur","change"]}],password:[a({complex:{length:6}}),{required:!0}],path:[e(),{required:!0}]});const x=()=>{var a,e,t;try{let s=j.value||"/www/wwwroot";return _.value&&(s=null==(a=F.value)?void 0:a.path),{ftp_username:(null==(e=F.value)?void 0:e.name)||"",path:s,ftp_password:(null==(t=F.value)?void 0:t.password)||r(12)}}catch(s){return{}}},E={class:"p-[2rem]"},P=o({__name:"index",setup(s,{expose:o}){const{isEdit:_,defaultPath:g}=m(),{rowData:b}=d(),{BtForm:j,submit:F}=t({data:x,options:t=>l(()=>[c("用户名","ftp_username",{attrs:{class:"!w-[320px]",clearable:!0,placeholder:"请输入用户名",disabled:_.value,onInput:a=>{t.value.path="".concat(g.value).concat(t.value.ftp_username.length>0?"/"+t.value.ftp_username:"")}},rules:[{validator:(a,e,r)=>{0===e.length?r(new Error("FTP用户名不能为空!")):/^[a-zA-Z0-9_]+$/g.test(e)?e.length<=3?r(new Error("FTP用户名长度错误,需要大于3个字符!")):r():r(new Error("FTP用户名只能包含字母、数字和下划线!"))},trigger:["blur","change"]}]}),h("密码","ftp_password",{attrs:{class:"!w-[32rem]",placeholder:"请输入密码"},rules:[a({complex:{length:6}})]},()=>t.value.ftp_password=r(12)),v("根目录","path",{attrs:{class:"!w-[32rem]",placeholder:"请输入根目录"},rules:[e()]},()=>{f({type:"dir",path:"/www/wwwroot",change:a=>{t.value.path=a}})})]),submit:async(a,e,r)=>{await e();const{ftp_username:t,path:s,ftp_password:o}=a.value;let l={ftp_username:t,path:s,[_.value?"new_password":"ftp_password"]:o,ps:t};return _.value&&(l.id=b.value.id),await w(l,_.value)}});return o({onConfirm:F}),(a,e)=>(p(),n("div",E,[u(i(j))]))}});export{P as default};
Save File
Cancel