Commit 229da08f by 前端

修复导入问题

1 parent 5ca9cb2d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<device-select @onChange="(value)=>form.deviceHardwareId=value"></device-select> <device-select @onChange="(value)=>form.deviceHardwareId=value"></device-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="filename"> <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-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-button slot="append">浏览</el-button> <el-button slot="append">浏览</el-button>
...@@ -83,7 +83,8 @@ export default { ...@@ -83,7 +83,8 @@ export default {
filename: [{ validator: checkFilename, trigger: "change" }], filename: [{ validator: checkFilename, trigger: "change" }],
}, },
BASEURL:BASEURL, BASEURL:BASEURL,
IMPORTDEVICEMANAGE:IMPORTDEVICEMANAGE IMPORTDEVICEMANAGE:IMPORTDEVICEMANAGE,
importFileList:[]
}; };
}, },
computed: { computed: {
...@@ -117,7 +118,7 @@ export default { ...@@ -117,7 +118,7 @@ export default {
this.errorNum = parseInt(data.fail); this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo; this.seqNo = data.seqNo;
this.$refs.upload.clearFiles(); this.$refs.importUpload.clearFiles();
this.showResult = true; this.showResult = true;
} else { } else {
this.$message({ this.$message({
...@@ -130,18 +131,21 @@ export default { ...@@ -130,18 +131,21 @@ export default {
} }
}, },
errorUpload(err) { errorUpload(err) {
window.location.href = "/"; console.log(err);
//window.location.href = "/";
}, },
submitUpload() { submitUpload() {
this.$refs.form.validate((valid) => { let _this = this;
_this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.data.deviceHardwareId = this.form.deviceHardwareId; _this.data.deviceHardwareId = _this.form.deviceHardwareId;
this.$refs.upload.submit(); _this.$refs.importUpload.submit();
} }
}); });
}, },
changeFile(file, filelist) { changeFile(file, filelist) {
this.filename = file.name; this.filename = file.name;
console.log(filelist)
}, },
beforeUpload(file) { beforeUpload(file) {
if (file.name == this.filename) { 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!