import{D as J}from"./index.DoJnwA7v.js";import{u as K}from"./useResponse.DqThFJSa.js";import{c as L}from"./api.C3FYkifp.js";import{F as P,G as Z,h as C}from"./elementPlus.CqHltQSO.js";import{d as $,aJ as z,r as D,aI as H,aK as Q,Z as F,ai as n,o as i,M as g,O as a,B as w,U as l,S as U,u as t,c as b,a8 as V,F as y}from"./vue.1RczIYhx.js";import{_ as W}from"./_plugin-vue_export-helper.DlAUqK2U.js";const X=$({__name:"CreateDialog",props:{modelValue:{default:!1},modelModifiers:{}},emits:z(["refresh"],["update:modelValue"]),setup(x,{emit:M}){w("shopOptions");const O=w("groupOptions"),B=[{label:"正常",value:1}],{data:I}=J(),v=D(!1),k=H("createDialog"),p=Q(x,"modelValue"),N=M,m=D(),s=F({asin:"",country:"",shop:"",group:"",status:1,frequency:6,description:""}),R=F({asin:[{required:!0,message:"请输入ASIN",trigger:"blur"}],country:[{required:!0,message:"请选择国家",trigger:"change"}],shop:[{required:!0,message:"请输入店铺",trigger:"blur"}],group:[{required:!0,message:"请输入分组",trigger:"blur"}]}),S=async d=>{d&&await d.validate(async(o,c)=>{if(o){const u={asin:s.asin,country_code:s.country,shop_name:s.shop,tag:s.group,freq:s.frequency,status:s.status};(await K(L,u,v)).code===2e3&&(C.success({message:"创建成功",plain:!0,icon:"CirclePlus"}),p.value=!1,N("refresh"))}else C.error("创建失败，请检查表单")})};function A(){T(m.value),k.value.visible=!1}const T=d=>{d&&d.resetFields()};return(d,o)=>{const c=n("el-input"),u=n("el-form-item"),r=n("el-col"),f=n("el-option"),_=n("el-select"),h=n("el-input-number"),j=n("el-row"),E=n("el-form"),q=n("el-button"),G=n("el-dialog");return i(),g(G,{ref_key:"createDialog",ref:k,modelValue:p.value,"onUpdate:modelValue":o[7]||(o[7]=e=>p.value=e),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"竞品监控 - 创建 ",style:{width:"40%"}},{footer:a(()=>[l(q,{icon:t(P),onClick:A},{default:a(()=>o[8]||(o[8]=[U("取 消")])),_:1},8,["icon"]),l(q,{icon:t(Z),loading:t(v),type:"primary",onClick:o[6]||(o[6]=e=>S(t(m)))},{default:a(()=>o[9]||(o[9]=[U("确 定")])),_:1},8,["icon","loading"])]),default:a(()=>[l(E,{ref_key:"ruleFormRef",ref:m,model:t(s),rules:t(R),class:"mx-2.5 mt-5","label-position":"top","label-width":"auto","status-icon":""},{default:a(()=>[l(j,{gutter:20},{default:a(()=>[l(r,{span:24},{default:a(()=>[l(u,{class:"font-medium",label:"ASIN",prop:"asin"},{default:a(()=>[l(c,{modelValue:t(s).asin,"onUpdate:modelValue":o[0]||(o[0]=e=>t(s).asin=e),placeholder:"不再支持批量创建（批量创建使用Excel导入），请填写单个asin"},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:12},{default:a(()=>[l(u,{class:"font-medium",label:"国 家",prop:"country"},{default:a(()=>[l(_,{modelValue:t(s).country,"onUpdate:modelValue":o[1]||(o[1]=e=>t(s).country=e),placeholder:"请选择国家"},{default:a(()=>[(i(!0),b(y,null,V(t(I).country_code,e=>(i(),g(f,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{span:12},{default:a(()=>[l(u,{class:"font-medium",label:"店 铺",prop:"shop"},{default:a(()=>[l(c,{modelValue:t(s).shop,"onUpdate:modelValue":o[2]||(o[2]=e=>t(s).shop=e),placeholder:"请输入店铺"},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:12},{default:a(()=>[l(u,{class:"font-medium",label:"分 组",prop:"group"},{default:a(()=>[l(_,{modelValue:t(s).group,"onUpdate:modelValue":o[3]||(o[3]=e=>t(s).group=e),placeholder:"请选择分组",filterable:"","allow-create":"","default-first-option":""},{default:a(()=>[(i(!0),b(y,null,V(t(O),e=>(i(),g(f,{label:e.tag,value:e.tag},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{span:12},{default:a(()=>[l(u,{class:"font-medium",label:"更新频率",prop:"frequency"},{default:a(()=>[l(h,{modelValue:t(s).frequency,"onUpdate:modelValue":o[4]||(o[4]=e=>t(s).frequency=e),min:"3"},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:12},{default:a(()=>[l(u,{class:"font-medium",label:"状态",prop:"status"},{default:a(()=>[l(_,{modelValue:t(s).status,"onUpdate:modelValue":o[5]||(o[5]=e=>t(s).status=e),disabled:""},{default:a(()=>[(i(),b(y,null,V(B,e=>l(f,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}}),se=W(X,[["__scopeId","data-v-cd70beaf"]]);export{se as default};
