import{C as R,D as k,F as L}from"./element-plus.55d71530.js";import{P as V}from"./index.e651cfa0.js";import{r as n}from"./index.e2bd5212.js";import"./lodash.d6737109.js";import"./dayjs.37feae28.js";import{d as b,s as f,r as q,b as I,_,o as P,c as j,V as s,M as p,u}from"./@vue.96c135a1.js";function K(a){return n.get({url:"/labels.labels/lists",params:a})}function A(a){return n.post({url:"/labels.labels/add",params:a})}function M(a){return n.post({url:"/labels.labels/edit",params:a})}function N(a){return n.get({url:"/labels.labels/detail",params:a})}const O={class:"edit-popup"},S=b({name:"labelsEdit"}),Q=b({...S,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(a,{expose:F,emit:B}){const c=B,m=f(),r=f(),i=q("add"),E=I(()=>i.value=="edit"?"\u7F16\u8F91\u5546\u54C1\u6807\u7B7E":"\u65B0\u589E\u5546\u54C1\u6807\u7B7E"),l=_({id:"",label_type:1,label_name:""}),v=_({label_type:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u7B7E\u5206\u7C7B",trigger:["blur"]}],label_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u7B7E\u540D\u79F0",trigger:["blur"]}]}),d=async t=>{for(const e in l)t[e]!=null&&t[e]!=null&&(l[e]=t[e])},y=async t=>{const e=await N({id:t.id});d(e)},g=async()=>{var e,o;await((e=m.value)==null?void 0:e.validate());const t={...l};i.value=="edit"?await M(t):await A(t),(o=r.value)==null||o.close(),c("success")},C=(t="add")=>{var e;i.value=t,(e=r.value)==null||e.open()},D=()=>{c("close")};return F({open:C,setFormData:d,getDetail:y}),(t,e)=>{const o=R,w=k,h=L;return P(),j("div",O,[s(V,{ref_key:"popupRef",ref:r,title:u(E),async:!0,width:"550px",onConfirm:g,onClose:D},{default:p(()=>[s(h,{ref_key:"formRef",ref:m,model:u(l),"label-width":"90px",rules:u(v)},{default:p(()=>[s(w,{label:"\u6807\u7B7E\u540D\u79F0",prop:"label_name"},{default:p(()=>[s(o,{modelValue:u(l).label_name,"onUpdate:modelValue":e[0]||(e[0]=x=>u(l).label_name=x),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6807\u7B7E\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{Q as _,K as a};
