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

View File

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

View File

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