liuxiaolong
2019-05-06 2ab7a76a38fbf8fa107bf6371f5410ba54e1d394
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
<template>
  <div>
    <h4 class="font-weight-bold py-3 mb-2">
        <!-- <router-link to="/">
          <span class="text-muted font-weight-light">统计分析 /</span>
        </router-link> -->
        统计分析
    </h4>
    <b-card>
      <h1>这里是内容区,写的时候删掉这里</h1>
    </b-card>
  </div>
</template>
 
<script>
import { mapActions } from 'vuex'
import { getApplicationList } from '@/server/common.js'
export default {
  name: 'application-center',
  metaInfo: {
    title: '首页'
  },
  data() {
    return {
      noneImg: 'this.src="' + require('@/assets/img/noneImg.png') + '"',
      userInfo: this.$store.getters.basicUserInfo,
      applicationList: [],
      searchName: ''
    }
  },
  computed: {
    searchList() {
      const searchName = this.searchName.replace(/\s/g, '').toUpperCase()
      if (!searchName) {
        return this.applicationList
      }
      let searchList = []
      this.applicationList.map(item => {
        if (
          item.name.indexOf(searchName) !== -1 ||
          item.module.indexOf(searchName) !== -1
        ) {
          searchList.push(item)
        }
      })
      return searchList
    },
    newList() {
      let list = []
      this.applicationList.map(item => {
        if (item.state === 1) {
          list.push(item)
        }
      })
      return list
    }
  },
  methods: {
    ...mapActions(['openNewWindowtab']),
    /* 获取应用列表 */
    async getApplicationList() {
      let result = await getApplicationList({
        orgId: this.userInfo.orgId,
        userId: this.userInfo.id
      })
      if (result && !result.error) {
        this.applicationList = result
      } else if (result && result.message) {
        this.$toast({
          message: result.message ? result.message : '报错了',
          type: 'error'
        })
      }
    },
    openModule(data) {
      if (!data || data.state !== 1) {
        // this.$toast({
        //   message: '这个系统您目前还不能使用!',
        //   type: 'error'
        // })
        return false
      }
      this.openNewWindowtab(data.url)
    }
  },
  created() {
    this.getApplicationList()
  },
  watch: {
    newList(val, oldVal) {
      if (val !== oldVal && val.length === 1) {
        this.openNewWindowtab({ urlStr: val[0].url, isblank: true })
      }
    }
  }
}
</script>
<style lang="scss">
.img-box {
  display: inline-block;
  width: 140px;
  height: 140px;
  img {
    width: 100%;
  }
}
.card.disabled {
  background: transparent !important;
  border: 0;
  color: #a3a4a6 !important;
  cursor: no-drop;
}
</style>