import{d as G,Q as L,r as d,x as M,o as _,A as p,B as s,f as u,a,E as f,k as O,c as R,F as T,R as K,G as Q,a2 as Z,a8 as j,V as D,as as P,at as W,W as z,K as H,Z as I,__tla as J}from"./index-92ad187a.js";import{_ as X,__tla as Y}from"./Dialog-44c9fa34.js";import{a as $,D as aa,__tla as ea}from"./dict-221f3e01.js";import{g as la,c as ta,u as sa,__tla as ra}from"./index-135e0996.js";import{C as k}from"./constants-c811e5ff.js";import{u as ua,__tla as oa}from"./useMessage-d9788660.js";let g,ma=Promise.all([(()=>{try{return J}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return ea}catch{}})(),(()=>{try{return ra}catch{}})(),(()=>{try{return oa}catch{}})()]).then(async()=>{g=G({__name:"GroupForm",emits:["success"],setup(da,{expose:w,emit:U}){const{t:c}=L(),v=ua(),o=d(!1),y=d(""),m=d(!1),V=d(""),t=d({id:void 0,name:void 0,remark:void 0,status:k.ENABLE}),x=M({name:[{required:!0,message:"\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],status:[{required:!0,message:"\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),i=d();w({open:async(r,e)=>{if(o.value=!0,y.value=c("action."+r),V.value=r,S(),e){m.value=!0;try{t.value=await la(e)}finally{m.value=!1}}}});const A=U,E=async()=>{if(i&&await i.value.validate()){m.value=!0;try{const r=t.value;V.value==="create"?(await ta(r),v.success(c("common.createSuccess"))):(await sa(r),v.success(c("common.updateSuccess"))),o.value=!1,A("success")}finally{m.value=!1}}},S=()=>{var r;t.value={id:void 0,name:void 0,remark:void 0,status:k.ENABLE},(r=i.value)==null||r.resetFields()};return(r,e)=>{const b=j,n=D,B=P,C=W,F=z,h=H,N=X,q=I;return _(),p(N,{title:a(y),modelValue:a(o),"onUpdate:modelValue":e[4]||(e[4]=l=>Z(o)?o.value=l:null),width:"600"},{footer:s(()=>[u(h,{onClick:E,type:"primary",disabled:a(m)},{default:s(()=>[f("\u786E \u5B9A")]),_:1},8,["disabled"]),u(h,{onClick:e[3]||(e[3]=l=>o.value=!1)},{default:s(()=>[f("\u53D6 \u6D88")]),_:1})]),default:s(()=>[O((_(),p(F,{ref_key:"formRef",ref:i,model:a(t),rules:a(x),"label-width":"100px"},{default:s(()=>[u(n,{label:"\u540D\u79F0",prop:"name"},{default:s(()=>[u(b,{modelValue:a(t).name,"onUpdate:modelValue":e[0]||(e[0]=l=>a(t).name=l),placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(n,{label:"\u72B6\u6001",prop:"status"},{default:s(()=>[u(C,{modelValue:a(t).status,"onUpdate:modelValue":e[1]||(e[1]=l=>a(t).status=l)},{default:s(()=>[(_(!0),R(T,null,K(a($)(a(aa).COMMON_STATUS),l=>(_(),p(B,{key:l.value,label:l.value},{default:s(()=>[f(Q(l.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(n,{label:"\u5907\u6CE8",prop:"remark"},{default:s(()=>[u(b,{modelValue:a(t).remark,"onUpdate:modelValue":e[2]||(e[2]=l=>a(t).remark=l),type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[q,a(m)]])]),_:1},8,["title","modelValue"])}}})});export{g as _,ma as __tla};
