You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.4 KiB

2 years ago
<template>
<div>
2 years ago
<Modal v-model="isShow" title="中标公告上传" @on-ok="submit">
2 years ago
<el-upload
style="width: 300px"
ref="upload"
multiple
:on-success="successHandle"
:before-upload="uploadBefore"
accept=".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.mp4,.xls,.xlsx"
:action="action"
:file-list="fileList"
:auto-upload="false"
:on-remove="removeHande"
>
<el-button slot="trigger" size="small" type="primary"
2 years ago
>选取文件</el-button
2 years ago
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
2 years ago
>开始上传</el-button
2 years ago
>
<div slot="tip" class="el-upload__tip">
2 years ago
支持文件格式.rar .zip .doc .docx .pdf .jpg .png .gif .mp4 .xls .xlsx
2 years ago
<br />单个文件不能超过50M
</div>
</el-upload>
</Modal>
</div>
</template>
<script>
2 years ago
import { detailContract, editorContract } from "@/api/contract/contract";
2 years ago
export default {
data() {
return {
2 years ago
id: "",
2 years ago
isShow: false,
action: process.env.VUE_APP_UPLOAD_API,
fileList: [],
2 years ago
};
2 years ago
},
methods: {
2 years ago
setId(id) {
this.id = id;
2 years ago
},
2 years ago
show() {
2 years ago
this.isShow = true;
2 years ago
},
hide() {
2 years ago
this.isShow = false;
2 years ago
},
//上传
successHandle(response, file, fileList) {
this.fileList = fileList;
},
removeHande(file, fileList) {
this.fileList = fileList;
},
uploadBefore(file) {
console.log(file);
if (file.size / 1000 > 50 * 1024) {
this.$message({
type: "warning",
message: "上传图片大小超过50M",
});
return false;
}
},
2 years ago
2 years ago
async getDetail() {
2 years ago
const res = await detailContract({
2 years ago
id: this.id,
});
this.detail = res;
2 years ago
this.fileList = res.tender ? res.tender.map(i => ({
url: i.url,
name: i.original_name,
response: i
})) : []
2 years ago
},
submit() {
this.detail.invite_status = 3;
2 years ago
this.detail.tender_id = this.fileList.map(i => i.response?.id)
2 years ago
editorContract(this.detail).then((res) => {
this.hide();
this.$emit("refresh");
});
2 years ago
},
2 years ago
},
2 years ago
computed: {},
watch: {
2 years ago
isShow(newVal) {
2 years ago
if (newVal) {
2 years ago
this.getDetail();
2 years ago
}
2 years ago
},
},
};
2 years ago
</script>
2 years ago
<style scoped lang="scss"></style>