FllowSetting.vue
3.1 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
<template>
<!-- 跟踪设置 -->
<div>
<el-dialog
width="50%"
:title="$t('task.TrackingSettings')"
:visible.sync="showFllowSetting"
:close-on-click-modal="false"
append-to-body
>
<div class="container">
<div class="label">{{ $t('task.TrackingNode') }}</div>
<div class="node-list">
<el-checkbox-group v-model="checkedNodes">
<el-checkbox
v-for="node in nodes"
:key="node.nodeId"
:label="node.nodeId"
@change="handleCheck(node.nodeId)"
>
{{ node.name }}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div slot="footer">
<el-button @click="cancel">{{ $t('Common.Cancel') }}</el-button>
<el-button type="primary" @click="confirm">
{{ $t('Common.Confirm') }}
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { taskFollowSave } from '@/api/process'
export default {
name: 'FllowSetting',
props: {
defId: {
type: String,
default: '',
},
instId: {
type: String,
default: '',
},
},
data() {
return {
showFllowSetting: false,
}
},
computed: {
nodes() {
return this.$store.state.process.nodes
},
checkedNodes: {
get() {
return this.$store.state.process.checkedNodes
},
set() {},
},
},
methods: {
cancel() {
this.showFllowSetting = false
},
confirm() {
const { length } = this.checkedNodes
if (!length) {
this.$message.warning('请选择跟踪节点')
return
}
const data = { taskId: '' }
for (let i = 0; i < length; i++) {
data.taskId = data.taskId + this.checkedNodes[i] + ','
}
data.proInst = this.instId
taskFollowSave(data, (res) => {
if (res.state) {
this.showFllowSetting = false
this.$message.success(res.message)
}
})
},
handleCheck(nodeId) {
const index = _.findIndex(this.checkedNodes, (item) => item == nodeId)
if (index != -1) {
this.$store.dispatch('process/setCheckedSplice', index)
} else {
this.$store.dispatch('process/setCheckedPush', nodeId)
}
},
handleOpen() {
this.showFllowSetting = true
const data = {
defId: this.defId,
proInst: this.instId,
}
this.$store.dispatch('process/getTaskNodeById', data)
},
},
}
</script>
<style lang="scss" scoped>
.container {
display: flex;
align-items: center;
border: 1px solid #ebeef5;
height: 100%;
.label {
width: 80px;
padding: 20px;
&::before {
display: inline-block;
content: '*';
color: #f50;
margin-right: 2px;
}
}
.node-list {
padding: 20px;
border-left: 1px solid #ebeef5;
}
}
::v-deep .el-dialog__footer {
// border: none;
}
</style>