index.vue
7.8 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<template>
<div class="home">
<div class="home-left">
<el-row :gutter="8">
<el-col :span="12">
<el-card shadow="hover" :body-style="{ padding: '0' }">
<ul class="workbench flexst">
<li v-for="(item, index) in newsListData" class="pointer" :key="index"
:style="{ backgroundColor: item.color }">
<i class="el-icon-s-claim"></i>
{{ item.title }}
</li>
</ul>
</el-card>
</el-col>
<el-col :span="12">
<el-card shadow="hover" style="height:247px">
<div slot="header" class="flexst">
<h5 class="title">系统通知</h5>
<i class="el-icon-s-unfold pointer"></i>
</div>
<vue-seamless-scroll :data="noticeList" :class-option="classOption">
<ul>
<li v-for="(item, index) in noticeList" :key="index" @click="handleNotice" class="flexst pointer">
<p class="list-title">{{ item.noticeTitle }}</p>
<p class="marginZL15">{{ item.createtime.substring(0, 10) }}</p>
<p v-if="item.userBrowse == '1'" style="color:red">未读</p>
<p v-else>已读</p>
</li>
</ul>
</vue-seamless-scroll>
</el-card>
</el-col>
</el-row>
<el-row :gutter="8" class="marginTop10">
<el-col :span="12">
<el-card shadow="hover" style="height:247px">
<div slot="header" class="flexst">
<h5 class="title">待办事项</h5>
<i class="el-icon-s-unfold pointer"></i>
</div>
<ul>
<li v-for="(item, index) in todoList" :key="index" class="flexst">
<p class="right15">{{ item.dealTime.substring(0, 10) }}</p>
<p class="list-title" style="text-align:right">{{ item.dealBusiness }} ({{ item.dealStep + '环节' }})</p>
</li>
</ul>
</el-card>
</el-col>
<el-col :span="12">
<el-card shadow="hover" style="height:247px">
<div slot="header" class="flexst">
<h5 class="title">政策法规</h5>
<i class="el-icon-s-unfold pointer"></i>
</div>
<ul>
<li v-for="(item, index) in policyList" @click="handleView(item.noticeFileUrl)" :key="index"
class="flexst pointer">
<p class="right15 list-title">{{ item.noticeTitle }}</p>
<p>{{ item.createtime.substring(0, 10) }}</p>
</li>
</ul>
</el-card>
</el-col>
</el-row>
<el-card shadow="hover" class="marginTop10 box-mountNode" id="mountNodeCon"
:body-style="{ padding: '8px 6px 0 6px' }">
<div id="mountNode"></div>
</el-card>
</div>
<div class="home-right">
<calendar />
<el-card shadow="hover" class="marginTop10" style="height:345px">
<div slot="header" class="flexst">
<h5 class="title">动态信息</h5>
<i class="el-icon-s-unfold pointer"></i>
</div>
<ul>
<li v-for="(item, index) in doneList" :key="index" class="flexst">
<p class="right15">{{ item.dealTime.substring(0, 10) }}</p>
<p class="list-title">{{ item.dealBusiness }} ({{ item.dealStep + '环节' }})</p>
</li>
</ul>
</el-card>
</div>
</div>
</template>
<script>
import * as G2 from '@antv/g2'
import calendar from '@/components/Calendar/index'
import vueSeamlessScroll from "vue-seamless-scroll"
import { getHomeNoticeList, getHomeTodoList, getHomeDoneList } from "@/api/home.js";
import { setReadStatus } from "@/api/notice.js";
export default {
name: 'home',
components: { calendar, vueSeamlessScroll },
data () {
return {
newsListData: [
{
icon: '',
title: '任务',
color: '#61AEFF'
},
{
icon: '',
title: '邮件',
color: '#43DEB3'
},
{
icon: '',
title: '消息',
color: '#F3C143'
},
{
icon: '',
title: '日历',
color: '#F09936'
},
{
icon: '',
title: '常用功能',
color: '#9C92FF'
},
{
icon: '',
title: '申请',
color: '#589FFF'
}
],
chartData: [{
year: '1991',
value: 15468
}, {
year: '1992',
value: 16100
}, {
year: '1993',
value: 15900
}, {
year: '1994',
value: 17409
}, {
year: '1995',
value: 17000
}, {
year: '1996',
value: 31056
}, {
year: '1996',
value: 31056
}],
noticeList: [],
todoList: [],
doneList: [],
policyList: []
}
},
// 计算属性 类似于data概念
computed: {
classOption () {
return {
step: 0.5, // 数值越大速度滚动越快
limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
hoverStop: true, // 是否开启鼠标悬停stop
direction: 1, // 0向下 1向上 2向左 3向右
openWatch: true, // 开启数据实时监控刷新dom
singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
};
},
},
mounted () {
this.buildChart();
this.queryTodoList();
this.queryDoneList();
this.queryNoticeList();
},
methods: {
handleView (pdfUrl) {
const href = pdfUrl
window.open(href, '_blank');
},
//获取待办事项列表
queryTodoList () {
getHomeTodoList().then(res => {
if (res.result) {
this.todoList = res.result.slice(0, 5)
}
})
},
//获取已办事项列表
queryDoneList () {
getHomeDoneList().then(res => {
if (res.result) {
this.doneList = res.result
}
})
},
//获取通知列表
queryNoticeList () {
getHomeNoticeList().then(res => {
if (res.result) {
this.noticeList = res.result.noticeList
this.noticeList.forEach(item => {
item.createtime = this._timedate(item.createtime)
})
this.policyList = res.result.policyList.slice(0, 5)
}
})
},
_timedate (d) {
var td = new Date();
td = new Date(td.getFullYear(), td.getMonth(), td.getDate());
var od = new Date(d);
od = new Date(od.getFullYear(), od.getMonth(), od.getDate());
var xc = (od - td) / 1000 / 60 / 60 / 24;
if (xc == -1) {
return "昨天";
} else if (xc == 0) {
return "今天";
} else {
return d
}
},
buildChart () {
let height = document.getElementById("mountNodeCon").offsetHeight - 20
var chart = new G2.Chart({
container: 'mountNode',
height: height
});
chart.source(this.chartData);
chart.scale({
value: {
min: 10000
},
year: {
range: [0, 1]
}
});
chart.axis('value', {
label: {
formatter: function formatter (val) {
return (val / 10000).toFixed(1) + 'k';
}
}
});
chart.tooltip({
crosshairs: true
})
chart.forceFit();
chart.area().position('year*value').shape('smooth');
chart.line().position('year*value').size(2).shape('smooth');
chart.render();
},
handleNotice () {
this.$alertMes('9999999999')
//setReadStatus({'bsmNotice':bsmNotice})
}
}
}
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "./index.scss";
/deep/.el-card__body {
padding: 3px 10px 5px 10px;
overflow: hidden;
}
</style>