"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[99188],{99188:function(t,e,a){a.r(e),a.d(e,{default:function(){return c}});var s=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:{label:"实验编号（系统自动授予）"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{readonly:""},model:{value:t.form.testId,callback:function(e){t.$set(t.form,"testId",e)},expression:"form.testId"}})],1),e("el-form-item",{staticStyle:{width:"300px"},attrs:{prop:"title",required:"",label:"实验名称"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{readonly:"",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"},attrs:{disabled:!t.isEdit},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,s){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:{readonly:"","prefix-icon":"el-icon-edit"},model:{value:a.bucketName,callback:function(e){t.$set(a,"bucketName",e)},expression:"item.bucketName"}})],1)],1),e("div",{staticClass:"g-flex"},[e("el-form-item",{staticClass:"g-mr-xl",attrs:{label:"版本号（自动分配）"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{readonly:"",value:t.getVersion(a)}})],1),e("el-form-item",{staticClass:"g-mr-xl",attrs:{required:"",label:"选择或自定义控制参数"}},[e("el-select",{staticStyle:{width:"256px"},attrs:{disabled:!t.isEdit,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",{staticStyle:{width:"280px"},attrs:{min:0,max:100,readonly:!t.isEdit,placeholder:"请填写0~100的自然数，并流量和为100",clearable:""},model:{value:a.bucketFlowPercent,callback:function(e){t.$set(a,"bucketFlowPercent",t._n(e))},expression:"item.bucketFlowPercent"}})],1)],1)])})),1)],1),t.isEdit?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):t._e()],1)],1)},i=[],l=(a(44114),a(98992),a(3949),a(81454),{components:{},data(){return{form:{bucketParamsList:[{bucketFlowPercent:"",bucketName:"",extInfo:""}],testDays:7,title:""},addFormRules:{title:{required:!0,message:"请输入实验名称"}},createTestLoading:!1}},computed:{sourceId(){return this.$route.params.id||""},isEdit(){return this.$route.params&&this.$route.params.id&&"edit"===this.$route.query.type}},async mounted(){this.$route.params.id&&this.getGroupById()},methods:{cancel(){this.$router.go(-1)},getVersion(t){return this.form.testId+"-"+this.form.version+"-"+t.bucketId},async getGroupById(){const t={id:this.$route.params.id},e=await this.$store.dispatch({type:"abTest/getGroupById",payload:t});e.bucketParamsList=e.bucketconflist,e.bucketParamsList.forEach((t=>{t.extInfo=t.extConf,t.bucketFlowPercent=t.percent})),e&&(this.form={...e})},async createTest(){const t=this.form.bucketParamsList.map((t=>({bucketFlowPercent:t.bucketFlowPercent,bucketId:t.bucketId,extInfo:t.extInfo}))),e={bucketReopenParamsVos:t,id:this.form.id,testDays:this.form.testDays};this.createTestLoading=!0;const a=await this.$store.dispatch({type:"abTest/reopenTest",payload:e});this.createTestLoading=!1,console.log(a),a&&this.$router.push("/experiment/ab")}}}),r=l,o=a(81656),n=(0,o.A)(r,s,i,!1,null,"4c494734",null),c=n.exports}}]);