<template>
  <el-dialog
    title="主从策略配置"
    custom-class="ems-dialog"
    :visible.sync="dialogFormVisible"
    width="420px"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    @close="cancel"
  >
    <el-form :model="form" label-width="100px">
      <el-form-item label="主策略">
        <el-select v-model="form.main" placeholder="请选择">
          <el-option label="主策略一" value="1"></el-option>
          <el-option label="主策略二" value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="辅助策略">
        <el-select v-model="form.assis" placeholder="请选择">
          <el-option label="辅助策略一" value="1"></el-option>
          <el-option label="辅助策略二" value="2"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible=false">取 消</el-button>
      <el-button type="primary" :loading="loading" @click="sure">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  data(){
    return {
      loading:false,
      dialogFormVisible:false,
      form:{
        main:'',
        assis:''
      }
    }
  },
  methods:{
    cancel(){
      this.form.main='';
      this.form.assis='';
    },
    sure(){
      if(this.form.main===''||this.form.assis===''){
        return this.$alert('请选择正确的策略');
      }
      this.loading = true
      setTimeout(()=>{
        this.loading = false
        //如果接口调用成功 关闭弹窗
        this.dialogFormVisible = false;
      },3000)
    }
  }
}
</script>

<style scoped lang="scss">

</style>
