BAOLH
2025-11-28 dca8f76effaeb7521baa2f247e5de2948431d238
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
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
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--侧边部门数据-->
      <el-col :span="6">
        <div class="head-container">
          <el-card class="box-card">
            <div slot="header">
              <el-select
                v-model="projectId"
                filterable
                clearable
                placeholder="请先选择所属项目"
                style="width:100%"
                class="filter-item"
                @change="changer"
              >
                <el-option
                  v-for="item in projectDatas"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
              <el-input
                v-model="taskName"
                clearable
                size="small"
                placeholder="输入任务名称搜索"
                prefix-icon="el-icon-search"
                class="filter-item"
                @change="getTaskDatas"
              />
            </div>
            <div
              v-if="!infinite"
              v-loading="taskLoading"
              class="infinite-list"
              style="overflow:auto;height:500px"
            >
              <el-card
                v-for="task in taskDatas"
                :key="task.id"
                class="box-card"
                :class="{ active: task === selectedTask }"
                style="margin-bottom: 10px;cursor:pointer"
                shadow="hover"
                @click.native="handleNodeClick(task)"
              >
                <div>
                  {{ task.name }}
                  <i
                    class="el-icon-search"
                    style="float: right;"
                    @click.stop="showTaskDetail(task)"
                  />
                </div>
              </el-card>
            </div>
          </el-card>
        </div>
        <el-tree
          v-if="false"
          v-loading="taskLoading"
          :data="taskDatas"
          :load="getTaskDatas"
          :props="defaultProps"
          class="flow-tree"
          accordion
          :expand-on-click-node="false"
          lazy
          @node-click="handleNodeClick"
        >
          <template slot-scope="{ node }">
            <el-tooltip
              effect="dark"
              :content="node.label"
              placement="top-start"
              style="font-size:14px;"
            >
              <div>{{ node.label }}</div>
            </el-tooltip>
          </template>
        </el-tree>
      </el-col>
      <!--任务分配数据-->
      <el-col :span="18">
        <el-dialog
          title="分配详情"
          :visible.sync="dialogVisible_taskUser"
          width="600px"
          @closed="setNull"
          @close="dialogVisible_taskUser = false"
        >
          <div v-if="steps.length > 0" v-loading="dialogLoading_taskUser">
            <el-card v-if="steps.length > 0">
              <div style="width: 35%;float: left">
                任务名称:{{ TaskName }}
                <p v-for="(item, index) in taskUserDetail" :key="index">
                  {{ index }} 共消耗 {{ item }} 工时
                </p>
              </div>
              <div style="width: 65%;float: right">
                <el-progress
                  :percentage="taskProgress"
                  style="width: 80%;margin-left: 55px"
                  :color="ProgressStatus"
                  :format="formatTaskProgress"
                />
                <br>
                <i>任务预计时长:{{ expectedHours }}小时</i><i
                  style="margin-left: 40px"
                >任务实际用时:{{ actualHours }}小时</i>
              </div>
            </el-card>
          </div>
          <br>
          <div
            v-if="steps.length > 0"
            v-loading="dialogLoading_taskUser"
            class="block"
            style="height: 500px; overflow: auto;"
          >
            <el-timeline>
              <el-timeline-item
                v-for="(item, index) in steps"
                :key="index"
                :timestamp="item.fillDate"
                :color="item.color"
              >
                <el-card>
                  <h4>
                    {{ item.title }}
                    <el-tooltip
                      class="item"
                      effect="dark"
                      :content="item.remarks"
                      placement="top-start"
                    >
                      <i
                        v-if="item.flag"
                        class="el-icon-s-comment"
                        style="float: right"
                      />
                    </el-tooltip>
                  </h4>
                </el-card>
              </el-timeline-item>
            </el-timeline>
          </div>
          <div v-else v-loading="dialogLoading_taskUser" class="block">
            <p>暂无信息</p>
          </div>
        </el-dialog>
 
        <el-dialog
          title="任务详情"
          :visible.sync="dialogVisible_task"
          width="300px"
          @closed="setNull"
          @close="dialogLoading_task = false"
        >
          <div v-if="taskDetail" v-loading="dialogLoading_task">
            <el-card style="padding-top: 10px">
              <div
                v-for="(item, index) in taskDetail"
                :key="index"
                style="padding-top: 10px"
              >
                <span>{{ index }} 分配时长: {{ item }} 小时</span><br>
              </div>
            </el-card>
          </div>
          <div v-else>
            <el-card style="padding-top: 10px">
              <span>暂无数据</span><br>
            </el-card>
          </div>
          <div
            style="color: red;font-size: 12px;margin-left: 3px;margin-top: 11px;"
          >
            * 非已完成的任务的详细信息
          </div>
        </el-dialog>
 
        <el-dialog
          v-loading="taskLoading_L"
          title="临期任务"
          :visible.sync="dialogVisible_task_LQ"
          @closed="setNull"
          @close="dialogLoading_task_LQ = false"
        >
          <el-card class="box-card" shadow="never">
            <el-tabs v-model="tobeOver" style="height: 220px;">
              <el-tab-pane :label="tobeTasked" name="first">
                <el-table :data="advList" height="180" :show-header="false">
                  <el-table-column
                    :show-overflow-tooltip="true"
                    prop="name"
                    fixed="left"
                    min-width="180px"
                  >
                    <template slot-scope="scope">
                      <el-tag slot="reference">{{ scope.row.name }}</el-tag>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="taskStartDate"
                    :show-overflow-tooltip="true"
                    min-width="180px"
                  />
                  <el-table-column
                    prop="taskEndDate"
                    :show-overflow-tooltip="true"
                    min-width="180px"
                  />
                </el-table>
              </el-tab-pane>
            </el-tabs>
            <el-pagination
              :current-page="currentPage"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="pageSize"
              layout="total, prev, pager, next, sizes , jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </el-card>
        </el-dialog>
        <!--工具栏-->
        <div class="head-container">
          <div>
            <!-- 搜索 -->
            <el-select
              v-model="query.userId"
              filterable
              clearable
              placeholder="所属员工"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            >
              <el-option
                v-for="item in proUsers"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
              />
            </el-select>
            <el-input
              v-model="query.name"
              clearable
              placeholder="请输入任务名称"
              prefix-icon="el-icon-search"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            />
            <el-select
              v-model="query.taskStatus"
              filterable
              clearable
              multiple
              collapse-tags
              placeholder="任务状态"
              style="width: 185px;"
              class="filter-item"
              @keyup.enter.native="crud.toQuery"
            >
              <el-option
                v-for="item in dict[taskStatus]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
            <rrOperation :crud="crud" />
          </div>
          <crudOperation v-if="flag" :permission="permission">
            <el-button
              slot="right"
              v-permission="permission.generate"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-plus"
              style="margin-right: 6px;"
              @click="openGenerate"
            >导入</el-button>
            <el-button
              slot="right"
              v-permission="permission.generate"
              :loading="slong"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-bottom"
              style="margin-right: 6px;"
              @click="exportUser()"
            >生成员工Excel</el-button>
            <el-button
              slot="right"
              :disabled="crud.selections.length !== 1"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-search"
              style="margin-right: 6px;"
              @click="showDetail(crud.selections[0])"
            >任务详情</el-button>
            <el-button
              slot="right"
              v-permission="permission.generate"
              :disabled="crud.selections.length === 0"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-check"
              style="margin-right: 6px;"
              @click="toTaskCompleted"
            >任务完结</el-button>
            <el-button
              slot="right"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-tickets"
              style="margin-right: 6px;"
              @click="adventTesk()"
            >临期任务</el-button>
            <el-button
              slot="right"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-plus"
              :disabled="crud.selections.length !== 1"
              style="margin-right: 6px;"
              @click="toReviewTask()"
            >新建复核</el-button>
          </crudOperation>
          <div>
            <span>
              当前任务:<i> {{ selectedTaskName }} </i>
              <span
                v-if="taskTotal.performanceType"
                style="margin: right 10px;"
              ><i>
                (绩效类型:
                {{
                  taskTotal.performanceType === "1" ? "绩效" : "非绩效"
                }})</i></span>
            </span>
            <el-divider>
              <span
                v-for="item in taskTotal.details"
                :key="item._id"
                style="font-size: 13px;"
              >
                <template v-if="item._id === 'task_status_not_started'">
                  <b>未开始:</b>{{ item.taskStatusCnt }}件(合计:{{
                    item.taskHours
                  }}小时)
                </template>
                <template v-if="item._id === 'task_status_in_hand'">
                  <b>进行中:</b>{{ item.taskStatusCnt }}件(合计:{{
                    item.taskHours
                  }}小时)
                </template>
                <template v-if="item._id === 'task_status_stop'">
                  <b>已暂停:</b>{{ item.taskStatusCnt }}件(合计:{{
                    item.taskHours
                  }}小时)
                </template>
                <template v-if="item._id === 'task_status_completed'">
                  <b>已完成:</b>{{ item.taskStatusCnt }}件(合计:{{
                    item.taskHours
                  }}小时)
                </template>
              </span>
            </el-divider>
          </div>
        </div>
        <!--表单组件-->
        <el-dialog
          :close-on-click-modal="false"
          :before-close="crud.cancelCU"
          :visible.sync="crud.status.cu > 0"
          :title="crud.status.title"
          width="500px"
        >
          <el-form
            ref="form"
            :model="form"
            :rules="rules"
            size="small"
            label-width="110px"
          >
            <el-form-item label="所属" prop="taskId">
              <el-input
                v-show="false"
                v-model="form.task.id"
                style="width: 340px;"
              />
              <el-input
                v-model="form.task.name"
                :disabled="true"
                style="width: 340px;"
              />
            </el-form-item>
            <el-form-item v-show="form.rid !== null" label="复核对象" prop="rname">
              <el-input v-model="form.rname" disabled style="width: 340px;" />
            </el-form-item>
            <el-form-item label="任务名称" prop="name">
              <el-input v-model="form.name" style="width: 340px;" />
            </el-form-item>
            <el-form-item label="任务开始时间" prop="taskStartDate">
              <el-date-picker
                v-model="form.taskStartDate"
                popper-class="hide-time"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                :default-time="
                  $store.state.user.user.sysRostering.workStartTime + ':00'
                "
                :picker-options="{ disabledDate }"
                style="width: 340px; "
                @change="checkStartTime(form.taskStartDate)"
              />
            </el-form-item>
            <el-form-item label="任务结束时间" prop="taskEndDate">
              <el-date-picker
                v-model="form.taskEndDate"
                popper-class="hide-time"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                :default-time="
                  $store.state.user.user.sysRostering.workEndTime + ':00'
                "
                :picker-options="{ disabledDate }"
                style="width: 340px;"
                @change="checkEndTime(form.taskEndDate)"
              />
            </el-form-item>
            <el-form-item label="任务工时" prop="taskHours">
              <el-input
                v-model="form.taskHours"
                style="width: 340px;"
                @change="withUser(form)"
              >
                <template
                  slot="append"
                >小时</template>
              </el-input>
            </el-form-item>
            <el-form-item v-if="crud.status.add === 1" label="选择类型" prop="selectType">
              <el-radio-group v-model="form.selectType" style="width: 340px;" @change="handleTypeChange">
                <el-radio-button label="single">单选</el-radio-button>
                <el-radio-button label="multiple">多选</el-radio-button>
              </el-radio-group>
            </el-form-item>
            <el-form-item v-show="form.selectType === 'single'" label="所属员工" prop="userId">
              <el-select
                v-model="form.userId"
                filterable
                clearable
                placeholder="请选择"
                style="width: 340px;"
                @change="withUser(form)"
              >
                <el-option
                  v-for="item in users"
                  :key="item.id"
                  :label="item.nickName"
                  :value="item.id"
                  :disabled="
                    !item.enabled || form.divideUserIds.includes(item.id)
                  "
                >
                  <span style="float: left">{{ item.nickName }}</span>
                  <span style="float: right; color: #8492a6; font-size: 13px">{{
                    item.levelName
                  }}</span>
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item v-show="form.selectType === 'multiple'" label="所属员工" prop="userIds">
              <el-select
                v-model="form.userIds"
                filterable
                clearable
                multiple
                placeholder="请选择"
                style="width: 340px;"
                @change="withUser(form)"
              >
                <el-option
                  v-for="item in users"
                  :key="item.id"
                  :label="item.nickName"
                  :value="item.id"
                  :disabled="
                    !item.enabled || form.divideUserIds.includes(item.id)
                  "
                >
                  <span style="float: left">{{ item.nickName }}</span>
                  <span style="float: right; color: #8492a6; font-size: 13px">{{
                    item.levelName
                  }}</span>
                </el-option>
              </el-select>
            </el-form-item>
 
            <el-form-item label="绩效工时" prop="performanceHours">
              <el-input
                v-model="form.performanceHours"
                style="width: 340px;"
                :disabled="true"
              >
                <template
                  slot="append"
                >小时</template>
              </el-input>
            </el-form-item>
            <el-form-item label="UID" prop="uid">
              <el-input
                v-model="form.uid"
                style="width: 340px;"
              />
            </el-form-item>
            <el-form-item label="任务进度" prop="newTaskProgress">
              <el-input
                v-model="form.newTaskProgress"
                style="width: 340px;"
                :disabled="true"
              />
            </el-form-item>
            <el-form-item v-if="form.newTaskProgress === 100" label="任务状态1">
              <el-switch
                v-if="form.taskStatus === taskSt || form.taskStatus === taskSo"
                v-model="form.is_ok"
                v-permission="permission.list"
                :active-text="taskStatusOne"
                @change="handleChange"
              />
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="text" @click="crud.cancelCU">取消</el-button>
            <el-button
              :loading="crud.status.cu === 2"
              type="primary"
              @click="crud.submitCU"
            >确认</el-button>
          </div>
        </el-dialog>
        <el-table
          ref="table"
          v-loading="crud.loading"
          :data="crud.data"
          size="small"
          style="width: 100%;"
          @selection-change="crud.selectionChangeHandler"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column
            :show-overflow-tooltip="true"
            prop="name"
            label="名称"
            fixed="left"
            width="270"
          >
            <template slot-scope="scope">
              <el-tag slot="reference">{{ scope.row.name }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="taskStartDate"
            label="任务开始时间"
            width="140"
          />
          <el-table-column
            :show-overflow-tooltip="true"
            prop="taskEndDate"
            label="任务结束时间"
            width="140"
          />
          <el-table-column
            :show-overflow-tooltip="true"
            prop="taskHours"
            label="任务工时"
            width="80"
          />
          <el-table-column
            :show-overflow-tooltip="true"
            prop="userNickName"
            label="所属员工"
            width="100"
          >
            <template slot-scope="scope">
              <!-- <el-tooltip class="item" effect="light" :open-delay="1000" placement="top" :disabled="!flag">
                <div slot="content" class="slot-style">
                  <div @click="showDetail(scope.row)">
                    <h4 style="cursor: pointer;">查看详情</h4>
                  </div>
                </div> -->
              <el-tag v-if="scope.row.userNickName">{{
                scope.row.userNickName
              }}</el-tag>
              <el-tag v-else>未指定</el-tag>
              <!-- </el-tooltip> -->
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="performanceHours"
            label="绩效工时"
            width="80"
          />
          <el-table-column
            :show-overflow-tooltip="true"
            prop="costHours"
            label="消耗工时"
            width="80"
          />
          <el-table-column
            :show-overflow-tooltip="true"
            label="任务进度"
            width="80"
          >
            <template slot-scope="scope">
              <span
                style="margin-left: 10px"
              >{{ scope.row.newTaskProgress }}%</span>
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="taskStatus"
            label="任务状态"
            width="80"
          >
            <template slot-scope="scope">
              <el-tag>{{
                dict.label[taskStatus][scope.row.taskStatus]
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-if="checkPer(['admin', 'taskUser:edit', 'taskUser:del'])"
            label="操作"
            width="200"
            align="center"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.userNickName"
                :key="scope.row.userNickName"
                slot="left"
                v-permission="permission.list"
                size="mini"
                type="primary"
                style="float: left"
                :disabled="true"
              >已分配</el-button>
              <el-button
                v-else
                slot="left"
                v-permission="permission.list"
                size="mini"
                type="primary"
                style="float: left"
                @click="unPick(scope.row)"
              >获取</el-button>
              <udOperation
                v-if="flag"
                :data="scope.row"
                :permission="permission"
              />
            </template>
          </el-table-column>
        </el-table>
        <!--表格渲染-->
        <!--分页组件-->
        <pagination />
        <!--进度不足100%-->
        <el-dialog
          title="提示"
          :visible.sync="centerDialogVisibleTaskProgress"
          width="30%"
          center
        >
          <span>当前要完结的任务中存在没有到达100%的任务,确定要完结吗?</span>
          <span slot="footer" class="dialog-footer">
            <el-button @click="centerDialogVisibleTaskProgress = false">取 消</el-button>
            <el-button type="primary" @click="doTaskCompleted">确 定</el-button>
          </span>
        </el-dialog>
        <!--导入任务分配信息-->
        <el-dialog
          :close-on-click-modal="false"
          :before-close="closeGenerate"
          :visible.sync="generateStatus"
          title="导入任务分配信息"
          width="720px"
        >
          <el-form ref="generateForm" size="small" label-width="80px">
            <upload-excel-component-two
              :on-success="handleSuccess"
              :before-upload="beforeUpload"
            />
            <el-table
              :data="generateForm"
              border
              highlight-current-row
              style="width: 100%;margin-top:20px;"
            >
              <el-table-column
                v-for="item of tableHeader"
                :key="item"
                :prop="item"
                :label="item"
              />
            </el-table>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="text" @click="closeGenerate">取消</el-button>
            <el-button
              :loading="generateLoading"
              type="primary"
              :disabled="uploading"
              @click="submitGenerate"
            >确认</el-button>
          </div>
        </el-dialog>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import crudTaskUser from '@/api/task/taskUser'
import crudTask from '@/api/task/task'
import crudUser from '@/api/system/user'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { mapGetters } from 'vuex'
import constant from '@/utils/constant'
import UploadExcelComponentTwo from '@/components/UploadExcel/excelIndex.vue'
import { transformData, formatExcelDate } from '@/utils/trans'
import { downloadFile } from '@/utils/index'
const defaultForm = {
  id: null,
  name: null,
  userId: null,
  projectId: null,
  task: { id: null, name: null },
  taskStartDate: null,
  taskEndDate: null,
  taskHours: null,
  performanceHours: null,
  newTaskProgress: null,
  taskStatus: null,
  remarks: null,
  divideUserIds: [],
  is_ok: null,
  uid: null,
  rid: null,
  rname: null,
  // 多选用户id
  userIds: [],
  // 用于新增用户时单选或多选
  selectType: 'single'
}
export default {
  name: 'TaskUser',
  components: {
    crudOperation,
    rrOperation,
    udOperation,
    pagination,
    UploadExcelComponentTwo
  },
  cruds() {
    return CRUD({
      title: '任务分配',
      url: 'api/taskUser',
      crudMethod: { ...crudTaskUser }
    })
  },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  // 数据字典
  dicts: [
    constant.TASK_STATUS,
    constant.TAST_CLASSIFICATION,
    constant.STANDARD_WORKLOAD_UNIT,
    constant.PERFORMANCE_TYPE
  ],
  data() {
    // 时长(万内)验证
    // eslint-disable-next-line no-unused-vars
    var durationValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一万 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    return {
      projectId: null,
      projectDatas: [],
      taskName: '',
      selectedTaskName: '',
      planStartTime: null,
      planEndTime: null,
      taskTotal: {},
      taskDatas: [],
      taskLoading: false,
      defaultProps: { children: 'nodes', label: 'name', isLeaf: 'leaf' },
      permission: {
        list: ['admin', 'taskUser:list'],
        add: ['admin', 'taskUser:add'],
        edit: ['admin', 'taskUser:edit'],
        del: ['admin', 'taskUser:del'],
        download: ['admin', 'taskUser:download'],
        generate: ['admin', 'taskUser:add']
      },
      rules: {
        name: [
          { required: true, message: '任务名称不能为空', trigger: 'change' }
        ],
        taskStartDate: [
          { required: true, message: '任务开始时间不能为空', trigger: 'change' }
        ],
        taskEndDate: [
          { required: true, message: '任务结束时间不能为空', trigger: 'change' }
        ],
        taskHours: [
          { required: true, message: '任务时长不能为空', trigger: 'change' }
        ]
      },
      queryTypeOptions: [
        { key: 'userId', display_name: '所属员工' },
        { key: 'taskStatus', display_name: '任务状态' },
        { key: 'createTime', display_name: '创建时间' },
        { key: 'name', display_name: '名称' }
      ],
      // 字典:任务状态
      taskStatus: constant.TASK_STATUS,
      // 字典:任务分类
      taskClassification: constant.TAST_CLASSIFICATION,
      // 字典:标准工作量单位
      standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
      // 字典:绩效对象
      performanceType: constant.PERFORMANCE_TYPE,
      // 字典:批准状态-未承认
      approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED,
      // CRUD状态
      crudStatusPrepared: CRUD.STATUS.PREPARED,
      Is_ok: false,
      generateForm: [],
      tableHeader: [],
      users: [],
      proUsers: [],
      // 项目列表
      projects: [],
      // 检索任务列表
      queryTasks: [],
      // 表单任务列表
      formTasks: [],
      // 生成表单状态
      generateStatus: false,
      // 生成表单加载
      generateLoading: false,
      // 进度未达到100%确认
      centerDialogVisibleTaskProgress: false,
      uploading: true,
      flag: false,
      infinite: false,
      selectedTask: '',
      dialogVisible_taskUser: false,
      dialogLoading_taskUser: true,
      taskLoading_L: true,
      dialogVisible_task: false,
      dialogVisible_task_LQ: false,
      dialogLoading_task: true,
      dialogLoading_task_LQ: true,
      steps: [],
      TaskName: '',
      expectedHours: '',
      actualHours: '',
      taskUserDetail: {},
      taskDetail: {},
      taskProgress: '',
      ProgressStatus: '',
      advList: [],
      tobeOver: 'first',
      tobeTasked: '任务详细',
      total: 0,
      currentPage: 1,
      pageSize: 10,
      slong: false,
      taskSo: constant.TASK_STATUS_UNRECOGNIZED,
      taskSt: constant.TASK_STATUS_COMPLETED,
      taskStatusOne: '',
      // 复核任务参数
      reviewTaskParams: {
        rid: null,
        rname: null
      }
    }
  },
  computed: {
    ...mapGetters(['user'])
  },
  mounted() {
    this.getAllProjectDatas()
    this.getTaskDatas()
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      if (!this.query.taskId) {
        this.taskTotal = {}
        return false
      }
      crudTaskUser.getSum({ taskId: this.query.taskId }).then(res => {
        this.taskTotal = res
      })
      return true
    },
    [CRUD.HOOK.afterSubmit]() {
      this.formTasks = []
      this.form.name = null
      this.form.performanceHours = null
    },
    // 新建之前
    [CRUD.HOOK.beforeToAdd]() {
      const that = this
      if (that.reviewTaskParams.rid !== null) {
        that.$set(that.form, 'rid', that.reviewTaskParams.rid)
        that.$set(that.form, 'rname', that.reviewTaskParams.rname)
        that.$set(that.form, 'name', that.reviewTaskParams.rname + '(复核)')
      }
      return true
    },
    // 编辑之前
    [CRUD.HOOK.beforeToEdit]() {
      if (this.form.taskStatus === this.taskSo) {
        this.form.is_ok = false
        this.taskStatusOne = '未承认'
      }
      if (this.form.taskStatus === this.taskSt) {
        this.form.is_ok = true
        this.taskStatusOne = '已完成'
      }
    },
    [CRUD.HOOK.afterEditError]() {
      this.formTasks = []
      this.form.name = null
      this.form.performanceHours = null
    },
    [CRUD.HOOK.afterEditCancel]() {
      this.formTasks = []
      this.form.name = null
      this.form.performanceHours = null
    },
    // 取消新建之前
    [CRUD.HOOK.beforeAddCancel]() {
      const that = this
      that.$set(that.reviewTaskParams, 'rid', null)
      that.$set(that.reviewTaskParams, 'rname', null)
      return true
    },
    [CRUD.HOOK.afterAddCancel]() {
      this.formTasks = []
      this.form.name = null
      this.form.performanceHours = null
    },
    // 提交之后
    [CRUD.HOOK.afterSubmit]() {
      const that = this
      that.$set(that.reviewTaskParams, 'rid', null)
      that.$set(that.reviewTaskParams, 'rname', null)
      return true
    },
    [CRUD.HOOK.afterAddError]() {
      this.formTasks = []
      this.form.name = null
      this.form.performanceHours = null
    },
    [CRUD.HOOK.beforeToCU]() {
      this.form.task.id = this.query.taskId
      this.form.task.name = this.selectedTaskName
      this.form.projectId = this.projectId
    },
    [CRUD.HOOK.beforeSubmit]() {
      if (!this.form.taskStatus) {
        this.form.taskStatus = 'task_status_not_started'
      }
      if (this.form.is_ok === true) {
        this.form.taskStatus = this.taskSt
      } else if (this.form.is_ok === false) {
        this.form.taskStatus = this.taskSo
      }
      if (!this.form.name) {
        this.form.name = this.form.task.name
      }
      // if (this.form.task.id === undefined || this.form.task.id === null || this.form.task.id === '') {
      //   this.form.task = null
      // }
      return true
    },
    // [CRUD.HOOK.afterCrudDelete]() {
    //   this.advList = []
    // },
    disabledDate(time) {
      return (
        time.getTime() < new Date(this.planStartTime) - 8.64e7 ||
        time.getTime() > new Date(this.planEndTime).getTime()
      )
    },
    handleChange(value) {
      if (value) {
        this.taskStatusOne = '已完成'
        this.form.taskStatus === this.taskSt
      } else {
        this.taskStatusOne = '未承认'
        this.form.taskStatus === this.taskSo
      }
    },
    checkStartTime(time) {
      if (time > this.planEndTime || time < this.planStartTime) {
        this.form.taskStartDate = null
        this.$notify({
          title: '无效时间',
          type: 'error',
          duration: 2500
        })
        return
      }
    },
    changer() {
      this.getTaskDatas()
      this.crud.data = []
      this.taskDatas = []
    },
    checkEndTime(time) {
      if (time > this.planEndTime || time < this.planStartTime) {
        this.form.taskEndDate = null
        this.$notify({
          title: '无效时间',
          type: 'error',
          duration: 2500
        })
        return
      }
    },
    // 获取用户
    getUser(taskId) {
      // 获取用户
      crudUser.getProjectUser(taskId).then(res => {
        // 用户列表
        this.users = res
      })
    },
 
    // 获取项目包含所有的用户
    getProUser(taskId) {
      // 获取用户
      crudUser.getAllUser(taskId).then(res => {
        // 用户列表
        this.proUsers = res
      })
    },
    getAllProjectDatas() {
      crudTask.getProjects().then(res => {
        this.projectDatas = res
      })
    },
    // 获取左侧部门数据
    getTaskDatas(node, resolve) {
      // if (node !== undefined) {
      //   this.infinite = true
      // }
      const sort = 'id,desc'
      const params = { sort: sort }
      if (!this.projectId) {
        return
      } else {
        params['projectId'] = this.projectId
        this.taskLoading = true
      }
      if (typeof node === 'object' && node.level !== 0) {
        params['pid'] = node.data.id
      } else {
        params['isTop'] = true
      }
      if (this.taskName) {
        params['name'] = this.taskName
      }
      setTimeout(() => {
        crudTask
          .ChildrenTaskAnyParent(params)
          .then(res => {
            if (resolve) {
              resolve(res)
            } else {
              this.infinite = false
              this.taskDatas = res
            }
            this.taskLoading = false
          })
          .catch(() => {
            this.taskLoading = false
          })
      }, 100)
    },
    // 生成员工Excel
    exportUser() {
      this.slong = true
      crudTaskUser
        .exportUser(this.query.taskId)
        .then(res => {
          downloadFile(res, '测试数据', 'xlsx')
          this.slong = false
          this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
        })
        .catch(() => {
          this.slong = false
          this.crud.notify('生成失败', CRUD.NOTIFICATION_TYPE.ERROR)
        })
    },
    // 切换任务
    handleNodeClick(data) {
      this.selectedTask = data
      if (data.pid === 0) {
        this.query.taskId = null
        this.query.taskStatus = []
        this.selectedTaskName = null
      } else {
        this.query.taskId = data.id
        this.query.taskStatus = [
          'task_status_not_started',
          'task_status_in_hand',
          'task_status_test',
          'task_status_stop',
          'task_status_unrecognized'
        ]
        this.selectedTaskName = data.name
        this.flag = true // data.flag;
        this.planStartTime = data.planStartTime
        this.planEndTime = data.planEndTime
      }
      this.crud.toQuery()
      this.getUser(this.query.taskId)
      this.getProUser(this.query.taskId)
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.adventTesk()
    },
    handleCurrentChange(val) {
      this.currentPage = val
      this.adventTesk()
    },
    // 临期任务
    adventTesk() {
      this.dialogVisible_task_LQ = true
      // 点击侧面查询临期任务
      crudTaskUser
        .getTaskUserAdvent(this.query.taskId, this.currentPage, this.pageSize)
        .then(res => {
          this.advList = res.data
          this.total = res.total
          this.taskLoading_L = false
        })
    },
    beforeUpload(file) {
      const isLt1M = file.size / 1024 / 1024 < 1
      if (isLt1M) {
        return true
      }
      this.$message({
        message: '请不要上传大于1m的文件.',
        type: 'warning'
      })
      return false
    },
    handleSuccess({ results, header }) {
      this.uploading = false
      this.generateForm = results
      this.generateForm = results.map(item => {
        const {
          // eslint-disable-next-line no-unused-vars
          所属员工ID,
          // eslint-disable-next-line no-unused-vars
          任务状态ID,
          // eslint-disable-next-line no-unused-vars
          优先度ID,
          // eslint-disable-next-line no-unused-vars
          隔绝列1,
          // eslint-disable-next-line no-unused-vars
          隔绝列2,
          // eslint-disable-next-line no-unused-vars
          隔绝列3,
          // eslint-disable-next-line no-unused-vars
          隔绝列4,
          // eslint-disable-next-line no-unused-vars
          隔绝列5,
          // eslint-disable-next-line no-unused-vars
          隔绝列6,
          // eslint-disable-next-line no-unused-vars
          隔绝列7,
          // eslint-disable-next-line no-unused-vars
          隔绝列8,
          ...newItem
        } = item
        // 判断日期格式是否正确,如果不正确,则提示错误信息,并覆盖数据为false
        if ('任务开始时间' in newItem && Number.isFinite(newItem['任务开始时间'])) {
          newItem['任务开始时间'] = formatExcelDate(newItem['任务开始时间'])
        } else {
          this.$message.warning('第' + (this.generateForm.indexOf(item) + 1) + '项的任务开始时间格式不正确')
          return false
        }
        if ('任务结束时间' in newItem && Number.isFinite(newItem['任务结束时间'])) {
          newItem['任务结束时间'] = formatExcelDate(newItem['任务结束时间'])
        } else {
          this.$message.warning('第' + (this.generateForm.indexOf(item) + 1) + '项的任务结束时间格式不正确')
          return false
        }
        return newItem
      })
 
      if (this.generateForm.includes(false)) {
        // 存在异常数据,清空表单数据
        this.generateForm = []
        return false
      } else {
        // 表头数据转换
        this.generateFormTwo = transformData(results)
        for (let i = 0; i < this.generateFormTwo.length; i++) {
          const item = this.generateFormTwo[i]
          if (!item.name) {
            this.$message({
              message: `第${i + 1}项的名称为空`,
              type: 'warning'
            })
            this.generateFormTwo = []
            this.generateForm = []
            return false
          }
          if (!item.taskStartDate) {
            this.$message({
              message: `第${i + 1}项的任务开始时间为空`,
              type: 'warning'
            })
            this.generateFormTwo = []
            this.generateForm = []
            return false
          }
          if (!item.taskEndDate) {
            this.$message({
              message: `第${i + 1}项的任务结束时间为空`,
              type: 'warning'
            })
            this.generateFormTwo = []
            this.generateForm = []
            return false
          }
          if (!item.taskHours) {
            this.$message({
              message: `第${i + 1}项的任务工时为空`,
              type: 'warning'
            })
            this.generateFormTwo = []
            this.generateForm = []
            return false
          }
          if (!item.taskStatus) {
            this.$message({
              message: `第${i + 1}项的任务状态为空`,
              type: 'warning'
            })
            this.generateFormTwo = []
            this.generateForm = []
            return false
          }
          // 状态转换
          if (item.taskStatus === '未开始') {
            item.taskStatus = constant.TASK_STATUS_NOT_STARTED
          } else if (item.taskStatus === '进行中') {
            item.taskStatus = constant.TASK_STATUS_IN_HAND
          } else if (item.taskStatus === '待测试') {
            item.taskStatus = constant.TASK_STATUS_TEST
          } else if (item.taskStatus === '已暂停') {
            item.taskStatus = constant.TASK_STATUS_STOP
          } else if (item.taskStatus === '未承认') {
            item.taskStatus = constant.TASK_STATUS_UNRECOGNIZED
          } else if (item.taskStatus === '已完成') {
            item.taskStatus = constant.TASK_STATUS_COMPLETED
          }
          if (item.taskStartDate > item.taskEndDate) {
            this.$message({
              message: `第${i + 1}项的任务开始时间大于任务结束时间`,
              type: 'warning'
            })
            this.generateFormTwo = []
            this.generateForm = []
            return false
          }
        }
        this.tableHeader = header.filter(
          item =>
            item !== '所属员工ID' && item !== '任务状态ID' && item !== '优先度ID' && item !== '隔绝列1' &&
            item !== '隔绝列2' && item !== '隔绝列3' && item !== '隔绝列4' && item !== '隔绝列5' && item !== '隔绝列6' &&
            item !== '隔绝列7' && item !== '隔绝列8'
        )
      }
    },
    // 生成表单打开
    openGenerate() {
      // 生成表单数据
      this.generateForm = []
      // 生成表单状态
      this.generateStatus = true
    },
    // 生成表单关闭
    closeGenerate() {
      // 生成表单状态
      this.generateStatus = false
    },
    // 生成表单提交
    submitGenerate() {
      if (!this.generateForm) {
        this.$message.warning('请选择上传的文件')
        return
      }
      // 生成表单加载
      this.generateLoading = true
      this.uploading = true
      crudTaskUser
        .generate({
          generateForm: this.generateFormTwo,
          taskId: this.query.taskId
        })
        .then(res => {
          // 生成表单关闭
          this.closeGenerate()
          // 生成表单加载
          this.generateLoading = false
          // 搜索:刷新表格
          this.crud.toQuery()
          this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
        })
        .catch(() => {
          this.uploading = false
          // 生成表单加载
          this.generateLoading = false
        })
    },
 
    unPick(e) {
      crudTaskUser
        .addTaskUser({ TaskId: e.id, projectId: this.projectId })
        .then(res => {
          this.pickFlg = false
          if (res === 1) {
            this.$notify({
              title: '获取成功',
              type: 'success',
              duration: 2500
            })
 
            this.crud.toQuery()
          } else {
            this.$notify({
              title: '获取失败',
              type: 'error',
              duration: 2500
            })
          }
        })
    },
    toTaskCompleted() {
      const selectData = this.$refs.table.selection
      var changesId = []
      for (var i = 0; i < selectData.length; i++) {
        if (selectData[i].newTaskProgress !== 100) {
          this.centerDialogVisibleTaskProgress = true
          return
        }
        changesId.push(selectData[i].id)
      }
      // 当程序执行到这里时,说明选择的都是已经达到100的任务
      crudTaskUser.changeStatus(changesId).then(res => {
        this.crud.toQuery()
        this.$notify.success({
          title: '确认成功'
        })
      })
    },
    doTaskCompleted() {
      this.centerDialogVisibleTaskProgress = false
      const selectData = this.$refs.table.selection
      var changesId = []
      for (var i = 0; i < selectData.length; i++) {
        changesId.push(selectData[i].id)
      }
      // 当程序执行到这里时,说明选择的都是已经达到100的任务
      crudTaskUser.changeStatus(changesId).then(res => {
        this.crud.toQuery()
        this.$notify.success({
          title: '确认成功'
        })
      })
    },
    // 当选择完人物计算出绩效工时
    withUser(data) {
      // 绩效直下
      this.form.performanceHours = data.taskHours
      // if (data.taskHours != null && data.userId != null) {
      //   crudTaskUser
      //     .getPerformanceg({
      //       taskHours: data.taskHours,
      //       userId: data.userId
      //     })
      //     .then(res => {
      //       this.form.performanceHours = res == 0 ? null : res;
      //     });
      // }
    },
    showDetail(e) {
      this.dialogVisible_taskUser = true
      this.TaskName = e.name
      this.expectedHours = e.performanceHours
      this.actualHours = 0
      // 发送taskUser,获取所有的日报信息,并在后台进行处理,将处理后的结果返回给前端的steps中,进行显示
      crudTaskUser.getTaskUserDetail(e.id).then(res => {
        this.steps = res
        for (let i = 0; i < this.steps.length; i++) {
          this.taskUserDetail[this.steps[i].taskUserName] = this.steps[
            i
          ].alreadyConsumeHours
        }
 
        // var key = this.taskUserDetail.keySet();
        for (var key in this.taskUserDetail) {
          this.actualHours += this.taskUserDetail[key]
        }
 
        this.taskProgress = Math.round(
          (this.actualHours / this.expectedHours) * 100
        )
        if (this.taskProgress > 100) {
          this.taskProgress = 100
        }
        if (this.taskProgress === 100) {
          this.ProgressStatus = '#F56C6C'
        }
        if (this.taskProgress < 100) {
          this.ProgressStatus = '#409EFF'
        }
        this.dialogLoading_taskUser = false
      })
    },
    setNull() {
      this.taskUserDetail = {}
      this.dialogLoading_taskUser = true
      this.dialogLoading_task = true
      this.dialogLoading_task_LQ = true
    },
    showTaskDetail(e) {
      this.taskDetail = {}
      this.dialogVisible_task = true
      crudTaskUser.getTaskDetail(e.id).then(res => {
        for (let i = 0; i < res.length; i++) {
          this.taskDetail[res[i].nickName] = res[i].assignedWork
        }
        this.dialogLoading_task = false
      })
    },
    formatTaskProgress(percentage) {
      return percentage === 100 ? '实际消耗已超出计划时长' : `${percentage}%`
    },
    // 开启新建复核
    toReviewTask() {
      const that = this
      if (that.crud.selections[0].rid === undefined || that.crud.selections[0].rid === null) {
        that.$set(that.reviewTaskParams, 'rid', that.crud.selections[0].id)
        that.$set(that.reviewTaskParams, 'rname', that.crud.selections[0].name)
        that.crud.toAdd()
      } else {
        that.$message.warning('复核任务下不可创建复核任务')
      }
    },
    // 切换类型时清空之前的选择
    handleTypeChange() {
      const that = this
      that.$set(that.form, 'userId', null)
      that.$set(that.form, 'userIds', [])
    }
  }
}
</script>
 
<style rel="stylesheet/scss" lang="scss">
/*.el-picker-panel__footer{*/
/*  display: none;*/
/*}*/
.hide-time .el-button--text {
  display: none;
}
 
.tree-scroll {
  height: 100%;
  width: 100%;
}
 
.flow-tree {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 600px;
  width: 100%;
 
  >>> .el-tree-node {
    // height:40px;
    > .el-tree-node__children {
      overflow-y: visible !important;
    }
    > .el-tree-node__content {
      height: 100%;
    }
  }
}
::v-deep .vue-treeselect__control,
::v-deep .vue-treeselect__placeholder,
::v-deep .vue-treeselect__single-value {
  height: 40px;
  line-height: 40px;
}
 
.active {
  /* 添加长亮效果的样式 */
  color: #1890ff;
}
</style>