newOaWorkflowManageList.vue
2.47 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
<template>
<div class="new-oa-workflow-manage-container">
<el-card class="box-card">
<div v-if="newOaWorkflowManageInfo.newOaWorkflows && newOaWorkflowManageInfo.newOaWorkflows.length > 0">
<el-row :gutter="20">
<el-col v-for="(item, index) in newOaWorkflowManageInfo.newOaWorkflows" :key="index" :span="4"
class="text-center workflow-item" @click.native="newFlow(item)">
<div>
<img src="/img/flow.png" width="80px" />
</div>
<div class="margin-top">
<span style="color: #333333;">{{ item.flowName }}</span>
</div>
</el-col>
</el-row>
</div>
<div v-else class="empty-tip">
<span>{{ $t('newOaWorkflowManage.noPublishedFlow') }}</span>
</div>
</el-card>
</div>
</template>
<script>
import { queryOaWorkflow } from '@/api/oa/newOaWorkflowManageApi'
export default {
name: 'NewOaWorkflowManageList',
data() {
return {
newOaWorkflowManageInfo: {
newOaWorkflows: [],
conditions: {
state: 'C',
flowType: '1001',
page: 1,
row: 100
}
}
}
},
created() {
this._listNewOaWorkflows()
},
methods: {
async _listNewOaWorkflows() {
try {
const { data } = await queryOaWorkflow(this.newOaWorkflowManageInfo.conditions)
this.newOaWorkflowManageInfo.newOaWorkflows = data
} catch (error) {
console.error('Failed to fetch workflows:', error)
}
},
async newFlow(flow) {
try {
const { data } = await queryOaWorkflow({
page: 1,
row: 1,
flowId: flow.flowId,
state: 'C'
})
if (data.length < 1) {
this.$message.error(this.$t('newOaWorkflowManage.flowNotDeployed'))
return
}
this.$router.push({
path: '/views/oa/newOaWorkflow',
query: { flowId: flow.flowId }
})
} catch (error) {
console.error('Failed to check flow deployment:', error)
}
}
}
}
</script>
<style lang="scss" scoped>
.new-oa-workflow-manage-container {
padding: 20px;
.box-card {
min-height: 400px;
}
.workflow-item {
margin-bottom: 20px;
cursor: pointer;
transition: all 0.3s;
&:hover {
transform: translateY(-5px);
}
}
.empty-tip {
padding: 20px;
text-align: center;
color: #909399;
}
.margin-top {
margin-top: 10px;
}
}
</style>