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

View File

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