import{F as A,G,h as J}from"./elementPlus.CXoFsoPv.js";import{u as K}from"./useResponse.DqThFJSa.js";import{D as Z}from"./index.fM6cvGYs.js";import{a as $}from"./api.XBMlgKHf.js";import{d as H,aJ as k,r as x,aK as P,aI as Q,Z as U,ai as u,o as d,c as _,U as t,O as n,B as W,u as a,F as q,a8 as F,M as C,a as X,S as O}from"./vue.1RczIYhx.js";import{_ as Y}from"./_plugin-vue_export-helper.DlAUqK2U.js";const h={class:"drawer-container"},D={class:"flex flex-1 justify-end"},ee=H({__name:"EditDrawer",props:k({rowData:Object},{modelValue:{default:!1},modelModifiers:{}}),emits:k(["refresh"],["update:modelValue"]),setup(b,{emit:B}){const M=W("groupOptions"),{data:R}=Z(),V=x(!1),p=P(b,"modelValue"),g=Q("editDrawer"),E=b,{rowData:l}=E,N=B,v=x(),s=U({asin:l==null?void 0:l.asin,country_code:l==null?void 0:l.country_code,shop_name:l==null?void 0:l.shop_name,tag:l==null?void 0:l.goods.tag,status:l==null?void 0:l.status.toString(),freq:l==null?void 0:l.freq}),S=U({shop_name:[{required:!0,message:"请输入店铺",trigger:"blur"}],tag:[{required:!0,message:"请输入分组",trigger:"blur"}]}),j=async f=>{f&&await f.validate(async(e,i)=>{if(e)try{const r=await K($,{id:l==null?void 0:l.id,...s},V);r&&r.code==2e3&&(p.value=!1,J.success({message:"编辑成功",plain:!0,icon:"Operation"}),N("refresh"))}catch(r){console.error("Error==>",r)}else console.log("error submit!",i)})};function w(){g.value.handleClose()}return(f,e)=>{const i=u("el-input"),r=u("el-form-item"),m=u("el-option"),c=u("el-select"),I=u("el-input-number"),L=u("el-divider"),y=u("el-button"),T=u("el-form"),z=u("el-drawer");return d(),_("div",h,[t(z,{ref_key:"editDrawer",ref:g,modelValue:p.value,"onUpdate:modelValue":e[7]||(e[7]=o=>p.value=o),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"竞品监控 - 编辑 ",size:"25%"},{default:n(()=>[t(T,{ref_key:"ruleFormRef",ref:v,model:a(s),rules:a(S),class:"mx-2.5 mt-7","label-position":"top","label-width":"auto","status-icon":""},{default:n(()=>[t(r,{class:"font-medium",label:"ASIN",prop:"asin"},{default:n(()=>[t(i,{modelValue:a(s).asin,"onUpdate:modelValue":e[0]||(e[0]=o=>a(s).asin=o),disabled:!0},null,8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"店 铺",prop:"shop"},{default:n(()=>[t(i,{modelValue:a(s).shop_name,"onUpdate:modelValue":e[1]||(e[1]=o=>a(s).shop_name=o),placeholder:"请输入店铺"},null,8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"分 组",prop:"tag"},{default:n(()=>[t(c,{modelValue:a(s).tag,"onUpdate:modelValue":e[2]||(e[2]=o=>a(s).tag=o),"allow-create":"",filterable:""},{default:n(()=>[(d(!0),_(q,null,F(a(M),o=>(d(),C(m,{label:o.tag,value:o.tag},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"状 态",prop:"status"},{default:n(()=>[t(c,{modelValue:a(s).status,"onUpdate:modelValue":e[3]||(e[3]=o=>a(s).status=o),disabled:!0},{default:n(()=>[t(m,{label:"启用",value:"1"}),t(m,{label:"暂停",value:"2"})]),_:1},8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"国 家",prop:"country_code"},{default:n(()=>[t(c,{modelValue:a(s).country_code,"onUpdate:modelValue":e[4]||(e[4]=o=>a(s).country_code=o),disabled:!0,placeholder:"请选择国家"},{default:n(()=>[(d(!0),_(q,null,F(a(R).country_code,o=>(d(),C(m,{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(r,{class:"font-medium",label:"更新频率",prop:"freq"},{default:n(()=>[t(I,{modelValue:a(s).freq,"onUpdate:modelValue":e[5]||(e[5]=o=>a(s).freq=o)},null,8,["modelValue"])]),_:1}),t(r,null,{default:n(()=>[t(L),X("div",D,[t(y,{icon:a(A),onClick:w},{default:n(()=>e[8]||(e[8]=[O("取 消")])),_:1},8,["icon"]),t(y,{icon:a(G),loading:a(V),type:"primary",onClick:e[6]||(e[6]=o=>j(a(v)))},{default:n(()=>e[9]||(e[9]=[O(" 确 定 ")])),_:1},8,["icon","loading"])])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])])}}}),re=Y(ee,[["__scopeId","data-v-92e89bfb"]]);export{re as default};
