Files
emsfront/src/mixins/ems/getQuerySiteId.js

26 lines
694 B
JavaScript
Raw Normal View History

2025-06-28 14:52:49 +08:00
// 用于单站监控二级菜单页面获取路由中的站点ID
const getQuerySiteId= {
data: function () {
return {
siteId:''
}
},
watch: {
2025-07-21 23:00:41 +08:00
'$store.state.ems.zdList':{
2025-06-28 14:52:49 +08:00
handler (newQuery,oldQuery) {
2025-07-21 23:00:41 +08:00
if(!newQuery || newQuery.length === 0){return}
2025-06-28 14:52:49 +08:00
// 参数变化处理
this.$nextTick(() => {
2025-07-21 23:00:41 +08:00
const {siteId} =newQuery[0]
this.siteId = siteId
siteId && this.init(newQuery.siteId)
console.log('watch站点列表返回数据newQuery=',newQuery)
console.log('设置页面siteIdthis.siteId=',this.siteId)
2025-06-28 14:52:49 +08:00
})
},
immediate: true,
}
},
}
export default getQuerySiteId