import{P as U,Q as P,C as g,D as S,F as A}from"./element-plus.8e273e86.js";import{P as I}from"./index.8afed1db.js";import{b as N,c as T,d as j}from"./store_product_unit.99c56566.js";import"./lodash.41b9567d.js";import{d as D,s as F,r as q,b as G,Z as _,o as L,c as O,U as o,L as l,u as a,R as b}from"./@vue.76ce7aa3.js";const Q={class:"edit-popup"},Z=D({name:"unitEdit"}),X=D({...Z,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(z,{expose:V,emit:E}){const m=E,i=F(),r=F(),p=q("add"),C=G(()=>p.value=="edit"?"\u7F16\u8F91\u8BA1\u91CF\u5355\u4F4D":"\u65B0\u589E\u8BA1\u91CF\u5355\u4F4D"),u=_({id:"",name:"",py:"",number:"",data:"",is_bulk:0}),v=_({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0",trigger:["blur"]}]}),c=async t=>{for(const e in u)t[e]!=null&&t[e]!=null&&(u[e]=t[e])},y=async t=>{const e=await N({id:t.id});c(e)},k=async()=>{var e,n;await((e=i.value)==null?void 0:e.validate());const t={...u};p.value=="edit"?await T(t):await j(t),(n=r.value)==null||n.close(),m("success")},B=(t="add")=>{var e;p.value=t,(e=r.value)==null||e.open()},R=()=>{m("close")};return V({open:B,setFormData:c,getDetail:y}),(t,e)=>{const n=g,d=S,f=U,w=P,x=A;return L(),O("div",Q,[o(I,{ref_key:"popupRef",ref:r,title:a(C),async:!0,width:"550px",onConfirm:k,onClose:R},{default:l(()=>[o(x,{ref_key:"formRef",ref:i,model:a(u),"label-width":"90px",rules:a(v)},{default:l(()=>[o(d,{label:"\u5355\u4F4D\u540D\u79F0",prop:"name"},{default:l(()=>[o(n,{modelValue:a(u).name,"onUpdate:modelValue":e[0]||(e[0]=s=>a(u).name=s),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0"},null,8,["modelValue"])]),_:1}),o(d,{label:"\u5355\u4F4D\u7F16\u53F7",prop:"number"},{default:l(()=>[o(n,{modelValue:a(u).number,"onUpdate:modelValue":e[1]||(e[1]=s=>a(u).number=s),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u7F16\u53F7"},null,8,["modelValue"])]),_:1}),o(d,{label:"\u662F\u5426\u6563\u88C5",prop:"is_bulk"},{default:l(()=>[o(w,{modelValue:a(u).is_bulk,"onUpdate:modelValue":e[2]||(e[2]=s=>a(u).is_bulk=s)},{default:l(()=>[o(f,{label:1},{default:l(()=>e[4]||(e[4]=[b("\u662F")])),_:1}),o(f,{label:0},{default:l(()=>e[5]||(e[5]=[b("\u5426")])),_:1})]),_:1},8,["modelValue"])]),_:1}),o(d,{label:"\u5907\u6CE8\u4FE1\u606F",prop:"data"},{default:l(()=>[o(n,{modelValue:a(u).data,"onUpdate:modelValue":e[3]||(e[3]=s=>a(u).data=s),type:"textarea",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8\u4FE1\u606F"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{X as _};
