index.vue 1.81 KB
<template>
  <div class="human-layout">
    <tab
      :tabList="tabList"
      :activeName.sync="activeName"
    />
    <template v-for="i in tabList">
      <component
        :ref="i.componentName"
        :key="i.id"
        :is="i.componentName"
        v-show="activeName == i.id"
        :show="activeName == i.id && show"
        :pageId="`human-${pageId}`"
        :searchTime="searchTime"
        :pageData="pageData"
        @openReceptionDialog="$emit('openReceptionDialog',$event)"
      />
    </template>
  </div>
</template>

<script type='text/ecmascript-6'>
import Tab from '../Tab'
import Output from './Output.vue'
import Behavior from './Behavior.vue'
import Reception from './Reception.vue'

export default {
  components: {
    Tab,
    Output,
    Behavior,
    Reception
  },
  props: {
    pageId: {
      type: String,
      default: ''
    },
    show: Boolean,
    searchTime: {
      type: Object,
      default: () => { }
    },
    pageData: {
      type: Object,
      default: () => { }
    },
  },
  name: '',
  watch: {
    show (val) {
      if (val) this.activeName = this.tabList[0].id
    }
  },
  data () {
    return {
      activeName: '',
      tabList: [
        {
          label: '产值分析',
          componentName: 'Output',
          id: '1',
        },
        {
          label: '行为分析',
          componentName: 'Behavior',
          id: '2',
        },
        {
          label: '接待分析',
          componentName: 'Reception',
          id: '3',
        },
        // {
        //   label: '人员变动',
        //   componentName: 'OutputLine',
        //   id: '4',
        // },
      ]
    }
  },
  mounted () {
  },
  methods: {
  }
}
</script>

<style scoped lang='scss'>
.human-layout {
  background-color: #fff;
  position: relative;
  transform: translateY(-54px);
}
</style>