<template>
  <div class="information_index">
      <div class="mtitle">
          <div :class="select===1?'selected':''" @click="newTb">基本信息</div>
          <div :class="select===2?'selected':''" @click="tbTask">企业安全管理信息</div>
      </div>
      <enterprise v-show="select===1"/>
      <safety v-show="select===2"/>
  </div>
</template>

<script>
import enterprise from './Enterprise-information.vue'
import safety from './safety-management.vue'
export default {
    components: {
        enterprise,
        safety
    },
    name: 'InformationIndex',
    data() {
        return {
            select: 1
        }
    },
    mounted() {
        this.getFrom()
    },
    methods: {
        getFrom() {
            if (this.$route.query.related) {
                const fromImage = JSON.parse(this.$route.query.related)
                if (fromImage && fromImage.length > 0) {
                    this.select = 2
                } else {
                    this.select = 1
                }
            }
        },
        newTb() {
            this.select = 1
        },
        tbTask() {
            this.select = 2
        }
    }
}
</script>

<style scoped lang="scss">
.information_index{
  .mtitle{
    display: flex;
    background: white;
    color: #333333;
    font-size: 4.3vw;
      div{
        height: 13.5vw;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin:0 3vw;
       }
    .selected{
        border-bottom: 5px solid #1D18BC;
        color: #1D18BC;
    }
  }
}
</style>
