调解书上传下载

This commit is contained in:
hanchaobo
2024-04-22 17:32:07 +08:00
parent ca17f03831
commit b1c8e45570
3 changed files with 154 additions and 0 deletions
@@ -0,0 +1,130 @@
<template>
<div>
<el-dialog title="调解书" :visible="mediationAppVisable" width="500px" @close="cancel" center
:distroy-on-close="true">
<div>
<div>
<span style="font-weight: bold;">下载调解书</span>
</div>
<div style="margin-top: 10px;">
<div style="color: blue; cursor: pointer" v-for="(item, index) in getFileListV"
v-if="item.annexType == 7 || item.annexType == 13" @click="downloadApplic(item.annexPath)">{{
item.annexName }}</div>
</div>
</div>
<div style="margin-top: 30px;">
<div>
<span style="font-weight: bold;">上传调解书</span>
</div>
<div style="margin-top: 10px;">
<el-upload class="upload-demo" accept=".doc,.docx,.pdf" ref="upload" :action="UploadUrl()"
:headers="headers" :data="filedata" :on-preview="handlePreview" :on-remove="handleRemove"
:auto-upload="false" :limit="1" :on-change="beforeUpload" :on-success="handlSuccess"
:file-list="fileList">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传.doc,docx,pdf文件</div>
</el-upload>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" class="endbutton1" round><span>取 消</span></el-button>
<el-button @click="submitMediator" class="endbutton1" type="primary" round><span>确 认</span></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getFileList, meetingUpload } from "@/api/caseManagement/caseManagement.js"
import { createRoomId } from '@/api/metting/metting.js'
import { getToken } from "@/utils/auth";
import moment from "moment";
export default {
props: ["mediationAppVisable", "mediationLise", "queryParams"],
data() {
return {
getFileListV: [],
fileURL: window.location.origin + "/API",
fileList: [],
headers: {
Authorization: "Bearer " + getToken(),
},
filedata: {
annexType: null,
caseId: null
},
};
},
watch: {
mediationAppVisable(val) {
this.fileList = []
if (val) {
let dataValue = {
caseAppliId: this.mediationLise.id,
}
console.log(dataValue)
this.getFileListFn(dataValue)
}
},
},
methods: {
/**上传地址*/
UploadUrl() {
return window.location.origin + "/API/video/upload";
},
handlePreview(file) {
},
handleRemove(file, fileList) {
},
beforeUpload(flie, fileList) {
const isLt2M = flie.size / 1024 / 1024 < 50; // 小于50MB
if (!isLt2M) {
this.$message.error('上传的文件大小不能超过 50MB!');
}
return isLt2M;
function getFileExtension(filename) {
const parts = filename.split('.');
return parts.length > 1 ? parts.pop() : '';
}
const extension = getFileExtension(flie.name);
if (extension == 'docx' || extension == 'doc') {
this.filedata.annexType = 7
} else if (extension == 'pdf') {
this.filedata.annexType = 13
}
this.filedata.caseId = this.mediationLise.id
this.fileList = fileList;
},
handlSuccess(res, file) {
if (res.code == 200) {
this.$modal.msgSuccess("上传成功");
this.$emit("cancelmediationApp");
}
},
cancel() {
this.$emit("cancelmediationApp");
},
// 获取申请书附件
async getFileListFn(vals) {
await getFileList(vals).then(res => {
this.getFileListV = res.data
})
},
// 下载申请书
downloadApplic(val) {
window.open(this.fileURL + val);
},
/**提交选择结果*/
async submitMediator() {
this.$refs.upload.submit()
},
},
};
</script>
<style lang="scss" scoped></style>