fix:修改添加机柜 dc没有刷新的问题

This commit is contained in:
zhangyu
2020-12-25 11:52:27 +08:00
parent 5dd5b388c1
commit 4ad23fc698
3 changed files with 22 additions and 0 deletions

View File

@@ -195,6 +195,7 @@
this.rightBox.show = false;
if (refresh) {
this.getTableData();
this.$store.commit('setDcDataRefresh');
}
},
newCabinet() {
@@ -248,6 +249,7 @@
if(response.code == 200){
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.getTableData();
this.$store.commit('setDcDataRefresh');
}else{
this.$message.error(response.msg);
}

View File

@@ -140,6 +140,7 @@
<transition name="right-box">
<traffic-setting-box @close="closeTrafficBox" :dc="dc" ref="trafficBox" v-if="rightBox.trafficSetting.show"></traffic-setting-box>
</transition>
<span v-if="dcDataRefresh" style="display: none"></span>
</div>
</template>
<script>
@@ -270,6 +271,14 @@
scrollbarWrap: null,
}
},
computed:{
dcDataRefresh(){//通过vuex更新dc 需要该属性到页面 否则不被监听
if(this.$store.getters.getDcDataRefresh){
this.getTableData();
}
return this.$store.getters.getDcDataRefresh;
},
},
methods: {
assetStatClassName(param) {
if (param.column.label == this.$t("config.dc.assets")) {

View File

@@ -31,6 +31,7 @@ const store = new Vuex.Store({
},
idcArr:[],
overViewProject:{},
dcDataRefresh:false,
},
getters: {
getLinkData(state){
@@ -48,6 +49,9 @@ const store = new Vuex.Store({
getOverViewProject(state){
return state.overViewProject
},
getDcDataRefresh(state){
return state.dcDataRefresh
},
},
mutations: {
/* 监听对象变化,用于顶部菜单与底部内容的同步 */
@@ -116,6 +120,13 @@ const store = new Vuex.Store({
setOverViewProject(state,data){
state.overViewProject=data;
},
setDcDataRefresh(state){
console.log(123)
state.dcDataRefresh=true;
setTimeout(()=>{
state.dcDataRefresh=false;
},100)
},
},
actions: {
}