Blame view

frontend/front/src/views/matter/newMatter/index.vue 1.97 KB
8ea9c133   陈威   初始化提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
  <content-layout
    :tab-pane-list="currentShowTab"
    @tab-click="handleTabClick"
    @node-click="handleNodeClick"
  >
    <keep-alive :include="keepaliveComponents">
      <component
        :is="currentView[currentActiveTab]"
        :ref="`${currentActiveTab}Table`"
        v-loading="loading"
      ></component>
    </keep-alive>
  </content-layout>
</template>

<script>
  import { mapState } from 'vuex'

  import processClassify from '@/mixins/processClassify.js'
  import fromModule from '@/mixins/fromModule'

  import { TAB_PANE_LIST, COMPONENTS_MAP } from './const'
  export default {
    name: 'NewMatter',
    components: {
      ContentLayout: () => import('@/views/matter/components/ContentLayout'),
      ProcessOverview: () => import('./ProcessOverview'),
      MyCollection: () => import('./MyCollection'),
      MyDraft: () => import('./MyDraft'),
    },
    mixins: [processClassify, fromModule],
    data() {
      return {
        isKeepalive: false,
        currentTabPaneList: TAB_PANE_LIST,
        currentView: COMPONENTS_MAP,
        currentActiveTab: this.$route.query.tabActiveName || 'processOverview',
      }
    },
    computed: {
      ...mapState('user', ['account']),
      keepaliveComponents() {
        return this.isKeepalive ? Object.values(COMPONENTS_MAP) : []
      },
    },
    activated() {
      this.currentActiveTab =
        this.$route.query.tabActiveName || 'processOverview'
    },
    created() {
      if (localStorage.getItem(`keepalive_${this.account}`)) {
        const keepaliveRouteList = JSON.parse(
          localStorage.getItem(`keepalive_${this.account}`)
        )
        if (keepaliveRouteList && keepaliveRouteList.length) {
          this.isKeepalive = keepaliveRouteList
            .map((item) => item.name)
            .includes('NewMatter')
        }
      }
    },
    mounted() {
      this.currentActiveTab =
        this.$route.query.tabActiveName || 'processOverview'
    },
  }
</script>

<style lang="scss" scoped></style>