Commit 229da08f by 前端

修复导入问题

1 parent 5ca9cb2d
......@@ -7,7 +7,7 @@
<device-select @onChange="(value)=>form.deviceHardwareId=value"></device-select>
</el-form-item>
<el-form-item label="" prop="filename">
<el-upload ref="upload" class="upload-wrap" :action="IMPORTDEVICEMANAGE" :on-change="changeFile" :before-upload="beforeUpload" :multiple="false" :show-file-list="false" :on-success="successUpload" :on-error="errorUpload" :data="data" :auto-upload="false">
<el-upload ref="importUpload" class="upload-wrap" :file-list="importFileList" :action="IMPORTDEVICEMANAGE" :on-change="changeFile" :before-upload="beforeUpload" :multiple="false" :show-file-list="false" :on-success="successUpload" :on-error="errorUpload" :data="data" :auto-upload="false">
<el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-button slot="append">浏览</el-button>
......@@ -83,7 +83,8 @@ export default {
filename: [{ validator: checkFilename, trigger: "change" }],
},
BASEURL:BASEURL,
IMPORTDEVICEMANAGE:IMPORTDEVICEMANAGE
IMPORTDEVICEMANAGE:IMPORTDEVICEMANAGE,
importFileList:[]
};
},
computed: {
......@@ -117,7 +118,7 @@ export default {
this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo;
this.$refs.upload.clearFiles();
this.$refs.importUpload.clearFiles();
this.showResult = true;
} else {
this.$message({
......@@ -130,18 +131,21 @@ export default {
}
},
errorUpload(err) {
window.location.href = "/";
console.log(err);
//window.location.href = "/";
},
submitUpload() {
this.$refs.form.validate((valid) => {
let _this = this;
_this.$refs.form.validate((valid) => {
if (valid) {
this.data.deviceHardwareId = this.form.deviceHardwareId;
this.$refs.upload.submit();
_this.data.deviceHardwareId = _this.form.deviceHardwareId;
_this.$refs.importUpload.submit();
}
});
},
changeFile(file, filelist) {
this.filename = file.name;
console.log(filelist)
},
beforeUpload(file) {
if (file.name == this.filename) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!