bus事件

This commit is contained in:
gongjiale 2022-11-21 19:16:13 +08:00
parent bd88609e0b
commit d70ca58781
2 changed files with 35 additions and 17 deletions

View File

@ -152,10 +152,16 @@ export default defineComponent({
}
//
const tabClick = (id) => {
chooseId.value = id
if(chooseId.value === id){
chooseId.value = ''
mybus.emit('clearLeftSelect')
}else{
chooseId.value = id
let placeTypeCode =[]
placeTypeCode.push(id)
mybus.emit('CameraConditionPlaceType', placeTypeCode)
}
}
//
const init = async () => {
@ -196,14 +202,15 @@ export default defineComponent({
chooseId.value=''
})
const onSelect = async (item, val, child) => {
let res = {}
if (whoShow1.value && !whoShow1.value.itShowXiHaiAn) {
res = await getCameraAllOrgan({ parentId: val.id })
} else {
// if(selectId.value===val.id){
// selectId.value=''
//   mybus.emit('clearLeftSelect')
// }else{
let res = {}
 mybus.emit('getCameraByParentId', val.id)
// 西
res = await getCameraInfoByAreaId({ areaId: val.id })
}
treeData.value.map((treeDataItem, index) => {
if (item.id == treeDataItem.id) {
treeData.value[index].children.map((childItem, childIndex) => {
@ -215,11 +222,20 @@ export default defineComponent({
}
})
if (child) {
if(selectId.value===child.id){
selectId.value=''
  mybus.emit('clearLeftSelect')
}else{
selectId.value = child.id
}
}
// }
}
watch(selectId, (newVal) => {
if (newVal == '') {
mybus.emit('getCameraByParentId', '')
mybus.emit('getListByParentId', '')
@ -244,14 +260,15 @@ export default defineComponent({
})
}
const showDown = (item, val) => {
selectId.value = val.id
console.log('item---showDown--------->', item)
console.log('val----showDown-------->', val)
if (item.children) {
val.show = !val.show
//
if (!val.show) {
selectId.value = ''
mybus.emit('clearLeftSelect')
}
}
}
@ -284,10 +301,11 @@ export default defineComponent({
<style lang="less" scoped>
.titleName {
font-size: 18px;
color: #7e7676;
margin-bottom: 10px;
padding-left: 10px;
border-left: 6px solid #1296db;
color: #7e7676;
margin-bottom: 10px;
padding-left: 6px;
border-left: 6px solid #1296db;
margin-left: 10px;
}
.glgkmk {
cursor: pointer;
@ -310,6 +328,7 @@ export default defineComponent({
}
.active {
color: #0058e1;
font-weight: bold;
}
}
@ -317,15 +336,15 @@ export default defineComponent({
color: #0058e1;
}
.nav {
margin-bottom: 13px;
display: flex;
justify-content: space-around;
justify-content: space-between;
margin-right: 20px;
align-items: center;
font-size: 18px;
font-family: 'Alibaba PuHuiTi';
color: #000000;
line-height: 0.32rem;
margin-bottom: 0.1rem;
margin-bottom: 24px;
.photo {
display: inline-block;

View File

@ -389,7 +389,6 @@ import { ElMessage } from 'element-plus'
})
},
getCameraByParentId(type) {
debugger
if (!this.whoShow1.itShowXiHaiAn) {
getCameraByParentId(this.mapSearchParam).then((res) => {
console.log('根据parent查询摄像头', res.data.data)