vio_casefile.js
18.2 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
import {
addViolationCaseFile,
delViolationCaseFile,
exportViolationCaseFile,
getViolationCaseFile,
listViolationCaseFile,
updateViolationCaseFile,
deleteUpCase,
delayUpCase,
} from "@/api/casefile/violationCaseFile";
import violationCaseFileInfo from "@/views/h5/task/violationCaseFileInfo";
import h5Info from "@/views/h5/task/violationCaseFileInfo";
import h5Page from "@/views/h5/Pagination";
import {companyList, constructionsitesList, earthsitesList, getArea,} from "@/api/dict";
export default {
name: "ViolationCaseFile",
components: {
violationCaseFileInfo,
h5Page,
h5Info
},
data() {
return {
modalLoading:false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 预警信息表格数据
violationCaseFileList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
number: null,
violationObjectType: null,
owningRegion: null,
violationType: null,
violationGrade: null,
projectName: null,
companyName: null,
describe: null,
sendObject: null,
status: null,
receive: null,
receiveStatus: null,
readBy: null,
readTime: null,
isAsc:"DESC",
orderByColumn:"casefile_violation desc,createTime"
},
// 表单参数
form: {},
place: null,
// 表单校验
rules: {
number: [
{required: true, message: "必填", trigger: "blur"}
],
violationObjectType: [
{required: true, message: "必填", trigger: "blur"}
],
owningRegion: [
{required: true, message: "必填", trigger: "blur"}
],
violationType: [
{required: true, message: "必填", trigger: "blur"}
],
},
caseType: [],
projectNameList: {},
isLoading: false,
fileEntityList: [],
companyList: [],
remoteQueryData: {
"page": 1,
"size": 100
},
areas: [],
data: {},
isLoadingCompany: false,
idInfo: null,
openInfo: false,
slide1: [],
videoSrc: [],
object:null,
funIdx:null,
delayDialog:false,
deleteDialog:false,
};
},
watch: {
fileEntityList(value) {
this.slide1 = []
this.videoSrc = []
if (this.fileEntityList.length != 0) {
this.fileEntityList.map(item => {
if (item.name.indexOf(".jpg") > -1 || item.name.indexOf(".png") > -1 || item.name.indexOf(".jpeg") > -1 || item.name.indexOf(".jpg") > -1) {
if (item.raw != null) {
this.slide1.push(URL.createObjectURL(item.raw));
} else {
if(item.url.startsWith("https:")){
this.slide1.push(item.url);
}else{
this.slide1.push(process.env.VUE_APP_BASE_API + item.url);
}
}
}
if (item.name.indexOf(".mp4") > -1 || item.name.indexOf(".avi") > -1) {
if (item.raw != null) {
this.videoSrc.push(URL.createObjectURL(item.raw));
} else {
if(item.url.startsWith("https:")){
this.videoSrc.push(item.url);
}else{
this.videoSrc.push(process.env.VUE_APP_BASE_API + item.url);
}
}
}
})
}
}
},
created() {
this.listData({dictType:"vio_casefile"}).then(res=>{
this.caseType = res.rows;
});
getArea().then(res => {
this.areas = res.result;
});
constructionsitesList(this.remoteQueryData).then(res => {
this.projectNameList["0"] = res.result.list;
});
earthsitesList(this.remoteQueryData).then(res => {
this.projectNameList["1"] = res.result.list;
});
companyList(this.remoteQueryData).then(res => {
this.companyList = res.result.list;
});
if(window.location.search){
let params = window.location.search.replace("?","");
let arr = params.split("&");
let type = -1;
let name = null;
for(let j in arr){
if(arr[j].split("=")[0] == "objType"){
if(arr[j].split("=")[1] == "company"){
type = 1;
this.queryParams.violationObjectType = "2";
}else if(arr[j].split("=")[1] == "construction"){
type = 0;
this.queryParams.violationObjectType = "0";
}else if(arr[j].split("=")[1] == "earthSite"){
type = 0;
this.queryParams.violationObjectType = "1";
}
}
if(arr[j].split("=")[0] == "objValue"){
name = arr[j].split("=")[1];
}
}
if(type == 0){
this.queryParams.projectName = decodeURIComponent(name);
}
if(type == 1){
this.queryParams.companyName = decodeURIComponent(name);
}
}
this.getList();
},
methods: {
getAreaName(code){
for(let i in this.areas){
if(this.areas[i].code == code){
this.form.owningRegion = this.areas[i].name;
this.form.place = this.areas[i].code ;
break;
}
}
},
getCaseStatus(item){
if(item.status == 2){
return "被驳回";
}
if(item.status == 1){
return "结案存档";
}
if(item.status1 && Number(item.status1) == 1){
return "已回复";
}
if(item.status1 && Number(item.status1) > 1){
return "审核中";
}
return "未回复";
},
getCaseType(type){
for(let i in this.caseType){
if(this.caseType[i].dictValue == type){
return this.caseType[i].dictLabel;
}
}
return type;
},
openFunction(obj,idx){
this.object = obj;
if(idx == 1){
this.deleteDialog = true;
this.reason = "综管回退"
}else if(idx == 2){
this.delayDialog = true;
this.reason = "延期处理"
}
},
deleteUpCase(){
if(!this.form.describe){
this.$message("请填写理由!");
return;
}
this.object.describe = this.form.describe;
deleteUpCase(this.object).then(res=>{
this.deleteDialog = false;
this.getList();
});
},
delayUpCase(){
debugger;
if(!this.form.describe){
this.$message("请填写理由!");
return;
}
this.object.describe = this.form.describe;
this.object.timeType = this.form.timeType;
this.object.delayedTime = this.form.delayedTime;
delayUpCase(this.object).then(res=>{
this.delayDialog = false;
this.getList();
});
},
getRemoteDate(value){
this.remoteQueryData.name =value;
constructionsitesList(this.remoteQueryData).then(res => {
this.projectNameList["0"] = res.result.list;
this.$forceUpdate();
});
earthsitesList(this.remoteQueryData).then(res => {
this.projectNameList["1"] = res.result.list;
this.$forceUpdate();
});
},
// selectArea(item) {
// this.form.owningRegion = item.name;
// },
/** 查询预警信息列表 */
getList() {
this.loading = true;
if(this.queryParams.createTime){
this.queryParams.startTime = this.queryParams.createTime[0];
this.queryParams.endTime = this.queryParams.createTime[1];
}
let query = {};
for(var i in this.queryParams){
query[i] = this.queryParams[i];
}
query.createTime = null;
if(query.owningRegion)
query.owningRegion = query.owningRegion + ""
listViolationCaseFile(query).then(response => {
this.violationCaseFileList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.openInfo = false;
this.reset();
},
// 表单重置
reset() {
this.fileEntityList = [];
this.form = {
id: null,
number: null,
violationObjectType: null,
owningRegion: null,
violationType: null,
violationGrade: null,
projectName: null,
companyName: null,
describe: null,
sendObject: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
status: 0,
receive: null,
receiveStatus: 0,
readBy: null,
readTime: null
};
this.rules.companyName = [{required: false, message: "必填", trigger: "blur"}]
this.rules.projectName = [{required: false, message: "必填", trigger: "blur"}]
this.remoteQueryData.name = null;
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.violationObjectType =null;
this.queryParams.projectName = null;
this.queryParams.companyName = null;
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleInfo(row) {
this.idInfo = row.id + "";
this.openInfo = true;
this.title = "预警信息详情";
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.form.projectName = null;
this.getRemoteDate();
this.form.number = this.getNumber();
this.form.violationGrade = "一般类";
this.form.sendObject = "区管理部门";
this.title = "添加预警信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getViolationCaseFile(id).then(response => {
this.form = response.data.violationCaseFile;
let files = JSON.stringify(response.data.uploadFiles);
this.fileEntityList = JSON.parse(files.replaceAll("filePath", "url").replaceAll("fileName", "name"))
this.open = true;
this.title = "修改预警信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.sendObject == "运输企业" && this.form.companyName == null) {
this.$message("请选择相关企业");
return;
}
this.modalLoading = true;
let formData = new FormData();
let form = this.form;
//去掉params属性
delete form.params;
formData.append('fileList', null);
//将新增的文件放入formData
this.fileEntityList.forEach(item => {
if (item.id == null) {
formData.append('fileList', item.raw)
}
})
if (this.form.id != null) {
formData.append("violationCaseFile", JSON.stringify(form));
formData.append("uploadFilesList", null);
this.fileEntityList.forEach(item => {
delete item.params;
if (item != "null" && item != null) {
formData.append('uploadFilesList', JSON.stringify(item).replaceAll("url", "filePath").replaceAll("name", "fileName"));
}
})
updateViolationCaseFile(formData).then(response => {
this.modalLoading = false;
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
for (let key in form) {
formData.append(key, form[key] == null ? "" : form[key])
}
addViolationCaseFile(formData).then(response => {
this.modalLoading = false;
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除预警信息编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delViolationCaseFile(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
if(this.queryParams.createTime){
this.queryParams.startTime = this.queryParams.createTime[0];
this.queryParams.endTime = this.queryParams.createTime[1];
}
const query = {};
for(var i in this.queryParams){
query[i] = this.queryParams[i];
}
query.createTime = null;
if(query.owningRegion)
query.owningRegion = query.owningRegion + ""
this.$confirm('是否确认导出所有预警信息数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportViolationCaseFile(query);
}).then(response => {
this.download(response.message);
})
},
/** 生成案卷编号 */
getNumber() {
const now = new Date();
const year = now.getFullYear().toString().slice(-2); // 提取后两位数
const month = now.getMonth() + 1 < 10 ? `0${now.getMonth() + 1}` : now.getMonth() + 1;
const day = now.getDate() < 10 ? `0${now.getDate()}` : now.getDate();
const hour = now.getHours() < 10 ? `0${now.getHours()}` : now.getHours();
const minute = now.getMinutes() < 10 ? `0${now.getMinutes()}` : now.getMinutes();
const second = now.getSeconds() < 10 ? `0${now.getSeconds()}` : now.getSeconds();
const millisecond = now.getMilliseconds();
const code = `${year}${month}${day}${hour}${minute}${second}${millisecond}`;
return code;
},
getCompanys(value){
let query = {
name:value,
page:1,
size:100
};
companyList(query).then(res => {
this.companyList = res.result.list;
});
},
companyLoadOptions(query) {
// 根据输入的关键字query异步加载选项数据
this.isLoadingCompany = true
setTimeout(() => {
// 模拟异步加载数据
const data = [
{name: '公司1'},
{name: '公司2'},
{name: '公司3'}
].filter(item => item.name.includes(query))
this.companyList = data
this.isLoadingCompany = false
}, 200)
},
/**
* 文件改变时,限制文件上传格式和大小
* 文件格式只能为docx/doc/pdf/png/jpeg/png/jpg
* 大小不超过20M
* */
fileChange(file, fileList) {
let count = 0;
for (let i = 0; i < fileList.length; i++) {
// console.log(fileList.length)
// console.log(this.fileEntityList[i].name+"111"+file.name)
if (fileList[i].name == file.name) {
count++;
if (count == 2) {
this.$message({
message: '已存在此文件!',
type: 'warning'
});
for (let j = fileList.length; j > 0; j--) {
//如果存在此文件,去除新选择的重复文件
if (fileList[j - 1].name == file.name) {
fileList.splice(j - 1, 1);
i--;
return false;
}
}
}
}
}
let fileType = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase();
//格式符合后判断大小
if ("docx,doc,pdf,png,jpeg,png,jpg,mp4,avi".indexOf(fileType) != -1) {
let max5M = file.size / 1024 / 1024 < 100;
if (!max5M) {
this.$message({
message: '上传文件大小不得超过100M!',
type: 'warning'
});
fileList = fileList.splice(fileList.length - 1, 1);
} else {
//符合条件后进行添加
this.fileEntityList = fileList
}
} else {
this.$message({
message: '上传文件只能是 docx、doc、pdf、png、jpeg、png、jpg、mp4、avi格式!',
type: 'warning'
});
fileList = fileList.splice(fileList.length - 1, 1);
}
},
// 删除文件
handleDeleteFile(index) {
this.fileEntityList.splice(index, 1);
this.slide1.splice(index, 1);
this.videoSrc.splice(index, 1);
},
/** 文件下载 */
downloadFA(row) {
let name = row.name;
let url = row.url;
const a = document.createElement('a')
a.setAttribute('download', name)
a.setAttribute('target', '_blank')
a.setAttribute('href', process.env.VUE_APP_BASE_API + url);
a.click()
},
/** 生成违规描述 */
createDescribe() {
this.$refs["form"].validate(valid => {
if (valid) {
let formData = this.form;
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1 < 10 ? `0${now.getMonth() + 1}` : now.getMonth() + 1;
const day = now.getDate() < 10 ? `0${now.getDate()}` : now.getDate();
const hour = now.getHours() < 10 ? `0${now.getHours()}` : now.getHours();
const minute = now.getMinutes() < 10 ? `0${now.getMinutes()}` : now.getMinutes();
const second = now.getSeconds() < 10 ? `0${now.getSeconds()}` : now.getSeconds();
const code = `${year}/${month}/${day} ${hour}:${minute}:${second}`;
let companyName = formData.companyName ? formData.companyName : "";
let projectName = formData.projectName ? formData.projectName : "";
for(let i in this.caseType){
if(this.caseType[i].dictValue == formData.violationType){
this.form.describe = code + companyName + "在" + projectName + "出现" + this.caseType[i].dictLabel;
break;
}
}
this.rules.companyName = null;
this.rules.projectName = null;
}
});
}
}
};