4424f41c
monkeyhouyi
网信执法、清单管理静态页面
|
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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|
</el-tabs>
<el-dialog :title="eventType==='audit'?'审批通过':'审批拒绝'" :close-on-click-modal="false"
:visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll append-to-body
width='600px'>
<el-form label-width="80px">
<el-form-item label="加签人员" v-if="eventType==='audit'&& properties.hasFreeApprover">
<user-select v-model="handleId" placeholder="请选择加签人员,不选即该节点审核结束" />
</el-form-item>
<el-form-item label="审批意见">
<el-input v-model="reason" placeholder="请输入审批意见(选填)" type="textarea" :rows="4" />
</el-form-item>
<el-form-item v-if="properties.hasSign">
<div class="sign-main">
<div class="sign-head">
<div class="sign-tip">请在这里输入你的签名</div>
<div class="sign-action">
<el-button class="clear-btn" size="mini" @click="handleReset">清空</el-button>
<el-button class="sure-btn" size="mini" @click="handleGenerate"
:disabled="!!signImg">确定签名</el-button>
</div>
</div>
<div class="sign-box">
<vue-esign ref="esign" :height="330" v-if="!signImg" :lineWidth="5" />
<img :src="signImg" alt="" v-if="signImg" class="sign-img">
</div>
</div>
</el-form-item>
<el-form-item label="抄送人员" v-if="properties.isCustomCopy">
<user-select v-model="copyIds" placeholder="请选择" multiple />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" @click="handleApproval()" :loading="approvalBtnLoading">
{{$t('common.confirmButton')}}
</el-button>
</span>
</el-dialog>
<el-dialog title="指派" :close-on-click-modal="false" :visible.sync="assignVisible"
class="NCC-dialog NCC-dialog_center" lock-scroll append-to-body width='600px'>
<el-form label-width="80px" :model="assignForm" :rules="assignRules" ref="assignForm">
<el-form-item label="指派节点" prop="nodeCode">
<el-select v-model="assignForm.nodeCode" placeholder="请选择指派节点">
<el-option v-for="item in assignNodeList" :key="item.nodeCode" :label="item.nodeName"
:value="item.nodeCode" />
</el-select>
</el-form-item>
<el-form-item label="指派人" prop="freeApproverUserId">
<user-select v-model="assignForm.freeApproverUserId" placeholder="请选择指派人" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="assignVisible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" @click="handleAssign()">{{$t('common.confirmButton')}}
</el-button>
</span>
</el-dialog>
<UserBox v-if="userBoxVisible" ref="userBox" :title="userBoxTitle" @submit="handleTransfer" />
<print-browse :visible.sync="printBrowseVisible" :id="properties.printId" :formId="setting.id"
:fullName="setting.fullName" />
</div>
</transition>
</template>
<script>
import { FlowEngineInfo } from '@/api/workFlow/FlowEngine'
import { FlowBeforeInfo, Audit, Reject, Transfer, Recall, Cancel, Assign } from '@/api/workFlow/FlowBefore'
import { Revoke, Press } from '@/api/workFlow/FlowLaunch'
import { Create, Update, DynamicCreate, DynamicUpdate } from '@/api/workFlow/workFlowForm'
import recordList from './RecordList'
import Process from '@/components/Process/Preview'
import PrintBrowse from '@/components/PrintBrowse'
import vueEsign from 'vue-esign'
export default {
components: { recordList, Process, vueEsign, PrintBrowse },
data() {
return {
userBoxVisible: false,
userBoxTitle: '审批人',
assignVisible: false,
assignForm: {
nodeCode: '',
freeApproverUserId: ''
},
assignRules: {
nodeCode: [
{ required: true, message: '请选择指派节点', trigger: 'change' }
],
freeApproverUserId: [
{ required: true, message: '请选择指派人', trigger: 'change' }
]
},
assignNodeList: [],
currentView: '',
formData: {},
setting: {},
flowFormInfo: {},
flowTaskInfo: {},
flowTaskNodeList: [],
flowTemplateJson: {},
flowTaskOperatorRecordList: [],
properties: {},
endTime: 0,
visible: false,
reason: '',
handleId: '',
activeTab: '0',
loading: false,
btnLoading: false,
approvalBtnLoading: false,
printBrowseVisible: false,
eventType: '',
signImg: '',
copyIds: ''
}
},
methods: {
goBack(isRefresh) {
this.$emit('close', isRefresh)
},
init(data) {
this.loading = true
this.activeTab = '0'
this.setting = data
/**
* opType
* -1 - 我发起的新建/编辑
* 0 - 我发起的详情
* 1 - 待办事宜
* 2 - 已办事宜
* 3 - 抄送事宜
* 4 - 流程监控
*/
if (this.setting.opType == '-1') {
this.getEngineInfo(data)
} else {
this.getBeforeInfo(data)
}
},
getEngineInfo(data) {
FlowEngineInfo(data.flowId).then(res => {
data.type = res.data.type
data.fullName = res.data.fullName
if (data.formType == 1) {
if (res.data.formUrl) {
this.currentView = (resolve) => require([`@/views/${res.data.formUrl}`], resolve)
} else {
this.currentView = (resolve) => require([`@/views/workFlow/workFlowForm/${data.enCode}`], resolve)
}
} else {
this.currentView = (resolve) => require([`@/views/workFlow/workFlowForm/dynamicForm`], resolve)
}
data.formConf = res.data.formData
this.flowTemplateJson = res.data.flowTemplateJson ? JSON.parse(res.data.flowTemplateJson) : null
this.flowTemplateJson.state = 'state-curr'
data.formOperates = []
this.properties = this.flowTemplateJson && this.flowTemplateJson.properties || {}
if (this.flowTemplateJson && this.flowTemplateJson.properties && this.flowTemplateJson.properties.formOperates) {
data.formOperates = this.flowTemplateJson.properties.formOperates || []
}
setTimeout(() => {
this.$nextTick(() => {
this.$refs.form && this.$refs.form.init(data)
})
}, 500)
}).catch(() => { this.loading = false })
},
getBeforeInfo(data) {
FlowBeforeInfo(data.id, { taskNodeId: data.taskNodeId }).then(res => {
this.flowFormInfo = res.data.flowFormInfo
this.flowTaskInfo = res.data.flowTaskInfo
data.fullName = this.flowTaskInfo.fullName
data.type = this.flowTaskInfo.type
if (data.formType == 1) {
if (this.flowTaskInfo.formUrl) {
this.currentView = (resolve) => require([`@/views/${this.flowTaskInfo.formUrl}`], resolve)
} else {
this.currentView = (resolve) => require([`@/views/workFlow/workFlowForm/${data.enCode}`], resolve)
}
} else {
this.currentView = (resolve) => require([`@/views/workFlow/workFlowForm/dynamicForm`], resolve)
}
this.flowTaskNodeList = res.data.flowTaskNodeList
this.flowTemplateJson = this.flowTaskInfo.flowTemplateJson ? JSON.parse(this.flowTaskInfo.flowTemplateJson) : null
this.flowTaskOperatorRecordList = res.data.flowTaskOperatorRecordList
this.properties = res.data.approversProperties || {}
this.endTime = this.flowTaskInfo.completion == 100 ? this.flowTaskInfo.endTime : 0
data.formConf = res.data.flowFormInfo
if (data.opType != 1) data.readonly = true
data.formOperates = []
if (data.opType == 0) {
this.properties = this.flowTemplateJson && this.flowTemplateJson.properties || {}
if (this.flowTemplateJson && this.flowTemplateJson.properties && this.flowTemplateJson.properties.formOperates) {
data.formOperates = this.flowTemplateJson.properties.formOperates || []
}
} else {
data.formOperates = res.data.formOperates || []
}
if (this.flowTaskNodeList.length) {
let assignNodeList = []
for (let i = 0; i < this.flowTaskNodeList.length; i++) {
const nodeItem = this.flowTaskNodeList[i]
data.opType == 4 && nodeItem.type == 1 && assignNodeList.push(nodeItem)
const loop = data => {
if (Array.isArray(data)) data.forEach(d => loop(d))
if (data.nodeId === nodeItem.nodeCode) {
if (nodeItem.type == 0) data.state = 'state-past'
if (nodeItem.type == 1) data.state = 'state-curr'
if (nodeItem.nodeType === 'approver' || nodeItem.nodeType === 'start' || nodeItem.nodeType === 'subFlow') data.content = nodeItem.userName
return
}
if (data.conditionNodes && Array.isArray(data.conditionNodes)) loop(data.conditionNodes)
if (data.childNode) loop(data.childNode)
}
loop(this.flowTemplateJson)
}
this.assignNodeList = assignNodeList
}
setTimeout(() => {
this.$nextTick(() => {
this.$refs.form && this.$refs.form.init(data)
})
}, 500)
}).catch(() => { this.loading = false })
},
eventLancher(eventType) {
this.$refs.form && this.$refs.form.dataFormSubmit(eventType)
},
eventReciver(formData, eventType) {
this.formData = formData
this.eventType = eventType
if (eventType === 'save' || eventType === 'submit') {
return this.submitOrSave()
}
if (eventType === 'audit' || eventType === 'reject') {
this.handleId = ''
this.reason = ''
this.copyIds = ''
this.handleReset()
this.visible = true
}
},
submitOrSave() {
this.formData.status = this.eventType === 'submit' ? 0 : 1
if (this.eventType === 'save') return this.handleRequest()
this.$confirm('您确定要提交当前流程吗, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.handleRequest()
}).catch(() => { });
},
handleRequest() {
if (!this.formData.id) delete (this.formData.id)
if (this.eventType === 'save') this.btnLoading = true
let formMethod = null
if (this.setting.formType == 1) {
formMethod = this.formData.id ? Update : Create
} else {
formMethod = this.formData.id ? DynamicUpdate : DynamicCreate
}
formMethod(this.setting.enCode, this.formData).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
if (this.eventType === 'save') this.btnLoading = false
this.$emit('close', true)
}
})
}).catch(() => {
if (this.eventType === 'save') this.btnLoading = false
})
},
revoke() {
this.$prompt('', "撤回流程", {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPlaceholder: '请输入撤回原因(选填)',
inputType: 'textarea',
inputValue: "",
closeOnClickModal: false
}).then(({ value }) => {
Revoke(this.setting.id, { handleOpinion: value }).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.$emit('close', true)
}
})
})
}).catch(() => { })
},
press() {
this.$confirm('此操作将提示该节点尽快处理,是否继续?', '提示', {
type: 'warning'
}).then(() => {
Press(this.setting.id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000
})
})
}).catch(() => { })
},
recall() {
this.$prompt('', "撤回审核", {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPlaceholder: '请输入撤回原因(选填)',
inputType: 'textarea',
inputValue: "",
closeOnClickModal: false
}).then(({ value }) => {
Recall(this.setting.taskId, { handleOpinion: value }).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.$emit('close', true)
}
})
})
}).catch(() => { })
},
cancel() {
this.$prompt('', "终止审核不可恢复", {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPlaceholder: '请输入终止原因(选填)',
inputType: 'textarea',
inputValue: "",
closeOnClickModal: false
}).then(({ value }) => {
Cancel(this.setting.taskId, { handleOpinion: value }).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.$emit('close', true)
}
})
})
}).catch(() => { })
},
openUserBox(type) {
this.userBoxVisible = true
this.$nextTick(() => {
this.$refs.userBox.init()
})
},
handleTransfer(freeApproverUserId) {
Transfer(this.setting.taskId, { freeApproverUserId }).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.$emit('close', true)
}
})
})
},
openAssignBox() {
this.assignVisible = true
this.$nextTick(() => {
this.$refs['assignForm'].resetFields()
})
},
handleAssign() {
this.$refs['assignForm'].validate((valid) => {
if (!valid) return
Assign(this.setting.taskId, this.assignForm).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.$emit('close', true)
}
})
})
})
},
handleApproval() {
if (this.properties.hasSign && !this.signImg) {
this.$message({
message: '请签名',
type: 'error'
})
return
}
let query = {
handleOpinion: this.reason,
formData: this.formData,
enCode: this.setting.enCode,
signImg: this.signImg,
copyIds: this.copyIds
}
if (this.eventType === 'audit' && this.properties.hasFreeApprover) {
query = { freeApproverUserId: this.handleId, ...query }
}
const approvalMethod = this.eventType === 'audit' ? Audit : Reject
this.approvalBtnLoading = true
approvalMethod(this.setting.taskId, query).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.approvalBtnLoading = false
this.visible = false
this.$emit('close', true)
}
})
}).catch(() => { this.approvalBtnLoading = false })
},
handleReset() {
this.signImg = ''
this.$nextTick(() => {
this.$refs.esign && this.$refs.esign.reset()
})
},
handleGenerate() {
this.$refs.esign.generate().then(res => {
if (res) this.signImg = res
}).catch(err => {
this.$message({
message: '请签名',
type: 'warning'
})
})
},
setPageLoad(val) {
this.loading = !!val
},
setLoad(val) {
this.btnLoading = !!val
}
}
}
</script>
<style lang="scss" scoped>
.radio-audit {
display: block;
margin-bottom: 20px;
}
.sign-main {
border: 1px solid #dcdfe6;
border-radius: 4px;
overflow: hidden;
.sign-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
border-bottom: 1px solid #dcdfe6;
.sign-tip {
color: #606266;
font-size: 12px;
}
.sign-action {
display: flex;
align-items: center;
.clear-btn,
.sure-btn {
margin-left: 5px;
}
}
}
.sign-box {
border-top: 0;
height: 100px;
}
.sign-img {
width: 100%;
}
}
</style>
|