import{r as v}from"./index.ad3efb29.js";import{d as _,r as c,w as y,ai as g,o as s,M as V,O as w,c as G,a8 as A,F as I,J as q}from"./vue.adf17aba.js";const b=u=>v({url:"/api/ad_manage/ad_tree/adgroup",method:"get",params:u}),C=_({__name:"index",props:{modelValue:{},query:{},width:{default:""},multiple:{type:Boolean,default:!1}},emits:["update:modelValue","change-ad-group"],setup(u,{emit:f}){const e=u,l=c(e.multiple?Array.isArray(e.modelValue)?e.modelValue:[]:typeof e.modelValue=="string"?e.modelValue:""),r=c([]),p=f,h=async a=>{if(!a)return;const{profileId:t,campaignType:n,campaignId:d}=e.query;await i({profileId:t,campaignType:n,campaignId:d,adGroupName:a})},m=()=>{p("update:modelValue",l.value),p("change-ad-group",l.value)},i=async a=>{if(!a.campaignId)return;const t=await b(a);r.value=t.data,r.value.length===1&&(l.value=r.value[0].adGroupId,m())};return y([()=>e.query.campaignType,()=>e.query.campaignId],async()=>{await i(e.query)},{immediate:!0}),y(()=>e.modelValue,()=>{l.value=e.multiple?Array.isArray(e.modelValue)?e.modelValue:[]:typeof e.modelValue=="string"?e.modelValue:""}),(a,t)=>{const n=g("el-option"),d=g("el-select");return s(),V(d,{modelValue:l.value,"onUpdate:modelValue":t[0]||(t[0]=o=>l.value=o),filterable:"",remote:"","remote-method":h,style:q({width:a.width}),clearable:"","collapse-tags":"",multiple:a.multiple,onChange:m,placeholder:"请选择广告组"},{default:w(()=>[(s(!0),G(I,null,A(r.value,o=>(s(),V(n,{key:o.adGroupId,label:o.adGroupName,value:o.adGroupId},null,8,["label","value"]))),128))]),_:1},8,["modelValue","style","multiple"])}}});export{C as _};
