<template>
  <el-dialog :title=" '输入算法参数'" :close-on-click-modal="false" :visible.sync="visible">
    <el-form label-width="80px">
        <el-form-item
            v-for="(algParameter, index) in algParameters"
            :label="algParameter.algorithmParameterName"
            :key="algParameter.key"
            :prop="'algParameters.' + index + '.value'"
        >
            <el-input v-model="algParameter.algorithmParameterOptions"></el-input>
            <el-input v-model="algParametersSelect[index]" placeholder="请从上方以'.'号分隔的参数中选择一项"></el-input>
        </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="getSelectAlgPara()">执行</el-button>
    </span>
    
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      id:null,
      algorithmId:null,
      algParameters:[],
      algParametersSelect:[]
    };
  },
  methods: {
    init(id,algorithmId) {
      this.id = id;
      this.algorithmId=algorithmId;
      this.visible = true;
      this.$http({
        url: this.$http.adornUrl("/algParameter/getAlgParameter"),
        method: "get",
        params: this.$http.adornParams({
          algorithmId: this.algorithmId,
        }),
      }).then(({ data }) => {
        this.algParameters=data.algorithmParameters;
      });
    },
    getSelectAlgPara(){
        this.$http({
            url:this.$http.adornUrl('/algstrain/changeMissStatus'),
            method:'get',
            params:this.$http.adornParams({
              algorithmTrainingId:this.id
            }),
          }).then(({data})=>{
            
            
        });

        this.$http({
            url:this.$http.adornUrl('/algstrain/startTrainingWithPara'),
            method:'get',
            params:this.$http.adornParams({
              algorithmTrainingId:this.id,
              algParameters:this.algParametersSelect.join()
            }),
          }).then(({data})=>{
            this.$parent.getDataList();
            this.visible=false;
        });
    }
    
  },
};
</script>
