"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[52999],{52999:function(t,e,a){a.r(e),a.d(e,{default:function(){return c}});var i=function(){var t=this,e=t._self._c;return e("div",{staticStyle:{background:"white",padding:"15px"}},[e("el-form",{ref:"couponFormRef",attrs:{rules:t.addFormRules,model:t.form}},[e("el-timeline",[e("el-timeline-item",{attrs:{timestamp:"基本信息",placement:"top"}},[e("el-card",[e("div",{staticClass:"title"},[e("i",{staticClass:"el-icon-warning g-mr-xl"}),e("span",[t._v("此实验最多可运行90天")])]),e("div",{staticClass:"g-flex"},[e("el-form-item",{staticStyle:{width:"300px"},attrs:{prop:"title",required:"",label:"实验名称"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{clearable:""},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.fetchDataSource()}},model:{value:t.form.title,callback:function(e){t.$set(t.form,"title",e)},expression:"form.title"}})],1),e("el-form-item",{staticStyle:{width:"300px"},attrs:{prop:"testDays",label:"计划实验周期（默认7天）"}},[e("el-select",{staticStyle:{width:"256px"},model:{value:t.form.testDays,callback:function(e){t.$set(t.form,"testDays",e)},expression:"form.testDays"}},[e("el-option",{attrs:{label:"3",value:3}}),e("el-option",{attrs:{label:"7",value:7}}),e("el-option",{attrs:{label:"14",value:14}}),e("el-option",{attrs:{label:"21",value:21}}),e("el-option",{attrs:{label:"28",value:28}}),e("el-option",{attrs:{label:"90",value:90}})],1)],1)],1)])],1),e("el-timeline-item",{attrs:{timestamp:"变体",placement:"top"}},[t._l(t.form.bucketParamsList,(function(a,i){return e("el-card",{key:a.id,staticStyle:{"margin-bottom":"20px"}},[e("div",{staticStyle:{position:"relative"},attrs:{slot:"header"},slot:"header"},[e("el-form-item",{staticStyle:{width:"300px"},attrs:{required:"",label:"名称"}},[e("el-input",{staticStyle:{width:"200px"},attrs:{"prefix-icon":"el-icon-edit"},model:{value:a.bucketName,callback:function(e){t.$set(a,"bucketName",e)},expression:"item.bucketName"}})],1),t.isEdit?t._e():e("i",{staticClass:"el-icon-circle-close close-icon",on:{click:function(e){return t.form.bucketParamsList.splice(i,1)}}})],1),e("div",{staticClass:"g-flex"},[e("el-form-item",{staticClass:"g-mr-xl",attrs:{required:"",label:"选择或自定义控制参数"}},[e("el-select",{staticStyle:{width:"256px"},attrs:{filterable:"","allow-create":"","default-first-option":""},model:{value:a.extInfo,callback:function(e){t.$set(a,"extInfo",e)},expression:"item.extInfo"}},[e("el-option",{attrs:{label:"true",value:"true"}}),e("el-option",{attrs:{label:"false",value:"false"}})],1)],1),e("el-form-item",{attrs:{required:"",label:"流量分配（百分比）"}},[e("el-input-number",{staticStyle:{width:"240px"},attrs:{min:0,max:100,placeholder:"流量和为100",clearable:""},model:{value:a.bucketFlowPercent,callback:function(e){t.$set(a,"bucketFlowPercent",e)},expression:"item.bucketFlowPercent"}})],1)],1)])})),e("el-form-item",[e("el-button",{staticStyle:{width:"100%"},attrs:{size:"medium"},on:{click:function(e){return t.addVariant()}}},[t._v(" 添加其他变体 ")])],1)],2)],1),e("div",{staticStyle:{"text-align":"center","margin-top":"10px"}},[e("el-button",{attrs:{type:"default"},on:{click:t.cancel}},[t._v("取消")]),e("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.createTestLoading,expression:"createTestLoading"}],attrs:{disabled:t.disabled,type:"primary"},on:{click:t.createTest}},[t._v("审核")])],1)],1)],1)},l=[],r=(a(44114),{components:{},data(){return{form:{bucketParamsList:[{bucketFlowPercent:"",bucketName:"",extInfo:""}],testDays:7,title:""},addFormRules:{title:{required:!0,message:"请输入实验名称"}},createTestLoading:!1}},computed:{disabled(){for(const t in this.form){if(this.form.hasOwnProperty(t)&&""===this.form[t])return!0;if(Array.isArray(this.form[t]))for(const e of this.form[t])for(const t in e)if(e.hasOwnProperty(t)&&""===e[t]||void 0===e.bucketFlowPercent)return!0}return!1}},methods:{cancel(){this.$router.go(-1)},getVersion(t){return this.form.testId+"-"+this.form.version+"-"+t.bucketId},async createTest(){const t={...this.form};this.createTestLoading=!0;const e=await this.$store.dispatch({type:"abTest/createABTest",payload:t});this.createTestLoading=!1,console.log(e),e&&this.$router.push("/experiment/ab")},addVariant(){this.form.bucketParamsList.push({bucketFlowPercent:"",bucketName:"",extInfo:""})}}}),s=r,o=a(81656),n=(0,o.A)(s,i,l,!1,null,"111902d6",null),c=n.exports}}]);