order.vue
29.8 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
<template>
<div class="">
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :inline="true"
size="small">
<el-form-item>
<div class="pre_select_box">
<el-select v-model="searchForm.timeType"
class="sort_select"
placeholder="请选择">
<el-option label="创建时间"
value="1"></el-option>
<el-option label="期望服务时间"
value="2"></el-option>
</el-select>
<el-date-picker v-model="searchForm.dateRange"
class="data_picker"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="~"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="是否需要安装">
<el-select v-model="searchForm.needInstall"
class="small_select">
<el-option label="全部"
value=""></el-option>
<el-option label="无需安装"
value="N"></el-option>
<el-option label="需要安装"
value="Y"></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单归属:">
<el-popover v-model="filterVisible"
placement="bottom-start"
width="400"
trigger="click">
<div>
<glsx-organization @change="onChange"></glsx-organization>
</div>
<el-input v-model="searchForm.orgName"
:placeholder="searchForm.specialShopName || '所属组织'"
slot="reference"
readonly
clearable>
</el-input>
</el-popover>
</el-form-item>
<el-form-item label="服务类型:">
<el-select v-model="searchForm.serviceType"
class="small_select"
placeholder="请选择">
<el-option label="全部"
value=""></el-option>
<el-option label="安装工单"
value="IS"></el-option>
</el-select>
</el-form-item>
<el-form-item label="系统工单状态:">
<el-select v-model="searchForm.orderStatus"
class="small_select"
placeholder="请选择">
<el-option label="全部"
value=""></el-option>
<el-option v-for="(item,index) in statusList"
:key="`s_${index}`"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字:">
<el-input v-model="searchForm.term"
class="long_input"
maxlength="50"
placeholder="设备号|车架号|姓名|业务工单号|系统工单号"></el-input>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search"
type="primary"
@click="getList(1)">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh"
type="default"
@click="rest()">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 搜索区域 end -->
<!-- 操作区域 开始 -->
<div class="links_group">
<span class="name">工单管理</span>
<div>
<el-button type="primary"
icon="el-icon-download"
size="small"
:loading="iloading"
@click="dowloadZipFiles()">图片导出</el-button>
<el-button type="primary"
icon="el-icon-upload2"
size="small"
@click="openDialog()">批量导入</el-button>
<el-button type="primary"
icon="el-icon-plus"
size="small"
@click="addOrder">工单新增</el-button>
<el-button type="primary"
icon="el-icon-download"
size="small"
:loading="dloading"
@click="downloadExcel()">导出excel</el-button>
</div>
</div>
<!-- 操作区域 end -->
<!-- 表格区域 开始 -->
<div class="table_box">
<el-table class="el_table"
:data="tableData"
border
size="small"
v-loading="tabLoading"
@selection-change="onSelectionChange">
<el-table-column type="selection"
width="50" />
<el-table-column label="序号"
type="index"></el-table-column>
<!-- <el-table-column label="系统工单号" prop="orderNo" :width="tdWidth"></el-table-column> -->
<el-table-column label="服务类型"
prop="serviceType"></el-table-column>
<el-table-column label="店面名称"
prop="shopName"
:width="tdWidth"
show-overflow-tooltip></el-table-column>
<el-table-column label="业务工单号"
prop="bizOrderNo"
:width="longTdWidth"></el-table-column>
<el-table-column label="姓名"
prop="ownerName"
:width="tdWidth"
show-overflow-tooltip></el-table-column>
<el-table-column label="车架号"
prop="vin"
:width="longTdWidth"></el-table-column>
<el-table-column label="设备组合"
prop="deviceCompose"
:width="tdWidth"
show-overflow-tooltip></el-table-column>
<el-table-column label="设备数量"
prop="deviceCnt"></el-table-column>
<el-table-column label="期望服务时间"
prop="serviceTime"
:width="tdWidth"></el-table-column>
<el-table-column label="所属组织"
prop="tenantName"></el-table-column>
<el-table-column label="系统工单状态"
prop="statusDesc"
:width="tdWidth"></el-table-column>
<!-- <el-table-column label="安装服务商" prop="serviceProvider" :width="tdWidth"></el-table-column>
<el-table-column label="安装技工" prop="mechanicName" :width="tdWidth"></el-table-column> -->
<el-table-column label="工单归属"
prop="createdBy"
:width="longTdWidth"
show-overflow-tooltip></el-table-column>
<el-table-column label="创建时间"
prop="createdDate"
:width="tdWidth"></el-table-column>
<el-table-column label="操作"
fixed="right"
align="left"
width="210px">
<template slot-scope="{row}">
<el-link class="el_link"
type="primary"
@click="lookDetail(row,1)">查看</el-link>
<el-link class="el_link"
type="primary"
v-if="row.status == 0 ||row.status == 1"
@click="lookDetail(row,2)">编辑</el-link>
<auth-link class="el_link"
type="primary"
name="删除"
@click.native="removeOrder(row)">删除</auth-link>
<!-- <el-link class="el_link" type="primary" v-if="row.status == 0 ||row.status == 1" @click="lookDetail(row,3)">激活</el-link>
<el-link class="el_link" type="primary" v-if="row.status == 5" @click="lookDetail(row,4)">审核</el-link> -->
<auth-link class="el_link"
type="primary"
permission-tag="WORK_ORDER_ACTIVATE_BUTTON"
v-if="row.status == 0 ||row.status == 1"
@click.native="lookDetail(row,3)">激活</auth-link>
<auth-link class="el_link"
type="primary"
permission-tag="WORK_ORDER_APPROVE_BUTTON"
v-if="row.status == 5"
@click.native="lookDetail(row,4)">审核</auth-link>
<auth-link class="el_link"
type="primary"
v-if="row.status == 2"
uid="14010101"
name="照片编辑"
@click.native="lookDetail(row,5)">照片编辑</auth-link>
<el-dropdown trigger="click"
@command="e => onCommand(e,row)"
v-if="hasPermission('work_order_associated') && (row.status == 1 || row.status == 0)">
<el-button class="btn_mini_size"
icon="el-icon-arrow-down"
size="mini"></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="1"
v-if="hasPermission('work_order_associated')">关联车辆</el-dropdown-item>
<el-dropdown-item v-if="hasPermission('WORK_ORDER_REPUSH_BUTTON')"
@click.native="workOrderRePush(row)">工单重推</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination background
layout="sizes, total,prev, pager, next, jumper"
:total="pageTotal"
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:page-sizes="pageSizes"
@current-change="getList"
@size-change="changePageSize" />
</div>
</div>
<!-- 表格区域 end -->
<!-- 弹框 开始 -->
<glsx-dialog :show="showDialog"
title="批量操作"
width="560px"
@close="closeDialog()">
<div>
<div class="upload_box"
v-show="!showResult">
<div class="input_box">
<el-input v-model="uploadFile.name"
placeholder="请选择需要导入的工单表格"
class="a_input"
size="small"
readonly></el-input>
<el-upload ref="elUpload"
:action="IMPORT_WORKORDER_FILES"
:headers="uploadHeaders"
:show-file-list="false"
:auto-upload="false"
:on-change="onFileChange"
:on-success="onSuccess">
<el-button size="small"
type="primary">选择文件</el-button>
</el-upload>
</div>
<div class="tips">*请选择需要导入的工单表格*</div>
</div>
<div class="upload_result"
v-show="showResult">
<div class="cell">
<span class="num">{{uploadResult.succNum}}</span>
<span>成功记录</span>
</div>
<div class="cell">
<span class="num cred">{{uploadResult.failNum}}</span>
<span>失败记录</span>
</div>
</div>
</div>
<div slot="footer">
<div class="dialog_links">
<div>
<el-button type="primary"
size="small"
v-if="!showResult"
@click="downloadTemplate()">下载模板</el-button>
<el-button type="primary"
size="small"
v-if="showResult && uploadResult.failFile"
@click="downloadFail()">导出失败记录</el-button>
</div>
<div class="">
<el-button type="primary"
size="small"
:loading="loading"
:disabled="!uploadFile.name"
v-if="!showResult"
@click="saveFile()">确认</el-button>
<el-button type="default"
size="small"
@click="closeDialog()">关闭</el-button>
</div>
</div>
</div>
</glsx-dialog>
<!-- 弹框 end -->
<!-- 查看工单 开始 -->
<glsx-dialog :show="showWorkDialog"
:show-close="false"
@close="closeDetailDialog()"
:appendtobody="true">
<div class="custom_title"
slot="title">
<span class="name">{{dialogTitle[orderType]}}</span>
<div class="dialog_menu">
<a href="javascript:void(0)"
:class="activeId == item.id?'active':''"
v-for="(item,index) in menus"
:key="index"
@click="linkEvent(item)">{{item.name}}</a>
</div>
</div>
<div>
<edit-order ref="editOrderCom"
:id="orderId"
:type="orderType"
@change="onEditChange"></edit-order>
</div>
<div slot="footer">
<el-button type="primary"
size="small"
:loading="aloading"
v-if="orderType == 1 && orderInfo.status == 2"
@click="goCarDetail()">车辆详情</el-button>
<el-button type="primary"
size="small"
:loading="aloading"
v-if="orderType == 3"
@click="activeDevice()">激活</el-button>
<el-button type="primary"
size="small"
:loading="aloading"
v-if="orderType == 2"
@click="saveInfo()">提交</el-button>
<el-button type="primary"
size="small"
:loading="aloading"
v-if="orderType == 4"
@click="auditWorkOrderInfo()">审核</el-button>
<el-button type="primary"
size="small"
:loading="aloading"
v-if="orderType == 5"
@click="saveImageInfo()">保存</el-button>
<el-button type="default"
size="small"
@click="closeDetailDialog()">关闭</el-button>
</div>
</glsx-dialog>
<!-- 查看工单 end -->
<!-- 关联车辆 开始 -->
<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="vehicleId">
<el-select class="a_select"
v-model="carInfoForm.vehicleId"
@change="onCarChange">
<el-option v-for="(item,index) in vehicleList"
:key="index"
:value="item.vehicleId"
:label="item.vin"></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">
<div class="name">姓名:</div>
<div class="txt">{{currentVehicle.ownerName||'--'}}</div>
</div>
<div class="cell">
<div class="name">店面名称:</div>
<div class="txt">{{currentVehicle.shopName||'--'}}</div>
</div>
<div class="cell">
<div class="name">业务工单:</div>
<div class="txt">{{currentVehicle.bizOrderNo||'--'}}</div>
</div>
</div>
</el-form-item>
</el-form>
</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 -->
</div>
</template>
<script>
// import GlsxDialog from "@/components/dialog";
import {
GET_WORKORDER_SEARCH,
GET_WORKORDER_EXPORT,
GET_WORKORDER_BATCHEXPORTPICS,
GET_WORKORDER_TEMPLATEFILE,
IMPORT_WORKORDER_FILES,
GET_WORKORDER_STATUSOPTION,
DELETE_ORDER_INFO,
GET_VEHICLE_LIST_BY_VIN,
SAVE_RELINKVEHICLE_INFO,
REPUSH_TO_BHG
} from "@/services/order";
import { deepClone, showToast, showModal } from "@/utils/util";
import store from "@/store";
import GlsxOrganization from "@/components/glsx-organization";
import EditOrder from "./edit.vue";
import AuthLink from "@/components/auth-button/link";
export default {
components: {
// GlsxDialog,
GlsxOrganization,
EditOrder,
AuthLink,
},
data() {
return {
searchForm: { timeType: "1" },
currentPage: 1,
pageSizes: [10, 20, 30, 40],
pageSize: 10,
pageTotal: 0,
tableData: [],
showDialog: false,
uploadFile: {},
showResult: false,
loading: false,
dloading: false,
tabLoading: false,
filterVisible: false,
showWorkDialog: false,
orderId: "",
menus: [
{ id: "orderInfo", name: "工单信息" },
{ id: "orderProgress", name: "工单进度" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
],
activeId: "orderInfo",
checkList: [],
iloading: false,
orderType: 1,
aloading: false,
IMPORT_WORKORDER_FILES,
uploadHeaders: {},
uploadResult: {},
dialogTitle: {
1: "查看工单",
2: "编辑工单",
3: "激活工单",
4: "审核工单",
5: "照片编辑",
},
statusList: [],
tdWidth: 140,
longTdWidth: 180,
orderInfo: {},
// 关联车辆弹框
showCarDialog: false,
carInfoForm: {},
vehicleList: [],
currentVehicle: {},
carInfoFormRules: {
vehicleId: [
{ required: true, message: "请选择对应车辆", trigger: "change" },
],
},
carLoading: false,
};
},
watch: {
$route: {
handler: function (n, o) {
if (n.query && n.query.refresh) {
this.currentPage = 1;
this.getList();
}
},
immediate: true,
},
},
created() {
let token = localStorage.getItem("token");
this.uploadHeaders = { Authorization: token };
this.getStatus();
},
mounted() {
this.getList();
},
methods: {
// 重置
rest() {
this.searchForm = { timeType: "1" };
this.pageSize = 10;
this.currentPage = 1;
this.getList();
},
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
let m = oParams.dateRange;
if (m && m.length > 0) {
oParams.sDate = m[0];
oParams.eDate = m[1];
}
oParams.pageSize = this.pageSize;
delete oParams.dateRange;
delete oParams.orgName;
return oParams;
},
// 获取数据列表
getList(current) {
let oParams = this.getParams();
oParams.pageNumber = current || this.currentPage;
this.tabLoading = true;
GET_WORKORDER_SEARCH(oParams).then((res) => {
this.tabLoading = false;
let {
data: { list, totalElements },
} = res;
this.tableData = list;
this.pageTotal = totalElements;
});
},
//每页展示
changePageSize(e) {
this.pageSize = e;
this.getList();
},
// 监听文件导入
onFileChange(file, fileList) {
if (!file.response) {
this.uploadFile = file;
}
},
// 打开批量导入弹框
openDialog() {
this.showDialog = true;
},
// 关闭弹框
closeDialog() {
this.showDialog = false;
this.uploadFile = {};
this.uploadResult = {};
this.showResult = false;
},
// 上传文件
saveFile() {
if (!this.uploadFile.name) {
showToast({
message: "请选择上传文件",
});
return false;
}
this.loading = true;
this.$refs.elUpload.submit();
},
// 监听文件上传成功
onSuccess(response, file, fileList) {
this.loading = false;
if (response.code != 200) {
showToast({
message: response.message,
});
this.uploadFile = {};
this.$refs.elUpload.clearFiles();
return false;
}
this.uploadResult = response.data;
this.showResult = true;
this.getList();
},
// 新增工单
addOrder() {
this.$router.push({
name: "workOrderAdd",
});
},
// 图片批量导出
dowloadZipFiles() {
let _this = this;
let oParams = {};
let arr = [];
let list = this.checkList;
if (!list || list.length <= 0) {
showToast({
message: "请选择要导出的工单图片",
});
return false;
}
list.map((k) => {
arr.push(k.id);
});
oParams.orderIds = arr.toString();
_this.iloading = true;
GET_WORKORDER_BATCHEXPORTPICS(oParams)
.then((res) => {
_this.iloading = false;
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
if (res.data) {
window.open(res.data);
}
})
.catch((error) => {
_this.iloading = false;
});
// _this.$Common.exportExcel({
// url: `${store.state.baseURL}${GET_WORKORDER_BATCHEXPORTPICS}`,
// method: "GET",
// data: oParams,
// fileName: `图片${moment().format("YYYY-MM-DD")}.zip`,
// success: () => {
// _this.iloading = false;
// },
// fail: () => {
// _this.iloading = false;
// },
// });
},
// 导出excel
downloadExcel() {
let _this = this;
let oParams = this.getParams();
_this.dloading = true;
_this.$Common.exportExcel({
url: `${store.state.baseURL}${GET_WORKORDER_EXPORT}`,
method: "GET",
data: oParams,
fileName: "工单列表.xlsx",
success: () => {
_this.dloading = false;
},
fail: () => {
_this.dloading = false;
},
});
},
// 监听树
onChange(e) {
this.filterVisible = false;
if (e) {
this.orgInfo = e.origin;
this.searchForm.orgId = e.origin.orgId;
this.searchForm.orgType = e.origin.type;
this.searchForm.orgName = e.origin.orgName;
}
},
// 查看、编辑工单
lookDetail(row, type) {
this.showWorkDialog = true;
this.orderId = row.id;
this.orderType = type;
this.orderInfo = row;
this.menus = [
{ id: "orderInfo", name: "工单信息" },
{ id: "orderProgress", name: "工单进度" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
];
if (row.needInstall != "Y") {
this.menus = [
{ id: "orderInfo", name: "工单信息" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
];
}
if (type == 3) {
this.activeId = "deviceInfo";
}
},
// 菜单切换
linkEvent(row) {
this.activeId = row.id;
this.$refs.editOrderCom.scrollTo(row.id);
},
// 监听表格选择
onSelectionChange(e) {
this.checkList = e;
},
// 关闭查看工单详情弹框
closeDetailDialog() {
this.showWorkDialog = false;
this.activeId = "orderInfo";
this.orderId = "";
this.orderInfo = {};
this.$refs.editOrderCom.rest();
},
// 下载模板
downloadTemplate() {
window.open(GET_WORKORDER_TEMPLATEFILE);
},
// 编辑工单
saveInfo() {
this.aloading = true;
this.$refs.editOrderCom.saveInfo();
},
// 监听编辑工单组件
onEditChange(e) {
this.aloading = false;
if (e) {
this.getList();
this.closeDetailDialog();
}
},
// 下载失败模板
downloadFail() {
let o = this.uploadResult;
window.open(o.failFile);
},
// 激活工单
activeDevice() {
this.aloading = true;
this.$refs.editOrderCom.activeDevice();
},
// 获取工单状态
getStatus() {
GET_WORKORDER_STATUSOPTION().then((res) => {
this.statusList = res.data || [];
});
},
// 查看车辆详情
goCarDetail() {
let row = this.orderInfo;
let oParams = {};
oParams.vin = row.vin;
let path = `/trialRun#/vehicleManage/vehicleList`;
this.$root.parentCommon.setBreadCrumbs(path);
history.pushState(oParams, "车辆列表", path);
},
// 审核工单
auditWorkOrderInfo() {
this.aloading = true;
this.$refs.editOrderCom.auditWorkOrderInfo();
},
// 保存工单
saveImageInfo() {
this.aloading = true;
this.$refs.editOrderCom.saveImageInfo();
},
// 删除工单
removeOrder(row) {
let _this = this;
showModal({
message: "确认删除该工单吗?",
showCancelButton: true,
success: function () {
let oParams = {};
oParams.orderId = row.id;
DELETE_ORDER_INFO(oParams).then((res) => {
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
showToast({
message: "删除成功",
type: "success",
});
_this.getList();
});
},
});
},
// 关闭关联车辆弹框
closeCarDialog() {
let _this = this;
this.showCarDialog = false;
this.vehicleList = [];
this.currentVehicle = {};
this.carInfoForm = {};
this.orderId = "";
setTimeout(function () {
_this.$refs.carInfoForm.clearValidate();
}, 100);
},
// 点击下拉菜单
onCommand(e, row) {
console.log(row);
if (e == 1) {
this.showCarDialog = true;
this.orderId = row.id;
this.getVehicleList(row.vin);
}
},
// 是否有权限
hasPermission(id) {
let list = this.$root.parentCommon.getAuthData();
let idx = list.findIndex((k) => k.origin.permissionTag == id);
if (idx < 0) {
return false;
} else {
return true;
}
},
// 获取车辆列表
getVehicleList(vin) {
let _this = this;
_this.carLoading = true;
GET_VEHICLE_LIST_BY_VIN({ vin: vin })
.then((res) => {
_this.carLoading = false;
let list = res.data || [];
_this.vehicleList = list;
_this.currentVehicle = list[0] || {};
if (list[0]) {
_this.$set(_this.carInfoForm, "vehicleId", list[0].vehicleId);
}
})
.catch((error) => {
_this.carLoading = false;
});
},
// 订单关联车辆
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 SAVE_RELINKVEHICLE_INFO(oParams);
_this.aloading = false;
if (res.code != 200) {
showToast({
message: res.message,
type: "error",
});
return false;
}
showToast({
message: "关联成功",
type: "success",
});
_this.closeCarDialog();
_this.getList(1);
console.log(res);
},
// 监听车辆选择
onCarChange(e) {
console.log(e);
let list = this.vehicleList;
let n = list.find((k) => k.vehicleId == e);
this.currentVehicle = n || {};
},
// 工单重推
workOrderRePush(row) {
this.$confirm(`是否工单重推?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
REPUSH_TO_BHG({ id: row.id }).then((res) => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '操作成功'
})
_this.getList();
} else {
this.$message({
type: 'error',
message: '操作失败'
})
}
})
})
}
},
};
</script>
<style lang="scss" scoped>
@import '@/styles/order.scss';
</style>