import{J as V,K as g,D as K,F as O}from"./element-plus.4a7d92a3.js";import{P}from"./index.a19e7573.js";import{B as S,C as T,D as j}from"./index.9fc4c153.js";import"./lodash.9dc701ad.js";import{a as z}from"./user_label.860309e7.js";import{d as E,s as f,r as b,b as A,Z as v,o as c,c as y,U as n,L as i,u as o,T as I,a9 as J,K as N}from"./@vue.18505fe0.js";const Z={class:"edit-popup"},q=E({name:"userEdit"}),ee=E({...q,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(G,{expose:w,emit:h}){const p=h,d=f(),r=f(),u=b("add"),m=b([]);(()=>{z({page_size:9999}).then(t=>{m.value=t.lists})})();const k=A(()=>u.value=="edit"?"\u7F16\u8F91\u7528\u6237":"\u65B0\u589E\u7528\u6237"),a=v({id:"",label_id:""}),x=v({}),_=async t=>{for(const e in a)t[e]!=null&&t[e]!=null&&(a[e]=t[e]);a.label_id||(a.label_id="")},D=async t=>{const e=await S({id:t.id});_(e)},F=async()=>{var e,l;await((e=d.value)==null?void 0:e.validate());const t={...a};u.value=="edit"?await T(t):await j(t),(l=r.value)==null||l.close(),p("success")},L=(t="add")=>{var e;u.value=t,(e=r.value)==null||e.open()},B=()=>{p("close")};return w({open:L,setFormData:_,getDetail:D}),(t,e)=>{const l=V,C=g,R=K,U=O;return c(),y("div",Z,[n(P,{ref_key:"popupRef",ref:r,title:o(k),async:!0,width:"550px",onConfirm:F,onClose:B},{default:i(()=>[n(U,{ref_key:"formRef",ref:d,model:o(a),"label-width":"90px",rules:o(x)},{default:i(()=>[n(R,{label:"\u7528\u6237\u6807\u7B7E",prop:"username"},{default:i(()=>[n(C,{class:"flex-1",modelValue:o(a).label_id,"onUpdate:modelValue":e[0]||(e[0]=s=>o(a).label_id=s)},{default:i(()=>[(c(!0),y(I,null,J(o(m),s=>(c(),N(l,{key:s.label_id,label:s.label_name,value:s.label_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ee as _};
