From ab29f9152de2df439ce323a3517978ef69de93d5 Mon Sep 17 00:00:00 2001 From: chenpingsen Date: Thu, 25 Jul 2024 11:54:47 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=85=A7=E6=98=8E=E7=B3=BB=E7=BB=9F=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hx-ai-intelligent/src/api/IlluminationInfo.ts | 7 + .../equipmentControl/lightingManage/indexs.vue | 25 ++- .../view/equipmentControl/lightingManage/tabs1.vue | 227 ++++++++++++--------- 3 files changed, 157 insertions(+), 102 deletions(-) diff --git a/hx-ai-intelligent/src/api/IlluminationInfo.ts b/hx-ai-intelligent/src/api/IlluminationInfo.ts index 3b1d32c..0a8015e 100644 --- a/hx-ai-intelligent/src/api/IlluminationInfo.ts +++ b/hx-ai-intelligent/src/api/IlluminationInfo.ts @@ -9,6 +9,13 @@ export enum lightingManage { // 修改线路的可用/禁用状态 setDisable = '/carbon-smart/IlluminationInfo/revisePanel', + // 控制面板tab页 ================================================ + + // 获取当前修改的内容对比数据 + getChangeList = '/carbon-smart/IlluminationInfo/getLightSceneChangeInfo', + // 提交当前修改 + submitChangeList = '/carbon-smart/IlluminationInfo/changeLightScene', + // 计划列表tab页 ================================================ // 获得计划列表tab页的表格数据 diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue index adb4b68..1297d9d 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue @@ -42,6 +42,7 @@ v-model:visible="visible" class="drawer-item" width="496" + :forceRender="preload" placement="right" :body-style="{ background: 'rgba(0, 0, 0)', opacity: 0.8 }" :closable="false" @@ -54,7 +55,6 @@ @changeArea="changeArea" @reset="reset" :treeData="treeData" - :nowArea="nowArea" > @@ -93,6 +93,10 @@ onMounted(() => { getAllArea() }) +// 预加载flag,获得分区数据后,预加载抽屉,防止获取ref报错 +const preload = ref(false) + + // 分层业务 ===================================================== // 所有楼层的数据 @@ -109,13 +113,12 @@ const changeFloor = (area: any) => { treeData.value[0].selected = true } + // 分区业务 ===================================================== // 分区结构树 const treeData = ref([]) -// 当前选中的分区id -const nowArea = ref('1') -// 当前选中的分区序号 - 用于样式渲染 +// 当前选中的分区序列 - 用于样式渲染 const area = ref(['1']) // 线路内小灯泡 - 此处位置需前端写死 const bulbs = ref([ @@ -182,15 +185,18 @@ const changeArea = (result: any) => { } // 由当前组件控制的分区切换 const changeThisArea = (result: any) => { - tabs1Ref.value.changeCancel() console.log(result, 'changeThisArea') // 修改前,将所有选项置空 reset() let level1 = result[0]; area.value.length = 0 + // 只选择了分区 if (result.length === 1) { result[0].selected = true area.value.push(result[0].id) + // 控制子组件按钮区 + tabs1Ref.value.changeArea(result[0]) + // 选择了分区 + 线路 } else if (result.length === 2) { // 如果没有分区,默认选择第一个 if (!level1) { @@ -199,8 +205,10 @@ const changeThisArea = (result: any) => { // 选中状态都设为true level1.selected = result[1].selected = true area.value.splice(0, 0, level1.id, result[1].id) + // 控制子组件按钮区 + tabs1Ref.value.changeArea(result[0]) + tabs1Ref.value.changeLine(result[1]) } - nowArea.value = level1.id } // 重置分区树所有当前选项 const reset = () => { @@ -220,6 +228,7 @@ const computedClass = (string: string) => { } } +// 获得所有分区 const getAllArea = () => { http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then(res => { const data = res.data @@ -242,7 +251,10 @@ const getAllArea = () => { }) }) }) + // 默认展示 线路 1-1 treeData.value = data[0].childList + // 开始预加载 + preload.value = true }) } @@ -256,6 +268,7 @@ let visible = ref(false); const toggleDrawer = () => { visible.value = !visible.value; }; +// 抽屉tab1组件的引用 const tabs1Ref = ref() diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue index 9cd93e4..0ae9d57 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue @@ -13,7 +13,7 @@