FlowNodeRestfuls.vue
3.88 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
<template>
<div class="form-inline">
<label class="control-label"
>{{ node.name }}({{ node.nodeId }}):
<el-button
icon=""
type="primary"
size="mini"
@click="setRestFul(node.nodeId, node.name)"
>设置接口事件</el-button
> </label
><br /><br />
<!-- 单个节点事件配置 -->
<FlowNodeEventSetting
ref="flowNodeEventSetting"
:titleSetting="titleSetting"
:passConf="passConf"
:typeSet="typeSet"
:def-id="defConfigData.initData.bpmDefinition.defId"
@handle-save="handleSave"
></FlowNodeEventSetting>
</div>
</template>
<script>
import req from '@/request.js'
import {mapState, mapActions} from 'vuex'
import {Message} from 'element-ui'
const FlowNodeEventSetting = () =>
import('@/components/flow/FlowNodeEventSetting.vue')
export default {
name: 'FlowNodeRestfuls',
components: {FlowNodeEventSetting},
props: {
//任务节点信息
node: {
type: Object,
required: true
},
//流程配置信息
defConfigData: {
type: Object,
required: true
}
},
watch: {
passConf: {
handler(newValue, oldValue) {
//单个任务节点的节点事件
if (newValue.nodeId) {
let path = 'nodeSetData.nodeRestfulMap.' + newValue.nodeId
let obj = {}
obj[path] = newValue.restful
//更新vuex里面defConfigData配置数据
this.$store.dispatch('flow/updateConfig', obj)
} else {
//全局任务节点的节点事件
let path = 'nodeSetData.bpmDefSetting.globalRestfuls'
let obj = {}
obj[path] = newValue.restful
//更新vuex里面defConfigData配置数据
this.$store.dispatch('flow/updateConfig', obj)
}
},
deep: true
}
},
data() {
return {
titleSetting: '节点事件设置', //某个节点事件的标题
passConf: {restful: [], nodeId: ''}, //节点事件配置信息
typeSet: 0 //1 全局 0 节点
}
},
methods: {
//监听节点事件的保存方法
handleSave(data) {
this.passConf.restful = data
},
//设置任务节点的事件
setRestFul(nodeId, nodeName) {
this.passConf = {restful: [], nodeId: ''} //清空节点事件配置信息
this.passConf.nodeId = nodeId
try {
if (!nodeId) {
this.passConf.restful = this.defConfigData.nodeSetData.bpmDefSetting.globalRestfuls //全局restful接口事件
this.passConf.nodes = this.defConfigData.nodeSetData.nodes //流程任务节点
} else {
this.passConf.restful = this.defConfigData.nodeSetData.nodeRestfulMap[
nodeId
] //单个任务restful接口事件
}
} catch (e) {}
this.titleSetting = '全局事件设置'
this.typeSet = 1
if (nodeId) {
this.titleSetting = '节点【' + nodeName + '】事件设置'
this.typeSet = 0
}
setTimeout(() => {
this.$refs.flowNodeEventSetting.showDialog() //显示设置节点事件侧边栏
})
}
},
mounted() {}
}
</script>
<style lang="scss" scoped>
.div_list {
height: 30px;
background: #e2e2e2;
line-height: 30px;
font-weight: bold;
padding-left: 10px;
margin-bottom: 10px;
}
>>> label.el-checkbox {
margin: 5px 10px 0 0;
}
.ht {
width: 300px;
}
.form-inline {
float: left;
width: 100%;
}
.left-label {
width: 18%;
float: left;
}
.control-label {
word-break: break-all;
text-align: right;
color: #545252;
font-size: 12px;
padding: 0px 10px !important;
font-weight: bold;
line-height: 35px;
}
div >>> .box-card {
margin-bottom: 20px;
}
div >>> .box-card .clearfix {
padding-top: 20px;
}
div >>> .el-collapse-item__header {
height: 40px;
line-height: 40px;
font-size: 14px;
font-weight: bold;
}
div >>> .el-button {
padding: 7px;
margin-left: 10px;
}
</style>