<template>
  <div>
    <main-top>
      <div slot="con"></div>
    </main-top>
    <div class="tablecon noSubmune">
      <div class="tablebody">
        <div class="editname">
          <span>平台名称：</span>
          <el-input class="elInput paddingmore" :maxlength="25" show-word-limit @keydown.enter.native="submitName"
            v-model="planeName" placeholder="请输入平台名称"></el-input>
          <div class="queding">
            <el-button @click="submitName" type="primary">保存</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import MainTop from "@/components/main-top";
import { mapGetters } from "vuex";
import { getConfigDetail, save } from "@/configue/api";



export default {
  data() {
    return {
      planeName: ''
    };
  },
  components: {
    MainTop,
  },
  methods: {
    getName() {
      getConfigDetail(data => {
        this.planeName = data.data.name
      })
    },
    submitName() {
      save('config', {
        "name": this.planeName
      }, () => {
        this.$alert("保存成功", "提示");
      })
    }
  },
  computed: {
    ...mapGetters({
      activeMenu: "activeMenu",
    }),
  },
  watch: {
    subMenu: {
      deep: true,
      immediate: true,
      handler: function () {
        this.getAuth(this.activeMenu);
      },
    },
    activeMenu: {
      deep: true,
      immediate: true,
      handler: function (newVal) {
        this.getAuth(newVal);
      },
    },
  },
  mounted() {
    this.getName()
  },
};
</script>

<style lang="less" scoped>
.editname {
  margin-top: 20px;

  .queding {
    margin-top: 20px;
  }
}
</style>
