index.vue
7.67 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<template>
<div class="worker" :class="{ 'has-bg': searchKeywords }">
<div class="worker-header">
<header class="worker-header--title">工作台</header>
<van-search
class="worker-search"
v-model="searchKeywords"
@input="handleSearch"
placeholder="搜索"
/>
<div class="worker-search--result" v-if="searchKeywords">
共{{ this.searchResultList.length }}个搜索结果
</div>
</div>
<!-- 查询结果 -->
<template v-if="searchKeywords">
<apply-card
:apply-list="searchResultList"
@apply-click="handleApplyClick"
></apply-card>
<van-empty
v-if="this.searchResultList.length == 0"
class="custom-image"
:image="noSearchData"
description="暂无内容"
/>
</template>
<div class="worker-content" id="workerContent" v-else>
<!-- 最新使用 -->
<apply-card
:apply-list="latestList"
title="最近使用"
@apply-click="handleApplyClick"
noDataText="最近暂未使用应用哦~"
></apply-card>
<!-- 流程中心 -->
<apply-card
:apply-list="processList"
title="流程中心"
isProcessCenter
></apply-card>
<!-- 应用中心 -->
<div class="worker-center">
<div class="worker-center--title">应用中心</div>
<van-tabs
v-model="active"
scrollspy
color="#409EFF"
sticky
:ellipsis="false"
offset-top="95px"
title-active-color="#409EFF"
title-inactive-color="#262626"
v-if="applyClassify && applyClassify.length > 1"
>
<van-tab
v-for="(item, index) in applyClassify"
:key="index"
:title="
item.typeName.length > 4
? `${item.typeName.substring(0, 4)}...`
: item.typeName
"
>
<apply-card
:apply-list="item.appList"
:title="item.typeName"
:isShowBottomMargin="false"
@apply-click="handleApplyClick"
></apply-card>
</van-tab>
</van-tabs>
<apply-card
v-else-if="applyClassify && applyClassify.length === 1"
:apply-list="applyClassify[0].appList"
:title="applyClassify[0].typeName"
:isShowBottomMargin="false"
@apply-click="handleApplyClick"
></apply-card>
<van-empty
v-else
class="custom-image"
:image="noDataImage"
description="暂无应用"
/>
</div>
<placed-top containerId="workerContent" />
</div>
<tabBar :active-index="2"></tabBar>
</div>
</template>
<script>
import ApplyCard from '@/views/worker/components/ApplyCard'
const tabBar = () => import('@/components/TabBar.vue')
const PlacedTop = () => import('@/components/PlacedTop.vue')
import {
getApplyData,
addRecentlyAppsCount,
getRecentlyApps,
} from '@/api/portal'
const WEBSITE = 1 //站内地址
const STATION_ADDRESS = 2 // 网页地址
const FORM_LIST = 3 // 表单列表
const CHART = 4 //图表
const NEW_PROCESS = 5 // 新建流程
export default {
name: 'worker',
components: {
ApplyCard,
tabBar,
PlacedTop,
},
data() {
return {
noDataImage: require('@/assets/images/no_data_list.png'),
noSearchData: require('@/assets/images/no_data.png'),
searchKeywords: '',
searchResultList: [],
active: '',
latestList: [],
processList: [
{
name: '新建流程',
icon: 'icon-xinjianliucheng11',
iconColor: '#409EFF',
path: '/matter/newMatter',
},
{
name: '我的任务',
icon: 'icon-daibanyiban',
iconColor: '#4053FF',
path: '/matter/myTask',
},
{
name: '我的申请',
icon: 'icon-wodeshenqing',
iconColor: '#F6B85A',
path: '/matter/myRequest',
},
{
name: '传阅事项',
icon: 'icon-wodechuanyue',
iconColor: '#8550E1',
path: '/matter/circulateMatter',
},
/* {
name: '我的转办',
icon: 'icon-wodezhuanban',
iconColor: '#FF8A46',
path: '/matter/myDelegate',
}, */
],
applyClassify: [],
}
},
created() {
this.getLatestApp()
this.getApplyList()
},
methods: {
getApplyList() {
getApplyData().then((res) => {
if (res && res.length) {
this.applyClassify = res.map((item) => {
let childrenAppList = []
if (item.children && item.children.length) {
childrenAppList = item.children.map((it) => it.appList).flat()
}
return {
...item,
appList: childrenAppList.length
? [...item.appList, ...childrenAppList]
: item.appList,
}
})
}
})
},
handleSearch(val) {
const allApply = this.applyClassify.map((item) => item.appList).flat()
this.searchResultList = allApply.filter((item) =>
item.name.includes(val)
)
},
handleApplyClick(item) {
// 统计点击次数
addRecentlyAppsCount(item.id)
this.getLatestApp()
let content = {}
if ([FORM_LIST, CHART, NEW_PROCESS].includes(item.mode)) {
content = JSON.parse(item.content)
}
switch (item.mode) {
case WEBSITE:
this.$router.push(item.content)
break
case STATION_ADDRESS:
window.location.href = item.content
break
case FORM_LIST:
this.$router.push({
path: '/worker/formList',
query: {
alias: content.alias,
name: content.name,
},
})
break
case CHART:
this.$router.push({
path: '/worker/previewChart',
query: {
chartId: content.id,
name: content.name,
},
})
break
case NEW_PROCESS:
this.$router.push({
path: '/matter/startProcess',
query: {
defId: content.id,
from: 'worker',
},
})
break
}
},
getLatestApp() {
getRecentlyApps().then((res) => {
if (res && res.length) {
this.latestList = res
}
})
},
},
}
</script>
<style lang="scss" scoped>
.worker {
height: $vh;
&-header {
&--title {
height: 44px;
line-height: 44px;
background: $base-white-color;
text-align: center;
font-size: 17px;
font-weight: 800;
color: #222222;
border-bottom: 1px solid #f6f6f6;
}
}
&-search {
padding: 16px 16px 0 16px;
::v-deep {
.van-search__content {
padding-left: 8px;
border-radius: 8px;
}
}
&--result {
padding: 16px 0 8px 16px;
color: #262626;
font-size: 14px;
}
}
&-content {
height: calc(#{$vh} - 145px);
overflow-y: scroll;
}
&-center {
background: #fff;
&--title {
padding: 16px 0 8px 16px;
font-size: 17px;
font-weight: bold;
color: $base-text-color;
}
}
}
.has-bg {
background: #fff;
}
</style>