import{d as I,r as m,j,w as L,a9 as p,o as r,E as h,G as c,M as d,a as i,K as _,H as U,N as k,c as B,a0 as N,F as E,aq as G,ar as M}from"./vue.3f733908.js";import{r as T,X as y}from"./index.0d411246.js";import{G as R}from"./api.0c329410.js";import{_ as q}from"./_plugin-vue_export-helper.c27b6911.js";const Q=a=>T({url:"/api/ad_manage/campaign_rule/get_info",method:"get",params:a}),W=a=>T({url:"/api/ad_manage/campaign_rule/save",method:"post",data:a}),z=R,F=a=>(G("data-v-830b6101"),a=a(),M(),a),O=F(()=>i("div",{class:"asj-h3"},[i("span",{class:"custom-title-icon"}),_(" 选择模板 ")],-1)),X={style:{display:"flex","justify-content":"flex-start","flex-direction":"column"}},D=I({__name:"select-tmpl",props:{data:{}},setup(a,{expose:x}){const e=a,o=m("custom"),t=m(0);e.data.template&&(t.value=e.data.template.id);const n=m([]);j(async()=>{await v()}),L(()=>e.data.useTmpl,()=>{e.data.useTmpl?(o.value="tmpl",t.value=e.data.template.id):o.value="custom"});async function v(){const u=await z({page:1,pageSize:999,type:e.data.ruleType});n.value=u.data}function f(){const u=y.find(n.value,s=>s.id===t.value);e.data.rule=y.clone(u.rule,!0),e.data.template=u}function b(){e.data.useTmpl=o.value==="tmpl",e.data.useTmpl&&(!t.value&&n.value.length>0&&(t.value=n.value[0].id),f())}return x({getTmplList:v}),(u,s)=>{const g=p("el-radio"),S=p("el-option"),V=p("el-select"),w=p("el-radio-group"),C=p("el-card");return r(),h(C,{class:"mt-3"},{default:c(()=>[O,d(w,{modelValue:o.value,"onUpdate:modelValue":s[1]||(s[1]=l=>o.value=l),onChange:b},{default:c(()=>[i("div",X,[d(g,{label:"custom"},{default:c(()=>[_("自定义规则")]),_:1}),d(g,{label:"tmpl"},{default:c(()=>[_("使用已有模板")]),_:1}),U(d(V,{onChange:f,modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),style:{"margin-left":"22px"}},{default:c(()=>[(r(!0),B(E,null,N(n.value,l=>(r(),h(S,{label:l.name,value:l.id,key:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),[[k,o.value==="tmpl"]])])]),_:1},8,["modelValue"])]),_:1})}}});const H=q(D,[["__scopeId","data-v-830b6101"]]),Y=Object.freeze(Object.defineProperty({__proto__:null,default:H},Symbol.toStringTag,{value:"Module"}));export{H as S,Y as a,Q as g,W as s};
