update 所有会议-会议纪要改成上传文件相同弹框,增加导出zip

This commit is contained in:
danshihao
2024-03-05 11:24:32 +08:00
parent 284b4ecd85
commit 9785b08a13
@@ -8,62 +8,43 @@
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col :span="24">
<!--上传会议资料显示 -->
<!--<a-form-item label="会议文件" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="type === '2' ">-->
<!-- <j-upload file-type-error-message="请上传会议文件" :multiple="true"-->
<!-- :return-id="true"-->
<!-- v-decorator="['fileIds']"-->
<!-- :trigger-change="true"></j-upload>-->
<!--</a-form-item>-->
<!--上传会议纪要显示 -->
<a-form-item label="会议纪要" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="type === '1' ">
<j-upload file-type-error-message="请上传会议纪要" :multiple="true"
:return-id="true"
v-decorator="['fileIds']"
:trigger-change="true"></j-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 以表格的形式展示 所有的文件 -->
<template v-if="type === '2' ">
<div class="table-operator">
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
:action="importExcelUrl" :beforeUpload="beforeUpload" @change="handleChange"
>
<a-button type="primary" icon="plus">新增</a-button>
</a-upload>
<a-button type="danger" icon="delete" @click="batchDel">
批量删除
</a-button>
</div>
<a-table
ref="table"
size="middle"
rowKey="id"
:scroll="{x:'auto'}"
:pagination="false"
:columns="columns"
:dataSource="fileList"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
<div class="table-operator">
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
:action="importExcelUrl" :beforeUpload="beforeUpload" @change="handleChange"
>
<template slot="text" slot-scope="text">
<a-tooltip>
<template slot="title">{{ text }}</template>
<div class="table-text">{{ text }}</div>
</a-tooltip>
</template>
<span slot="action" slot-scope="record" class="action-span-cell">
<a-button type="primary" icon="plus">新增</a-button>
</a-upload>
<a-button type="danger" icon="delete" @click="batchDel">
批量删除
</a-button>
<a-button type="primary" icon="export" @click="handleExportZip('文件')">
导出
</a-button>
</div>
<a-table
ref="table"
size="middle"
rowKey="id"
:scroll="{x:'auto'}"
:pagination="false"
:columns="columns"
:dataSource="fileList"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
>
<template slot="text" slot-scope="text">
<a-tooltip>
<template slot="title">{{ text }}</template>
<div class="table-text">{{ text }}</div>
</a-tooltip>
</template>
<span slot="action" slot-scope="record" class="action-span-cell">
<a class="color-blue" @click="myDownload(record)">下载</a>
<a class="color-blue" @click="myPreview(record)">查看</a>
<a class="color-blue" @click="deleteFile(record)">删除</a>
</span>
</a-table>
</template>
</a-table>
</a-spin>
<email-error-msg-modal ref="emailError"></email-error-msg-modal>
</j-modal>
@@ -71,7 +52,7 @@
<script>
import JUpload from '@comp/jero/JUpload'
import {httpAction} from '@api/manage'
import {downloadFileZip, httpAction} from '@api/manage'
import {getFileInfoByIds} from '@/api/api'
import EmailErrorMsgModal from '@views/projectManagement/modules/EmailErrorMsgModal'
import Vue from 'vue'
@@ -121,22 +102,12 @@ export default {
width: 1000,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
type: '', // 上传会议纪要还是上传会议资料
model: {},
labelCol: {
xs: {span: 24},
sm: {span: 6}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 18}
},
// 会议id
meetingId: '',
// 已经上传的会议文件
meetingFileIds: '',
validatorRules: {},
url: {},
columns,
fileList: [],
@@ -166,7 +137,6 @@ export default {
async edit(record, type) {
this.visible = true
this.type = type
this.form.resetFields()
this.model = Object.assign({}, record)
// 根据会议类型返回不同的url
this.url = Object.assign({}, this.createUrlByMeetingType(record.meetingType + ''))
@@ -174,26 +144,18 @@ export default {
// 会议资料与会议纪要的回显
if (type === '1') {
this.meetingFileIds = this.model.meetingMinute ? this.model.meetingMinute : ''
if (this.meetingFileIds && this.meetingFileIds !== '') {
this.$nextTick(() => {
this.form.setFieldsValue({'fileIds': this.meetingFileIds})
})
}
} else if (type === '2') {
this.meetingFileIds = this.model.meetingData ? this.model.meetingData : ''
if (this.meetingFileIds && this.meetingFileIds !== '') {
this.fileList = await this.getFileInfoArr(this.meetingFileIds)
this.$nextTick(() => {
// this.form.setFieldsValue({'fileIds': this.meetingFileIds})
})
}
}
if (this.meetingFileIds && this.meetingFileIds !== '') {
this.fileList = await this.getFileInfoArr(this.meetingFileIds)
}
},
close() {
this.$emit('close')
// fix:80439 解决弹窗下次打开时,回显历史数据
this.fileList = []
this.onClearSelected()
this.meetingFileIds = ''
this.type = ''
this.visible = false
@@ -281,32 +243,20 @@ export default {
})
}
// 会议纪要-触发表单的验证
if(this.type === '1') {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err && values.fileIds !== undefined) {
const params = {
fileIds: values.fileIds,
id: that.meetingId
}
let url = this.url.uploadCouncilFile
callbackFunc(url, params)
} else {
that.close()
}
})
} else if (this.type === '2'){
// 会议文件
let ids = this.fileList.map(tt => tt.id).join(',')
const params = {
fileIds: ids,
id: that.meetingId
}
let url = this.url.uploadFile
// 会议文件 不用对比开始与最后文件的差别,后端会自己比对
callbackFunc(url, params)
// 会议文件
let ids = this.fileList.map(tt => tt.id).join(',')
const params = {
fileIds: ids,
id: that.meetingId
}
let url
if(this.type === '1') {
url = this.url.uploadCouncilFile
} else if (this.type === '2'){
url = this.url.uploadFile
}
// 会议文件 不用对比开始与最后文件的差别,后端会自己比对
callbackFunc(url, params)
},
handleCancel() {
this.close()
@@ -386,6 +336,14 @@ export default {
}
})
},
// 导出zip
handleExportZip () {
// 有勾选就导出勾选,没有勾选就导出所有
const ids = this.selectedRowKeys.length ? this.selectedRowKeys.join(',') : this.fileList.map(item => item.id).join(',')
downloadFileZip('sys/common/zipDownload', this.title + '.zip', {
ids
})
},
beforeUpload(file) {
this.uploadGoOn = true
file.uploadGoOn = true