import{d as M,r as c,ai as n,o as y,c as h,a as s,U as t,O as l,S as i,P as k,V as g,F as V,a8 as U,T as j,u as R}from"./vue.adf17aba.js";import{W as L}from"./enum.cd3ef671.js";import{c as N}from"./index.fdb4f26c.js";const S=s("div",{class:"asj-h2"},"广告活动",-1),q=s("span",{class:"asj-h3"},"模板名称",-1),W=s("div",{class:"asj-h3"},"操作",-1),E={style:{display:"block",margin:"10px 0"}},G=s("div",{class:"asj-h3"},"频率设置",-1),O={class:"auto-page-foot"},I=M({__name:"switch-campaign",props:{mode:{},data:{},submitFormData:{type:Function}},emits:["refresh"],setup(w,{emit:x}){const u=w,p=x,_=c(),d=c(),e=c(u.data);u.mode==="add"&&(e.value.rule.action.state=[],e.value.rule.action.setTime="");const C=()=>{u.mode==="add"&&e.value.rule.conditions.length===0&&d.value.addConditionGroup()},D=async()=>!(await d.value.validate()).includes(!1),Y=async()=>{const r=await D();_.value.validate(async o=>{o&&r?(await u.submitFormData(),p("refresh")):console.log("验证失败")})},F=()=>{p("refresh")};return(r,o)=>{const B=n("el-input"),f=n("el-form-item"),m=n("el-checkbox"),H=n("el-date-picker"),v=n("el-checkbox-group"),T=n("el-form"),b=n("el-button");return y(),h(V,null,[s("div",null,[S,t(T,{model:e.value,"label-position":"top",style:{"margin-top":"20px"},ref_key:"formRef",ref:_},{default:l(()=>[t(f,{prop:"name",rules:{required:!0,message:"必填项",trigger:"blur"}},{label:l(()=>[q]),default:l(()=>[t(B,{modelValue:e.value.name,"onUpdate:modelValue":o[0]||(o[0]=a=>e.value.name=a),style:{width:"30%"}},null,8,["modelValue"])]),_:1}),W,t(v,{modelValue:e.value.rule.action.state,"onUpdate:modelValue":o[2]||(o[2]=a=>e.value.rule.action.state=a)},{default:l(()=>[s("div",null,[t(m,{label:"enabled"},{default:l(()=>[i("开始")]),_:1}),k(s("div",E,[t(f,{prop:"rule.action.setTime",rules:[{required:e.value.rule.action.state.includes("enabled"),message:"必填项",trigger:"blur"}]},{default:l(()=>[t(H,{modelValue:e.value.rule.action.setTime,"onUpdate:modelValue":o[1]||(o[1]=a=>e.value.rule.action.setTime=a),type:"datetime",format:"YYYY-MM-DD HH:mm","time-format":"HH:mm","value-format":"YYYY-MM-DD HH:mm"},null,8,["modelValue"])]),_:1},8,["rules"])],512),[[g,e.value.rule.action.state.includes("enabled")]])]),t(m,{label:"paused",onClick:C},{default:l(()=>[i("暂停")]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["model"]),k(s("div",null,[t(N,{data:e.value.rule.conditions,ref_key:"condiBuilderRef",ref:d},null,8,["data"])],512),[[g,e.value.rule.action.state.includes("paused")]])]),G,t(v,{modelValue:e.value.rule.weekdays,"onUpdate:modelValue":o[3]||(o[3]=a=>e.value.rule.weekdays=a)},{default:l(()=>[(y(),h(V,null,U([1,2,3,4,5,6,0],a=>t(m,{label:a,key:a},{default:l(()=>[i(j(R(L)[a]),1)]),_:2},1032,["label"])),64))]),_:1},8,["modelValue"]),s("div",O,[t(b,{style:{width:"200px"},onClick:F},{default:l(()=>[i("取消")]),_:1}),t(b,{style:{width:"200px"},type:"primary",onClick:Y},{default:l(()=>[i("提交")]),_:1})])],64)}}});export{I as _};
