import{u as G}from"./useInstance.233fbdde.js";import{e as R,a as j,b as I,c as M}from"./materialTitle.b5bc5ee4.js";import{d as S,s as T,b as c,r as B,p as C,c as d,e as g,k as x,i as u,h as l,u as a,f as $,j as z,m,t as H,F as J,a2 as K,E as q}from"./index.0308b213.js";const O=m("\u5305\u542B"),P=m("\u9009\u62E9"),Q=m("\u63D0\u4EA4"),W=m("\u53D6\u6D88"),te=S({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(D,{emit:V}){const i=D,{global:k}=G();let A=T(()=>Number(i.id)>0);c({list:[]});let p=c({list:[]});const r=B(!1),y=B(),e=c({id:"",goods_id:"",title:"",max_quantity:"",min_quantity:"",type:""}),h=()=>{e.id>0?R(e).then(t=>{q({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),_()}):j(e).then(t=>{q({message:"\u65B0\u589E\u6210\u529F",type:"success"}),_()})};C(()=>i.modelValue,t=>{r.value=t,t&&i.id&&(e.id=i.id,v())});const b=()=>{I().then(t=>{p.list=t})};b(),C(()=>e.agentid,t=>{t&&(t!=e.agentid&&(e.sid=""),p.list=[],b())},{immediate:!0});const v=()=>{M({id:i.id}).then(t=>{t=t.data,e.goods_id=t.goods_id,e.title=t.title,e.max_quantity=t.max_quantity,e.min_quantity=t.min_quantity,e.type=t.type})},_=()=>{V("update:modelValue",!1),V("onClose"),k.$resetForm(y.value,e)};return(t,n)=>{const U=d("el-option"),w=d("el-select"),s=d("el-form-item"),f=d("el-input"),E=d("el-radio"),L=d("el-radio-group"),F=d("el-button"),N=d("el-dialog");return g(),x(N,{modelValue:r.value,"onUpdate:modelValue":n[5]||(n[5]=o=>r.value=o),title:a(A)?"\u67E5\u770B":"\u65B0\u589E",width:"70%","destroy-on-close":"",onClose:_},{default:u(()=>[l(a(K),{ref_key:"formRef",ref:y,model:a(e),"inline-message":!0,"label-width":"160px"},{default:u(()=>[l(s,{label:"\u5546\u54C1"},{default:u(()=>[l(w,{class:"agent-select",modelValue:a(e).goods_id,"onUpdate:modelValue":n[0]||(n[0]=o=>a(e).goods_id=o),placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1",filterable:"",clearable:""},{default:u(()=>[(g(!0),$(J,null,z(a(p).list,(o,X)=>(g(),x(U,{value:o.id,label:o.title},{default:u(()=>[m(H(o.title),1)]),_:2},1032,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1}),l(s,{label:"\u6807\u9898"},{default:u(()=>[l(f,{modelValue:a(e).title,"onUpdate:modelValue":n[1]||(n[1]=o=>a(e).title=o),placeholder:"\u8BF7\u8F93\u5165\u6807\u9898"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u6700\u591A\u9009\u62E9"},{default:u(()=>[l(f,{modelValue:a(e).max_quantity,"onUpdate:modelValue":n[2]||(n[2]=o=>a(e).max_quantity=o),placeholder:"\u8BF7\u8F93\u5165\u6700\u591A\u9009\u62E9"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u6700\u5C11\u9009\u62E9"},{default:u(()=>[l(f,{modelValue:a(e).min_quantity,"onUpdate:modelValue":n[3]||(n[3]=o=>a(e).min_quantity=o),placeholder:"\u8BF7\u8F93\u5165\u6700\u5C11\u9009\u62E9"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u7C7B\u578B"},{default:u(()=>[l(L,{modelValue:a(e).type,"onUpdate:modelValue":n[4]||(n[4]=o=>a(e).type=o)},{default:u(()=>[l(E,{label:1},{default:u(()=>[O]),_:1}),l(E,{label:2},{default:u(()=>[P]),_:1})]),_:1},8,["modelValue"])]),_:1}),l(s,null,{default:u(()=>[l(F,{type:"primary",onClick:h},{default:u(()=>[Q]),_:1}),l(F,{onClick:_},{default:u(()=>[W]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{te as _};
