import{f as x}from"./role-a0a31a82.js";import{i as A,j as F}from"./user-956d2dff.js";import{M as n,d as T,F as V,e as M,f as O}from"./ui-ba7aaa7e.js";import{e as P,l as S,r as l,P as U,a3 as h,a4 as i,f as c}from"./vue-bf422dc1.js";const j={name:"EditPopup"},N=P({...j,emits:["success"],setup(q,{expose:f,emit:d}){const o=S({...{user_id:0,role_id:""}}),m=l([]),u=l(),a=l(!1),_=l("分配商户角色"),p=t=>{y(t),v(),a.value=!0},v=async()=>{const{data:t}=await x();m.value=t},y=async t=>{const{data:e}=await A({id:t});for(const s in o)e[s]!=null&&e[s]!==void 0&&(o[s]=e[s])};f({init:p});const g={name:[{required:!0,message:"必填",type:"error"}],title:[{required:!0,message:"必填",type:"error"}]},b=d,w=async()=>{const t=await u.value.validate();if(typeof t!="object"&&t)try{const e=await F(o);e.code===1?(n.success("操作成功"),a.value=!1,b("success")):n.error(e.msg)}catch(e){n.error(e.msg)}};return(t,e)=>{const s=T,R=V,k=M,D=O;return U(),h(D,{visible:a.value,"onUpdate:visible":e[1]||(e[1]=r=>a.value=r),"close-on-overlay-click":!1,"destroy-on-close":!0,header:_.value,"on-confirm":w},{default:i(()=>[c(k,{ref_key:"formRef",ref:u,"label-align":"left",data:o,rules:g,"label-width":80},{default:i(()=>[c(R,{label:"选择角色",name:"role_id"},{default:i(()=>[c(s,{modelValue:o.role_id,"onUpdate:modelValue":e[0]||(e[0]=r=>o.role_id=r),options:m.value},null,8,["modelValue","options"])]),_:1})]),_:1},8,["data"])]),_:1},8,["visible","header"])}}});export{N as _};
