import{d as B,ay as D,B as g,r as n,Z as v,w as A,ai as a,aq as j,o as b,c as q,P as E,M as O,O as p,U as i,u as M,S as T,aF as U,aG as L,a as d}from"./vue.adf17aba.js";import{u as P}from"./index.ad3efb29.js";import{b as Z}from"./index.8ced8f01.js";import{E as y}from"./elementPlus.4833989a.js";import{_ as $}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const H=s=>(U("data-v-a1b3e781"),s=s(),L(),s),J={class:"customize-container"},K=H(()=>d("div",{style:{"font-weight":"700","padding-bottom":"18px"}},[d("span",{style:{color:"#306cd7","font-size":"26px"}},"|"),d("span",{style:{"font-size":"18px","padding-left":"5px"}},"广告组")],-1)),Q=B({__name:"AdGroup",emits:["update-groupId"],setup(s,{emit:x}){const I=P(),{profile:h}=D(I),m=g("respCampaignId"),N=g("respCampaignName"),u=n(!1),w=n("default"),_=n(),r=v({groupName:""}),G=v({groupName:[{required:!0,message:"请输入广告活动",trigger:"blur"}]}),C=async t=>{t&&await t.validate((e,o)=>{e?(console.log("submit!"),R()):console.log("error submit!",o)})},l=n("");async function R(){u.value=!0;const t={profile_id:h.value.profile_id,campaignId:m.value,name:N.value},e=Object.fromEntries(Object.entries(t).filter(([o,c])=>c!=null));try{const o=await Z(e);l.value=o.data.adGroupId,y({message:"广告组创建成功",type:"success"}),r.groupName=""}catch(o){y.error("广告组创建失败!"),console.error("请求失败：",o)}finally{u.value=!1}}const z=x;return A(l,()=>{l.value&&z("update-groupId",{id:l.value})}),(t,e)=>{const o=a("el-input"),c=a("el-button"),F=a("el-form-item"),S=a("el-form"),V=a("el-card"),k=j("loading");return b(),q("div",J,[E((b(),O(V,{"body-style":"padding: 20px 80px 0 80px;"},{default:p(()=>[K,i(S,{ref_key:"groupRuleFormRef",ref:_,model:r,rules:G,"label-position":"left","label-width":"120px",class:"demo-ruleForm",size:w.value,"status-icon":""},{default:p(()=>[i(F,{label:"广告组名称",prop:"groupName"},{default:p(()=>[i(o,{modelValue:r.groupName,"onUpdate:modelValue":e[0]||(e[0]=f=>r.groupName=f),style:{width:"600px"},placeholder:"请输入广告组名称"},null,8,["modelValue"]),i(c,{type:"primary",plain:"",disabled:!M(m),onClick:e[1]||(e[1]=f=>C(_.value)),style:{"margin-left":"30px"}},{default:p(()=>[T("保存")]),_:1},8,["disabled"])]),_:1})]),_:1},8,["model","rules","size"])]),_:1})),[[k,u.value]])])}}});const ae=$(Q,[["__scopeId","data-v-a1b3e781"]]);export{ae as default};
