Search.vue
7.41 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
292
293
294
295
296
<template>
<div class="start-flow__container">
<van-sticky>
<NavBar :is-custom="true" @go-back="handleGoBack">
<template slot="title">搜索流程</template>
</NavBar>
<van-search
v-model="searchValue"
show-action
placeholder="请输入流程名称"
@search="onSearch"
>
<template #action>
<div @click="onSearch" style="color: #409eff">搜索</div>
</template>
</van-search>
</van-sticky>
<div class="roadWrapper flow_list">
<van-pull-refresh v-model="isDownLoading" @refresh="onRefresh()">
<van-list
v-model="loading"
:finished="finished"
finished-text=""
:immediate-check="false"
:offset="20"
@load="onLoad"
class="new-matter-list"
>
<van-cell
v-for="item in itemList"
:key="item.id"
@click="showItem(item)"
center
:border="false"
:class="[item.supportMobile == 1 ? 'task_mobile' : 'task_pc']"
>
<template slot="title">
<div class="flow_list_title">
<i
class="icon-xinjianliucheng1"
></i>
</div>
<div class="task_list_word">
<div class="task_list_name" v-html="hightLight(searchValue,item.name)">
</div>
<div class="task_list_time">{{ item.defKey }}</div>
</div>
</template>
<template #right-icon>
<i
class="icon-collect"
:class="[
collectedProcess[item.id] ? 'collection' : 'not-collected',
]"
@click.stop="
handleCollectOrCancelCollect(
item.defKey,
collectedProcess[item.id] || ''
)
"
></i>
</template>
</van-cell>
</van-list>
</van-pull-refresh>
<van-empty
v-if="itemList.length == 0"
class="custom-image"
:image="noDataImage"
description="暂无内容"
/>
</div>
<van-popup
v-model="showSelectStartor"
position="bottom"
get-container="body"
round
>
<van-picker
show-toolbar
title="选择发起人"
:columns="leaders"
value-key="name"
@cancel="showSelectStartor = false"
@confirm="handerStartor"
/>
</van-popup>
</div>
</template>
<script>
import flow from '@/api/flow.js'
import { Notify } from 'vant'
import collectProcess from '@/mixins/collectProcess.js'
import vanListCommon from '@/mixins/vanListCommon.js'
import hightLight from '@/mixins/hightLight.js'
export default {
name: 'newMatterSearch',
mixins: [collectProcess, vanListCommon,hightLight],
data() {
return {
active: 0,
showSelectStartor: false,
leaders: [],
leaderId: '',
selectDefId: '',
noDataImage: require('@/assets/images/no_data.png'),
}
},
methods: {
//上拉加载
//异步请求数据 ,我们的项目时封装好的方法,此处只是调用
onLoad() {
let params = {
pageBean: {
page: this.page,
pageSize: this.pageSize,
showTotal: true,
},
querys: [],
sorter: [
{
property: 'supportMobile',
direction: 'DESC',
},
{
property: 'createTime',
direction: 'DESC',
},
],
}
if (this.searchValue) {
params.querys.push({
property: 'name_',
value: this.searchValue,
operation: 'LIKE',
relation: 'OR',
group: 'quickSearch',
})
params.querys.push({
property: 'def_key_',
value: this.searchValue,
operation: 'LIKE',
relation: 'OR',
group: 'quickSearch',
})
}
let _self = this
flow
.myMobileProcess(params)
.then((response) => {
_self.loadData(response, _self)
})
.catch((error) => {})
.finally(() => {
_self.isDownLoading = false
_self.isUpLoading = false
})
},
showItem(row) {
if (row.supportMobile != 1) {
Notify({
message: '此流程还未设置手机表单',
background: '#FFEAD9',
color: '#fff',
})
return
}
if (!row.leaders || row.leaders.length == 0) {
this.$router.push({
path: '/matter/startProcess',
query: {
defId: row.defId,
},
})
} else {
this.leaderId = ''
this.leaders = []
let _this = this
this.selectDefId = row.defId
row.leaders.forEach((identity) => {
_this.leaders.push({ id: identity.id, name: identity.name })
})
this.showSelectStartor = true
}
},
handleSelectStartorClose() {
this.showSelectStartor = false
this.leaderId = ''
this.selectDefId = ''
},
handerStartor(e) {
this.leaderId = e.id
if (!this.leaderId) {
Notify({ type: 'danger', message: '请选择发起人' })
} else {
this.showSelectStartor = false
this.$router.push({
path: '/matter/startProcess',
query: {
defId: this.selectDefId,
leaderId: this.leaderId,
},
})
}
},
handleGoBack() {
this.$router.push({
path: '/matter/newMatter',
})
},
},
}
</script>
<style lang="scss" scoped>
.flow_list {
height: calc(#{$vh} - 124px);
overflow: scroll;
}
.van-search {
padding: 16px 8px 8px 16px;
.van-search__content {
border-radius: 8px;
}
}
.new-matter-list {
.van-cell__title {
width: 100%;
}
.van-cell {
padding: 16px;
border-bottom: 0.5px solid #eee;
}
.flow_list_title {
width: 40px;
height: 40px;
border-radius: 8px;
background: rgba(64, 158, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
float: left;
.icon-xinjianliucheng1{
color: #409eff;
font-size: 24px
}
}
.task_list {
display: block;
padding: 10px 15px 10px 0;
border-bottom: 1px solid #e9e9e9;
}
.task_list_word {
width: calc(100% - 60px);
padding-left: 10px;
float: left;
min-height: 42px;
}
.task_list_name {
width: 100%;
font-size: 15px;
color: $base-text-color;
word-break: break-all;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
line-height: 20px;
}
.task_list_time {
font-size: 12px;
font-weight: 400;
color: #8c8c8c;
line-height: 20px;
}
}
.selectStartor {
width: 70%;
margin-left: 10%;
}
::v-deep .van-empty__image {
width: 268px;
height: 196px;
}
.van-empty {
padding-top: 124px;
}
.collection {
color: #ffae44;
}
.not-collected {
color: #e7ebf0;
}
.icon-collect{
font-size:22px;
}
</style>