fix: project-query和metric preview里添加图表后顶部菜单高亮状态改变

This commit is contained in:
陈劲松
2020-02-11 11:30:56 +08:00
parent 8a63c091e1
commit ad78583ccc
5 changed files with 20 additions and 11 deletions

View File

@@ -122,6 +122,7 @@
</template> </template>
<script> <script>
import bus from '../../libs/bus';
export default { export default {
name: "Header", name: "Header",
data() { data() {
@@ -424,6 +425,10 @@
// 刷新后有高亮 // 刷新后有高亮
let activePath = this.$route.path.slice(1); let activePath = this.$route.path.slice(1);
this.activeIndex = activePath; this.activeIndex = activePath;
bus.$on("menu-change", (menu) => {
console.info(menu);
this.activeIndex = menu;
});
}, },
computed: { computed: {
projectListReloadWatch() { projectListReloadWatch() {
@@ -433,8 +438,8 @@
return this.$store.state.assetDcList; return this.$store.state.assetDcList;
}, },
getAssetDcData() { getAssetDcData() {
return this.$store.state.assetData return this.$store.state.assetData;
}, }
}, },
watch: { watch: {
getAssetDcData: { getAssetDcData: {

View File

@@ -176,6 +176,7 @@
</template> </template>
<script> <script>
import bus from "../../../libs/bus";
export default { export default {
name: "asset", name: "asset",
data() { data() {
@@ -467,6 +468,7 @@
}, },
jumpToAlertMsg(assetId) { jumpToAlertMsg(assetId) {
this.$store.commit('assetForAlertListChange', assetId); this.$store.commit('assetForAlertListChange', assetId);
bus.$emit("menu-change", 'alertList');
this.$router.push({ this.$router.push({
path: "/alertList", path: "/alertList",
query: { query: {

View File

@@ -435,7 +435,7 @@
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.$refs.chartForm.resetFields();//清空表单 this.$refs.chartForm.resetFields();//清空表单
let panel = this.panelData.find(p => p.id === this.panelId); let panel = this.panelData.find(p => p.id === this.panelId);
console.info("panel", panel) //console.info("panel", panel)
this.$emit('on-create-success', 'create', response.data,params, panel); this.$emit('on-create-success', 'create', response.data,params, panel);
} else { } else {
this.$message.error(response.msg); this.$message.error(response.msg);
@@ -572,7 +572,7 @@
let dSet = this.$refs.chartTag; let dSet = this.$refs.chartTag;
this.$nextTick(() => { this.$nextTick(() => {
dSet.forEach((item, index) => { dSet.forEach((item, index) => {
console.info('bbb', elementInfo.elements[index]) //console.info('bbb', elementInfo.elements[index])
item.setMdata(elementInfo.elements[index]); item.setMdata(elementInfo.elements[index]);
}); });
}); });

View File

@@ -200,7 +200,7 @@ export default {
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'success' type: 'success'
}).then(() => { }).then(() => {
//this.$store.state.assetData.moduleData = 'panel'; bus.$emit("menu-change", 'panel');
this.$store.state.showPanel.id = panel.id; this.$store.state.showPanel.id = panel.id;
this.$store.state.showPanel.name = panel.name; this.$store.state.showPanel.name = panel.name;
this.$router.push({ this.$router.push({

View File

@@ -255,6 +255,8 @@
<script> <script>
import echarts from 'echarts'; import echarts from 'echarts';
import chartBox from "../dashboard/chartBox"; import chartBox from "../dashboard/chartBox";
import bus from "../../../libs/bus";
export default { export default {
name: "project2", name: "project2",
components: { components: {
@@ -513,8 +515,8 @@
tooltip:{ tooltip:{
show:true, show:true,
formatter:function(params){ formatter:function(params){
console.log("params") //console.log("params")
console.log(params); //console.log(params);
return `<div style='width:100%;display:block;word-break:break-all;word-wrap:break-word;white-space:normal'> ${params.name}</div>`; return `<div style='width:100%;display:block;word-break:break-all;word-wrap:break-word;white-space:normal'> ${params.name}</div>`;
}, },
}, },
@@ -601,7 +603,7 @@
this.$refs.addChartModal.show(true); this.$refs.addChartModal.show(true);
let metricInfo = {}; let metricInfo = {};
metricInfo.elements = []; metricInfo.elements = [];
console.info("aaa", this.selectedEndpoints) //console.info("aaa", this.selectedEndpoints)
for(let i = 0; i < this.selectedEndpoints.length; i++) { for(let i = 0; i < this.selectedEndpoints.length; i++) {
let type = ''; let type = '';
if (this.selectedEndpoints[i].type == '1') { if (this.selectedEndpoints[i].type == '1') {
@@ -619,7 +621,7 @@
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'success' type: 'success'
}).then(() => { }).then(() => {
//this.$store.state.assetData.moduleData = 'panel'; bus.$emit("menu-change", 'panel');
this.$store.state.showPanel.id = panel.id; this.$store.state.showPanel.id = panel.id;
this.$store.state.showPanel.name = panel.name; this.$store.state.showPanel.name = panel.name;
this.$router.push({ this.$router.push({
@@ -674,7 +676,7 @@
response.data.list[i].paramObj.push({key: k, value: tempObj[k]}) response.data.list[i].paramObj.push({key: k, value: tempObj[k]})
} }
} catch (err) { } catch (err) {
console.info(response.data.list[i], err); console.error(response.data.list[i], err);
} }
} }
this.endpointTableData = response.data.list; this.endpointTableData = response.data.list;
@@ -923,7 +925,7 @@
this.showEndpoint(); this.showEndpoint();
}, },
pickTime:function(){ pickTime:function(){
console.log(this.formatTime) //console.log(this.formatTime)
this.showEndpoint(); this.showEndpoint();
}, },
getTime:function(size,unit){//计算时间 getTime:function(size,unit){//计算时间