|
|
@@ -3,20 +3,28 @@ import type { ApprovalType } from '../type';
|
|
3
|
3
|
|
|
4
|
4
|
import type { TaskInfo } from '#/api/workflow/task/model';
|
|
5
|
5
|
|
|
6
|
|
-import { computed, ref, reactive } from 'vue';
|
|
|
6
|
+import { computed, reactive, ref } from 'vue';
|
|
7
|
7
|
|
|
8
|
8
|
import { cn } from '@vben/utils';
|
|
9
|
9
|
|
|
10
|
10
|
import { UploadFilled } from '@element-plus/icons-vue';
|
|
11
|
|
-import { ElButton, ElDrawer, ElForm, ElFormItem, ElInput, ElMessage, ElUpload, ElMessageBox, ElSpace, ElTreeSelect, ElSelect, ElOption } from 'element-plus';
|
|
12
|
|
-
|
|
13
|
11
|
import {
|
|
14
|
|
- backProcess,
|
|
15
|
|
- deleteOrder,
|
|
16
|
|
- submitOrder,
|
|
17
|
|
- taskOperation,
|
|
18
|
|
-} from '#/api/workflow/task';
|
|
|
12
|
+ ElButton,
|
|
|
13
|
+ ElDrawer,
|
|
|
14
|
+ ElForm,
|
|
|
15
|
+ ElFormItem,
|
|
|
16
|
+ ElInput,
|
|
|
17
|
+ ElMessage,
|
|
|
18
|
+ ElMessageBox,
|
|
|
19
|
+ ElOption,
|
|
|
20
|
+ ElSelect,
|
|
|
21
|
+ ElSpace,
|
|
|
22
|
+ ElTreeSelect,
|
|
|
23
|
+ ElUpload,
|
|
|
24
|
+} from 'element-plus';
|
|
|
25
|
+
|
|
19
|
26
|
import { requestClient } from '#/api/request';
|
|
|
27
|
+import { backProcess, deleteOrder, submitOrder } from '#/api/workflow/task';
|
|
20
|
28
|
import { getSingleImageUploadConfig } from '#/components/upload/config';
|
|
21
|
29
|
import CreatOrder from '#/views/workflow/order/creatOrder.vue';
|
|
22
|
30
|
|
|
|
@@ -92,6 +100,15 @@ const userList = ref([]);
|
|
92
|
100
|
const selectedDeptId = ref('');
|
|
93
|
101
|
const selectedUsers = ref([]);
|
|
94
|
102
|
|
|
|
103
|
+// 延时审批的抽屉
|
|
|
104
|
+const approveDelayDrawerVisible = ref(false);
|
|
|
105
|
+const approveDelayFormData = reactive({
|
|
|
106
|
+ approveRemark: '',
|
|
|
107
|
+ approveStatus: '1',
|
|
|
108
|
+ delayId: 0,
|
|
|
109
|
+ newDeadline: '',
|
|
|
110
|
+});
|
|
|
111
|
+
|
|
95
|
112
|
// 编辑
|
|
96
|
113
|
const handleEdit = () => {
|
|
97
|
114
|
drawerId.value = props.task!.id;
|
|
|
@@ -189,7 +206,8 @@ function handleRemove() {
|
|
189
|
206
|
cancelButtonText: '取消',
|
|
190
|
207
|
type: 'warning',
|
|
191
|
208
|
center: true,
|
|
192
|
|
- }).then(async () => {
|
|
|
209
|
+ })
|
|
|
210
|
+ .then(async () => {
|
|
193
|
211
|
await deleteOrder([props.task!.id]);
|
|
194
|
212
|
emit('reload');
|
|
195
|
213
|
})
|
|
|
@@ -223,7 +241,7 @@ function handleApprove() {
|
|
223
|
241
|
handleFormData.processContent = '';
|
|
224
|
242
|
handleFormData.taskId = props.task!.taskId;
|
|
225
|
243
|
handleFileList.value = [];
|
|
226
|
|
-
|
|
|
244
|
+
|
|
227
|
245
|
// 打开抽屉
|
|
228
|
246
|
handleDrawerVisible.value = true;
|
|
229
|
247
|
}
|
|
|
@@ -236,7 +254,7 @@ function handleDelay() {
|
|
236
|
254
|
delayFormData.delayDuration = 0;
|
|
237
|
255
|
delayFormData.delayReason = '';
|
|
238
|
256
|
delayFileList.value = [];
|
|
239
|
|
-
|
|
|
257
|
+
|
|
240
|
258
|
// 打开抽屉
|
|
241
|
259
|
delayDrawerVisible.value = true;
|
|
242
|
260
|
}
|
|
|
@@ -249,10 +267,10 @@ function handleCopy() {
|
|
249
|
267
|
selectedDeptId.value = '';
|
|
250
|
268
|
selectedUsers.value = [];
|
|
251
|
269
|
userList.value = [];
|
|
252
|
|
-
|
|
|
270
|
+
|
|
253
|
271
|
// 加载部门树
|
|
254
|
272
|
loadDeptTree();
|
|
255
|
|
-
|
|
|
273
|
+
|
|
256
|
274
|
// 打开抽屉
|
|
257
|
275
|
ccDrawerVisible.value = true;
|
|
258
|
276
|
}
|
|
|
@@ -261,11 +279,7 @@ function handleCopy() {
|
|
261
|
279
|
async function loadDeptTree() {
|
|
262
|
280
|
try {
|
|
263
|
281
|
const response = await requestClient.get('/system/user/deptTree');
|
|
264
|
|
- if (response.code === 200) {
|
|
265
|
|
- deptTree.value = response.data;
|
|
266
|
|
- } else {
|
|
267
|
|
- ElMessage.error('加载部门树失败');
|
|
268
|
|
- }
|
|
|
282
|
+ deptTree.value = response;
|
|
269
|
283
|
} catch (error) {
|
|
270
|
284
|
ElMessage.error('加载部门树失败');
|
|
271
|
285
|
console.error('加载部门树失败:', error);
|
|
|
@@ -275,9 +289,12 @@ async function loadDeptTree() {
|
|
275
|
289
|
// 加载人员列表
|
|
276
|
290
|
async function loadUserList(deptId) {
|
|
277
|
291
|
try {
|
|
278
|
|
- const response = await requestClient.get(`/system/user/list?deptId=${deptId}&pageNum=1&pageSize=20`);
|
|
279
|
|
- if (response.code === 200) {
|
|
280
|
|
- userList.value = response.data.list || [];
|
|
|
292
|
+ const response = await requestClient.get(
|
|
|
293
|
+ `/system/user/list?deptId=${deptId}&pageNum=1&pageSize=999`,
|
|
|
294
|
+ );
|
|
|
295
|
+ console.log('加载人员列表响应:', response);
|
|
|
296
|
+ if (response.rows && response.rows.length > 0) {
|
|
|
297
|
+ userList.value = response.rows || [];
|
|
281
|
298
|
} else {
|
|
282
|
299
|
ElMessage.error('加载人员列表失败');
|
|
283
|
300
|
}
|
|
|
@@ -318,14 +335,14 @@ async function handleDelaySubmit() {
|
|
318
|
335
|
ElMessage.error('请输入有效的延时时长(至少1小时)');
|
|
319
|
336
|
return;
|
|
320
|
337
|
}
|
|
321
|
|
-
|
|
|
338
|
+
|
|
322
|
339
|
// 调用延时API
|
|
323
|
340
|
await requestClient.put('/workOrder/order/delay', delayFormData);
|
|
324
|
341
|
ElMessage.success('延时申请提交成功');
|
|
325
|
|
-
|
|
|
342
|
+
|
|
326
|
343
|
// 关闭抽屉
|
|
327
|
344
|
delayDrawerVisible.value = false;
|
|
328
|
|
-
|
|
|
345
|
+
|
|
329
|
346
|
// 重新加载数据
|
|
330
|
347
|
emit('reload');
|
|
331
|
348
|
} catch (error) {
|
|
|
@@ -346,14 +363,14 @@ async function handleCCSubmit() {
|
|
346
|
363
|
ElMessage.error('请选择人员');
|
|
347
|
364
|
return;
|
|
348
|
365
|
}
|
|
349
|
|
-
|
|
|
366
|
+
|
|
350
|
367
|
// 调用抄送API
|
|
351
|
368
|
await requestClient.put('/workOrder/order/cc', ccFormData);
|
|
352
|
369
|
ElMessage.success('抄送成功');
|
|
353
|
|
-
|
|
|
370
|
+
|
|
354
|
371
|
// 关闭抽屉
|
|
355
|
372
|
ccDrawerVisible.value = false;
|
|
356
|
|
-
|
|
|
373
|
+
|
|
357
|
374
|
// 重新加载数据
|
|
358
|
375
|
emit('reload');
|
|
359
|
376
|
} catch (error) {
|
|
|
@@ -381,9 +398,48 @@ async function handleBack() {
|
|
381
|
398
|
}
|
|
382
|
399
|
}
|
|
383
|
400
|
|
|
|
401
|
+// 延时审批
|
|
|
402
|
+function handleApproveDelay() {
|
|
|
403
|
+ // 重置表单数据
|
|
|
404
|
+ approveDelayFormData.approveRemark = '';
|
|
|
405
|
+ approveDelayFormData.approveStatus = '1';
|
|
|
406
|
+ approveDelayFormData.delayId = props.task!.taskId;
|
|
|
407
|
+ approveDelayFormData.newDeadline = '';
|
|
|
408
|
+
|
|
|
409
|
+ // 打开抽屉
|
|
|
410
|
+ approveDelayDrawerVisible.value = true;
|
|
|
411
|
+}
|
|
384
|
412
|
|
|
|
413
|
+// 延时审批提交
|
|
|
414
|
+async function handleApproveDelaySubmit() {
|
|
|
415
|
+ try {
|
|
|
416
|
+ // 验证表单
|
|
|
417
|
+ if (!approveDelayFormData.approveRemark.trim()) {
|
|
|
418
|
+ ElMessage.error('请输入审批意见');
|
|
|
419
|
+ return;
|
|
|
420
|
+ }
|
|
|
421
|
+ if (!approveDelayFormData.newDeadline) {
|
|
|
422
|
+ ElMessage.error('请选择新截止时间');
|
|
|
423
|
+ return;
|
|
|
424
|
+ }
|
|
|
425
|
+ console.log('延时审批表单数据:', approveDelayFormData);
|
|
|
426
|
+ // 调用延时审批API
|
|
|
427
|
+ await requestClient.put(
|
|
|
428
|
+ '/workOrder/order/approveDelay',
|
|
|
429
|
+ approveDelayFormData,
|
|
|
430
|
+ );
|
|
|
431
|
+ ElMessage.success('延时审批操作成功');
|
|
385
|
432
|
|
|
|
433
|
+ // 关闭抽屉
|
|
|
434
|
+ approveDelayDrawerVisible.value = false;
|
|
386
|
435
|
|
|
|
436
|
+ // 重新加载数据
|
|
|
437
|
+ emit('reload');
|
|
|
438
|
+ } catch (error) {
|
|
|
439
|
+ ElMessage.error('延时审批操作失败');
|
|
|
440
|
+ console.error('延时审批失败:', error);
|
|
|
441
|
+ }
|
|
|
442
|
+}
|
|
387
|
443
|
</script>
|
|
388
|
444
|
|
|
389
|
445
|
<template>
|
|
|
@@ -445,6 +501,15 @@ async function handleBack() {
|
|
445
|
501
|
退回
|
|
446
|
502
|
</ElButton>
|
|
447
|
503
|
</ElSpace>
|
|
|
504
|
+ <ElSpace v-if="type === 'delay'">
|
|
|
505
|
+ <ElButton
|
|
|
506
|
+ v-if="buttonPermissions?.approveDelay"
|
|
|
507
|
+ type="primary"
|
|
|
508
|
+ @click="handleApproveDelay"
|
|
|
509
|
+ >
|
|
|
510
|
+ 延时审批
|
|
|
511
|
+ </ElButton>
|
|
|
512
|
+ </ElSpace>
|
|
448
|
513
|
</div>
|
|
449
|
514
|
</div>
|
|
450
|
515
|
|
|
|
@@ -464,7 +529,9 @@ async function handleBack() {
|
|
464
|
529
|
@close="handleCloseDrawer"
|
|
465
|
530
|
/>
|
|
466
|
531
|
</div>
|
|
467
|
|
- <div class="absolute bottom-0 left-0 right-0 border-t border-gray-200 p-4 bg-white">
|
|
|
532
|
+ <div
|
|
|
533
|
+ class="absolute bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4"
|
|
|
534
|
+ >
|
|
468
|
535
|
<div class="flex justify-end space-x-2">
|
|
469
|
536
|
<ElButton @click="drawerVisible = false">取消</ElButton>
|
|
470
|
537
|
<ElButton type="primary" @click="handleConfirmEdit">保存</ElButton>
|
|
|
@@ -477,7 +544,8 @@ async function handleBack() {
|
|
477
|
544
|
v-model="handleDrawerVisible"
|
|
478
|
545
|
title="处理工单"
|
|
479
|
546
|
width="800px"
|
|
480
|
|
- :close-on-click-modal="false">
|
|
|
547
|
+ :close-on-click-modal="false"
|
|
|
548
|
+ >
|
|
481
|
549
|
<div class="drawer-content p-4 pb-20">
|
|
482
|
550
|
<ElForm
|
|
483
|
551
|
:model="handleFormData"
|
|
|
@@ -517,7 +585,9 @@ async function handleBack() {
|
|
517
|
585
|
</ElFormItem>
|
|
518
|
586
|
</ElForm>
|
|
519
|
587
|
</div>
|
|
520
|
|
- <div class="absolute bottom-0 left-0 right-0 border-t border-gray-200 p-4 bg-white">
|
|
|
588
|
+ <div
|
|
|
589
|
+ class="absolute bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4"
|
|
|
590
|
+ >
|
|
521
|
591
|
<div class="flex justify-end space-x-2">
|
|
522
|
592
|
<ElButton @click="handleDrawerVisible = false">取消</ElButton>
|
|
523
|
593
|
<ElButton type="primary" @click="handleSubmitForm">提交</ElButton>
|
|
|
@@ -530,7 +600,8 @@ async function handleBack() {
|
|
530
|
600
|
v-model="delayDrawerVisible"
|
|
531
|
601
|
title="延时申请"
|
|
532
|
602
|
width="800px"
|
|
533
|
|
- :close-on-click-modal="false">
|
|
|
603
|
+ :close-on-click-modal="false"
|
|
|
604
|
+ >
|
|
534
|
605
|
<div class="drawer-content p-4 pb-20">
|
|
535
|
606
|
<ElForm
|
|
536
|
607
|
:model="delayFormData"
|
|
|
@@ -580,7 +651,9 @@ async function handleBack() {
|
|
580
|
651
|
</ElFormItem>
|
|
581
|
652
|
</ElForm>
|
|
582
|
653
|
</div>
|
|
583
|
|
- <div class="absolute bottom-0 left-0 right-0 border-t border-gray-200 p-4 bg-white">
|
|
|
654
|
+ <div
|
|
|
655
|
+ class="absolute bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4"
|
|
|
656
|
+ >
|
|
584
|
657
|
<div class="flex justify-end space-x-2">
|
|
585
|
658
|
<ElButton @click="delayDrawerVisible = false">取消</ElButton>
|
|
586
|
659
|
<ElButton type="primary" @click="handleDelaySubmit">提交</ElButton>
|
|
|
@@ -593,17 +666,15 @@ async function handleBack() {
|
|
593
|
666
|
v-model="ccDrawerVisible"
|
|
594
|
667
|
title="抄送"
|
|
595
|
668
|
width="800px"
|
|
596
|
|
- :close-on-click-modal="false">
|
|
|
669
|
+ :close-on-click-modal="false"
|
|
|
670
|
+ >
|
|
597
|
671
|
<div class="drawer-content p-4 pb-20">
|
|
598
|
|
- <ElForm
|
|
599
|
|
- :model="ccFormData"
|
|
600
|
|
- label-width="120px"
|
|
601
|
|
- class="cc-order-form"
|
|
602
|
|
- >
|
|
|
672
|
+ <ElForm :model="ccFormData" label-width="120px" class="cc-order-form">
|
|
603
|
673
|
<!-- 部门选择 -->
|
|
604
|
674
|
<ElFormItem label="选择部门" required>
|
|
605
|
675
|
<ElTreeSelect
|
|
606
|
676
|
v-model="selectedDeptId"
|
|
|
677
|
+ check-strictly
|
|
607
|
678
|
:data="deptTree"
|
|
608
|
679
|
node-key="id"
|
|
609
|
680
|
:props="{ label: 'label', children: 'children' }"
|
|
|
@@ -622,19 +693,81 @@ async function handleBack() {
|
|
622
|
693
|
>
|
|
623
|
694
|
<ElOption
|
|
624
|
695
|
v-for="user in userList"
|
|
625
|
|
- :key="user.id"
|
|
626
|
|
- :label="user.nickname || user.username"
|
|
627
|
|
- :value="user.id"
|
|
|
696
|
+ :key="user.userId"
|
|
|
697
|
+ :label="
|
|
|
698
|
+ user.nickName + (user.userName ? `(${user.userName})` : '')
|
|
|
699
|
+ "
|
|
|
700
|
+ :value="user.userId"
|
|
628
|
701
|
/>
|
|
629
|
702
|
</ElSelect>
|
|
630
|
703
|
</ElFormItem>
|
|
631
|
704
|
</ElForm>
|
|
632
|
705
|
</div>
|
|
633
|
|
- <div class="absolute bottom-0 left-0 right-0 border-t border-gray-200 p-4 bg-white">
|
|
|
706
|
+ <div
|
|
|
707
|
+ class="absolute bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4"
|
|
|
708
|
+ >
|
|
634
|
709
|
<div class="flex justify-end space-x-2">
|
|
635
|
710
|
<ElButton @click="ccDrawerVisible = false">取消</ElButton>
|
|
636
|
711
|
<ElButton type="primary" @click="handleCCSubmit">提交</ElButton>
|
|
637
|
712
|
</div>
|
|
638
|
713
|
</div>
|
|
639
|
714
|
</ElDrawer>
|
|
|
715
|
+
|
|
|
716
|
+ <!-- 延时审批的抽屉组件 -->
|
|
|
717
|
+ <ElDrawer
|
|
|
718
|
+ v-model="approveDelayDrawerVisible"
|
|
|
719
|
+ title="延时审批"
|
|
|
720
|
+ width="800px"
|
|
|
721
|
+ :close-on-click-modal="false"
|
|
|
722
|
+ >
|
|
|
723
|
+ <div class="drawer-content p-4 pb-20">
|
|
|
724
|
+ <ElForm
|
|
|
725
|
+ :model="approveDelayFormData"
|
|
|
726
|
+ label-width="120px"
|
|
|
727
|
+ class="approve-delay-form"
|
|
|
728
|
+ >
|
|
|
729
|
+ <!-- 审批意见 -->
|
|
|
730
|
+ <ElFormItem label="审批意见" required>
|
|
|
731
|
+ <ElInput
|
|
|
732
|
+ v-model="approveDelayFormData.approveRemark"
|
|
|
733
|
+ type="textarea"
|
|
|
734
|
+ :rows="4"
|
|
|
735
|
+ placeholder="请输入审批意见"
|
|
|
736
|
+ />
|
|
|
737
|
+ </ElFormItem>
|
|
|
738
|
+
|
|
|
739
|
+ <!-- 审核状态 -->
|
|
|
740
|
+ <ElFormItem label="审核状态" required>
|
|
|
741
|
+ <ElSelect
|
|
|
742
|
+ v-model="approveDelayFormData.approveStatus"
|
|
|
743
|
+ placeholder="请选择审核状态"
|
|
|
744
|
+ >
|
|
|
745
|
+ <ElOption label="审核通过" value="1" />
|
|
|
746
|
+ <ElOption label="审核拒绝" value="2" />
|
|
|
747
|
+ </ElSelect>
|
|
|
748
|
+ </ElFormItem>
|
|
|
749
|
+
|
|
|
750
|
+ <!-- 新截止时间 -->
|
|
|
751
|
+ <ElFormItem label="新截止时间" required>
|
|
|
752
|
+ <ElDatePicker
|
|
|
753
|
+ v-model="approveDelayFormData.newDeadline"
|
|
|
754
|
+ type="datetime"
|
|
|
755
|
+ placeholder="请选择新截止时间"
|
|
|
756
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
757
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
758
|
+ />
|
|
|
759
|
+ </ElFormItem>
|
|
|
760
|
+ </ElForm>
|
|
|
761
|
+ </div>
|
|
|
762
|
+ <div
|
|
|
763
|
+ class="absolute bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4"
|
|
|
764
|
+ >
|
|
|
765
|
+ <div class="flex justify-end space-x-2">
|
|
|
766
|
+ <ElButton @click="approveDelayDrawerVisible = false">取消</ElButton>
|
|
|
767
|
+ <ElButton type="primary" @click="handleApproveDelaySubmit">
|
|
|
768
|
+ 提交
|
|
|
769
|
+ </ElButton>
|
|
|
770
|
+ </div>
|
|
|
771
|
+ </div>
|
|
|
772
|
+ </ElDrawer>
|
|
640
|
773
|
</template>
|