fix: 修复新增chart选择非1级panel后跳转失败问题
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
placement: {type: String},
|
placement: {type: String},
|
||||||
isEdit: {type: Boolean, default: true},
|
isEdit: {type: Boolean, default: true},
|
||||||
panelData: {type: Array},
|
panelData: {type: Array},
|
||||||
showPanel: {type: Number},
|
showPanel: {type: Object},
|
||||||
panelLock: {type: Boolean, default: true},
|
panelLock: {type: Boolean, default: true},
|
||||||
filterPanel: {type: String},
|
filterPanel: {type: String},
|
||||||
},
|
},
|
||||||
@@ -58,6 +58,14 @@
|
|||||||
handler(n) {
|
handler(n) {
|
||||||
this.$refs.panelTree && this.$refs.panelTree.filter(n);
|
this.$refs.panelTree && this.$refs.panelTree.filter(n);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
showPanel: {
|
||||||
|
immediate: true,
|
||||||
|
handler(n) {
|
||||||
|
if (n && n.id) {
|
||||||
|
this.$refs.panelTree.setCurrentKey(this.showPanel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
@@ -120,6 +128,7 @@
|
|||||||
selectPanel(data, checked, child) {
|
selectPanel(data, checked, child) {
|
||||||
this.panel = data;
|
this.panel = data;
|
||||||
this.$emit('selectPanel', this.panel);
|
this.$emit('selectPanel', this.panel);
|
||||||
|
this.$refs.panelTree.setCurrentKey(this.panel);
|
||||||
this.esc();
|
this.esc();
|
||||||
},
|
},
|
||||||
//tree设为单选
|
//tree设为单选
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="top-tool-main-left">
|
<div class="top-tool-main-left">
|
||||||
<select-panel :current-panel="showPanel" :filter-panel="filterPanel" :panel-lock="panelLock" :panelData="panelData" :placement="'bottom-start'" @deletePanel="del" @editPanel="edit"
|
<select-panel :current-panel="showPanel" :filter-panel="filterPanel" :panel-data="panelData" :panel-lock="panelLock" :placement="'bottom-start'" :show-panel="showPanel"
|
||||||
@selectPanel="panelChange" ref="selectPanel" style="width: 300px;">
|
@deletePanel="del" @editPanel="edit" @selectPanel="panelChange" ref="selectPanel" style="width: 300px;">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<div class="panel-select-header">
|
<div class="panel-select-header">
|
||||||
<el-input :placeholder="$t('overall.search')" clearable size="mini" style="width: 340px; margin-right: 5px;" v-model="filterPanel"></el-input>
|
<el-input :placeholder="$t('overall.search')" clearable size="mini" style="width: 340px; margin-right: 5px;" v-model="filterPanel"></el-input>
|
||||||
@@ -452,12 +452,13 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getTableData(clearShowPanel) {
|
getTableData(clearShowPanel) {
|
||||||
this.$get('panel?type=dashboard').then(response => {
|
this.$get('panel?type=dashboard').then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.panelData = response.data.list;
|
this.panelData = response.data.list;
|
||||||
this.showPanelList = this.panelData;
|
this.showPanelList = this.panelData;
|
||||||
this.dataTotalListBak=[...response.data.list]
|
this.dataTotalListBak = [...response.data.list];
|
||||||
let isInitData = false;
|
let isInitData = false;
|
||||||
if (response.data.list.length > 0) {
|
if (response.data.list.length > 0) {
|
||||||
if (this.$store.state.showPanel.id > 0 && this.$store.state.showPanel.name) {
|
if (this.$store.state.showPanel.id > 0 && this.$store.state.showPanel.name) {
|
||||||
@@ -472,7 +473,7 @@
|
|||||||
this.getData(this.filter);
|
this.getData(this.filter);
|
||||||
isInitData = true;
|
isInitData = true;
|
||||||
}else{
|
}else{
|
||||||
this.showPanel=response.data.list.find(item=>{return item.id == this.showPanel.id})
|
handler(response.data.list);
|
||||||
}
|
}
|
||||||
this.filter.panelId = this.showPanel.id;
|
this.filter.panelId = this.showPanel.id;
|
||||||
} else {
|
} else {
|
||||||
@@ -498,9 +499,24 @@
|
|||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
//console.log('error................'+JSON.stringify(error));
|
//console.log('error................'+JSON.stringify(error));
|
||||||
if (error) {
|
if (error) {
|
||||||
|
console.error(error);
|
||||||
this.$message.error(error.toString());
|
this.$message.error(error.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let vm = this;
|
||||||
|
|
||||||
|
function handler(panelData) {
|
||||||
|
panelData.forEach(panel => {
|
||||||
|
if (panel.id == vm.showPanel.id) {
|
||||||
|
vm.showPanel = panel;
|
||||||
|
} else {
|
||||||
|
if (panel.children && panel.children.length > 0) {
|
||||||
|
handler(panel.children)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//定期刷新
|
//定期刷新
|
||||||
selectInterval(val) {
|
selectInterval(val) {
|
||||||
|
|||||||
Reference in New Issue
Block a user