import{C as G,D as M,Q as O,R as P,F as S}from"./element-plus.9cae3cb1.js";import{P as j}from"./index.b375235f.js";import{r as i}from"./index.7f83e315.js";import"./lodash.fc1b942f.js";import"./dayjs.37feae28.js";import{f as z}from"./goods.da5748c3.js";import{d as R,s as E,r as _,b as A,_ as C,o as f,c as D,V as u,M as s,u as t,U as N,aa as Q,L as H}from"./@vue.96c135a1.js";function le(a){return i.get({url:"/top_ranking.top_ranking/lists",params:a})}function J(a){return i.post({url:"/top_ranking.top_ranking/add",params:a})}function K(a){return i.post({url:"/top_ranking.top_ranking/edit",params:a})}function ue(a){return i.post({url:"/top_ranking.top_ranking/delete",params:a})}function W(a){return i.get({url:"/top_ranking.top_ranking/detail",params:a})}const X={class:"edit-popup"},Y=R({name:"topRankingEdit"}),se=R({...Y,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(a,{expose:y,emit:V}){const g=V,k=E(),d=E(),p=_("add"),w=A(()=>p.value=="edit"?"\u7F16\u8F91\u70ED\u641C\u6392\u884C\u8868":"\u65B0\u589E\u70ED\u641C\u6392\u884C\u8868"),n=C({id:"",name:"",goods_id:"",sort:""}),B=C({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}],goods_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1ID",trigger:["blur"]}]}),F=async o=>{for(const e in n)o[e]!=null&&o[e]!=null&&(n[e]=o[e])},m=_(!1),v=_([]),b=async o=>{m.value=!0;const e=await z({goods_name:o,page_size:200});m.value=!1,v.value=e==null?void 0:e.lists};b(void 0);const h=async o=>{const e=await W({id:o.id});F(e)},x=async()=>{var e,r;await((e=k.value)==null?void 0:e.validate());const o={...n};p.value=="edit"?await K(o):await J(o),(r=d.value)==null||r.close(),g("success")},T=(o="add")=>{var e;p.value=o,(e=d.value)==null||e.open()},L=()=>{g("close")};return y({open:T,setFormData:F,getDetail:h}),(o,e)=>{const r=G,c=M,I=O,U=P,q=S;return f(),D("div",X,[u(j,{ref_key:"popupRef",ref:d,title:t(w),async:!0,width:"550px",onConfirm:x,onClose:L},{default:s(()=>[u(q,{ref_key:"formRef",ref:k,model:t(n),"label-width":"90px",rules:t(B)},{default:s(()=>[u(c,{label:"\u540D\u79F0",prop:"name"},{default:s(()=>[u(r,{modelValue:t(n).name,"onUpdate:modelValue":e[0]||(e[0]=l=>t(n).name=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(c,{label:"\u5546\u54C1",prop:"goods_id"},{default:s(()=>[u(U,{modelValue:t(n).goods_id,"onUpdate:modelValue":e[1]||(e[1]=l=>t(n).goods_id=l),filterable:"",remote:"","reserve-keyword":"",placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1","remote-method":b,loading:t(m)},{default:s(()=>[(f(!0),D(N,null,Q(t(v),l=>(f(),H(I,{key:l.id,label:l.goods_name,value:parseInt(l.id)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),u(c,{label:"\u6392\u5E8F",prop:"sort"},{default:s(()=>[u(r,{modelValue:t(n).sort,"onUpdate:modelValue":e[2]||(e[2]=l=>t(n).sort=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{se as _,ue as a,le as b};
