Commit 3b3080e5 by zhangtw

导入文件上传中,禁止操作

parent c5a19854
<template>
<div>
<!-- 导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" :before-close="handleBeforeClose" append-to-body>
<el-upload
ref="upload"
:limit="1"
......@@ -54,8 +54,8 @@
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
<el-button type="primary" @click="submitFileForm" :disabled="upload.isUploading">确 定</el-button>
<el-button @click="upload.open = false" :disabled="upload.isUploading">取 消</el-button>
</div>
</el-dialog>
</div>
......@@ -159,6 +159,7 @@ export default {
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
console.log(response)
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
......@@ -188,6 +189,7 @@ export default {
},
// 提交上传文件
submitFileForm() {
this.upload.isUploading = true
const file = this.$refs.upload.uploadFiles
if (
!file ||
......@@ -207,6 +209,14 @@ export default {
this.$emit("orderTypeChange", this.upload.orderType)
// 提交上传
this.$refs.upload.submit()
},
// 在 methods 中添加
handleBeforeClose(done) {
if (this.upload.isUploading) {
this.$modal.msgWarning("正在上传中,请等待上传完成后再关闭!")
return // 停止关闭
}
done() // 执行关闭
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论