import{d as S,al as j,q as g,r as n,Q as v,w as q,a9 as a,af as A,o as b,c as B,H as E,E as M,G as p,M as i,u as O,K as T,aq as H,ar as K,a as d}from"./vue.6daa721c.js";import{u as L}from"./index.ae7ce77b.js";import{b as Q}from"./index.30a15156.js";import{j as y}from"./elementPlus.346c766a.js";import{_ as U}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const $=s=>(H("data-v-a1b3e781"),s=s(),K(),s),J={class:"customize-container"},P=$(()=>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)),W=S({__name:"AdGroup",emits:["update-groupId"],setup(s,{emit:x}){const I=L(),{profile:h}=j(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 Q(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 q(l,()=>{l.value&&z("update-groupId",{id:l.value})}),(t,e)=>{const o=a("el-input"),c=a("el-button"),V=a("el-form-item"),k=a("el-form"),D=a("el-card"),F=A("loading");return b(),B("div",J,[E((b(),M(D,{"body-style":"padding: 20px 80px 0 80px;"},{default:p(()=>[P,i(k,{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(V,{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:!O(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})),[[F,u.value]])])}}});const ae=U(W,[["__scopeId","data-v-a1b3e781"]]);export{ae as default};
