workOrderAdmin.vue
30 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
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
<template>
<v-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>业务管理</el-breadcrumb-item>
<el-breadcrumb-item>工单管理</el-breadcrumb-item>
</template>
<template slot="main">
<div class="ibox">
<!-- 表单查询 -->
<el-form ref="form" :inline="true" :model="form">
<el-form-item>
<el-select
v-model="form.queryTimeType"
style="width: 100px"
placeholder="请选择"
size="small"
>
<el-option label="创建时间" value="1" />
<el-option label="期望安装时间" value="2" />
</el-select>
<el-date-picker
v-model="form.dateRange"
value-format="yyyy-MM-dd"
size="small"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="工单类型">
<el-select
v-model="form.needInstall"
style="width: 120px"
placeholder="请选择"
size="small"
>
<el-option label="全部" value="" />
<el-option label="无需安装" :value="0" />
<el-option label="需要安装" :value="1" />
</el-select>
</el-form-item>
<!-- 车辆分组分类组件 -->
<v-vechicle-select
label="客户归属"
@onVechicleChange="vechicleChange"
/>
<!-- 车辆分组分类组件 /-->
<el-form-item label="系统工单状态">
<el-select
v-model="form.businessStatus"
style="width: 120px"
placeholder="请选择"
size="small"
>
<el-option label="全部" value="" />
<el-option label="草稿" :value="ORDER_STATUS.draft" />
<el-option label="已提交" :value="ORDER_STATUS.committed" />
<el-option label="已派单" :value="ORDER_STATUS.dispatched" />
<el-option label="已激活" :value="ORDER_STATUS.activated" />
<el-option label="已取消" :value="ORDER_STATUS.returned" />
<el-option label="已拆除" :value="ORDER_STATUS.removed" />
</el-select>
</el-form-item>
<el-form-item>
<el-input
v-model="form.queryTerm"
placeholder="请输入对应条件值"
size="small"
class="input-with-select"
clearable
>
<el-select
slot="prepend"
v-model="form.queryType"
style="width: 100px"
placeholder="请选择"
size="small"
>
<el-option label="设备号" value="1" />
<el-option label="车架号" value="2" />
<el-option label="姓名" value="3" />
<el-option label="业务工单号" value="4" />
<el-option label="系统工单号" value="5" />
</el-select>
</el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="small"
:loading="loading"
@click="queryForm"
>查询</el-button
>
</el-form-item>
</el-form>
<!-- 表单查询 /-->
</div>
<div class="ibox">
<div class="ibox-title">
<h3 class="pull-left">工单管理</h3>
<el-button
type="primary"
plain
size="small"
class="pull-right ibox-ctrl"
@click="exportExcel"
>导出excel <i class="fa fa-download"
/></el-button>
<el-button
v-show="ROLE_TYPE == 1"
type="primary"
plain
size="small"
class="pull-right ibox-ctrl"
@click="cancelDispatchOrder()"
>取消派单
</el-button>
<el-button
v-show="ROLE_TYPE == 1"
type="primary"
plain
size="small"
class="pull-right ibox-ctrl"
@click="dispatchOrder()"
>派单
</el-button>
<el-button
type="primary"
plain
size="small"
class="pull-right ibox-ctrl"
@click="hanldeAddOrder"
>工单新增
</el-button>
<el-button
v-show="ROLE_TYPE == 1 || ROLE_TYPE == 2"
type="primary"
plain
size="small"
class="pull-right ibox-ctrl"
@click="groupImport"
>批量导入
</el-button>
<el-button
type="primary"
plain
size="small"
class="pull-right ibox-ctrl"
@click="exportImage"
>导出图片 <i class="fa fa-download"
/></el-button>
</div>
<div class="ibox-content">
<el-table
v-loading="loading"
:data="tableData"
border
size="small"
style="width: 100%"
@selection-change="selectChange"
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column
fixed
type="index"
label="序号"
:index="getIndex"
align="center"
width="70"
/>
<el-table-column
fixed
prop="id"
label="系统工单号"
min-width="100"
align="center"
/>
<el-table-column
fixed
prop="needInstall"
label="工单类型"
min-width="80"
align="center"
>
<template slot-scope="scope">
<span v-show="scope.row.needInstall === 1">需要安装</span>
<span v-show="scope.row.needInstall === 0">无需安装</span>
</template>
</el-table-column>
<el-table-column
fixed
prop="addFlagStr"
label="工单来源"
v-if="showSource"
align="center"
/>
<el-table-column
fixed
prop="workOrderNo"
label="业务工单号"
min-width="140"
align="center"
/>
<el-table-column
prop="name"
label="姓名"
min-width="160"
align="center"
/>
<el-table-column
prop="standNo"
label="车架号"
min-width="180"
align="center"
/>
<el-table-column
prop="deviceNum"
label="设备数量"
min-width="80"
align="center"
/>
<el-table-column
prop="fixTime"
label="期望安装日期"
min-width="160"
align="center"
>
<!-- <template slot-scope="scope">
{{ transferFixTime(scope.row.fixTime) }}
</template> -->
</el-table-column>
<el-table-column
prop="className"
label="客户归属"
min-width="160"
align="center"
/>
<el-table-column
prop="businessStatus"
label="系统工单状态"
min-width="120"
align="center"
>
<template slot-scope="scope">
<span v-show="scope.row.businessStatus === ORDER_STATUS.draft"
>草稿</span
>
<span
v-show="scope.row.businessStatus === ORDER_STATUS.committed"
>已提交</span
>
<span
v-show="scope.row.businessStatus === ORDER_STATUS.dispatched"
>已派单</span
>
<span
v-show="scope.row.businessStatus === ORDER_STATUS.activated"
>已激活</span
>
<span
v-show="scope.row.businessStatus === ORDER_STATUS.returned"
>已取消</span
>
<span v-show="scope.row.businessStatus === ORDER_STATUS.removed"
>已拆除</span
>
</template>
</el-table-column>
<el-table-column
prop="createUserName"
label="创建人"
min-width="100"
align="center"
/>
<el-table-column
prop="createTime"
label="创建时间"
min-width="160"
align="center"
/>
<el-table-column
fixed="right"
label="操作"
min-width="240"
align="center"
>
<template slot-scope="scope">
<el-button
type="text"
size="medium"
@click="checkOrder(scope.row)"
>查看</el-button
>
<el-button
v-if="
(scope.row.businessStatus === ORDER_STATUS.draft &&
(ROLE_TYPE == 1 || ROLE_TYPE == 2)) ||
(scope.row.businessStatus === ORDER_STATUS.committed &&
(ROLE_TYPE == 1 || ROLE_TYPE == 2)) ||
(scope.row.businessStatus === ORDER_STATUS.dispatched &&
(ROLE_TYPE == 1 || ROLE_TYPE == 2)) ||
(scope.row.businessStatus === ORDER_STATUS.activated &&
(ROLE_TYPE == 1 || ROLE_TYPE == 2))
"
type="text"
size="medium"
@click="editOrder(scope.row)"
>编辑
</el-button>
<el-button
v-if="
scope.row.businessStatus === ORDER_STATUS.dispatched &&
(ROLE_TYPE == 1 || ROLE_TYPE == 2)
"
type="text"
size="medium"
@click="activeOrder(scope.row)"
>激活
</el-button>
<el-button
v-if="
scope.row.businessStatus === ORDER_STATUS.committed &&
ROLE_TYPE == 1 &&
scope.row.fixTime
"
type="text"
size="medium"
@click="
dispatchOrder(
scope.row.id,
scope.row.fixArea,
scope.row.address
)
"
>派单
</el-button>
<el-button
v-if="
scope.row.businessStatus === ORDER_STATUS.dispatched &&
ROLE_TYPE == 1
"
type="text"
size="medium"
@click="cancelDispatchOrder(scope.row.id)"
>取消派单
</el-button>
<el-button
v-if="scope.row.businessStatus === ORDER_STATUS.draft"
type="text"
size="medium"
@click="deleteOrder(scope.row.id)"
>删除</el-button
>
<el-button
v-if="
scope.row.standnoHash &&
scope.row.businessStatus !== ORDER_STATUS.activated &&
pingAn
"
type="text"
size="medium"
@click="onCommand(scope.row)"
>关联车辆</el-button
>
</template>
</el-table-column>
</el-table>
<div class="table-page-wrap">
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
<!-- 工单新增编辑弹框 -->
<work-order-modal
:order-modal-visible="orderModalVisible"
:order-id="orderId"
:order-info="orderInfo"
:editable="orderEditable"
:activable="orderActivable"
:order-is-activated="orderIsActivated"
:is-edit-draft="isEditDraft"
:role-type="ROLE_TYPE"
:show-dispatch-info="showDispatchInfo"
@onRefreshList="getData"
@onOrderModalChange="orderModalChange"
/>
<!-- 工单新增弹框 /-->
<!-- 批量导入弹框 -->
<import-modal
:import-modal-visible="importModalVisible"
@onImportModalChange="importModalChange"
@onRefreshList="getData"
/>
<!-- 批量导入弹框 /-->
<!-- 派单弹框 -->
<dispatch-modal
:dispatch-modal-visible="dispatchModalVisible"
:ids="dispatchIds"
:fix-areas="dispatchFixAreas"
@onDispatchModalChange="dispatchModalChange"
@onRefreshList="getData"
/>
<!-- 派单弹框 /-->
<!-- 关联车辆 开始 -->
<glsx-dialog
:show="showCarDialog"
title="关联车辆"
width="600px"
:appendtobody="true"
@close="closeCarDialog()"
>
<div v-loading="carLoading">
<el-form
ref="carInfoForm"
:model="carInfoForm"
:rules="carInfoFormRules"
label-width="140px"
>
<el-form-item label="请选择对应车辆:" prop="sqbh">
<el-select
class="a_select"
v-model="carInfoForm.sqbh"
@change="onCarChange"
>
<el-option
v-for="(item, index) in vehicleList"
:key="index"
:value="item.sqbh"
:label="item.sqbh"
></el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="
currentVehicle.ownerName ||
currentVehicle.shopName ||
currentVehicle.bizOrderNo
"
>
<div class="car_info_box">
<div class="cell">
<span class="name">姓名:</span>
<span class="txt">{{
currentVehicle.ownerName || "--"
}}</span>
</div>
<div class="cell">
<span class="name">店面名称:</span>
<span class="txt">{{ currentVehicle.shopName || "--" }}</span>
</div>
<div class="cell">
<span class="name">业务工单:</span>
<span class="txt">{{ currentVehicle.sqbh || "--" }}</span>
</div>
</div>
</el-form-item>
</el-form>
<div class="waringExe">
*注意事项:由于E盾与包活干平台工单不进行二次同步,因此平安后派工单,
</div>
<div class="waringExe">由业务端于包活干平台手动取消</div>
</div>
<div slot="footer">
<el-button
type="primary"
size="small"
:loading="aloading"
@click="saveLinkInfo()"
>保存</el-button
>
<el-button type="default" size="small" @click="closeCarDialog()"
>关闭</el-button
>
</div>
</glsx-dialog>
<!-- 关联车辆 end -->
</template>
</v-layout>
</template>
<script>
import vDateRange from "@/components/DateRange.vue";
import vVechicleSelect from "@/components/VechicleSelect.vue";
import workOrderModal from "./workOrderModal.vue";
import importModal from "./importModal.vue";
import dispatchModal from "./dispatchModal.vue";
import moment from "moment";
import { services } from "@/api";
import { exportExcel } from "@/utils";
import { showToast } from "@/utils/util";
import GlsxDialog from "@/components/GlsxDialog.vue";
const BUSINESS_SERVICE = services.business;
export default {
components: {
vDateRange,
vVechicleSelect,
workOrderModal,
importModal,
dispatchModal,
GlsxDialog,
},
data() {
return {
ORDER_STATUS: {
draft: 1,
committed: 2,
dispatched: 3,
activated: 4,
returned: 5,
removed: 6,
},
ROLE_TYPE: undefined, // 1:运营 2:客户 3:服务商
loading: false,
currentPage: 1,
pageSize: 10,
total: 0,
tableData: [],
form: {
queryTimeType: "1",
dateRange: [],
needInstall: "",
classId: "",
groupId: "",
businessStatus: "",
queryType: "",
queryTerm: "",
},
selectedIds: [],
orderModalVisible: false,
orderId: undefined,
orderInfo: null,
orderEditable: false,
orderActivable: false,
importModalVisible: false,
dispatchModalVisible: false,
dispatchIds: "",
dispatchFixAreas: [],
isEditDraft: false,
showDispatchInfo: false,
orderIsActivated: false,
// 关联车辆弹框
showCarDialog: false,
carInfoForm: {},
vehicleList: [],
currentVehicle: {},
carInfoFormRules: {
sqbh: [
{ required: true, message: "请选择对应车辆", trigger: "change" },
],
},
carLoading: false,
aloading: false,
pingAn: false,
showSource: false, // 是否展示工单来源
};
},
computed: {},
created() {
const store = this.$store;
let user = sessionStorage.getItem("user")
? JSON.parse(sessionStorage.getItem("user"))
: {};
// 针对平安特殊的账户,动态展示工单来源字段
if (user.username == "PAXM" || user.username == "paxm") {
this.showSource = true;
}
store.dispatch("getRoleInfo").then(() => {
this.ROLE_TYPE = store.state.common.roleType;
this.pingAn = store.state.common.pingAn;
this.getData();
});
},
methods: {
onCommand(row) {
this.showCarDialog = true;
this.orderId = row.id;
this.getVehicleList(row.standnoHash);
},
// 获取车辆列表
getVehicleList(vin) {
if (vin == null) return false;
let _this = this;
_this.carLoading = true;
BUSINESS_SERVICE.getCarInformation({ standnoHash: vin })
.then((res) => {
_this.carLoading = false;
let list = res.data || [];
_this.vehicleList = list;
_this.currentVehicle = list[0] || {};
if (list[0]) {
_this.$set(_this.carInfoForm, "sqbh", list[0].sqbh);
}
})
.catch((error) => {
_this.carLoading = false;
});
},
// 关闭关联车辆弹框
closeCarDialog() {
let _this = this;
this.showCarDialog = false;
this.vehicleList = [];
this.currentVehicle = {};
this.carInfoForm = {};
this.orderId = "";
setTimeout(function () {
_this.$refs.carInfoForm.clearValidate();
}, 100);
},
// 订单关联车辆
async saveLinkInfo() {
let _this = this;
let oParams = {};
let _pass = await _this.$refs.carInfoForm
.validate()
.catch((err) => false);
console.log(_pass);
if (!_pass) {
return false;
}
_this.aloading = true;
oParams.orderId = this.orderId;
oParams.vehicleId = this.currentVehicle.vehicleId;
let res = await BUSINESS_SERVICE.carRebinding(JSON.stringify(oParams));
_this.aloading = false;
if (res.returnCode != 0) {
return false;
}
showToast({
message: "关联成功",
type: "success",
});
_this.closeCarDialog();
_this.getData();
},
// 监听车辆选择
onCarChange(e) {
let n = this.vehicleList.find((k) => k.sqbh == e);
this.currentVehicle = n || {};
},
transferFixTime(fixtime) {
if (!fixtime) {
return "";
}
const matchArr = fixtime.match(/^(\d{4}\-\d{2}\-\d{2})/);
if (matchArr) {
return fixtime.match(/^(\d{4}\-\d{2}\-\d{2})/)[0];
} else {
return "";
}
},
getIndex(index) {
return (this.currentPage - 1) * this.pageSize + index + 1;
},
getData(curr = this.currentPage, size = this.pageSize) {
this.loading = true;
const params = this.getParams();
params.currentPage = curr;
params.pageSize = size;
BUSINESS_SERVICE.getWorkOrderList(params)
.then((response) => {
if (Array.isArray(response.data)) {
this.tableData = response.data;
this.total = response.recordsTotal;
} else {
this.tableData = [];
this.total = 0;
}
this.loading = false;
})
.catch((error) => console.log(error));
},
getParams() {
const form = this.form;
const params = {};
if (form.dateRange && form.dateRange.length) {
form.sTime = moment(form.dateRange[0])
.startOf("day")
.format("YYYY-MM-DD HH:mm:ss"); // form.dateRange[0]+ ' 00:00:00';
form.eTime = moment(form.dateRange[1])
.endOf("day")
.format("YYYY-MM-DD HH:mm:ss"); // form.dateRange[1]+' 23:59:59';
} else {
form.sTime = "";
form.eTime = "";
}
if (form.sTime && form.eTime) {
if (form.queryTimeType == "1") {
params.createSTime = form.sTime;
params.createETime = form.eTime;
} else {
params.fixSTime = form.sTime;
params.fixETime = form.eTime;
}
}
params.needInstall = form.needInstall;
if (form.classId) {
params.classIdList = form.classId;
}
params.businessStatus = form.businessStatus;
const queryTerm = form.queryTerm.trim();
if (queryTerm) {
switch (form.queryType) {
case "1":
params.sn = queryTerm;
break;
case "2":
params.standNo = queryTerm;
break;
case "3":
params.name = queryTerm;
break;
case "4":
params.workOrderNo = queryTerm;
break;
case "5":
params.orderId = queryTerm;
break;
}
}
return params;
},
dateRangeChange(dateArr) {
if (dateArr && dateArr.length) {
this.form.sTime = dateArr[0];
this.form.eTime = dateArr[1];
} else {
this.form.sTime = "";
this.form.eTime = "";
}
},
vechicleChange(groupId, classId) {
this.form.groupId = groupId;
this.form.classId = classId;
},
handleSizeChange(val) {
this.pageSize = val;
this.getData(this.currentPage, this.pageSize);
},
handleCurrentChange(val) {
this.currentPage = val;
this.getData(val);
},
dispatchOrder(id, fixArea, address) {
if (id) {
this.dispatchIds = id;
const addr = (fixArea || "") + (address || "");
this.dispatchFixAreas = [addr];
this.dispatchModalVisible = true;
} else {
if (this.selectedIds.length) {
const filterIds = [];
const fixAreas = [];
this.selectedIds.forEach((id) => {
const item = this.tableData.find((obj) => {
return obj.id === id;
});
if (
item &&
item.businessStatus === this.ORDER_STATUS.committed &&
item.fixTime
) {
filterIds.push(id);
const addr =
(item.fixArea ? item.fixArea : "") +
(item.address ? item.address : "");
fixAreas.push(addr);
}
});
if (filterIds.length) {
this.dispatchIds = filterIds.join(",");
this.dispatchFixAreas = fixAreas;
this.dispatchModalVisible = true;
} else {
this.$message({
type: "error",
message: "工单状态为已提交且自装才可派单",
});
}
} else {
this.$message({
type: "info",
message: "请至少选择一项",
});
}
}
},
cancelDispatchOrder(id) {
if (id) {
BUSINESS_SERVICE.cancelDispatchWorkOrder({ ids: id }).then((res) => {
if (res.returnCode == 0) {
this.$message({
type: "success",
message: res.message,
});
this.getData();
}
});
} else {
if (this.selectedIds.length) {
const filterIds = [];
this.selectedIds.forEach((id) => {
const item = this.tableData.find((obj) => {
return obj.id === id;
});
if (item && item.businessStatus === this.ORDER_STATUS.dispatched) {
filterIds.push(id);
}
});
if (filterIds.length) {
BUSINESS_SERVICE.cancelDispatchWorkOrder({
ids: filterIds.join(","),
}).then((res) => {
if (res.returnCode == 0) {
this.$message({
type: "success",
message: res.message,
});
this.getData();
}
});
} else {
this.$message({
type: "error",
message: "工单状态为已派单才可取消派单",
});
}
} else {
this.$message({
type: "info",
message: "请至少选择一项",
});
}
}
},
hanldeAddOrder() {
// this.orderId = undefined;
// this.orderEditable = true;
// this.orderActivable = false;
// this.isEditDraft = true;
// this.orderModalVisible = true;
// this.showDispatchInfo = false;
// this.orderIsActivated = false;
this.$router.push({ name: "editOrderPage" });
},
editOrder(item) {
this.orderInfo = item;
this.orderId = item.id;
this.orderEditable = true;
this.orderActivable = false;
this.orderIsActivated = false;
if (item.businessStatus === this.ORDER_STATUS.draft) {
this.isEditDraft = true;
} else if (item.businessStatus === this.ORDER_STATUS.activated) {
this.orderEditable = false;
this.orderIsActivated = true;
this.isEditDraft = false;
} else {
this.isEditDraft = false;
}
this.showDispatchInfo =
item.businessStatus === this.ORDER_STATUS.dispatched &&
item.needInstall === 1;
this.orderModalVisible = true;
},
checkOrder(item) {
this.orderInfo = item;
this.orderId = item.id;
this.orderEditable = false;
this.orderActivable = false;
this.orderModalVisible = true;
this.showDispatchInfo =
item.businessStatus === this.ORDER_STATUS.dispatched &&
item.needInstall === 1;
this.orderIsActivated = false;
},
activeOrder(item) {
this.orderInfo = item;
this.orderId = item.id;
this.orderEditable = false;
this.orderActivable = true;
this.orderModalVisible = true;
this.showDispatchInfo = false;
this.orderIsActivated = false;
},
deleteOrder(id) {
this.$confirm("是否删除该工单?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
BUSINESS_SERVICE.deleteWorkOrder({ id: id }).then((res) => {
if (res.returnCode == 0) {
this.$message({
type: "success",
message: "删除成功!",
});
this.getData();
}
});
});
},
orderModalChange(isOpen) {
this.orderModalVisible = isOpen;
},
importModalChange(isOpen) {
this.importModalVisible = isOpen;
},
dispatchModalChange(isOpen) {
this.dispatchModalVisible = isOpen;
},
queryForm() {
this.currentPage = 1;
this.pageSize = 10;
this.getData();
},
selectChange(selection) {
this.selectedIds = [];
this.dispatchFixAreas = [];
selection.map((obj) => {
this.selectedIds.push(obj.id);
this.dispatchFixAreas.push(obj.fixArea + obj.address);
});
},
exportExcel() {
const url = "workOrder/exportWorkOrderList";
if (this.selectedIds.length) {
exportExcel(url, { idList: this.selectedIds.join(",") });
} else {
exportExcel(url, this.getParams());
}
},
exportImage() {
const url = "workOrder/exportPicture";
if (this.selectedIds.length) {
if (this.selectedIds.length > 30) {
this.$message({
type: "info",
message: "批量最多支持30单,请重新选择",
});
return;
}
const standnoList = [];
this.selectedIds.forEach((id) => {
const item = this.tableData.find((obj) => {
return obj.id === id;
});
standnoList.push(item.standNo);
});
exportExcel(url, { standnoList: standnoList.join(",") });
} else {
this.$message({
type: "info",
message: "请至少选择一项导出",
});
}
},
groupImport() {
this.importModalVisible = true; //
},
},
};
</script>
<style scoped>
.waringExe {
font-size: 10px;
margin-left: 15px;
}
</style>