Commit 98ad3721 authored by ytbdmhy's avatar ytbdmhy

优化导出excel的返回信息

parent 23faf233
......@@ -51,7 +51,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button
style="margin-top: 10px"
......@@ -103,11 +103,11 @@
this.loading = false;
return false;
}
// if (uploadedList.includes(file.name)) {
// this.$message.warning(file.name + "已被选中过,请勿重复选择");
// return false;
// }
// uploadedList.push(file.name);
if (file.size > 50 * 1024 * 1024) {
this.$message.warning(file.name + "文件大于50MB,无法上传");
this.loading = false;
return false;
}
},
async uploadSuccess(response) {
this.fileList = [];
......@@ -123,21 +123,17 @@
duration: 0
});
},
async uploadError(response) {
async uploadError(error, file, fileList) {
this.fileList = [];
this.dialogTitle = "导入结果";
this.dialogContent = "导入失败";
// this.dialogVisible = true;
this.loading = false;
// console.log(response);
this.$alert(response.data, '导入结果', {
confirmButtonText: '确定',
callback: action => {
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// });
}
this.$message({
type: "error",
message: "系统错误",
showClose: true,
duration: 3000
});
},
}
......
......@@ -55,7 +55,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button style="margin-top: 10px" size="small" type="success" @click="submitUpload1">数据导入</el-button>
</el-tab-pane>
......@@ -113,7 +113,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button style="margin-top: 10px" size="small" type="success" @click="submitUpload2">数据导入</el-button>
</el-tab-pane>
......@@ -172,7 +172,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button style="margin-top: 10px" size="small" type="success" @click="submitUpload3">数据导入</el-button>
</el-tab-pane>
......@@ -229,11 +229,11 @@
this.loading = false;
return false;
}
// if (uploadedList.includes(file.name)) {
// this.$message.warning(file.name + "已被选中过,请勿重复选择");
// return false;
// }
// uploadedList.push(file.name);
if (file.size > 50 * 1024 * 1024) {
this.$message.warning(file.name + "文件大于50MB,无法上传");
this.loading = false;
return false;
}
},
async uploadSuccess(response) {
this.fileList = [];
......@@ -255,16 +255,22 @@
this.dialogContent = "导入失败";
// this.dialogVisible = true;
this.loading = false;
console.log(response);
this.$alert(response.data, '导入结果', {
confirmButtonText: '确定',
callback: action => {
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// });
}
this.$message({
type: "error",
message: "系统错误",
showClose: true,
duration: 3000
});
// console.log(response);
// this.$alert(response.data, '导入结果', {
// confirmButtonText: '确定',
// callback: action => {
// // this.$message({
// // type: 'info',
// // message: `action: ${ action }`
// // });
// }
// });
},
}
}
......
......@@ -134,7 +134,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button
style="margin-top: 10px"
......@@ -187,11 +187,11 @@
this.loading = false;
return false;
}
// if (uploadedList.includes(file.name)) {
// this.$message.warning(file.name + "已被选中过,请勿重复选择");
// return false;
// }
// uploadedList.push(file.name);
if (file.size > 50 * 1024 * 1024) {
this.$message.warning(file.name + "文件大于50MB,无法上传");
this.loading = false;
return false;
}
},
async uploadSuccess(response) {
this.fileList = [];
......@@ -213,16 +213,22 @@
this.dialogContent = "导入失败";
// this.dialogVisible = true;
this.loading = false;
this.$message({
type: "error",
message: "系统错误",
showClose: true,
duration: 3000
});
// console.log(response);
this.$alert(response.data, '导入结果', {
confirmButtonText: '确定',
callback: action => {
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// this.$alert(response.data, '导入结果', {
// confirmButtonText: '确定',
// callback: action => {
// // this.$message({
// // type: 'info',
// // message: `action: ${ action }`
// // });
// }
// });
}
});
},
}
}
......
......@@ -53,7 +53,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button
style="margin-top: 10px"
......@@ -105,11 +105,11 @@
this.loading = false;
return false;
}
// if (uploadedList.includes(file.name)) {
// this.$message.warning(file.name + "已被选中过,请勿重复选择");
// return false;
// }
// uploadedList.push(file.name);
if (file.size > 50 * 1024 * 1024) {
this.$message.warning(file.name + "文件大于50MB,无法上传");
this.loading = false;
return false;
}
},
async uploadSuccess(response) {
this.fileList = [];
......@@ -131,16 +131,22 @@
this.dialogContent = "导入失败";
// this.dialogVisible = true;
this.loading = false;
this.$message({
type: "error",
message: "系统错误",
showClose: true,
duration: 3000
});
// console.log(response);
this.$alert(response.data, '导入结果', {
confirmButtonText: '确定',
callback: action => {
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// this.$alert(response.data, '导入结果', {
// confirmButtonText: '确定',
// callback: action => {
// // this.$message({
// // type: 'info',
// // message: `action: ${ action }`
// // });
// }
// });
}
});
},
}
}
......
......@@ -47,7 +47,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件</div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件,一次最多只能上传1个文件,且不能超过10MB</div>
</el-upload>
<el-button
style="margin-top: 10px"
......@@ -99,11 +99,11 @@
this.loading = false;
return false;
}
// if (uploadedList.includes(file.name)) {
// this.$message.warning(file.name + "已被选中过,请勿重复选择");
// return false;
// }
// uploadedList.push(file.name);
if (file.size > 50 * 1024 * 1024) {
this.$message.warning(file.name + "文件大于50MB,无法上传");
this.loading = false;
return false;
}
},
async uploadSuccess(response) {
this.fileList = [];
......@@ -125,16 +125,22 @@
this.dialogContent = "导入失败";
// this.dialogVisible = true;
this.loading = false;
this.$message({
type: "error",
message: "系统错误",
showClose: true,
duration: 3000
});
// console.log(response);
this.$alert(response.data, '导入结果', {
confirmButtonText: '确定',
callback: action => {
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// this.$alert(response.data, '导入结果', {
// confirmButtonText: '确定',
// callback: action => {
// // this.$message({
// // type: 'info',
// // message: `action: ${ action }`
// // });
// }
// });
}
});
},
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment