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