fix:修复关闭assetping后依然存在ping筛选的问题

This commit is contained in:
wangwenrui
2020-08-28 16:28:06 +08:00
parent 2469e93b61
commit b4ab263c6c
3 changed files with 38 additions and 4 deletions

View File

@@ -91,7 +91,7 @@ export default {
//单选
handler(val, index) {
if (!this.allowedAll&&!val.allowed && (index == 0 || index == 1 || val.NotSet)) {
this.custom[index].show = true;
// this.custom[index].show = true;
} else {
this.custom[index].show = !this.custom[index].show;
}

View File

@@ -88,7 +88,7 @@
</el-checkbox>
</el-checkbox-group>
</el-collapse-item>
<el-collapse-item name="ping" :title="$t('asset.left.ping')">
<el-collapse-item name="ping" :title="$t('asset.left.ping')" v-if="assetPingSwitch">
<el-checkbox-group v-model="pingCheckList" size="small" @change="changePingCheckBox">
<el-checkbox class="sidebar-info-item" :class="{'sidebar-info-item-active': indOf(pingCheckList, item.key)}" v-for="(item, index) in pingData" :key="index" :label="item.value">
<div class="sidebar-info-item-txt">
@@ -159,6 +159,7 @@
vendorCheckList: [],
pingData: [],
pingCheckList: [],
assetPingSwitch:true,
}
},
computed: {
@@ -216,9 +217,11 @@
}
}
},
created() {
this.initEvent(); //注册监听事件
},
mounted() {
Promise.all([this.getProjectList(), this.getModuleList(), this.getLeftMenuList()]).then(response => {
this.initEvent(); //注册监听事件
setTimeout(() => {
this.ready = true;
}, 300);
@@ -385,6 +388,10 @@
bus.$on('asset-property-change',()=>{
this.getLeftMenuList();
})
bus.$on('asset-ping-switch-change',(isOpen)=>{
this.assetPingSwitch = isOpen
})
},
// 获取asset左侧菜单数据
getLeftMenuList(){

View File

@@ -376,6 +376,16 @@
}
}
},
'tools.customTableTitle':{
deep:true,
immediate:true,
handler(n,o){
let pingTitle=n.find(item=>{return item.prop=='pingStatus'})
if(pingTitle){
this.dispatchEvent('asset-ping-switch-change',pingTitle.show)
}
}
}
},
methods: {
fullScreen() {
@@ -627,6 +637,11 @@
this.pageObj[column] = content;
this.getTableData();
});
},
dispatchEvent(event,param){
this.$nextTick(()=>{
bus.$emit(event,param)
})
}
},
@@ -635,11 +650,23 @@
let tableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
: this.tableTitle;
if (this.assetPingSwitch == 'off') {
this.dispatchEvent('asset-ping-switch-change',false)
for (let i in tableTitle) {
let label = tableTitle[i];
if (label.prop == 'pingStatus') {
tableTitle.splice(i, 1);
label.show=false;
label.NotSet=true;
break;
}
}
}else{
for (let i in tableTitle) {
let label = tableTitle[i];
if (label.prop == 'pingStatus') {
label.show=true;
label.NotSet=false;
break;
}
}