index.vue
6.05 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
<template>
<div class="home">
<ht-portal
ref="htPortal"
:column-layout-alias="columnLayoutAlias"
:current-user="currentUser"
@click-process="handleClickProcess"
@get-column-layout="getColumnLayout"
@change-layout="changeLayout"
>
<template #empty>
<el-empty
:image="noDataImg"
:image-size="380"
description="此布局暂无栏目,请添加栏目"
></el-empty>
</template>
</ht-portal>
<leader-dialog ref="leaderDialog" />
<!-- 消息提醒弹框 -->
<remind-pop></remind-pop>
</div>
</template>
<script>
import LeaderDialog from '@/views/matter/components/LeaderDialog'
import RemindPop from '@/components/remindPop/index.vue'
import moment from 'moment'
import { getUsername } from '@/utils/username'
import { getMyRequestTask } from '@/api/process'
export default {
name: 'Index',
components: {
LeaderDialog,
RemindPop,
},
data() {
return {
columnConfig: {},
noDataImg: require('@/assets/nodata_images/no-draft.png'),
currentUser: { username: getUsername() || '' },
}
},
computed: {
columnLayoutAlias() {
return this.$route.meta.alias || 'default_front'
},
},
mounted() {
this.$baseEventBus.$on('get-layout-config', () => {
localStorage.setItem(
this.columnConfig.id,
JSON.stringify(this.columnConfig.updateDate)
)
if (this.$refs.htPortal) {
this.$refs.htPortal?.updateColumnLayout()
}
})
this.$baseEventBus.$on('add-column', (layoutId) => {
if (this.$refs.htPortal) {
this.$refs.htPortal.addColumn(layoutId)
}
})
},
methods: {
getColumnLayout(data) {
this.columnConfig = data
sessionStorage.setItem('layoutId', data.id)
//判断管理端是否修改了栏目布局 identifyChange:0.前台未进行拖拽 1.前台更新后,后台未更新 2.前台更新之后,后台进行更新
if ([1, 2].includes(data.identifyChange)) {
localStorage.setItem(`isNewLayout_${data.id}`, true)
this.$baseEventBus.$emit('change-layout', { isNewLayout: true })
} else {
localStorage.setItem(`isNewLayout_${data.id}`, false)
this.$baseEventBus.$emit('change-layout', { isNewLayout: false })
}
},
changeLayout() {
localStorage.setItem(`isDragColumn_${this.columnConfig.id}`, true)
this.$baseEventBus.$emit('change-layout', { isDragColumn: true })
},
handleClickProcess(row, type, tableData) {
if (['commonProcess', 'processOverview', 'collection'].includes(type)) {
this.$refs.leaderDialog.handleNewProcessJumps(row)
} else if (type === 'todo') {
this.$refs.leaderDialog.handleJumpsTodoPage(row, {
isGetApprovalBtn: true,
type: 'fromTodoList',
key: tableData.length === 1 ? 'onlyOneTask' : '',
})
} else if (type === 'request') {
this.handleRequestJump(row)
} else if (type === 'draft') {
const path = '/matter/startProcess'
this.$router.push({
path,
query: this.getCurrentQuery(row, type),
})
} else if (type == 'done') {
this.setReaded(row.id)
const path = '/matter/approvalForm'
this.$router.push({
path,
query: this.getCurrentQuery(row, type),
})
} else {
const path = '/matter/approvalForm'
this.$router.push({
path,
query: this.getCurrentQuery(row, type),
})
}
},
getCurrentQuery(row, type) {
const { id, procInstId, nodeId } = row
const queryMap = {
done: {
type: 'done',
doneTaskId: row.taskId,
isDefAuthorize: row.isDefAuthorize,
},
draft: {
defId: row.procDefId,
name: row.subject,
instStatus: row.status,
},
received: {
readId: row.id, //为知会任务表的id
receivedStatus: row.status,
isRead: row.isRead,
},
circulated: {
readId: row.id,
},
}
let query = {
instId: ['done', 'request', 'draft'].includes(type) ? id : procInstId,
nodeId,
from: type,
}
if (['done', 'draft', 'received', 'circulated'].includes(type)) {
query = {
...query,
...queryMap[type],
}
}
if (['draft', 'done'].includes(type)) {
delete query.from
}
return query
},
handleRequestJump(row) {
getMyRequestTask(row.id).then((res) => {
let task = res.value
const path = '/matter/approvalForm'
let query = {
instId: row.id,
// 这个参数用于检查是否有撤回流程权限
type: 'request',
myApplication: true,
}
if (task && task.id) {
query = {
...query,
taskId: task.id,
isGetApprovalBtn: true,
}
}
this.$router.push({
path,
query,
})
})
},
setReaded(id) {
this.$requestConfig.setReaded({ procInstId: id }).then((resp) => {
console.log(resp)
})
},
},
}
</script>
<style lang="scss" scoped>
.home {
::v-deep {
.ht-custom-title {
.custom-title {
&::before {
background: var(--themeColor);
}
}
}
.ht-process-center .subject-name {
color: var(--themeColor);
}
.ht-process-publicity {
.is-read {
.email-icon {
color: rgba(var(--themeColorRgb), 0.5) !important;
}
&:hover {
.email-icon {
color: var(--themeColor) !important;
}
}
}
}
}
}
</style>