import{F as A,G,h as J}from"./elementPlus.CSBdF9Zt.js";import{u as K}from"./useResponse.DqThFJSa.js";import{D as Z}from"./index.K_MFulpu.js";import{a as $}from"./api.DyKZ9d1c.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 i,c as _,U as l,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:o}=E,N=B,v=x(),s=U({asin:o==null?void 0:o.asin,country_code:o==null?void 0:o.country_code,shop_name:o==null?void 0:o.shop_name,tag:o==null?void 0:o.goods.tag,status:o==null?void 0:o.status.toString(),freq:o==null?void 0:o.freq}),S=U({shop_name:[{required:!0,message:"请输入店铺",trigger:"blur"}],tag:[{required:!0,message:"请输入分组",trigger:"blur"}]}),j=async c=>{c&&await c.validate(async(e,m)=>{if(e)try{const r=await K($,{id:o==null?void 0:o.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!",m)})};function w(){g.value.handleClose()}return(c,e)=>{const m=u("el-input"),r=u("el-form-item"),d=u("el-option"),f=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 i(),_("div",h,[l(z,{ref_key:"editDrawer",ref:g,modelValue:p.value,"onUpdate:modelValue":e[7]||(e[7]=t=>p.value=t),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"竞品监控 - 编辑 ",size:"25%"},{default:n(()=>[l(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(()=>[l(r,{class:"font-medium",label:"ASIN",prop:"asin"},{default:n(()=>[l(m,{modelValue:a(s).asin,"onUpdate:modelValue":e[0]||(e[0]=t=>a(s).asin=t),disabled:!0},null,8,["modelValue"])]),_:1}),l(r,{class:"font-medium",label:"店 铺",prop:"shop"},{default:n(()=>[l(m,{modelValue:a(s).shop_name,"onUpdate:modelValue":e[1]||(e[1]=t=>a(s).shop_name=t),placeholder:"请输入店铺"},null,8,["modelValue"])]),_:1}),l(r,{class:"font-medium",label:"分 组",prop:"tag"},{default:n(()=>[l(f,{modelValue:a(s).tag,"onUpdate:modelValue":e[2]||(e[2]=t=>a(s).tag=t),"allow-create":"",filterable:""},{default:n(()=>[(i(!0),_(q,null,F(a(M),t=>(i(),C(d,{label:t.tag,value:t.tag},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1}),l(r,{class:"font-medium",label:"状 态",prop:"status"},{default:n(()=>[l(f,{modelValue:a(s).status,"onUpdate:modelValue":e[3]||(e[3]=t=>a(s).status=t),disabled:!0},{default:n(()=>[l(d,{label:"正常",value:"1"}),l(d,{label:"失败",value:"2"}),l(d,{label:"暂停",value:"3"}),l(d,{label:"下架",value:"10"})]),_:1},8,["modelValue"])]),_:1}),l(r,{class:"font-medium",label:"国 家",prop:"country_code"},{default:n(()=>[l(f,{modelValue:a(s).country_code,"onUpdate:modelValue":e[4]||(e[4]=t=>a(s).country_code=t),disabled:!0,placeholder:"请选择国家"},{default:n(()=>[(i(!0),_(q,null,F(a(R).country_code,t=>(i(),C(d,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(r,{class:"font-medium",label:"更新频率",prop:"freq"},{default:n(()=>[l(I,{modelValue:a(s).freq,"onUpdate:modelValue":e[5]||(e[5]=t=>a(s).freq=t)},null,8,["modelValue"])]),_:1}),l(r,null,{default:n(()=>[l(L),X("div",D,[l(y,{icon:a(A),onClick:w},{default:n(()=>e[8]||(e[8]=[O("取 消")])),_:1},8,["icon"]),l(y,{icon:a(G),loading:a(V),type:"primary",onClick:e[6]||(e[6]=t=>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-5202a0e7"]]);export{re as default};
