<template>
  <el-dialog
    title="修改配置文件"
    :visible.sync="configisShow"
    :close-on-click-modal="false"
    width="930px"
    class="configDialog"
    @close="handleclose"
  >
    <div class="msgTbale">
      <div class="headmsg">
        <span
          >装置编号：{{ terimMsg.towerName }} 规约：{{
            terimMsg.protocolName
          }}</span
        >
      </div>
      <div class="containConfig">
        <div class="configHead">
          <span class="configLabel">配置文件</span>
          <el-select v-model="configValue" filterable placeholder="请选择">
            <el-option
              v-for="item in configOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
        <div class="channelClass" v-if="configValue == 1">
          <channelSet ref="setChannel_ref" :terimMsgid="terimMsg"></channelSet>
        </div>
        <div class="mappClass" v-if="configValue == 2">
          <appSet ref="setAPP_ref" :terimMsgid="terimMsg"></appSet>
        </div>
        <div class="masterClass" v-if="configValue == 3">
          <mappSet ref="setMAPP_ref" :terimMsgid="terimMsg"></mappSet>
        </div>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="configisShow = false">取 消</el-button>
      <el-button @click="comfirmClick" type="primary">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { cmdSendApi } from "@/utils/api/index";
import channelSet from "./channelSet.vue";
import appSet from "./appSet.vue";
import mappSet from "./mappSet.vue";
export default {
  props: ["multipleSelection"],
  components: { channelSet, appSet, mappSet },
  data() {
    return {
      configisShow: false,
      terimMsg: "",
      configOptions: [
        {
          value: 1,
          label: "通道配置",
        },
        {
          value: 2,
          label: "app配置",
        },
        {
          value: 3,
          label: "运维配置",
        },
      ],
      configValue: 1,
    };
  },
  mounted() {},
  computed: {},
  watch: {},
  created() {},
  methods: {
    display() {
      console.log(this.multipleSelection);
      this.terimMsg = this.multipleSelection[0];
      this.configisShow = true;
    },
    //确定
    comfirmClick() {
      if (this.configValue == 1) {
        this.$refs.setChannel_ref.handleConfim();
        return;
      }
      if (this.configValue == 2) {
        this.$refs.setAPP_ref.handleConfim();
        return;
      }
      if (this.configValue == 3) {
        this.$refs.setMAPP_ref.handleConfim();
        return;
      }
    },
    // //执行操作
    // changeIssue(params) {
    //   cmdSendApi(params)
    //     .then((res) => {
    //       console.log(res);
    //       if (res.code == 200) {
    //         console.log("我执行了命令");
    //         this.configisShow = false;
    //       }
    //     })
    //     .catch((err) => {});
    // },
    //关闭
    handleclose() {
      this.configisShow = false;
      this.configValue = 1;
    },
  },
};
</script>
<style lang="less">
.configDialog {
  .el-dialog__body {
    padding: 12px;
  }
  .msgTbale {
    .headmsg {
      position: absolute;
      top: 23px;
      left: 156px;
    }
    .containConfig {
      height: 500px;
      .configHead {
        margin-bottom: 12px;
        .configLabel {
          margin-right: 12px;
        }
      }
    }
  }
}
</style>
