提交 8d73d562 编写于 作者: changdi.hao's avatar changdi.hao

优化上传

上级 a48c7f48
......@@ -127,7 +127,7 @@
:show-file-list="true"
:before-upload="uploadfile"
>
<div class="upload-container">
<div class="upload-container inline-b">
<el-input
class="file-name"
v-model="fileData.fileName"
......@@ -171,10 +171,10 @@
accept=".xlsx"
multiple
:limit="1"
:show-file-list="true"
:show-file-list="false"
:before-upload="uploadMateFile"
>
<div class="upload-container">
<div class="upload-container inline-b">
<el-input
class="file-name"
v-model="mateFileData.fileName"
......@@ -202,10 +202,10 @@
>
</div>
</el-dialog>
<!-- 导入匹配机构名单 -->
<!-- 批量屏蔽 -->
<el-dialog
class="exportlogistics-dialog"
title="匹配机构导入"
title="批量屏蔽导入"
:visible="isShowBatch"
@close="isShowBatch = false"
width="600px"
......@@ -218,10 +218,10 @@
accept=".xlsx"
multiple
:limit="1"
:show-file-list="true"
:show-file-list="false"
:before-upload="uploadBatchFile"
>
<div class="upload-container">
<div class="upload-container inline-b">
<el-input
class="file-name"
v-model="batchFileData.fileName"
......@@ -629,36 +629,30 @@ export default {
this.formInline.pageNo = val;
this.search();
},
download() {
const downloadUrl = 'https://files.yunqueyi.com/template/org_template.xlsx';
setTimeout(() => {
window.open(downloadUrl);
}, 500);
},
importMate() {
this.isShowMate = true;
},
importBatch() {
this.isShowBatch = true
},
//机构匹配上传exel
uploadMateFile(file) {
console.log("file",file)
this.mateFileData.fileName = file.name;
const formData = new FormData();
formData.append("projectId", this.projectId)
formData.append("file",file)
this.mateFileData.file = formData;
console.log("file",formData)
},
// 确认导入
// 机构匹配确认导入
confirmMateImport() {
this.isLoading = true;
let parmas = {
file: this.mateFileData.file,
projectId: this.projectId
}
uploadMateExcel(parmas).then(res => {
uploadMateExcel(this.mateFileData.file).then(res => {
if (res.code == '000000') {
if (res.data) {
this.isLoading = false;
this.isShowMate = false;
this.cancelMateImport();
let a = document.createElement('a');
let href = res.data;
a.setAttribute('href',href);
......@@ -680,7 +674,7 @@ export default {
this.$message.error(error.message);
})
},
// 取消导入
// 机构匹配取消导入
cancelMateImport() {
this.mateFileData = {
file: "",
......@@ -688,36 +682,24 @@ export default {
};
this.isShowMate = false;
},
//批量屏蔽上传exel
uploadBatchFile(file) {
this.batchFileData.fileName = file.name;
const formData = new FormData();
formData.append('projectId', this.projectId)
formData.append("file",file)
this.batchFileData.file = formData;
},
// 确认导入
// 批量屏蔽确认导入
confirmBatchImport() {
this.isLoading = true;
let parmas = {
file: this.batchFileData.file,
projectId: this.projectId
}
uploadBatchExcel(parmas).then(res => {
uploadBatchExcel(this.batchFileData.file).then(res => {
if (res.code == '000000') {
if (res.data) {
this.isLoading = false;
this.isShowMate = false;
let a = document.createElement('a');
let href = res.data;
a.setAttribute('href',href);
a.click();
this.$message({
message: '导入成功,您上传的机构信息已匹配完成,请确认后进行批量屏蔽',
type: 'success'
});
} else {
this.isLoading = false;
this.$message.error(res.message);
}
this.cancelBatchImport();
this.$message({
message: '屏蔽成功',
type: 'success'
});
} else {
this.isLoading = false;
this.$message.error(res.message);
......@@ -727,6 +709,7 @@ export default {
this.$message.error(error.message);
})
},
//批量屏蔽取消导入
cancelBatchImport() {
this.batchFileData = {
file: "",
......@@ -742,6 +725,7 @@ export default {
.component-content {
padding: 10px;
background: #fff;
.complete {
float: right;
}
......@@ -749,5 +733,14 @@ export default {
color: #D51F35;
}
}
.inline-b{
display: flex;
.el-button--mini{
margin-left: 20px;
}
}
.upload-container {
line-height: 0;
}
}
</style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册