feat:给bus添加off时间 以及手动释放一些内存,隐藏system新增内容

This commit is contained in:
zhangyu
2020-11-20 10:15:17 +08:00
parent ba188b9128
commit 99779334b2
15 changed files with 77 additions and 33 deletions

View File

@@ -1023,6 +1023,7 @@
}); });
}); });
} }
maxValueCopies=null;
}, },
handleLineFeed(str,chartWidth){ handleLineFeed(str,chartWidth){
let rlt=''; let rlt='';

View File

@@ -515,6 +515,17 @@
} }
}); });
this.initEvent(); this.initEvent();
},
beforeDestroy(){
bus.$off("current-project-change", project => {
this.currentProject = project;
});
bus.$on("current-module-change", module => {
this.currentModule = module;
});
// bus.$on("endpoint-list-change", menu => {
// this.getEndpointTableData();
// });
} }
} }
</script> </script>

View File

@@ -647,6 +647,19 @@
this.$nextTick(() => (this.isRouterAlive = true)) this.$nextTick(() => (this.isRouterAlive = true))
} }
}, },
beforeDestroy(){
/*bus.$off("parent-menu-change");
bus.$off("menu-change");*/
bus.$off("header-dc-change");
bus.$off("clear-asset-filter");
bus.$off("project-list-change");
bus.$off("module-list-change");
bus.$off('asset-list-change');
bus.$off('asset-property-change')
bus.$off('asset-ping-switch-change')
}
} }
</script> </script>

View File

@@ -22,27 +22,9 @@
<script> <script>
import Vis from 'vis-network/dist/vis-network.js' import Vis from 'vis-network/dist/vis-network.js'
import addNode from './addNode'
import addLine from './addLine'
import popDataMain from './popData/Main'
import popDataInfo from './popData/Info'
import TotalChart from "./popData/totalChart";
import alertTable from "./popData/alertTable";
import assetTable from "./popData/assetTable";
import endpointTable from "./popData/endpointTable";
import ExpressionInfo from "./popData/expressionInfo";
export default { export default {
name:"topology", name:"topology",
components: { components: {
ExpressionInfo,
TotalChart,
alertTable,
assetTable,
endpointTable,
'add-model':addNode,
'add-line':addLine,
'popDataMain':popDataMain,
'popDataInfo':popDataInfo,
}, },
props:{ props:{
nodesArray:{ nodesArray:{
@@ -697,6 +679,10 @@
this.selNodeId=''; this.selNodeId='';
this.$emit('setTopologyData',nodesArray, edgesArray); this.$emit('setTopologyData',nodesArray, edgesArray);
this.setNetworkData(nodesArray, edgesArray,true); this.setNetworkData(nodesArray, edgesArray,true);
},
clearData(){
this.nodesArray=null;
this.nodesArray
} }
}, },
mounted(){ mounted(){
@@ -869,6 +855,10 @@
return false return false
}); });
}) })
},
beforeDestroy(){
this.network=null;
this.clearData();
} }
} }
</script> </script>

View File

@@ -1005,6 +1005,7 @@
}); });
}); });
} }
maxValueCopies=null;
}, },
handleLineFeed(str,chartWidth){ handleLineFeed(str,chartWidth){
let rlt=''; let rlt='';

View File

@@ -851,7 +851,7 @@
this.selNodeId=''; this.selNodeId='';
this.$emit('setTopologyData',nodesArray, edgesArray); this.$emit('setTopologyData',nodesArray, edgesArray);
this.setNetworkData(nodesArray, edgesArray,true); this.setNetworkData(nodesArray, edgesArray,true);
} },
}, },
mounted(){ mounted(){
// this.timeInterval=setInterval(()=>{ // this.timeInterval=setInterval(()=>{
@@ -1040,7 +1040,10 @@
return false return false
}); });
}) })
} },
beforeDestroy() {
this.network=null;
},
} }
</script> </script>

View File

@@ -347,7 +347,11 @@
}, },
topologyLoad(){ topologyLoad(){
this.topologyLoading=true; this.topologyLoading=true;
} },
clearData(){
this.nodesArray=null;
this.nodesArrayOther=null;
},
}, },
mounted(){ mounted(){
@@ -355,6 +359,7 @@
}, },
beforeDestroy(){ beforeDestroy(){
this.$refs['pickTime'].selectInterval(); this.$refs['pickTime'].selectInterval();
this.clearData();
} }
} }

View File

@@ -533,6 +533,9 @@
}, },
destroyed() { destroyed() {
window.onresize = null; window.onresize = null;
bus.$off("alert-rule-list-change");
bus.$off("dc-list-change");
bus.$off('alert-message-change')
}, },
mounted() { mounted() {
//初始化表头 //初始化表头

View File

@@ -829,6 +829,8 @@
}, },
destroyed() { destroyed() {
window.onresize = null; window.onresize = null;
bus.$off("asset-filter-change");
bus.$off('alert-message-change');
} }
} }
</script> </script>

View File

@@ -492,6 +492,9 @@
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
}, },
beforeDestroy(){
bus.$off("dc-list-change");
},
destroyed() { destroyed() {
window.onresize = null; window.onresize = null;
}, },

View File

@@ -29,9 +29,9 @@
<el-form-item :label="$t('config.system.basic.storageRetention')" prop="storage_local_retention"> <el-form-item :label="$t('config.system.basic.storageRetention')" prop="storage_local_retention">
<el-input v-model.number="basic.storage_local_retention" ></el-input><span class="nz-input-append">{{$t('config.system.basic.day')}}</span> <el-input v-model.number="basic.storage_local_retention" ></el-input><span class="nz-input-append">{{$t('config.system.basic.day')}}</span>
</el-form-item> </el-form-item>
<el-form-item :label="$t('config.system.basic.maxSeries')" prop="storage_local_retention"> <!--<el-form-item :label="$t('config.system.basic.maxSeries')" prop="storage_local_retention">-->
<el-input-number v-model="basic.query_max_series" controls-position="right" :min="-1" :max="1000" :precision="0"></el-input-number> <!--<el-input-number v-model="basic.query_max_series" controls-position="right" :min="-1" :max="1000" :precision="0"></el-input-number>-->
</el-form-item> <!--</el-form-item>-->
<el-form-item :label="$t('config.system.basic.timezone')" prop="timezone"> <el-form-item :label="$t('config.system.basic.timezone')" prop="timezone">
<!-- <el-input v-model.number="basic.timezone" ></el-input>--> <!-- <el-input v-model.number="basic.timezone" ></el-input>-->
<el-select v-model="basic.timezone"> <el-select v-model="basic.timezone">
@@ -136,7 +136,7 @@
</el-form> </el-form>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('config.system.notification.notification')" name="notification"><!--$t('config.system.reset.reset')--> <!-- <el-tab-pane :label="$t('config.system.notification.notification')" name="notification">&lt;!&ndash;$t('config.system.reset.reset')&ndash;&gt;
<div class="linkBox" > <div class="linkBox" >
<div class="linkTitle"> <div class="linkTitle">
<span class="linkTitleHandle"></span> <span class="linkTitleHandle"></span>
@@ -144,7 +144,7 @@
<div class="linkTitleUrl">{{$t('config.system.notification.filePath')}}</div> <div class="linkTitleUrl">{{$t('config.system.notification.filePath')}}</div>
<div class="linkTitleBtn">{{$t('config.system.notification.operation')}}</div> <div class="linkTitleBtn">{{$t('config.system.notification.operation')}}</div>
</div> </div>
<!--linkAdd--> &lt;!&ndash;linkAdd&ndash;&gt;
<div class="linkContent linkAddBox"> <div class="linkContent linkAddBox">
<span class="linkTitleHandle"></span> <span class="linkTitleHandle"></span>
<el-form :inline="true" :model="notificationTemp" label-width="180px" size="small" ref="notificationTempForm" :rules="notificationRules" :validate-on-rule-change="false" class="reset-form"> <el-form :inline="true" :model="notificationTemp" label-width="180px" size="small" ref="notificationTempForm" :rules="notificationRules" :validate-on-rule-change="false" class="reset-form">
@@ -159,7 +159,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<!--notificationEdit--> &lt;!&ndash;notificationEdit&ndash;&gt;
<div class="scrollBox" <div class="scrollBox"
v-scrollBar> v-scrollBar>
<draggable v-model="notification" <draggable v-model="notification"
@@ -188,11 +188,11 @@
<div class="linkFormContent" v-else> <div class="linkFormContent" v-else>
<div class="linkTitleName" :title="item.name">{{item.name}}</div> <div class="linkTitleName" :title="item.name">{{item.name}}</div>
<div class="linkTitleUrl"> <div class="linkTitleUrl">
<!--<span class="linkTitleUrlContent" @click="openUrl(item)" @dblclick.stop="linkEdit(item)">--> &lt;!&ndash;<span class="linkTitleUrlContent" @click="openUrl(item)" @dblclick.stop="linkEdit(item)">&ndash;&gt;
<!--<el-tooltip class="item" effect="dark" :content="item.url" placement="top" popper-class="linkUrlTip">--> &lt;!&ndash;<el-tooltip class="item" effect="dark" :content="item.url" placement="top" popper-class="linkUrlTip">&ndash;&gt;
<span>{{item.filePath}}</span> <span>{{item.filePath}}</span>
<!--</el-tooltip>--> &lt;!&ndash;</el-tooltip>&ndash;&gt;
<!--</span>--> &lt;!&ndash;</span>&ndash;&gt;
</div> </div>
<div class="linkFormBtn"> <div class="linkFormBtn">
<i class="nz-icon nz-icon-edit" @click.stop="notificationEdit(item)"></i> <i class="nz-icon nz-icon-edit" @click.stop="notificationEdit(item)"></i>
@@ -203,7 +203,7 @@
</draggable> </draggable>
</div> </div>
</div> </div>
</el-tab-pane> </el-tab-pane>-->
<el-tab-pane :label="$t('config.system.link.link')" name="link"><!--$t('config.system.reset.reset')--> <el-tab-pane :label="$t('config.system.link.link')" name="link"><!--$t('config.system.reset.reset')-->
<div class="linkBox" > <div class="linkBox" >
<div class="linkTitle"> <div class="linkTitle">
@@ -327,7 +327,7 @@
current_site_url:'', current_site_url:'',
timezone:'', timezone:'',
default_cabinet_usize:'', default_cabinet_usize:'',
query_max_series:'' // query_max_series:''
}, },
basicCopy:null, basicCopy:null,
basicRules:{ basicRules:{

View File

@@ -1395,6 +1395,7 @@ export default {
//this.metricCascaderList = [...this.metricCascaderListTmp]; //this.metricCascaderList = [...this.metricCascaderListTmp];
}, },
beforeDestroy() { beforeDestroy() {
bus.$off('clear_history');
}, },
}; };

View File

@@ -650,6 +650,9 @@ export default {
this.clearHistory(); this.clearHistory();
}); });
}, },
beforeDestroy(){
bus.$off('clear_history');
}
}; };
</script> </script>

View File

@@ -1591,6 +1591,7 @@
destroyed() { destroyed() {
clearInterval(this.freshDataTimer); clearInterval(this.freshDataTimer);
clearInterval(this.freshDateTimer); clearInterval(this.freshDateTimer);
this.allProject=null;
} }
} }
</script> </script>

View File

@@ -854,6 +854,13 @@
}, },
destroyed(){ destroyed(){
window.onresize=null; window.onresize=null;
bus.$off("project-page-type");
bus.$off("current-project-change");
bus.$off("current-module-change");
bus.$off("project-list-change");
bus.$off("module-list-change");
bus.$off("endpoint-list-change");
bus.$off('alert-message-change')
} }
} }
</script> </script>