import{d as U,r as m,j as C,w as I,ai as u,o as i,M as h,O as c,U as d,a as r,S as _,P as k,V as B,c as L,a8 as j,F,aF as N,aG as E}from"./vue.adf17aba.js";import{a as M}from"./api.ecc2e6e0.js";import{X as x}from"./index.ad3efb29.js";import{_ as X}from"./_plugin-vue_export-helper.c27b6911.js";import"./api.39068aff.js";import"./elementPlus.4833989a.js";import"./echarts.72dc8373.js";const z=s=>(N("data-v-830b6101"),s=s(),E(),s),D=z(()=>r("div",{class:"asj-h3"},[r("span",{class:"custom-title-icon"}),_(" 选择模板 ")],-1)),G={style:{display:"flex","justify-content":"flex-start","flex-direction":"column"}},O=U({__name:"select-tmpl",props:{data:{}},setup(s,{expose:y}){const e=s,l=m("custom"),a=m(0);e.data.template&&(a.value=e.data.template.id);const n=m([]);C(async()=>{await v()}),I(()=>e.data.useTmpl,()=>{e.data.useTmpl?(l.value="tmpl",a.value=e.data.template.id):l.value="custom"});async function v(){const p=await M({page:1,pageSize:999,type:e.data.ruleType});n.value=p.data}function f(){const p=x.find(n.value,o=>o.id===a.value);e.data.rule=x.clone(p.rule,!0),e.data.template=p}function T(){e.data.useTmpl=l.value==="tmpl",e.data.useTmpl&&(!a.value&&n.value.length>0&&(a.value=n.value[0].id),f())}return y({getTmplList:v}),(p,o)=>{const g=u("el-radio"),V=u("el-option"),w=u("el-select"),b=u("el-radio-group"),S=u("el-card");return i(),h(S,{class:"mt-3"},{default:c(()=>[D,d(b,{modelValue:l.value,"onUpdate:modelValue":o[1]||(o[1]=t=>l.value=t),onChange:T},{default:c(()=>[r("div",G,[d(g,{label:"custom"},{default:c(()=>[_("自定义规则")]),_:1}),d(g,{label:"tmpl"},{default:c(()=>[_("使用已有模板")]),_:1}),k(d(w,{onChange:f,modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=t=>a.value=t),style:{"margin-left":"22px"}},{default:c(()=>[(i(!0),L(F,null,j(n.value,t=>(i(),h(V,{label:t.name,value:t.id,key:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),[[B,l.value==="tmpl"]])])]),_:1},8,["modelValue"])]),_:1})}}});const Q=X(O,[["__scopeId","data-v-830b6101"]]);export{Q as default};
