import{C as I,D as h,K,L as O,F as P}from"./element-plus.8c800afc.js";import{P as S}from"./index.d0a14c5a.js";import{r as p}from"./index.2398c167.js";import"./lodash.be6e4bb5.js";import{d as g,s as B,r as T,b as j,Z as b,o as c,c as E,U as t,L as d,u as o,T as A,a9 as N,K as Z}from"./@vue.18505fe0.js";function ee(a){return p.get({url:"/goods/code/lists",params:a})}function z(a){return p.post({url:"/goods/code/add",params:a})}function G(a){return p.post({url:"/goods/code/edit",params:a})}function ue(a){return p.post({url:"/goods/code/delete",params:a})}function H(a){return p.get({url:"/goods/code/detail",params:a})}const J={class:"edit-popup"},M=g({name:"codeEdit"}),oe=g({...M,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(a,{expose:C,emit:y}){const F=y,f=B(),m=B(),i=T("add"),V=j(()=>i.value=="edit"?"\u7F16\u8F91\u6761\u7801\u8868":"\u65B0\u589E\u6761\u7801\u8868"),u=b({id:"",name:"",py:"",code:"",type:"",data:"",more:"",sort:""}),v=b({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6761\u7801\u540D\u79F0",trigger:["blur"]}],py:[{required:!0,message:"\u8BF7\u8F93\u5165\u62FC\u97F3\u4FE1\u606F",trigger:["blur"]}],code:[{required:!0,message:"\u8BF7\u8F93\u5165\u6761\u7801\u5185\u5BB9",trigger:["blur"]}],type:[{required:!0,message:"\u8BF7\u9009\u62E9\u6761\u7801\u7C7B\u578B0:\u6761\u5F62\u7801 | 1:\u4E8C\u7EF4\u7801",trigger:["blur"]}]}),_=async r=>{for(const e in u)r[e]!=null&&r[e]!=null&&(u[e]=r[e])},D=async r=>{const e=await H({id:r.id});_(e)},x=async()=>{var e,s;await((e=f.value)==null?void 0:e.validate());const r={...u};i.value=="edit"?await G(r):await z(r),(s=m.value)==null||s.close(),F("success")},w=(r="add")=>{var e;i.value=r,(e=m.value)==null||e.open()},k=()=>{F("close")};return C({open:w,setFormData:_,getDetail:D}),(r,e)=>{const s=I,n=h,U=K,R=O,q=P;return c(),E("div",J,[t(S,{ref_key:"popupRef",ref:m,title:o(V),async:!0,width:"550px",onConfirm:x,onClose:k},{default:d(()=>[t(q,{ref_key:"formRef",ref:f,model:o(u),"label-width":"90px",rules:o(v)},{default:d(()=>[t(n,{label:"\u6761\u7801\u540D\u79F0",prop:"name"},{default:d(()=>[t(s,{modelValue:o(u).name,"onUpdate:modelValue":e[0]||(e[0]=l=>o(u).name=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6761\u7801\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u6761\u7801\u5185\u5BB9",prop:"code"},{default:d(()=>[t(s,{modelValue:o(u).code,"onUpdate:modelValue":e[1]||(e[1]=l=>o(u).code=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6761\u7801\u5185\u5BB9"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u6761\u7801\u7C7B\u578B",prop:"type"},{default:d(()=>[t(R,{class:"flex-1",modelValue:o(u).type,"onUpdate:modelValue":e[2]||(e[2]=l=>o(u).type=l),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u6761\u7801\u7C7B\u578B"},{default:d(()=>[(c(!0),E(A,null,N(a.dictData.code_type,(l,L)=>(c(),Z(U,{key:L,label:l.name,value:parseInt(l.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(n,{label:"\u5907\u6CE8\u4FE1\u606F",prop:"data"},{default:d(()=>[t(s,{modelValue:o(u).data,"onUpdate:modelValue":e[3]||(e[3]=l=>o(u).data=l),type:"textarea",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8\u4FE1\u606F"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u6269\u5C55\u4FE1\u606F",prop:"more"},{default:d(()=>[t(s,{modelValue:o(u).more,"onUpdate:modelValue":e[4]||(e[4]=l=>o(u).more=l),type:"textarea",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6269\u5C55\u4FE1\u606F"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u6392\u5E8F",prop:"sort"},{default:d(()=>[t(s,{modelValue:o(u).sort,"onUpdate:modelValue":e[5]||(e[5]=l=>o(u).sort=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{oe as _,H as a,ue as b,ee as c};
