index.vue
22.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
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" >
<el-form-item label="合同编号" prop="contractno">
<el-input v-model="queryParams.contractno" placeholder="请输入合同编号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="queryParams.contractName" placeholder="请输入合同名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" 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="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:contract:remove']" >删除</el-button >
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:contract:export']" >导出</el-button >
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange" >
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="合同编号" align="center" prop="contractno" width="100" />
<el-table-column label="合同名称" align="center" prop="contractName" width="200" />
<el-table-column label="合同类型" align="center" prop="contractType" width="100" />
<el-table-column label="合同金额" align="center" prop="contractAmount" width="100" />
<el-table-column label="生效日期" align="center" prop="effectiveDate" width="100" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.effectiveDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="到期日期" align="center" prop="expirationDate" width="100" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.expirationDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="甲方" align="center" prop="partyA" width="200">
<template slot-scope="scope">
<a :href="scope.row.partyAAddress" target="_blank" style="color: #1890ff" >{{ scope.row.partyA }}</a >
</template>
</el-table-column>
<el-table-column label="乙方" align="center" prop="partyB" width="200">
<template slot-scope="scope">
<a :href="scope.row.partyBAddress" target="_blank" style="color: #1890ff" >{{ scope.row.partyB }}</a >
</template>
</el-table-column>
<el-table-column label="付款方式" align="center" prop="paymentMethod" width="200" />
<el-table-column label="签订日期" align="center" prop="signingDate" width="100" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.signingDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="标的物信息" align="center" prop="subjectInformation" width="200" />
<el-table-column label="合同状态" align="center" prop="status" width="200" >
<template slot-scope="scope">
<el-tag v-if="scope.row.status == '0'">进行中</el-tag>
<el-tag type="danger" v-if="scope.row.status == '1'">已终止</el-tag>
<el-tag type="info" v-if="scope.row.status == '2'">已解除</el-tag>
<el-tag type="warning" v-if="scope.row.status == '3'">已完成</el-tag>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="approvalTatus" width="200" >
<template slot-scope="scope">
<dict-tag :options="dict.type.wf_process_status" :value="scope.row.processStatus"/>
</template>
</el-table-column>
<el-table-column label="附件" align="center" prop="attachments" width="100" >
<template slot-scope="scope">
<img v-if="scope.row.attachments" src="@/assets/images/PDF.png" @click="preview(scope.row.attachments)" width="40px" height="auto" style="cursor: pointer" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200" >
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-tickets" @click="handleFlowRecord(scope.row)" v-hasPermi="['workflow:process:query']" >详情</el-button >
<el-button type="text" size="mini" icon="el-icon-upload" v-if="scope.row.processStatus =='completed' && !scope.row.sealContract" @click="handleUploadSealContract(scope.row)" >上传合同</el-button >
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" >
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleAgain" icon="el-icon-refresh-right"
>重新发起</el-dropdown-item>
<el-dropdown-item command="handleDelete" icon="el-icon-delete" v-hasPermi="['workflow:process:remove']"
>删除</el-dropdown-item>
<el-dropdown-item command="handleStop" icon="el-icon-delete" v-hasPermi="['workflow:process:cancel']"
>取消</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</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="合同预览" :visible.sync="dialogVisibleContract" width="50%" center :before-close="handleClose" >
<pdf :src="pdfUrl" type="application/pdf" width="100%" height="800px" v-if="pdfUrl" />
</el-dialog>
<!-- 添加或修改【请填写功能名称】对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="变更原因" prop="reasonChange">
<el-input v-model="form.reasonChange" placeholder="请输入变更原因" />
</el-form-item>
<el-form-item label="变更内容" prop="reasonText">
<el-input type="textarea" v-model="form.reasonText" placeholder="请输入变更内容" :row="3" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm" >确 定</el-button >
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 履行评价 -->
<el-dialog :title="title" :visible.sync="showDialogEvaluate">
<el-table :data="tableData" style="width: 100%" border>
<el-table-column prop="content" label="内容" width="200"></el-table-column>
<el-table-column prop="description" label="评价描述" width="350">
<template slot-scope="scope">
<el-input v-model="scope.row.description"
clearable
/>
</template>
</el-table-column>
<el-table-column prop="level" label="评价等级">
<template slot-scope="scope">
<el-radio v-model="scope.row.level" label="1">优秀</el-radio>
<el-radio v-model="scope.row.level" label="2">良好</el-radio>
<el-radio v-model="scope.row.level" label="3">一般</el-radio>
<el-radio v-model="scope.row.level" label="4">较差</el-radio>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitFormEvaluate"
>确 定</el-button
>
<el-button @click="cancelEvaluate">取 消</el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="showContractAmount" width="500px">
<el-table :data="ContractAmountList" >
<el-table-column prop="amountDate" label="日期" ></el-table-column>
<el-table-column prop="amount" label="已付/已收金额(元)" >
</el-table-column>
</el-table>
</el-dialog>
<el-dialog :title="title" :visible.sync="showDialogUploadSealContract" width="500px">
<el-upload
class="upload-demo"
ref="upload"
:accept="'application/pdf'"
:before-upload="beforeUpload"
:action="this.url"
:headers="this.headers"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-change="handleChange"
:file-list="this.fileList"
:auto-upload="false"
:limit="1"
:multiple="false"
:on-success="handleSuccess"
:before-remove="beforeRemove"
:on-exceed="handleExceed"
name="files"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px" size="small" type="success" @click="submitUpload" >上传到服务器</el-button>
<div slot="tip" class="el-upload__tip">只能上传大小不超过 5MB 的 PDF 文件</div>
</el-upload>
</el-dialog>
</div>
</template>
<script>
import {listContract,getContract,delContract,addContract,updateContract,updateSealByContractno} from "@/api/compliancemanagement/contract";
import { startProcess, stopProcess } from "@/api/workflow/process";
import pdf from 'vue-pdf';
import { getToken } from "@/utils/auth";
export default {
name: "Contract",
dicts: ['wf_process_status'],
components: {
pdf,
},
data() {
return {
headers: {
Authorization: "Bearer " + getToken(),
},
url: process.env.VUE_APP_BASE_API + "/common/uploads",
fileList: [],
ContractAmountList:[
{amountDate:'2024-07-05',
amount:'100'},{amountDate:'2024-07-10',
amount:'100'}
],
showContractAmount:false,
tableData: [{
content: '合同规范性',
description: '',
level: ''
}, {
content: '质量',
description: '',
level: ''
}, {
content: '交期(工期)',
description: '',
level: ''
}, {
content: '成本',
description: '',
level: ''
},{
content: '合作配合情况',
description: '',
level: ''
}],
switchValue: true,
pdfUrl: "",
dialogVisibleContract: false,
baseUrl: process.env.VUE_APP_BASE_API + "/",
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 【请填写功能名称】表格数据
contractList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
contractno: undefined,
contractName: undefined,
contractType: undefined,
contractAmount: undefined,
effectiveDate: undefined,
expirationDate: undefined,
partyA: undefined,
partyB: undefined,
paymentMethod: undefined,
signingDate: undefined,
subjectInformation: undefined,
attachments: undefined,
},
// 表单参数
form: {},
biangeng: [],
// 表单校验
rules: {
contractno: [
{ required: true, message: "合同编号不能为空", trigger: "blur" },
],
contractName: [
{ required: true, message: "合同名称不能为空", trigger: "blur" },
],
contractType: [
{ required: true, message: "合同类型不能为空", trigger: "change" },
],
contractAmount: [
{ required: true, message: "合同金额不能为空", trigger: "blur" },
],
effectiveDate: [
{ required: true, message: "生效日期不能为空", trigger: "blur" },
],
expirationDate: [
{ required: true, message: "到期日期不能为空", trigger: "blur" },
],
partyA: [{ required: true, message: "甲方不能为空", trigger: "blur" }],
partyB: [{ required: true, message: "乙方不能为空", trigger: "blur" }],
paymentMethod: [
{ required: true, message: "付款方式不能为空", trigger: "blur" },
],
signingDate: [
{ required: true, message: "签订日期不能为空", trigger: "blur" },
],
subjectInformation: [
{ required: true, message: "标的物信息不能为空", trigger: "blur" },
],
attachments: [
{ required: true, message: "附件不能为空", trigger: "blur" },
],
reasonChange: [
{ required: true, message: "变更原因不能为空", trigger: "blur" },
],
reasonText: [
{ required: true, message: "变更内容不能为空", trigger: "blur" },
],
id: [{ required: true, message: "不能为空", trigger: "blur" }],
},
showDialogEvaluate:false,
showDialogUploadSealContract:false,
contractnoTemp:''
};
},
created() {
this.getList();
},
methods: {
handleUploadSealContract(row){
this.contractnoTemp = row.contractno
this.showDialogUploadSealContract = true
this.title = '上传用印合同'
},
beforeUpload(file) {
const isPDF = file.type === 'application/pdf';
const isLt5M = file.size / 1024 / 1024 < 5;
if (!isPDF) {
this.$message.error('只能上传 PDF 文件');
return false;
}
if (!isLt5M) {
this.$message.error('上传文件大小不能超过 5MB');
return false;
}
// 如果需要其他处理,可以在这里添加
return true; // 返回 true 允许上传
},
handleChange(file, fileList) {
this.fileList = fileList;
},
handleSuccess(response, file, fileList) {
// response 是上传成功后的响应数据
// 可以从中获取文件地址或文件名
// 假设后端返回的数据结构中有一个字段 url 表示文件地址
console.log('response',response)
this.showDialogUploadSealContract = false
const fileUrl = response.data.fileNames;
// 将文件地址或文件名赋值给表单的字段
this.form.templatefile =fileUrl;
const params = {
contractno:this.contractnoTemp,
sealContract:fileUrl
}
updateSealByContractno(params).then((response) => {
console.log('上传更新',response),
this.form.templatefile = ''
});
this.fileList = []
this.$router.push({
path: "/contract/compliancemanagement/contractmanagement/contractfiling",
});
},
handleRemove(file, fileList) {
this.form.templatefile=''
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(
`当前限制上传 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
files.length + fileList.length
} 个文件`
);
},
beforeRemove(file, fileList) {
this.fileList = fileList;
if (file && file.status==="success") {
return this.$confirm(`确定移除 ${file.name}?`);
}
},
submitUpload() {
this.$refs.upload.submit();
},
handleContractAmount(row){
this.showContractAmount = true
this.title = '进度'
},
// 更多操作触发
handleCommand(command, row) {
switch (command) {
case "handleAgain":
this.handleAgain(row);
break;
case "handleEvaluate":
this.handleEvaluate(row);
break;
case "handleEdit":
this.handleEdit(row);
break;
case "handleUnbind":
this.handleUnbind(row);
break;
case "handleDelete":
this.handleDelete(row);
break;
case "handleStop":
this.handleStop(row);
break;
default:
break;
}
},
handleUnbind(row){
console.log(row)
},
/** 查询【请填写功能名称】列表 */
getList() {
this.loading = true;
listContract(this.queryParams).then((response) => {
this.contractList = response.rows;
this.total = response.total;
this.loading = false;
console.log(this.contractList);
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
//合同附件预览
preview(contract) {
this.dialogVisibleContract = true;
console.log("contract:", contract);
// this.pdfUrl = process.env.VUE_APP_BASE_API+contract;
this.pdfUrl = this.baseUrl+contract;
},
handleClose() {
this.pdfUrl = "";
this.dialogVisibleContract = false;
},
// 表单重置
reset() {
this.form = {
contractno: undefined,
contractName: undefined,
contractType: undefined,
contractAmount: undefined,
effectiveDate: undefined,
expirationDate: undefined,
partyA: undefined,
partyB: undefined,
paymentMethod: undefined,
signingDate: undefined,
subjectInformation: undefined,
attachments: undefined,
reasonChange: undefined,
reasonText: undefined,
id: undefined,
};
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 = "添加";
// },
/** 合同变更按钮操作 */
handleEdit(row) {
this.loading = true;
this.reset();
this.biangeng = row;
console.log("变更值:", this.biangeng);
const id = row.id || this.ids;
getContract(id).then((response) => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "合同变更";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.buttonLoading = true;
if (this.form.id != null) {
updateContract(this.biangeng.procDefId,this.form)
.then((response) => {
this.$modal.msgSuccess("合同变更成功,已重新启动流程");
this.open = false;
this.getList();
console.log("变更列表值:", this.biangeng);
// this.handleAgain2(this.biangeng);
})
.finally(() => {
this.buttonLoading = false;
});
} else {
addContract(this.form)
.then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
})
.finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?')
.then(() => {
this.loading = true;
return delContract(ids);
})
.then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {})
.finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/contract/export",
{
...this.queryParams,
},
`contract_${new Date().getTime()}.xlsx`
);
},
/** 流程流转记录 */
handleFlowRecord(row) {
console.log(row);
this.$router.push({
path: "/workflow/process/detail/" + row.procInsId,
query: {
processed: false,
},
});
},
/** 取消流程申请 */
handleStop(row) {
const params = {
procInsId: row.procInsId,
};
stopProcess(params).then((res) => {
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
handleAgain(row) {
console.log(row);
startProcess(row.procDefId, row).then((res) => {
if (res) {
this.$modal.msgSuccess("流程重启动成功");
}
});
// this.$router.push({
// path: "/workflow/process/start/" + row.deployId,
// query: {
// definitionId: row.procDefId,
// procInsId: row.procInsId,
// },
// });
// console.log(row);
},
// handleAgain2(row) {
// console.log(row);
// startProcess(row.procDefId, row).then((res) => {});
// },
handleEvaluate(row){
console.log('评价',row)
this.title = row.contractName
this.showDialogEvaluate = true
},
submitFormEvaluate(){
console.log(this.tableData)
this.showDialogEvaluate = false
},
cancelEvaluate(){
this.showDialogEvaluate = false
}
},
};
</script>
<style>
/* switch按钮样式 */
.switch .el-switch__label {
position: absolute;
display: none;
color: #fff !important;
}
/*打开时文字位置设置*/
.switch .el-switch__label--right {
z-index: 1;
}
/* 调整打开时文字的显示位子 */
.switch .el-switch__label--right span {
margin-right: 9px;
}
/*关闭时文字位置设置*/
.switch .el-switch__label--left {
z-index: 1;
}
/* 调整关闭时文字的显示位子 */
.switch .el-switch__label--left span {
margin-left: 9px;
}
/*显示文字*/
.switch .el-switch__label.is-active {
display: block;
}
/* 调整按钮的宽度 */
.switch.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 70px !important;
margin: 0;
}
</style>