order.vue
18.3 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
<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()">搜索</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="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="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="center" width="180px">
<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>
<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>
<!-- <el-link class="el_link" type="primary" v-if="row.status == 2" @click="lookDetail(row,5)">照片编辑</el-link> -->
<auth-link class="el_link" type="primary" v-if="row.status == 2" uid="14010101" @click.native="lookDetail(row,5)">照片编辑</auth-link>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination background layout="sizes, total,prev, pager, next, jumper" :total="pageTotal" :page-size.sync="currentPage" :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 -->
</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,
} 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 moment from "moment";
import AuthLink from "@/components/auth-button/link";
import axios from "axios";
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: {},
};
},
watch: {
$route: {
handler: function (n, o) {
console.log(n);
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.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) {
console.log(file);
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;
}
console.log(this.uploadFile);
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;
_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;
console.log(e);
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() {
console.log("保存工单");
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() {
console.log("保存工单");
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`;
history.pushState(oParams, "车辆列表", path);
},
// 审核工单
auditWorkOrderInfo() {
this.aloading = true;
this.$refs.editOrderCom.auditWorkOrderInfo();
},
// 保存工单
saveImageInfo() {
this.aloading = true;
this.$refs.editOrderCom.saveImageInfo();
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/order.scss";
</style>