马宇豪
2023-09-06 bcbb4ac52e16679bc95543e00c5f5883e3da83ef
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
144
145
146
147
148
149
150
151
152
153
154
155
156
<template>
  <div class="home-default">
    <div class="home-default-header">
      <h1>工作台</h1>
      <div class="content">
        <div class="content-left">
          <img src="./../../assets/user.png" alt="">
          <div class="user">
            <h2>{{ dateTime}},{{userInfo.realName}},欢迎使用自治区自然灾害综合风险预警发布及响应联动系统</h2>
            <p>{{userInfo.company}}  {{userInfo.role.roleName}}</p>
          </div>
        </div>
        <div class="content-right">
          <div class="item">
            <p>本月通知数</p>
            <span>{{basicData.notificationsThisMonthNum}}</span>
          </div>
          <a-divider type="vertical" style="height: 100%; margin: 0px 16px"/>
          <div class="item">
            <p>总应叫应数</p>
            <span>{{basicData.responsesThisMonthSum}}</span>
          </div>
          <a-divider type="vertical" style="height: 100%; margin: 0px 16px"/>
          <div class="item">
            <p>叫应数</p>
            <span>{{basicData.responsesThisMonthNum}}</span>
          </div>
          <a-divider type="vertical" style="height: 100%; margin: 0px 16px"/>
          <div class="item">
            <p>叫应率</p>
            <span>{{basicData.responsesRate}}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="home-default-content">
      <div class="left" v-if="userInfo.role.id == 1 || userInfo.role.id == 3">
        <Projecting />
        <Dynamic style="margin-top: 20px"/>
      </div>
      <div class="left" v-if="userInfo.role.id == 2 || userInfo.role.id == 4">
        <Review />
      </div>
      <div class="right">
        <QuickNavigation />
        <IndexEcharts style="margin-top: 20px"/>
        <Team style="margin-top: 20px"/>
      </div>
    </div>
  </div>
</template>
 
<script>
import Projecting from '@/components/Home/Projecting'
import Dynamic from '@/components/Home/Dynamic'
import Review from '@/components/Home/Review'
import QuickNavigation from '@/components/Home/QuickNavigation'
import IndexEcharts from '@/components/Home/IndexEcharts'
import Team from '@/components/Home/Team'
import Cookies from "js-cookie";
import {getUserInfo} from "@/util/storage";
import {getResponseRecord} from "@/api/list";
import {getBasicData, getbasicData} from "@/api/login";
 
export default {
  name: 'home-default',
  components: {
    Projecting,
    Dynamic,
    Review,
    QuickNavigation,
    IndexEcharts,
    Team
  },
  data() {
    return {
      userInfo: getUserInfo(),
      basicData: {}
    };
  },
  created() {
    this.getData()
  },
  computed: {
    dateTime () {
      let date = new Date()
      if (date.getHours() >= 0 && date.getHours() < 12) {
        return '上午好'
      } else if (date.getHours() >= 12 && date.getHours() < 18) {
        return '下午好'
      } else {
        return '晚上好'
      }
    }
  },
  methods:{
    async getData(){
      const t = this
      const res = await getBasicData()
      if(res.data.code == 100){
        t.basicData = res.data.data
      }else{
        this.$message.error(res.data.msg)
      }
    }
  }
}
</script>
 
<style lang="less" scoped>
.home-default {
  .home-default-header {
    background-color: #fff;
    padding: 24px;
    h1 {
      font-size: 20px;
      color: rgba(0, 0, 0, 0.85);
      margin-bottom: 16px;
    }
    .content {
      display: flex;
      justify-content: space-between;
      .content-left {
        display: flex;
        img {
          width: 64px;
          height: 64px;
          margin-right: 20px;
        }
        .user {
          p {
            margin-bottom: 0px;
          }
        }
      }
      .content-right {
        display: flex;
        .item {
          text-align: center;
        }
      }
    }
  }
  .home-default-content {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    .left {
      width: 66%;
    }
    .right {
      width: 33%;
    }
  }
}
</style>