InstanceUrgent.vue
12.6 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<template>
<el-dialog
title="任务催办"
:visible.sync="taskUrgentDialog"
:close-on-click-modal="false"
append-to-body
>
<table cellspacing="0" cellpadding="0" border="0" class="form-table">
<tbody>
<tr v-if="nodeList && nodeList.length>1">
<th style="width: 140px;">
<span class="xh-star">*</span>催办节点:
</th>
<td>
<el-checkbox-group v-model="checkedNodes">
<el-checkbox v-for="node in nodeList" :label="node.nodeId" :key="node.nodeId">
{{node.name}}
</el-checkbox>
</el-checkbox-group>
</td>
</tr>
<tr>
<th style="width: 140px;">
<span class="xh-star">*</span>被催办人:
</th>
<td>
<span v-for="node in checkedNodes" :key="node">
<el-checkbox-group v-if="nodeDefMap[node] && nodeDefMap[node].assigneeUsers && nodeDefMap[node].assigneeUsers.length >0" v-model="appointee">
<el-checkbox v-for="(item,$index) in nodeDefMap[node].assigneeUsers" :label="item" :key="$index">{{item.fullname}}</el-checkbox>
</el-checkbox-group>
</span>
<span style="color:red;" v-if="checkedNodes.length==0 && isTaskUser">请先选择催办节点</span>
<span style="color:red;" v-if="!isTaskUser">要催办的任务无审批人</span>
</td>
</tr>
<tr>
<th style="width: 140px;">
<span class="xh-star"></span>是否催办秘书:
</th>
<td>
<el-radio v-model="appointeeSecretary" label="0">否</el-radio>
<el-radio v-model="appointeeSecretary" label="1">是</el-radio>
</td>
</tr>
<tr>
<th style="width: 140px;">
<span class="xh-star">*</span>催办方式:
</th>
<td>
<div class="value urgent-type">
<el-radio-group v-model="type">
<el-radio label="mail">邮箱</el-radio>
<el-radio label="sms" v-if="showMessageType('sms')">短信</el-radio>
<el-radio v-if="nodeDefMap[selectNodeId] && nodeDefMap[selectNodeId].localProperties.allowSmsApproval" label="smsApproval">短信审批</el-radio>
<el-radio label="inner" v-if="showMessageType('inner')">
站内消息
</el-radio>
<el-radio label="voice" v-if="showMessageType('voice')">
语音
</el-radio>
<el-radio label="wxEnterprise" v-if="showMessageType('wxEnterprise')">
微信
</el-radio>
<el-radio label="dingTalk" v-if="showMessageType('dingTalk')">
钉钉
</el-radio>
<el-radio label="flyBook" v-if="showMessageType('flyBook')">
飞书
</el-radio>
</el-radio-group>
<el-dropdown size="mini" class="dropdown" split-button type="primary" @command="handleCommand">
可选变量
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="{催办人:promoter}">催办人</el-dropdown-item>
<el-dropdown-item command="{被催办人:appointee}">被催办人</el-dropdown-item>
<el-dropdown-item command="{流程编号:instId}">流程编号</el-dropdown-item>
<el-dropdown-item command="{流程标题:subject}">流程标题</el-dropdown-item>
<el-dropdown-item command="{流程发起人:sponsor}">流程发起人</el-dropdown-item>
<el-dropdown-item command="{任务节点名称:nodeName}">任务节点名称</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</td>
</tr>
<tr v-if="type!='smsApproval'" >
<th style="width: 140px;">
<span class="xh-star">*</span>催办内容:
</th>
<td colspan="3">
<el-input v-if="type=='mail'" type="textarea" :autosize="{ minRows: 4, maxRows: 8}"
placeholder="请输入催办内容" v-model="contentMail"></el-input>
<el-input v-if="type=='sms' || type=='smsApproval'" type="textarea" :autosize="{ minRows: 4, maxRows: 8}"
placeholder="请输入催办内容" v-model="contentSms"></el-input>
<el-input v-if="type!='mail' && type!='sms'" type="textarea" :autosize="{ minRows: 4, maxRows: 8}"
placeholder="请输入催办内容" v-model="contentOthers"></el-input>
</td>
</tr>
<tr v-if="type=='smsApproval'" >
<th style="width: 140px;">
<span class="xh-star">*</span>短信审批备注:
</th>
<td colspan="3">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8}"
placeholder="短信审批备注会显示在发出的短信内容中,可在备注中对流程信息做补充说明,但请勿涉及敏感内容。" v-model="contentSms"></el-input>
注意:因为短信渠道未加密,发送的短信内容中不会包含详细批呈信息,请在短信催办前先与审批处理人做好沟通。
</td>
</tr>
</tbody>
</table>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" size="small">取 消</el-button>
<el-button type="primary" @click="confirm" :disabled="disabled" size="small">确 定</el-button>
</div>
</el-dialog>
</template>
<script>
import { mapState, mapActions } from "vuex";
import { Message } from "element-ui";
import req from "@/request.js";
export default {
name: "instanceUrgent",
components: {},
data() {
return {
disabled:false,
isTaskUser:true,//是否有任务审批人
taskUrgentDialog:false,
excutor:[],//节点审批人集合
appointee:[],//被催办人
type:"mail", //催办方式
contentMail:"",//邮件催办内容
contentSms:"",//短信催办内容
contentOthers: "",//其他催办内容
selectNodeId:'',
checkedNodes:[],//选择了要催办的任务
appointeeSecretary:"0",
nodeList:[],
nodeDefMap:{},
instId:"",
defId:"",
subject:""
};
},
methods: {
showMessageType(label) {
if(this.nodeList && this.nodeList.length > 0){
for (let i=0;i<this.nodeList.length;i++){
let node = this.nodeList[i]
if(node && node.localProperties.notifyType && node.localProperties.notifyType.includes(label)){
return true
}
}
return false
} else {
const node = this.nodeDefMap[this.selectNodeId]
return node && node.localProperties.notifyType && node.localProperties.notifyType.includes(label)
}
},
//鼠标点击页面其他其他位置不关闭弹框
handleOpen(instId,defId,subject,nodeId) {
this.instId = instId;
this.defId = defId;
this.subject = subject;
this.appointee=[];
this.taskUrgentDialog=true;
this.checkedNodes = [];
this.isTaskUser = true;
this.nodeDefMap = {}
this.selectNodeId = ""
//根据流程实例ID获取当前任务节点审批人
let this_ =this;
req.get(window.context.bpmRunTime + '/runtime/instance/v1/getExcutorNameByInstId?instId='+instId).then(res => {
res = res.data;
if(res){
//任务管理催办
if(nodeId){
this.selectNodeId = nodeId
res.forEach(nodeDef => {
if(nodeId == nodeDef.nodeId){
this_.nodeList = nodeDef;
this_.checkedNodes.push(nodeDef.nodeId);
//给每个用户添加对应的任务节点
for(let i = 0;i<nodeDef.assigneeUsers.length;i++){
nodeDef.assigneeUsers[i].nodeId = nodeDef.nodeId;
nodeDef.assigneeUsers[i].nodeName = nodeDef.name;
}
this_.nodeDefMap[nodeDef.nodeId] = nodeDef;
}
});
}else if(!nodeId){//实例管理催办
this_.nodeList = res;
if(res.length==1){
this_.checkedNodes.push(res[0].nodeId);
}
if(res.length > 0){
this.selectNodeId = res[0].nodeId
}
res.forEach(nodeDef => {
//给每个用户添加对应的任务节点
for(let i = 0;i<nodeDef.assigneeUsers.length;i++){
if (nodeDef.assigneeUsers[i]) {
nodeDef.assigneeUsers[i].nodeId = nodeDef.nodeId;
nodeDef.assigneeUsers[i].nodeName = nodeDef.name;
}
}
this_.nodeDefMap[nodeDef.nodeId] = nodeDef;
});
}
//要催办的任务无审批人
if(res.length==0){
this.isTaskUser=false;
}
}
});
//根据流程定义id获取流程信息
req.get(window.context.bpmModel + '/flow/def/v1/defGet?defId='+defId).then(res => {
res = res.data;
if(res && res.urgentMailTel){
this.contentMail = res.urgentMailTel;
}
if(res && res.urgentSmsTel){
this.contentSms = res.urgentSmsTel;
}
});
},
//可选变量
handleCommand(command) {
if(this.type=="mail"){
this.contentMail =this.contentMail+command;
}else if(this.type=="sms" || this.type=="smsApproval"){
this.contentSms =this.contentSms+command;
}else{
this.contentOthers=this.contentOthers+command;
}
},
//取消
cancel() {
this.taskUrgentDialog = false;
},
//确认
confirm() {
let content = "";//催办内容
if(this.type=="mail"){
content=this.contentMail;
}else if(this.type=="sms"){
content=this.contentSms;
}else{
content = this.contentOthers
}
if(this.checkedNodes.length==0){
Message.warning("被催办人不能为空");
return;
}
if(this.appointee.length==0){
Message.warning("请选择被催办人");
return;
}
if(content==""){
Message.warning("请输入催办内容");
return;
}
let isAppointeeSecretary = false;
if(this.appointeeSecretary == "1"){
isAppointeeSecretary = true;
}
let appointeeObj = {};
//给每个任务匹配对应的被催办人信息
for(let j =0;j<this.checkedNodes.length;j++){
appointeeObj[this.checkedNodes[j]] = [];
for(let i=0;i<this.appointee.length;i++){
if(this.appointee[i].nodeId == this.checkedNodes[j]){
appointeeObj[this.checkedNodes[j]].push(this.appointee[i])
}
}
}
let data = {"subject":this.subject,"type":this.type,"instId":this.instId,"content":content,"promoterId":JSON.parse(sessionStorage.getItem("currentUser")).userId,
"appointeeObj":appointeeObj,"promoter":JSON.parse(sessionStorage.getItem("currentUser")).username,"appointeeSecretary":isAppointeeSecretary};
const this_ = this;
this_.disabled =true;
req.post(window.context.bpmRunTime + '/runtime/instance/v1/sendUrgentByInstId', data).then(response => {
if (response.data.state) {
Message.success({
duration: 1500, message: response.data.message, onClose: function () {
this_.taskUrgentDialog = false;
this_.disabled = false;
}
});
}
}).catch(() => {
this_.disabled = false;
});
}
},
}
</script>
<style lang="scss" scoped>
.dropdown{
width: 150px;
float :right;
}
.value {
flex: 1;
padding: 10px 20px;
border-left: 1px solid #eee;
}
.urgent-type {
display: flex;
align-items: center;
justify-content: space-between;
.el-radio{
white-space: normal;
margin-top: 10px;
}
}
/deep/.el-checkbox {
color: #606266;
font-weight: 500;
font-size: 14px;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
margin-right: 30px;
margin-left: 0px !important;
}
div/deep/.el-dialog__header {
display: block !important;
}
.form-table{
border-top: 1px solid #ebeef5;
border-left: 1px solid #ebeef5;
}
</style>