diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue index cf3de9a..adb4b68 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue @@ -50,6 +50,7 @@ { // 获得分区与线路的结构 - http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then(res => { - const data = res.data - floorData.value = data - /** 只在前端使用的变量 - * @param id 用于判断样式和层级的前端属性 - * @param selected 用于表示是否选中的前端属性 - */ - data.forEach(floor => { - floor.childList.forEach((item, index) => { - if (index == 0) { - item.selected = true - } else { - item.selected = false - } - item.id = String(index + 1) - item.childList.forEach((v, i) => { - v.selected = false - v.id = (index + 1) + '-' + (i + 1) - }) - }) - }) - treeData.value = data[0].childList - }) + getAllArea() }) // 分层业务 ===================================================== +// 所有楼层的数据 +const floorData = ref([]) // 左上角分层切换 const changeFloor = (area: any) => { // 重置数据 @@ -130,8 +111,6 @@ const changeFloor = (area: any) => { // 分区业务 ===================================================== -// 所有楼层的数据 -const floorData = ref([]) // 分区结构树 const treeData = ref([]) // 当前选中的分区id @@ -203,6 +182,7 @@ const changeArea = (result: any) => { } // 由当前组件控制的分区切换 const changeThisArea = (result: any) => { + tabs1Ref.value.changeCancel() console.log(result, 'changeThisArea') // 修改前,将所有选项置空 reset() @@ -224,9 +204,9 @@ const changeThisArea = (result: any) => { } // 重置分区树所有当前选项 const reset = () => { - treeData.value.forEach(item => { + treeData.value.forEach((item: any) => { item.selected = false - item.childList.forEach(i => { + item.childList.forEach((i: any) => { i.selected = false }) }) @@ -240,6 +220,32 @@ const computedClass = (string: string) => { } } +const getAllArea = () => { + http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then(res => { + const data = res.data + floorData.value = data + /** 只在前端使用的变量 + * @param id 用于判断样式和层级的前端属性 + * @param selected 用于表示是否选中的前端属性 + */ + data.forEach((floor: any) => { + floor.childList.forEach((item: any, index: number) => { + if (index == 0) { + item.selected = true + } else { + item.selected = false + } + item.id = String(index + 1) + item.childList.forEach((v: any, i: number) => { + v.selected = false + v.id = (index + 1) + '-' + (i + 1) + }) + }) + }) + treeData.value = data[0].childList + }) +} + // 抽屉业务 ===================================================== // 抽屉 - 当前选择的tab @@ -250,6 +256,7 @@ let visible = ref(false); const toggleDrawer = () => { visible.value = !visible.value; }; +const tabs1Ref = ref()