优化导出、导入数据接收问题

This commit is contained in:
龙运模
2024-07-18 22:29:16 +08:00
parent 8e059496a2
commit 7f1673a5d9
5 changed files with 53 additions and 13 deletions
+9 -3
View File
@@ -27,6 +27,8 @@
</template>
<script>
import {eventBus} from "@/utils/eventBus"
export default {
name: "index",
props:{
@@ -41,10 +43,16 @@ export default {
return{
list:[{},{},{}],
}
},
setup(){
},
mounted() {
// 获取新消息
// this.$socketApi.getSock(this.getWsResult);
eventBus.$on('sockBack', this.getWsResult);
},
unmounted() {
eventBus.$off('sockBack', this.getWsResult);
},
methods:{
getWsResult(res){
@@ -82,8 +90,6 @@ export default {
},
exportClick(){
this.$emit('exportData');
// 获取新消息
this.$socketApi.getSock(this.getWsResult);
},
}
}
+15 -8
View File
@@ -34,7 +34,9 @@
<template #tip>
<div class="el-upload__tip">
<span class="tip">如果数据导入中途业务出错,请不要刷新页面,修改后继续点击导入</span>
<span class="tip">
<!-- 如果数据导入中途业务出错,请不要刷新页面,修改后继续点击导入-->
</span>
<span class="btn">
<slot></slot>
</span>
@@ -60,6 +62,9 @@
</template>
<script>
// import {inject} from "vue";
import {eventBus} from "@/utils/eventBus"
export default {
name: "import",
emits: ['parentParams', 'closed', "importSuccess"],
@@ -86,17 +91,18 @@ export default {
importInfo:{},
errorList:[]
}
},
setup(){
},
watch:{
visible(val){
if(val){
// 获取新消息
this.$socketApi.getSock(this.getWsResult);
}
}
},
mounted() {
eventBus.$on('sockBack', this.getWsResult);
},
unmounted() {
eventBus.$off('sockBack', this.getWsResult);
},
methods:{
getWsResult(res){
@@ -155,6 +161,7 @@ export default {
},
save(){
this.errorClick();
this.$emit('parentParams',this.params);
},
// 上传成功