quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
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
<template>
  <!--
          作者:yj
          时间:2022-06-1
          描述:插件中心-小票上传
      -->
      <div>
        <!--列表-->
        <Ticket v-if="activeName=='ticket'"></Ticket>
 
        <!--设置-->
        <Settings v-if="activeName == 'settings'"></Settings>
 
      </div>
    <!-- <div class="user">
        <div class="common-seach-wrap">
            <el-tabs v-model="activeName">
                <el-tab-pane label="小票管理" name="ticket">
                    <Ticket v-if="activeName=='ticket'"></Ticket>
                </el-tab-pane>
            </el-tabs>
        </div>
    </div> -->
</template>
 
<script>
    import bus from '@/utils/eventBus.js';
    import TicketApi from '@/api/ticket.js';
    import Ticket from './ticket/Index.vue';
    import Settings from './ticket/Settings.vue';
    export default {
        components: {
            Ticket,
            Settings,
        },
        data() {
            return {
                activeName: 'ticket',
                /*切换数组原始数据*/
                sourceList: [
                  {
                    key: 'ticket',
                    value: '小票管理',
                    path:'/plus/ticket/ticket/index'
                  },
                  {
                    key: 'settings',
                    value: '小票设置',
                    path:'/plus/ticket/ticket/settings'
                  }
                ],
                /*是否加载完成*/
                loading: true,
            }
        },
       created() {
 
           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 => {
             this.activeName = res;
           });
 
           //发送类别切换
           let params = {
             active: this.activeName,
             list: this.tabList,
             tab_type: 'ticket'
           };
           bus.$emit('tabData', params);
         },
         beforeDestroy() {
           //发送类别切换
           bus.$emit('tabData', { active: null, tab_type: 'ticket', list: [] });
           bus.$off('activeValue');
         },
         methods: {
 
           /*权限过滤*/
           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>