From 734bb7b9cd7bd73aae6eefb0d0fab904d623b895 Mon Sep 17 00:00:00 2001
From: YH-zlh <zhaolh@yhzhg.cn>
Date: Fri, 13 Dec 2024 04:02:44 +0000
Subject: [PATCH] 合同预警 合同附件上传下载
---
eladmin-web-master/src/views/contract/contract/index.vue | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 104 insertions(+), 5 deletions(-)
diff --git a/eladmin-web-master/src/views/contract/contract/index.vue b/eladmin-web-master/src/views/contract/contract/index.vue
index 1ce6606..74ac33f 100644
--- a/eladmin-web-master/src/views/contract/contract/index.vue
+++ b/eladmin-web-master/src/views/contract/contract/index.vue
@@ -126,6 +126,18 @@
>
查看分配
</el-button>
+ <el-button
+ slot="right"
+ v-permission="permission.edit"
+ class="filter-item"
+ size="mini"
+ type="success"
+ icon="el-icon-edit"
+ :loading="addWarningStatusLoading"
+ :disabled="crud.selections.length === 0"
+ style="margin-left: 4px !important;"
+ @click="addWarningStatus(crud.selections)"
+ >预警</el-button>
</crudOperation>
<el-row :gutter="40" style="color: red; font-weight: bolder;">
<el-col :xs="12" :sm="12" :lg="6">
@@ -302,6 +314,9 @@
<el-form-item label="合同终版文件" prop="relatedDocumentsFinal">
<file-upload :key="random" ref="fileFinalUpload" :file-url="form.relatedDocumentsFinal == null || form.relatedDocumentsFinal === '' ? null : form.relatedDocumentsFinal" :limit="5" @fileInfo="getFinalFileInfo" />
</el-form-item>
+ <el-form-item label="合同附件" prop="relatedDocumentsAttachment">
+ <file-upload :key="random" ref="fileAttachmentUpload" :file-url="form.relatedDocumentsAttachment == null || form.relatedDocumentsAttachment === '' ? null : form.relatedDocumentsAttachment" :limit="5" @fileInfo="getAttachmentFileInfo" />
+ </el-form-item>
<el-form-item label="合同状态" prop="contractStatus">
<el-select v-model="form.contractStatus" filterable placeholder="请选择" style="width: 200px;">
<el-option
@@ -351,7 +366,7 @@
</div>
</el-dialog>
<!--表格渲染-->
- <el-table ref="table" v-loading="crud.loading" :data="crud.data" stripe size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" stripe size="small" style="width: 100%;" :row-class-name="warningRowClassName" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column fixed="left" type="expand">
<template slot-scope="props">
@@ -518,6 +533,11 @@
</template>
</el-table-column>
</el-table-column>
+ <el-table-column label="合同附件" width="100" align="center">
+ <template slot-scope="scope">
+ <el-button type="success" icon="el-icon-download" :loading="downloadAttachmentLoading" @click="toDownloadContractAttachments(scope.row.contractId)" />
+ </template>
+ </el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" width="100" />
<el-table-column :show-overflow-tooltip="true" prop="acceptStatus" label="验收状态" width="100">
<template slot-scope="scope">
@@ -636,11 +656,13 @@
import constant from '../../../utils/constant'
import { contractTotalMoney, contractDelayTotalAmount, contractDelayTotalMoney, advancePaymentTotalMoney } from '@/api/contract/contract'
import { serviceTotalMoney, serviceDelayTotalAmount, serviceDelayTotalMoney, receivePaymentTotalMoney } from '@/api/contract/contract'
+import { addWarningStatus, downloadContractAttachments } from '@/api/contract/contract'
import Dict from '@/components/Dict/Dict'
import { mapGetters } from 'vuex'
import { getToken } from '@/utils/auth'
+import { downloadFile } from '@/utils/index'
-const defaultForm = { contractId: null, contractNumber: null, contractName: null, firstId: null, secondId: null, signDate: null, startDate: null, endDate: null, contractAreaCode: null, contractArea: null, contractType: null, contractSecondType: null, contractContent: null, contractAmount: null, contractPaymentDate: null, contractPaymentState: null, serviceStartsDate: null, serviceAmount: null, servicePaymentDate: null, servicePaymentState: null, relatedDocumentsFirst: null, relatedDocumentsFinal: null, contractStatus: null, acceptStatus: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
+const defaultForm = { contractId: null, contractNumber: null, contractName: null, firstId: null, secondId: null, signDate: null, startDate: null, endDate: null, contractAreaCode: null, contractArea: null, contractType: null, contractSecondType: null, contractContent: null, contractAmount: null, contractPaymentDate: null, contractPaymentState: null, serviceStartsDate: null, serviceAmount: null, servicePaymentDate: null, servicePaymentState: null, relatedDocumentsFirst: null, relatedDocumentsFinal: null, relatedDocumentsAttachment: null, contractStatus: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
name: 'InServiceContract',
components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, fileUpload, DateRangePicker },
@@ -850,6 +872,10 @@
divideStatus: false,
// 分配表单加载
divideLoading: false,
+ // 分配表单加载
+ addWarningStatusLoading: false,
+ // 分配表单加载
+ downloadAttachmentLoading: false,
// 分配表单数据
divideForm: { contractId: null, contractName: null, projectId: null, fundType: null, allocatedAmount: null },
// 分配表单验证
@@ -991,6 +1017,8 @@
that.$refs.fileFirstUpload.submit()
// 通过“that.$refs.fileFinalUpload”找到子页面,“submit”是子页面的方法。
that.$refs.fileFinalUpload.submit()
+ // 通过“that.$refs.fileAttachmentUpload”找到子页面,“submit”是子页面的方法。
+ that.$refs.fileAttachmentUpload.submit()
},
// 获取文件信息
getFirstFileInfo(info) {
@@ -1050,13 +1078,42 @@
}
}
},
+ // 获取文件信息
+ getAttachmentFileInfo(info) {
+ const that = this
+ // 判断返回数据
+ if (info.length === 0) {
+ // 表单文件路径赋值
+ that.crud.form.relatedDocumentsAttachment = null
+ // 表单提交
+ that.referSubmitCU()
+ // 终止
+ return
+ }
+ // 循环返回数据
+ for (let i = 0; i < info.length; i++) {
+ // 判断循环下标
+ if (i === 0) {
+ // 表单文件路径赋值
+ that.crud.form.relatedDocumentsAttachment = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName
+ } else {
+ // 表单文件路径赋值
+ that.crud.form.relatedDocumentsAttachment += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName
+ }
+ // 判断循环是否结束
+ if (i === info.length - 1) {
+ // 表单提交
+ that.referSubmitCU()
+ }
+ }
+ },
// 表单提交
referSubmitCU() {
const that = this
// 提交触发次数自增
that.triggerCount++
// 判断提交触发次数
- if (that.triggerCount === 2) {
+ if (that.triggerCount === 3) {
// 表单提交
that.crud.submitCU()
}
@@ -1342,11 +1399,53 @@
duration: 2500
})
that.uploadDialog.loading = false
+ },
+ // 预警
+ addWarningStatus(data) {
+ this.addWarningStatusLoading = true
+ const ids = []
+ if (data instanceof Array) {
+ data.forEach(val => {
+ ids.push(val['contractId'])
+ })
+ } else {
+ ids.push(data['contractId'])
+ }
+ // 添加预警
+ addWarningStatus(ids).then(() => {
+ this.addWarningStatusLoading = false
+ // 消息提示
+ this.crud.notify('添加预警成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ // 刷新页面
+ this.crud.refresh()
+ }).catch(() => {
+ this.addWarningStatusLoading = false
+ })
+ },
+ // 预警
+ warningRowClassName({ row, rowIndex }) {
+ if (row.warningStatus === 1) {
+ return 'warning-row'
+ } else {
+ return ''
+ }
+ },
+ toDownloadContractAttachments(id) {
+ this.downloadAttachmentLoading = true
+ // 添加预警
+ downloadContractAttachments({ 'id': id }).then(result => {
+ downloadFile(result, '合同附件', 'zip')
+ this.downloadAttachmentLoading = false
+ }).catch(() => {
+ this.downloadAttachmentLoading = false
+ })
}
}
}
</script>
-<style scoped>
-
+<style>
+ .warning-row td {
+ background-color: #F9D7BC !important;
+ }
</style>
--
Gitblit v1.9.3