quanwei
2025-10-31 f226d5fe6327e31bb471a96b7370cf94689c6608
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<template>
  <!--
          作者:luoyiming
          时间:2019-06-04
          描述:插件中心-分销
      -->
  <div class="common-seach-wrap">
    <!--名片列表-->
    <Business v-if="activeName == 'business'"></Business>
    <!--名片模板记录-->
    <Template v-if="activeName == 'template'"></Template>
    <!--名片等级管理-->
    <Grade v-if="activeName == 'grade'"></Grade>
    <!--行业管理-->
    <Industry v-if="activeName == 'industry'"></Industry>
    <!--设置-->
    <Setting v-if="activeName == 'setting'"></Setting>
  </div>
</template>
<script>
import bus from '@/utils/eventBus.js';
import PlusApi from '@/api/plus.js';
import Business from './business/index.vue';
import Template from './template/index.vue';
import Grade from './grade/index.vue';
import Industry from './industry/index.vue';
import Setting from './setting/Setting.vue';
 
export default {
  components: {
    Business,
    Template,
    Grade,
    Industry,
    Setting
  },
  data() {
    return {
      formInline: {
        nick_name: ''
      },
      /*参数*/
      param: {},
      /*当前选中*/
      activeName: 'business',
      /*切换数组*/
      sourceList: [
        {
          key: 'business',
          value: '名片列表',
          path:'/plus/business/business/index'
        },
        {
          key: 'template',
          value: '名片模板管理',
          path:'/plus/business/template/index'
        },
        {
          key: 'grade',
          value: '名片等级管理',
          path:'/plus/business/grade/index'
        },
          {
            key: 'industry',
            value: '行业管理',
            path: '/plus/business/industry/index',
 
          },{
          key: 'setting',
          value: '设置',
          path: '/plus/business/setting/index'
        }
      ],
      /*权限筛选后的数据*/
      tabList:[],
      /*判断third是否有参数*/
      is_third_param: false
    };
  },
  watch:{
 
    //监听路由
    $route(to, from) {
      this.init();
    }
  },
  created() {
 
    this.init();
 
  },
  beforeDestroy() {
    //发送类别切换
    bus.$emit('tabData', { active: null, tab_type:'business',list: [] });
    bus.$off('activeValue');
  },
  methods: {
 
    /*初始化方法*/
    init(){
      this.tabList=this.authFilter();
 
      if(this.tabList.length>0){
        this.activeName=this.tabList[0].key;
      }
 
      if (this.$route.query.type != null) {
        this.activeName = this.$route.query.type;
      }
 
      /*监听传插件的值*/
      bus.$on('activeValue', res => {
        if (this.is_third_param) {
          this.param.user_id = '';
          this.is_third_param = false;
        }
        this.activeName = res;
      });
 
      //发送类别切换
      let params = {
        active: this.activeName,
        list: this.tabList,
        tab_type:'business'
      };
      bus.$emit('tabData', params);
    },
 
    /*权限过滤*/
    authFilter(){
      let list=[];
      for(let i=0;i<this.sourceList.length;i++){
        let item=this.sourceList[i];
        if(this.$filter.isAuth(item.path)){
          list.push(item);
        }
      }
      return list;
    }
 
  }
};
</script>