Commit f11ba9d1 by LJM

重新点开导入弹窗,之前上传的数据需要清空

parent 9bf35607
......@@ -58,8 +58,10 @@
</el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</div>
</div>
<Menu></Menu>
<!--导入数据确认-->
<el-dialog title="导入数据确认" :close-on-click-modal="false" :visible.sync="dialogVisible" width="700px">
<el-dialog title="导入数据确认" :close-on-click-modal="false" :visible.sync="dialogVisible" @closed="handleDialogClosed" width="700px">
<div class="dialog-text">
<p class="tt" style="font-size: 13px;margin-bottom: 0;">
上架最高天数:现货:{{ cp_time_day == -1 ? '无限制' : cp_time_day + '天' }};期货:{{ futures_cp_time_day == -1 ? '无限制' : futures_cp_time_day + '天' }}
......@@ -92,7 +94,7 @@
</div>
<div slot="footer" class="dialog-footer row" style="text-align: right;justify-content: flex-end;">
<el-button @click="dialogVisible = false" style="margin-right: 10px;">取 消</el-button>
<el-upload :data="fileData" :action="uploadUrl" :before-upload="handleBeforeUpload" :on-success="handleChange" :on-progress="handleProgress">
<el-upload ref="upload" :data="fileData" :action="uploadUrl" :before-upload="handleBeforeUpload" :on-success="handleChange" :on-progress="handleProgress">
<el-button type="primary" :loading="uploading">确 定</el-button>
<el-progress v-if="uploading" :percentage="progress"/>
</el-upload>
......@@ -100,8 +102,6 @@
</div>
</el-dialog>
</div>
<Menu></Menu>
</div>
</template>
<script>
import Vue from 'vue';
......@@ -162,9 +162,19 @@ export default {
* 导入
*/
importChange() {
this.dialogVisible = true;
// 先重置所有状态
this.progress = 0;
this.uploading = false;
// 清空上传列表
if (this.$refs.upload) {
this.$refs.upload.clearFiles();
}
// 使用 nextTick 确保DOM更新后再显示对话框
this.$nextTick(() => {
this.dialogVisible = true;
});
},
/**
* 上传文件之前的钩子
......@@ -244,6 +254,14 @@ export default {
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleDialogClosed() {
// 对话框关闭时清空
this.progress = 0;
this.uploading = false;
if (this.$refs.upload) {
this.$refs.upload.clearFiles();
}
}
},
components: {
......
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 sign in to comment