← Back
Editing: index302.js
import{ft as a,il as e,bU as r,G as t}from"./utils-lib.js?v=VERSION_NUMBER";import{r as s,c as l,g as o,q as p,v as n,e as u,x as i}from"./base-lib.js?v=VERSION_NUMBER";import{a as m,u as d,q as w}from"./useStore8.js?v=VERSION_NUMBER";import{b as c,j as v,l as f}from"./form-item.js?v=VERSION_NUMBER";import{f as h}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{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=l({__name:"index",setup(s,{expose:l}){const{isEdit:_,defaultPath:g}=m(),{rowData:b}=d(),{BtForm:j,submit:F}=t({data:x,options:t=>o((()=>[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"]}]}),v("密码","ftp_password",{attrs:{class:"!w-[32rem]",placeholder:"请输入密码"},rules:[a({complex:{length:6}})]},(()=>t.value.ftp_password=r(12))),f("根目录","path",{attrs:{class:"!w-[32rem]",placeholder:"请输入根目录"},rules:[e()]},(()=>{h({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:l}=a.value;let o={ftp_username:t,path:s,[_.value?"new_password":"ftp_password"]:l,ps:t};return _.value&&(o.id=b.value.id),await w(o,_.value)}});return l({onConfirm:F}),(a,e)=>(p(),n("div",E,[u(i(j))]))}});export{P as default};
Save File
Cancel