index.vue 1.79 KB
<!--
 * @Description: 
 * @Author: huyue
 * @Date: 2022-05-31 17:23:27
 * @LastEditors: huyue
 * @LastEditTime: 2022-06-07 18:53:43
-->
<template>
  <div class="solicit-container">
    <tab :list="['总览', `跟进(${countData.tabPageFollowUpCount})`, `结果(${countData.tabPageResultCount})`]" :index="currentIndex" @change="changeIndex"></tab>
    <div class="solicit-content">
      <overview v-if="currentIndex == 0" @getCountInfo="getCountInfo"></overview>
      <follow v-if="currentIndex == 1"></follow>
      <result v-if="currentIndex == 2"></result>
    </div>
  </div>
</template>
<script>
import overview from './overview.vue'
import follow from './follow.vue'
import result from './result.vue'
import { mapState, mapMutations } from 'vuex'
export default {
  name: 'index',
  data() {
    return {
      tabList: ['总览', '跟进', '结果'],
      countData: {
        tabPageFollowUpCount: 0,
        tabPageResultCount: 0
      }
    }
  },
  watch: {
    overviewCountInfo: {
      handler(n) {
        this.countData = n
      },
      immediate: true,
      deep: true
    }
  },
  components: {
    overview,
    follow,
    result
  },
  computed: {
    ...mapState({
      currentIndex: state => state.solicit.currentIndex,
      overviewCountInfo: state => state.solicit.overviewCountInfo
    })
  },
  methods: {
    ...mapMutations({
      SET_TAB_INDEX: 'solicit/SET_TAB_INDEX',
      SET_OVERVIEW_COUNT_INFO: 'solicit/SET_OVERVIEW_COUNT_INFO'
    }),
    changeIndex(index) {
      this.SET_TAB_INDEX({ currentIndex: index })
    },
    getCountInfo(val) {
      this.SET_OVERVIEW_COUNT_INFO({
        overviewCountInfo: val
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.solicit-container {
  .solicit-content {
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
  }
}
</style>