MyCollection.vue
4.28 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
<template>
<div class="my-collection card-mode">
<ht-table
ref="htTable"
:data="collectionList"
:page-result="pageResult"
:selectable="false"
:quick-search-props="quickSearchProps"
:quick-search-width="300"
:show-export="false"
pagination-justify="end"
:show-custom-column="false"
:card-item-mode="false"
card-view
:page-sizes="pageSizes"
@load="loadData"
>
<template #search>
<ht-table-search-panel
:divide="3"
:label-width="80"
display-style="block"
>
<ht-table-search-field
label="流程名称"
prop="def.name_"
operation="LIKE"
/>
<ht-table-search-field
label="创建时间"
prop="def.create_time_"
type="datetimerange"
operation="BETWEEN"
/>
</ht-table-search-panel>
</template>
<template #card="{ data }">
<ul class="card-content">
<li
v-for="(item, index) in data"
:key="index"
class="card-item__wrap card-item"
>
<span class="card-item-subject" @click="handleClickCard(item)">
{{ item.name }}
</span>
<ht-icon
class="collection-icon"
name="collection"
@click="handleCancelCollectProcess(item.defKey)"
></ht-icon>
</li>
</ul>
</template>
<template #empty-card>
<el-image :src="noDataImg"></el-image>
<p class="no-data-text">暂无收藏哦</p>
</template>
</ht-table>
<leader-dialog ref="leaderDialog" />
</div>
</template>
<script>
import LeaderDialog from '@/views/matter/components/LeaderDialog'
import {
getCollectionProcess,
collectionProcessOrCancel,
} from '@/api/process'
import matter from '@/mixins/matter'
import tableHeight from '@/mixins/tableHeight'
export default {
name: 'MyCollection',
components: {
LeaderDialog,
},
mixins: [matter, tableHeight],
data() {
return {
collectionList: [],
quickSearchProps: [
{
prop: 'def.name_',
label: '流程名称',
},
],
noDataImg: require('@/assets/nodata_images/no-collection.png'),
}
},
activated() {
this.$refs.htTable.load(true)
},
methods: {
loadData(parms, cb) {
parms = parms || {}
parms.querys = parms.querys || []
if (this.$route.query && this.$route.query.flowKey) {
parms.querys.push({
property: 'def.def_key_',
value: this.$route.query.flowKey,
operation: 'EQUAL',
group: 'main',
relation: 'AND',
})
}
parms.querys = this.getCurrentQuery(parms, 'type_id_')
getCollectionProcess(parms)
.then((res) => {
if (res.state) {
const { rows, page, pageSize, total } = res.value
this.collectionList = rows
this.pageResult = {
page,
pageSize,
total,
}
}
})
.finally(() => {
cb?.()
})
},
handleCancelCollectProcess(defKey) {
collectionProcessOrCancel(defKey, 'cancel').then(
({ state, message }) => {
this.$message[state ? 'success' : 'error'](message)
state && this.$refs.htTable.load()
}
)
},
handleClickCard(row) {
//TODO:1.应用模块跳转2.是否窗口打开页面
this.$refs.leaderDialog.handleNewProcessJumps(row)
},
},
}
</script>
<style lang="scss" scoped>
.my-collection {
height: 100%;
.card-content {
.collection-icon {
cursor: pointer;
color: var(--themeColor);
}
.card-item-subject {
position: relative;
margin-left: 20px;
cursor: pointer;
flex: 1;
&::before {
position: absolute;
content: '';
width: 8px;
height: 8px;
border-radius: 50%;
border: 2px solid var(--themeColor);
top: 2px;
left: -20px;
}
}
}
}
</style>