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

优化上传

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