import{F}from"./element-plus.a63a26dd.js";import{P}from"./index.da3823b2.js";import{a as R,b,c as g}from"./user_product_storage.a690300d.js";import{t as k}from"./index.914e16f9.js";import{d as m,s as l,r as B,b as D,Z as d,o as E,c as S,U as p,L as U,u as c}from"./@vue.18505fe0.js";const A={class:"edit-popup"},M=m({name:"userProductStorageEdit"}),Z=m({...M,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(j,{expose:f,emit:_}){const u=_,i=l(),s=l(),r=B("add"),y=D(()=>r.value=="edit"?"\u7F16\u8F91\u7528\u6237\u5546\u54C1\u50A8\u5B58":"\u65B0\u589E\u7528\u6237\u5546\u54C1\u50A8\u5B58"),o=d({id:""}),h=d({}),n=async t=>{for(const e in o)t[e]!=null&&t[e]!=null&&(o[e]=t[e]);o.create_time=k(o.create_time,"yyyy-mm-dd hh:MM:ss")},v=async t=>{const e=await R({id:t.id});n(e)},w=async()=>{var e,a;await((e=i.value)==null?void 0:e.validate());const t={...o};r.value=="edit"?await b(t):await g(t),(a=s.value)==null||a.close(),u("success")},C=(t="add")=>{var e;r.value=t,(e=s.value)==null||e.open()},x=()=>{u("close")};return f({open:C,setFormData:n,getDetail:v}),(t,e)=>{const a=F;return E(),S("div",A,[p(P,{ref_key:"popupRef",ref:s,title:c(y),async:!0,width:"550px",onConfirm:w,onClose:x},{default:U(()=>[p(a,{ref_key:"formRef",ref:i,model:c(o),"label-width":"90px",rules:c(h)},null,8,["model","rules"])]),_:1},8,["title"])])}}});export{Z as _};
