FlowSignRuleSet.vue
11 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<template>
<div>
<el-dialog
width="70%"
:title="'会签规则设置('+curNode.nodeId+')'"
:visible.sync="dialogVisible"
top="8vh"
v-if="dialogVisible"
:close-on-click-modal="false"
append-to-body>
<el-container >
<el-tabs v-model="signRuleSetPane" type="card" style="width:100%;">
<el-tab-pane label="投票规则设置" name="first">
<table class="table table-bordered" style="border-spacing: 0;width: 100%;padding:8px">
<tr>
<th width="20%"> <span>决策类型</span></th>
<td>
<ht-radio v-model="data.signRule.decideType" :options='[{ key: "agree", value: "同意票"}, { key: "refuse", value: "否定票" }]'/>
</td>
</tr>
<tr>
<th width="20%"> <span>后续处理模式</span> </th>
<td>
<ht-radio v-model="data.signRule.followMode" :options='[{ key: "wait", value: "等待所有人投票"}, { key: "complete", value: "直接处理" }]'/>
</td>
</tr>
<tr>
<th width="20%"> <span>投票类型</span></th>
<td>
<ht-radio v-model="data.signRule.voteType" :options='[{ key: "amount", value: "绝对票数"}, { key: "percent", value: "百分比" }]'/>
</td>
</tr>
<tr>
<th width="20%"><span>票数:</span></th>
<td>
<el-input-number v-model="data.signRule.voteAmount" v-if="data.signRule.voteType!='percent'" :min="1"></el-input-number>
<el-input-number v-model="data.signRule.voteAmount" v-if="data.signRule.voteType=='percent'" :min="1" :max="100"></el-input-number>
<span v-if="data.signRule.voteType=='percent'">%</span>
</td>
</tr>
</table>
</el-tab-pane>
<el-tab-pane label="权限功能设置" name="second">
<table class="table table-bordered">
<tr style="text-align: center;">
<td style="width:14%">
<label>权限类型</label>
</td>
<td>
<label>人员配置</label>
</td>
</tr>
<!-- <tr>
<th >
<span>所有特权:</span>
</th>
<td>
<div style="min-height: 60px">
<table class="table table-bordered">
<thead>
<tr>
<th width="6%">序号</th>
<th width="84%">条件</th>
<th width="10%">操作</th>
</tr>
</thead>
<tr v-for="(userRule,$index) in data.privilegeList.all" :key="$index">
<td>{{$index+1}}</td>
<td>{{userRule.description}}</td>
<td>
<el-button size="mini" icon="el-icon-edit" @click="addUserCondition('all',$index)"></el-button>
<el-button size="mini" icon="el-icon-delete" @click="data.privilegeList.all.remove(data.privilegeList.all[$index])"></el-button>
</td>
</tr>
<tr>
<td style="text-align: left;" colspan="3">
<el-button size="mini" @click="addUserCondition('all')">新增人员规则</el-button>
</td>
</tr>
</table>
</div>
</td>
</tr>-->
<tr>
<th>
<span>允许加签:</span>
</th>
<td>
<div style="min-height: 60px">
<table class="table table-bordered">
<tr>
<th width="6%">序号</th>
<th width="84%">条件</th>
<th width="10%">操作</th>
</tr>
<tr v-for="(userRule,$index) in data.privilegeList.allowAddSign" :key="$index">
<td>{{$index+1}}</td>
<td>{{userRule.description}}</td>
<td>
<el-button size="mini" icon="el-icon-edit" @click="addUserCondition('allowAddSign',$index)"></el-button>
<el-button size="mini" icon="el-icon-delete" @click="data.privilegeList.allowAddSign.remove(data.privilegeList.allowAddSign[$index])"></el-button>
</td>
</tr>
<tr>
<td style="text-align: left;" colspan="3">
<el-button size="mini" @click="addUserCondition('allowAddSign')">新增人员规则</el-button>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<th>
<span>一票制:</span>
</th>
<td>
<div style="min-height: 60px">
<table class="table table-bordered">
<thead>
<tr>
<th width="6%">序号</th>
<th width="84%">条件</th>
<th width="10%">操作</th>
</tr>
</thead>
<tr v-for="(userRule,$index) in data.privilegeList.oneticket" :key="$index">
<td>{{$index+1}}</td>
<td>{{userRule.description}}</td>
<td>
<el-button size="mini" icon="el-icon-edit" @click="addUserCondition('oneticket',$index)"></el-button>
<el-button size="mini" icon="el-icon-delete" @click="data.privilegeList.oneticket.remove(data.privilegeList.oneticket[$index])"></el-button>
</td>
</tr>
<tr>
<td style="text-align: left;" colspan="3">
<el-button size="mini" @click="addUserCondition('oneticket')">新增人员规则</el-button>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</el-tab-pane>
</el-tabs>
</el-container>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" size="medium">取 消</el-button>
<el-button type="primary" @click="handleClose" size="medium">确 定</el-button>
</span>
</el-dialog>
<FlowNodeUserCondition @nodeUserConditionConfirm="nodeUserConditionConfirm" ref="flowNodeUserCondition" />
</div>
</template>
<script>
import flow from "@/api/flow.js";
import req from "@/request.js";
import { mapState, mapActions } from "vuex";
const FlowNodeUserCondition = () => import("@/components/flow/FlowNodeUserCondition.vue");
export default {
components: {FlowNodeUserCondition },
data() {
return {
data:[],
signRuleSetPane:'first',
dialogVisible:false,
curEditSetting:'',
curEditRuleIndex:''
};
},
watch:{
'data.signRule.voteType':function (n,o) {
if (n=='percent' && this.data.signRule.voteAmount>100) {
this.data.signRule.voteAmount=100;
}
}
},
computed: mapState({
curNode: state => state.flow.defConfigData.curEditNode,
}),
methods: {
showDialog() {
let this_ = this;
this.signRuleSetPane = 'first';
this.$store.dispatch("flow/getSignConfig").then(function(resp){
let data = JSON.parse(JSON.stringify(resp));
this_.data = data;
this_.dialogVisible = true;
})
},
handleClose() {
let param ={defId : this.curNode.defId,
nodeId :this.curNode.nodeId ,
privilegeList : JSON.stringify(this.data.privilegeList),
signRule : JSON.stringify(this.data.signRule)};
let this_ = this;
req.post(window.context.bpmModel+'/flow/node/v1/signConfigSave',param).then(response => {
let data = response.data;
if(data.state){
this_.$message.success("会签节点配置成功!");
let obj = {};
obj['signConfigs.'+this_.curNode.nodeId] = this_.data
this_.$store.dispatch("flow/updateConfig",obj);
this_.$emit('onConfirm');
this_.dialogVisible = false;
}else{
this_.$message.fail("会签节点配置失败!"+data.message);
}
});
},
//用户规则选择
addUserCondition(setting, index) {
this.curEditSetting = setting;
this.curEditRuleIndex = index;
let conf ={};
if (index != undefined) {
let ruleList = this.data.privilegeList[setting];
let userRule = ruleList[index];
conf.userRule = JSON.parse(JSON.stringify(userRule));
}
conf={...conf,...{nodeType:"signTask",nodeId:this.curNode.nodeId,defId:this.curNode.defId}};
this.$refs.flowNodeUserCondition.showDialog(conf);
},
nodeUserConditionConfirm(res){
if (!this.data.privilegeList[this.curEditSetting]) {
this.data.privilegeList[this.curEditSetting] = [];
}
if (this.curEditRuleIndex || this.curEditRuleIndex == 0) {
this.data.privilegeList[this.curEditSetting].splice(this.curEditRuleIndex,1,res);
} else {
this.data.privilegeList[this.curEditSetting].push(res);
}
this.$forceUpdate();
},
}
};
</script>
<style scoped>
div >>>.el-dialog__body{
padding:10px ;
}
div >>>.el-tabs__header{
margin-bottom: 0;
}
div >>>.el-tabs__content{
height: 500px;
overflow: auto;
}
.table > thead > tr > th,.table > thead > th, .table > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tr > td, .table > tfoot > tr > td {
border-top: 1px solid #e7eaec;
border-left: 1px solid #e7eaec;
line-height: 1.42857;
padding: 4px 8px;
vertical-align: middle;
}
.table{
border-bottom: 1px solid #e7eaec;
border-right: 1px solid #e7eaec;
width:100%;
border-spacing:0;
}
.inputs >>>.el-form-item__error{
display: none;
}
.table>>> .el-button {
padding: 6px 8px;
margin-left:0px;
}
</style>