index.vue
21.7 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
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="108px">
<el-form-item label="办文办事类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择办文办事类型" size="small">
<el-option label="全部" value=""/>
<el-option label="传阅学习类" value="0" />
<el-option label="公文批办类" value="1" />
<el-option label="热线举报类" value="2" />
<el-option label="上级信访类" value="3" />
<el-option label="现场信访类" value="4" />
</el-select>
</el-form-item>
<el-form-item label="来文单位" prop="company">
<el-input
v-model="queryParams.company"
placeholder="请输入来文单位"
size="small"
/>
</el-form-item>
<el-form-item label="收文时间" prop="receiveTime">
<el-date-picker size="small" style="width: 200px"
v-model="queryParams.receiveTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择收文时间">
</el-date-picker>
</el-form-item>
<el-form-item label="文件标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入文件标题"
size="small"
/>
</el-form-item>
<el-form-item label="信访单位(人)" prop="sendPerson">
<el-input
v-model="queryParams.sendPerson"
placeholder="请输入信访单位(人)"
size="small"
/>
</el-form-item>
<el-form-item label="信访日期" prop="sendDate">
<el-date-picker size="small" style="width: 200px"
v-model="queryParams.sendDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择收文时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['office:handle:add']"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['office:handle:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['office:handle:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['office:handle:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="handleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type='index'/>
<el-table-column label="办文办事类型" align="center" prop="type" >
<template slot-scope="scope">
<span>{{ typeOfName(scope.row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="公文类" align="center">
<el-table-column label="来文单位" align="center" prop="company" :show-overflow-tooltip="true"/>
<el-table-column label="收文时间" align="center" prop="receiveTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.receiveTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="文件标题" align="center" prop="title" :show-overflow-tooltip="true"/>
</el-table-column>
<el-table-column label="信访类" align="center">
<el-table-column label="信访单位(人)" align="center" prop="sendPerson" :show-overflow-tooltip="true"/>
<el-table-column label="信访日期" align="center" prop="sendDate" />
<el-table-column label="诉求" align="center" prop="appeal" :show-overflow-tooltip="true"/>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="status">
<template slot-scope="scope">
<span>{{parseStatusz(scope.row.status)}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleInfo(scope.row)"
v-hasPermi="['office:handle:edit']"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.status==2"
v-hasPermi="['office:handle:edit']"
>修改</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['office:handle:remove']"-->
<!-- >删除</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改办文办事对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="办文办事类型" prop="type">
<el-select v-model="form.type" placeholder="请选择办文办事类型" style="width: 100%" @change="changeType()">
<el-option label="传阅学习类" value="0" />
<el-option label="公文批办类" value="1" />
<el-option label="热线举报类" value="2" />
<el-option label="上级信访类" value="3" />
<el-option label="现场信访类" value="4" />
</el-select>
</el-form-item>
<!-- 公文类 -->
<el-form-item label="来文单位" prop="company" v-if="form.type==0 || form.type==1">
<el-input v-model="form.company" placeholder="请输入来文单位" />
</el-form-item>
<el-form-item label="收文时间" prop="receiveTime" v-if="form.type==0 || form.type==1">
<el-date-picker size="small" style="width: 100%"
v-model="form.receiveTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择收文时间">
</el-date-picker>
</el-form-item>
<el-form-item label="文件标题" prop="title" v-if="form.type==0 || form.type==1">
<el-input v-model="form.title" placeholder="请输入文件标题" />
</el-form-item>
<!-- 信访类 -->
<el-form-item label="信访单位(人)" prop="sendPerson" v-if="form.type==2 || form.type==3|| form.type==4">
<el-input v-model="form.sendPerson" placeholder="请输入信访单位(人)" />
</el-form-item>
<el-form-item label="信访日期" prop="sendDate" v-if="form.type==2 || form.type==3|| form.type==4">
<el-date-picker size="small" style="width: 100%"
v-model="form.sendDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择信访日期">
</el-date-picker>
</el-form-item>
<el-form-item label="诉求" prop="appeal" v-if="form.type==2 || form.type==3|| form.type==4">
<el-input v-model="form.appeal" type="textarea" placeholder="请输入内容" :rows="6"/>
</el-form-item>
<el-form-item>
<vue-preview :slides="slide1"></vue-preview>
</el-form-item>
<el-row>
<el-col>
<el-form-item prop="fileEntityList" label="附件">
<el-upload
ref="upload"
action=""
accept=".docx,.xlsx,.xls,.ppt,.rar,.zip,.doc,.pdf,.png,.jpeg,.png,.jpg"
:on-change="fileChange"
:auto-upload="false"
:show-file-list="false"
multiple
:file-list="fileEntityList">
<el-button size="small" type="primary" icon="el-icon-upload">上传附件</el-button>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-table :data="fileEntityList">
<el-table-column property="name" label="附件名称" header-align="center" align="center"></el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" header-align="center" align="center">
<template slot-scope="scope">
<el-button
size="small" type="success"
icon="el-icon-download"
@click="downloadFA(scope.row)"
v-hasPermi="['office:management:edit']"
v-if="form.id!=null"
round>下载
</el-button>
<el-button
size="small" type="danger"
icon="el-icon-delete"
@click="handleDeleteFile(scope.$index)"
v-hasPermi="['office:management:remove']"
round>删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="openInfo" width="600px" append-to-body>
<handleInfo :idInfo="idInfo" v-if="openInfo" :businessKey="businessKey" :depts="depts"/>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listHandle, getHandle, delHandle, addHandle, updateHandle, exportHandle } from "@/api/office/handle";
import handleInfo from "./handleInfo";
import {getDict} from "@/api/dict";
export default {
name: "Handle",
components: { handleInfo },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 办文办事表格数据
handleList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
company: null,
receiveTime: null,
title: null,
type: null,
sendPerson: null,
sendDate:null,
},
// 表单参数
form: {},
// 表单校验
rules: {
company: [
{required: true, message: "必填", trigger: "blur"}
],
receiveTime: [
{required: true, message: "必填", trigger: "blur"}
],
title: [
{required: true, message: "必填", trigger: "blur"}
],
appeal: [
{required: true, message: "必填", trigger: "blur"}
],
sendPerson: [
{required: true, message: "必填", trigger: "blur"}
],
sendDate: [
{required: true, message: "必填", trigger: "blur"}
],
},
fileEntityList: [],
idInfo: null,
openInfo: false,
businessKey:null,
depts:[],
slide1: []
};
},
watch: {
fileEntityList(value) {
this.slide1 = []
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({
src: URL.createObjectURL(item.raw),
msrc: URL.createObjectURL(item.raw),
alt: item.uid,
w: 1920,
h: 1080
});
}else{
this.slide1.push({
src: process.env.VUE_APP_BASE_API + item.url,
msrc: process.env.VUE_APP_BASE_API + item.url,
w: 1920,
h: 1080
});
}
}
})
}
}
},
created() {
let dep = {type:"CSUserDepartmentType"};
getDict(dep).then(res=>{
this.depts = res.result;
});
this.getList();
},
methods: {
/** 查询办文办事列表 */
getList() {
this.loading = true;
listHandle(this.queryParams).then(response => {
this.handleList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.openInfo = false;
this.businessKey = null;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
company: null,
receiveTime: null,
title: null,
type: null,
appeal: null,
sendPerson: null,
sendDate: null,
isRead: null,
opinion: null,
deptOpinion: null,
};
this.fileEntityList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加办文办事";
},
/** 查看详情 */
handleInfo(row){
this.idInfo = row.id+"";
this.openInfo = true;
this.title = "办文办事详情";
if(row.type==0){
this.businessKey = 'yuelanxuexi1';
}else if(row.type==1){
this.businessKey = 'gongwenchuli';
}
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getHandle(id).then(response => {
this.form = response.data.handleAffairs;
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) {
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("handleAffairs", 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"));
}
})
updateHandle(formData).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
for (let key in form) {
formData.append(key, form[key] == null ? "" : form[key])
}
addHandle(formData).then(response => {
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 delHandle(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有办文办事数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportHandle(queryParams);
}).then(response => {
this.download(response.message);
})
},
/**
* 文件改变时,限制文件上传格式和大小
* 文件格式只能为docx/xlsx/xls/ppt/rar/zip/doc/pdf/png/jpeg/png/jpg
* 大小不超过5M
* */
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,xlsx,xls,ppt,rar,zip,doc,pdf,png,jpeg,png,jpg".indexOf(fileType) != -1) {
let max5M = file.size / 1024 / 1024 < 5;
if (!max5M) {
this.$message({
message: '上传文件大小不得超过5M!',
type: 'warning'
});
fileList = fileList.splice(fileList.length - 1, 1);
} else {
//符合条件后进行添加
this.fileEntityList = fileList
}
} else {
this.$message({
message: '上传文件只能是 docx、xlsx、xls、ppt、rar、zip、doc、pdf、png、jpeg、png、jpg格式!',
type: 'warning'
});
fileList = fileList.splice(fileList.length - 1, 1);
}
},
// 删除文件
handleDeleteFile(index) {
this.fileEntityList.splice(index, 1);
this.slide1.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()
},
typeOfName(type){
if(type==0){
return "传阅学习";
}else if(type==1){
return "公文批办";
}else if(type==2){
return "热线举报";
}else if(type==3){
return "上级信访"
}else if(type==4){
return "现场信访"
}
},
changeType(){
if(this.form.type==0 || this.form.type==1){
this.form.sendPerson = null;
this.form.sendDate = null;
this.form.appeal = null;
this.rules.title[0].required = true;
this.rules.company[0].required = true;
this.rules.receiveTime[0].required = true;
this.rules.sendPerson[0].required = false;
this.rules.sendDate[0].required = false;
this.rules.appeal[0].required = false;
}else if(this.form.type==2 || this.form.type==3 || this.form.type==4 ){
this.form.title = null;
this.form.company = null;
this.form.receiveTime = null;
this.rules.title[0].required = false;
this.rules.company[0].required = false;
this.rules.receiveTime[0].required = false;
this.rules.sendPerson[0].required = true;
this.rules.sendDate[0].required = true;
this.rules.appeal[0].required = true;
}
},
parseStatusz(status) {
if(status==1){
return "审批通过";
}else if(status==2){
return "审批驳回";
}else if(status==3){
return "收文完成";
}else{
return "审批中";
}
}
}
};
</script>