import{C as U,D as x,F as R}from"./element-plus.a63a26dd.js";import{P as h}from"./index.c69e7fd7.js";import{b as k,c as g,d as A}from"./warehouse.c4720cc0.js";import"./lodash.2473fc51.js";import{d as E,s as f,r as W,b as I,Z as F,o as P,c as j,U as o,L as d,u}from"./@vue.18505fe0.js";const q={class:"edit-popup"},L=E({name:"warehouseEdit"}),G=E({...L,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(N,{expose:D,emit:V}){const m=V,c=f(),n=f(),p=W("add"),b=I(()=>p.value=="edit"?"\u7F16\u8F91\u4ED3\u5E93\u4FE1\u606F":"\u65B0\u589E\u4ED3\u5E93\u4FE1\u606F"),l=F({id:"",name:"",code:"",contacts:"",tel:"",address:"",notes:"",sort:""}),_=F({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u4ED3\u5E93\u540D\u79F0",trigger:["blur"]}]}),i=async t=>{for(const e in l)t[e]!=null&&t[e]!=null&&(l[e]=t[e])},B=async t=>{const e=await k({id:t.id});i(e)},y=async()=>{var e,s;await((e=c.value)==null?void 0:e.validate());const t={...l};p.value=="edit"?await g(t):await A(t),(s=n.value)==null||s.close(),m("success")},C=(t="add")=>{var e;p.value=t,(e=n.value)==null||e.open()},v=()=>{m("close")};return D({open:C,setFormData:i,getDetail:B}),(t,e)=>{const s=U,r=x,w=R;return P(),j("div",q,[o(h,{ref_key:"popupRef",ref:n,title:u(b),async:!0,width:"550px",onConfirm:y,onClose:v},{default:d(()=>[o(w,{ref_key:"formRef",ref:c,model:u(l),"label-width":"90px",rules:u(_)},{default:d(()=>[o(r,{label:"\u4ED3\u5E93\u540D\u79F0",prop:"name"},{default:d(()=>[o(s,{modelValue:u(l).name,"onUpdate:modelValue":e[0]||(e[0]=a=>u(l).name=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4ED3\u5E93\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),o(r,{label:"\u4ED3\u5E93\u7F16\u53F7",prop:"code"},{default:d(()=>[o(s,{modelValue:u(l).code,"onUpdate:modelValue":e[1]||(e[1]=a=>u(l).code=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4ED3\u5E93\u7F16\u53F7",readonly:!1},null,8,["modelValue"])]),_:1}),o(r,{label:"\u8054\u7CFB\u4EBA\u5458",prop:"contacts"},{default:d(()=>[o(s,{modelValue:u(l).contacts,"onUpdate:modelValue":e[2]||(e[2]=a=>u(l).contacts=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8054\u7CFB\u4EBA\u5458",readonly:!1},null,8,["modelValue"])]),_:1}),o(r,{label:"\u8054\u7CFB\u7535\u8BDD",prop:"tel"},{default:d(()=>[o(s,{modelValue:u(l).tel,"onUpdate:modelValue":e[3]||(e[3]=a=>u(l).tel=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8054\u7CFB\u7535\u8BDD",readonly:!1},null,8,["modelValue"])]),_:1}),o(r,{label:"\u4ED3\u5E93\u5730\u5740",prop:"address"},{default:d(()=>[o(s,{modelValue:u(l).address,"onUpdate:modelValue":e[4]||(e[4]=a=>u(l).address=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4ED3\u5E93\u5730\u5740",readonly:!1},null,8,["modelValue"])]),_:1}),o(r,{label:"\u5907\u6CE8\u4FE1\u606F",prop:"notes"},{default:d(()=>[o(s,{modelValue:u(l).notes,"onUpdate:modelValue":e[5]||(e[5]=a=>u(l).notes=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8\u4FE1\u606F",readonly:!1},null,8,["modelValue"])]),_:1}),o(r,{label:"\u6392\u5E8F",prop:"sort"},{default:d(()=>[o(s,{modelValue:u(l).sort,"onUpdate:modelValue":e[6]||(e[6]=a=>u(l).sort=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F",readonly:!1},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{G as _};
