import{d as T,Q as D,r as o,x as K,o as m,A as _,B as t,f as r,a,E as v,k as Q,c as U,F as k,R as w,G as W,a2 as Z,a8 as j,V as z,S as H,U as P,as as J,at as X,W as Y,K as $,Z as ee,__tla as ae}from"./index-92ad187a.js";import{_ as le,__tla as se}from"./Dialog-44c9fa34.js";import{a as te,D as re,__tla as ue}from"./dict-221f3e01.js";import{C as I}from"./constants-c811e5ff.js";import{a as oe,c as de,u as ie,__tla as me}from"./index-c41b61d6.js";import{g as ne,__tla as ce}from"./index-343decc0.js";import{u as _e,__tla as pe}from"./useMessage-d9788660.js";let S,ve=Promise.all([(()=>{try{return ae}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return ue}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return pe}catch{}})()]).then(async()=>{S=T({name:"UserGroupForm",__name:"UserGroupForm",emits:["success"],setup(fe,{expose:q,emit:x}){const{t:p}=D(),f=_e(),d=o(!1),y=o(""),i=o(!1),b=o(""),s=o({id:void 0,name:void 0,description:void 0,userIds:void 0,status:I.ENABLE}),A=K({name:[{required:!0,message:"\u7EC4\u540D\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],description:[{required:!0,message:"\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],userIds:[{required:!0,message:"\u6210\u5458\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],status:[{required:!0,message:"\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),n=o(),V=o([]);q({open:async(u,l)=>{if(d.value=!0,y.value=p("action."+u),b.value=u,F(),l){i.value=!0;try{s.value=await oe(l)}finally{i.value=!1}}V.value=await ne()}});const C=x,E=async()=>{if(n&&await n.value.validate()){i.value=!0;try{const u=s.value;b.value==="create"?(await de(u),f.success(p("common.createSuccess"))):(await ie(u),f.success(p("common.updateSuccess"))),d.value=!1,C("success")}finally{i.value=!1}}},F=()=>{var u;s.value={id:void 0,name:void 0,description:void 0,userIds:void 0,status:I.ENABLE},(u=n.value)==null||u.resetFields()};return(u,l)=>{const g=j,c=z,B=H,G=P,N=J,L=X,M=Y,h=$,O=le,R=ee;return m(),_(O,{modelValue:a(d),"onUpdate:modelValue":l[5]||(l[5]=e=>Z(d)?d.value=e:null),title:a(y)},{footer:t(()=>[r(h,{disabled:a(i),type:"primary",onClick:E},{default:t(()=>[v("\u786E \u5B9A")]),_:1},8,["disabled"]),r(h,{onClick:l[4]||(l[4]=e=>d.value=!1)},{default:t(()=>[v("\u53D6 \u6D88")]),_:1})]),default:t(()=>[Q((m(),_(M,{ref_key:"formRef",ref:n,model:a(s),rules:a(A),"label-width":"100px"},{default:t(()=>[r(c,{label:"\u7EC4\u540D",prop:"name"},{default:t(()=>[r(g,{modelValue:a(s).name,"onUpdate:modelValue":l[0]||(l[0]=e=>a(s).name=e),placeholder:"\u8BF7\u8F93\u5165\u7EC4\u540D"},null,8,["modelValue"])]),_:1}),r(c,{label:"\u63CF\u8FF0"},{default:t(()=>[r(g,{modelValue:a(s).description,"onUpdate:modelValue":l[1]||(l[1]=e=>a(s).description=e),placeholder:"\u8BF7\u8F93\u5165\u63CF\u8FF0",type:"textarea"},null,8,["modelValue"])]),_:1}),r(c,{label:"\u6210\u5458",prop:"userIds"},{default:t(()=>[r(G,{modelValue:a(s).userIds,"onUpdate:modelValue":l[2]||(l[2]=e=>a(s).userIds=e),multiple:"",placeholder:"\u8BF7\u9009\u62E9\u6210\u5458"},{default:t(()=>[(m(!0),U(k,null,w(a(V),e=>(m(),_(B,{key:e.id,label:e.nickname,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),r(c,{label:"\u72B6\u6001",prop:"status"},{default:t(()=>[r(L,{modelValue:a(s).status,"onUpdate:modelValue":l[3]||(l[3]=e=>a(s).status=e)},{default:t(()=>[(m(!0),U(k,null,w(a(te)(a(re).COMMON_STATUS),e=>(m(),_(N,{key:e.value,label:e.value},{default:t(()=>[v(W(e.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[R,a(i)]])]),_:1},8,["modelValue","title"])}}})});export{S as _,ve as __tla};
