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