import{d as N,r as f,a8 as l,o as q,c as U,M as a,u as t,G as s,a as i,K as r,H as g,N as x,ap as j,aq as G}from"./vue.95e072e2.js";import{S as L}from"./select-tmpl.a975ce18.js";import{c as E}from"./index.776f4fc6.js";import{u as K}from"./common.f714fcb5.js";import $ from"./freq-setting.b40e2ae6.js";import z from"./save-rule-dialog.206b07b0.js";import{_ as A}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.8a64ecdf.js";import"./elementPlus.58179425.js";import"./echarts.72dc8373.js";import"./api.bf14d834.js";import"./index.6c7077c1.js";import"./enum.cd3ef671.js";const k=n=>(j("data-v-0b0197e9"),n=n(),G(),n),J={class:"mx-5"},O=k(()=>i("div",{class:"asj-h2"},"广告活动",-1)),P=k(()=>i("div",{class:"asj-h3"},[i("span",{class:"custom-title-icon"}),r(" 操作 ")],-1)),Q={style:{display:"block",margin:"10px 0"}},W={class:"auto-page-foot"},X=N({__name:"switch-campaign",props:{data:{},RuleStatusButton:{}},emits:["refresh"],setup(n,{emit:y}){const V=n,_=y,u=f(),c=f(),{formData:e,submitFormData:w}=K(V);e.value.rule.action.state=[],e.value.rule.action.setTime="";const m=f(!1),D=[{label:"曝光量",value:"impressions"},{label:"点击量",value:"clicks"},{label:"转化率",value:"cr",suffix:"%"},{label:"单次点击费用",value:"cpc",prefix:"$"}];function S(){e.value.rule.conditions.length===0&&c.value.addConditionGroup()}async function C(){return!(await c.value.validate()).includes(!1)}async function v(){const p=await C();u.value.validate(async o=>{o&&p?(await w(),_("refresh")):console.log("验证失败")})}function T(){_("refresh")}function R(){e.value.useTmpl?v():m.value=!0}return(p,o)=>{const Y=l("el-divider"),b=l("el-checkbox"),B=l("el-date-picker"),H=l("el-form-item"),F=l("el-checkbox-group"),M=l("el-form"),I=l("el-card"),h=l("el-button");return q(),U("div",J,[O,a(L,{data:t(e)},null,8,["data"]),a(I,{class:"mt-3"},{default:s(()=>[a($,{rule:t(e).rule,disabled:t(e).useTmpl},null,8,["rule","disabled"]),a(Y),a(M,{model:t(e),"label-position":"top",style:{"margin-top":"20px"},ref_key:"formRef",ref:u,disabled:t(e).useTmpl},{default:s(()=>[P,a(F,{modelValue:t(e).rule.action.state,"onUpdate:modelValue":o[1]||(o[1]=d=>t(e).rule.action.state=d),disabled:t(e).useTmpl},{default:s(()=>[i("div",null,[a(b,{label:"enabled"},{default:s(()=>[r("开始")]),_:1}),g(i("div",Q,[a(H,{prop:"rule.action.setTime",rules:[{required:t(e).rule.action.state.includes("enabled"),message:"必填项",trigger:"blur"}]},{default:s(()=>[a(B,{modelValue:t(e).rule.action.setTime,"onUpdate:modelValue":o[0]||(o[0]=d=>t(e).rule.action.setTime=d),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),[[x,t(e).rule.action.state.includes("enabled")]])]),a(b,{label:"paused",onClick:S},{default:s(()=>[r("暂停")]),_:1})]),_:1},8,["modelValue","disabled"])]),_:1},8,["model","disabled"]),g(i("div",null,[a(E,{data:t(e).rule.conditions,"candidate-fields":D,ref_key:"condiBuilderRef",ref:c,disabled:t(e).useTmpl},null,8,["data","disabled"])],512),[[x,t(e).rule.action.state.includes("paused")]])]),_:1}),a(z,{modelValue:m.value,"onUpdate:modelValue":o[2]||(o[2]=d=>m.value=d),formData:t(e),formRef:u.value,onSubmit:v},null,8,["modelValue","formData","formRef"]),i("div",W,[a(h,{style:{width:"200px"},onClick:T},{default:s(()=>[r("取消")]),_:1}),a(h,{style:{width:"200px"},type:"primary",onClick:R},{default:s(()=>[r("提交")]),_:1})])])}}});const me=A(X,[["__scopeId","data-v-0b0197e9"]]);export{me as default};
