import{g as o}from"./select-tmpl.7bb8ee31.js";import{r as n,w as s,j as d}from"./vue.65d9dadc.js";const r=a=>{const e=n({campaignId:a.data.campaignId,campaignType:a.data.campaignType,profileId:a.data.profileId,ruleType:a.data.ruleType,templateName:"",useTmpl:!1,rule:{type:a.data.ruleType,campaignType:a.data.campaignType,campaignAd:[],action:{},activeModel:"",setTime:"",weekdays:[],conditions:[]},RuleStatusButton:a.RuleStatusButton}),l=n({}),m=async()=>{const u=(await o(a.data)).data[0];u&&(l.value=u.RuleStatusButton||{},delete u.RuleStatusButton,e.value=u,u.template?(e.value.useTmpl=!0,e.value.rule=u.template.rule):e.value.useTmpl=!1)},i=async()=>{const t={campaignId:e.value.campaignId,campaignType:e.value.campaignType,profileId:e.value.profileId,ruleType:e.value.ruleType,RuleStatusButton:e.value.RuleStatusButton,rule:null,templateName:e.value.templateName};e.value.useTmpl?t.templateId=e.value.template.id:(t.rule=e.value.rule,delete t.rule.modifier_name,delete t.rule.id),console.log("body",t)};return s(()=>a.RuleStatusButton,()=>{e.value.RuleStatusButton=a.RuleStatusButton},{deep:!0}),d(async()=>{await m()}),{formData:e,submitFormData:i,ruleStatusButton:l}};export{r as u};
