import{M as C,r as g,B as S,J as N,o as K,g as w,w as s,h as n,j as E,f as l,A as R,m as z}from"./index-25eb6331.js";import{E as D}from"./dialog-66decf59.js";import"./overlay-25bb32bf.js";import{E as I}from"./button-c2afb424.js";/* empty css                  *//* empty css              */import{e as q,f as B}from"./admin-storage-8eb4a874.js";import{E as M,a as j}from"./request-14d7fed5.js";import{_ as U}from"./_plugin-vue_export-helper-c27b6911.js";import{E as $,a as k}from"./index-0746525e.js";const i=C({toName:"",toKey:"",fromId:null}),L={toName:[{required:!0,message:"请输入新存储源名称",trigger:"blur"}],toKey:[{required:!0,message:"请输入新存储源别名",trigger:"blur"},{validator:(d,a,e)=>{if(a==null||a===""){e("请输入存储源别名");return}if(S.systemNames.includes(a)){e(new Error("不可占用系统级名称，请修改。"));return}if(!/^[\w\-]+$/.test(a)){e(new Error("只允许使用字母、数字、下划线、横杠"));return}q({storageKey:a}).then(o=>{o.data?e(new Error("该存储源别名已存在，请修改。")):e()})}}]},m=g(!1),u=g(!1);function O(){const d=o=>{m.value=!0,i.fromId=o.id,i.toKey=o.key,i.toName=o.name},a=()=>{m.value=!1},e=g(null);return{dialogVisible:m,openDialog:d,closeDialog:a,formData:i,rules:L,storageCopyFormRef:e,submitForm:o=>{u.value=!0,e.value.validate(p=>{p?B(i).then(y=>{M.success("复制成功"),m.value=!1,o("close")}).finally(()=>{u.value=!1}):u.value=!1})},saveLoading:u}}const P={__name:"index",setup(d,{emit:a}){const{dialogVisible:e,saveLoading:f,formData:o,rules:p,storageCopyFormRef:y,submitForm:V}=O(),_=N();return(A,t)=>{const c=j,b=$,F=k,v=I,x=D;return K(),w(x,{"append-to-body":"",title:"复制存储配置",modelValue:l(e),"onUpdate:modelValue":t[5]||(t[5]=r=>z(e)?e.value=r:null)},{footer:s(()=>[n(v,{onClick:t[3]||(t[3]=r=>e.value=!1)},{default:s(()=>[E("取 消")]),_:1}),n(v,{type:"primary",onClick:t[4]||(t[4]=r=>l(V)(a)),loading:l(f)},{default:s(()=>[E("确 定")]),_:1},8,["loading"])]),default:s(()=>[n(F,{onSubmit:t[2]||(t[2]=R(()=>{},["prevent"])),model:l(o),rules:l(p),"label-width":l(_).adminForm.labelWidth,"label-position":l(_).adminForm.labelPosition,size:l(_).adminForm.size,"status-icon":"",class:"z-admin-form",ref_key:"storageCopyFormRef",ref:y},{default:s(()=>[n(b,{label:"新存储源名称",prop:"toName"},{default:s(()=>[n(c,{modelValue:l(o).toName,"onUpdate:modelValue":t[0]||(t[0]=r=>l(o).toName=r),placeholder:"请输入新存储源名称"},null,8,["modelValue"])]),_:1}),n(b,{label:"新存储源别名",prop:"toKey"},{default:s(()=>[n(c,{modelValue:l(o).toKey,"onUpdate:modelValue":t[1]||(t[1]=r=>l(o).toKey=r),placeholder:"请输入新存储源别名"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules","label-width","label-position","size"])]),_:1},8,["modelValue"])}}},T=U(P,[["__scopeId","data-v-80935aa9"]]),oe=Object.freeze(Object.defineProperty({__proto__:null,default:T},Symbol.toStringTag,{value:"Module"}));export{T as S,oe as i,O as u};
