import{M as E,r as b,J as F,o as C,g as N,w as n,h as s,j as y,f as o,A as w,m as I,p as S,q as D,a as R}from"./index-25eb6331.js";import{E as q}from"./dialog-66decf59.js";import"./overlay-25bb32bf.js";import{E as z}from"./button-c2afb424.js";/* empty css                  *//* empty css              */import{c as P,a as B}from"./admin-user-0d4f86da.js";import{E as M,a as j}from"./request-14d7fed5.js";import{_ as h}from"./_plugin-vue_export-helper-c27b6911.js";import{E as L,a as O}from"./index-0746525e.js";const m=E({toUsername:"",toNickname:"",toPassword:"",fromId:null}),T={toUsername:[{required:!0,message:"请输入新用户名"},{min:1,max:255,message:"长度应在 1 到 255 个字符",trigger:"blur"},{validator:(i,r,a)=>{if(r==null||r===""){a();return}P({username:r}).then(d=>{d.data?a(new Error("该用户名已存在，请修改。")):a()})}}],toNickname:[{required:!0,message:"请输入新用户昵称",trigger:"blur"}]},u=b(!1),p=b(!1);function $(){const i=t=>{u.value=!0,m.fromId=t.id,m.toUsername=t.username,m.toNickname=t.nickname},r=()=>{u.value=!1},a=b(null);return{dialogVisible:u,openDialog:i,closeDialog:r,formData:m,rules:T,userCopyFormRef:a,submitForm:t=>{p.value=!0,a.value.validate(f=>{f?B(m).then(v=>{M.success("复制成功"),u.value=!1,t("close")}).finally(()=>{p.value=!1}):p.value=!1})},saveLoading:p}}const A=i=>(S("data-v-24cd43e4"),i=i(),D(),i),G=A(()=>R("div",{class:"text-xs text-gray-400"}," 如不填写，则从源用户复制密码 ",-1)),J={__name:"index",setup(i,{emit:r}){const{dialogVisible:a,saveLoading:d,formData:t,rules:f,userCopyFormRef:v,submitForm:U}=$(),c=F();return(H,e)=>{const _=j,g=L,x=O,V=z,k=q;return C(),N(k,{"append-to-body":"",title:"复制用户及权限",modelValue:o(a),"onUpdate:modelValue":e[6]||(e[6]=l=>I(a)?a.value=l:null)},{footer:n(()=>[s(V,{onClick:e[4]||(e[4]=l=>a.value=!1)},{default:n(()=>[y("取 消")]),_:1}),s(V,{type:"primary",onClick:e[5]||(e[5]=l=>o(U)(r)),loading:o(d)},{default:n(()=>[y("确 定")]),_:1},8,["loading"])]),default:n(()=>[s(x,{onSubmit:e[3]||(e[3]=w(()=>{},["prevent"])),model:o(t),rules:o(f),"label-width":o(c).adminForm.labelWidth,"label-position":o(c).adminForm.labelPosition,size:o(c).adminForm.size,"status-icon":"",class:"z-admin-form",ref_key:"userCopyFormRef",ref:v},{default:n(()=>[s(g,{label:"新用户名称",prop:"toUsername"},{default:n(()=>[s(_,{modelValue:o(t).toUsername,"onUpdate:modelValue":e[0]||(e[0]=l=>o(t).toUsername=l),placeholder:"请输入新用户名称"},null,8,["modelValue"])]),_:1}),s(g,{label:"新用户昵称",prop:"toNickname"},{default:n(()=>[s(_,{modelValue:o(t).toNickname,"onUpdate:modelValue":e[1]||(e[1]=l=>o(t).toNickname=l),placeholder:"请输入新用户昵称"},null,8,["modelValue"])]),_:1}),s(g,{label:"新用户密码"},{default:n(()=>[s(_,{modelValue:o(t).toPassword,"onUpdate:modelValue":e[2]||(e[2]=l=>o(t).toPassword=l),placeholder:"请输入新用户密码"},null,8,["modelValue"]),G]),_:1})]),_:1},8,["model","rules","label-width","label-position","size"])]),_:1},8,["modelValue"])}}},W=h(J,[["__scopeId","data-v-24cd43e4"]]),se=Object.freeze(Object.defineProperty({__proto__:null,default:W},Symbol.toStringTag,{value:"Module"}));export{W as U,se as i,$ as u};
