add:空调/照明群控系统交互逻辑增补 接口修改

This commit is contained in:
chenpingsen
2024-08-05 17:28:54 +08:00
parent 243aea92bb
commit 5fb7235510
9 changed files with 409 additions and 179 deletions

View File

@@ -7,6 +7,7 @@
v-for="(item, index) in floorData"
:key="index"
class="btn-item"
:style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }"
@click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button
>
@@ -56,7 +57,12 @@
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板">
<tabs1 ref="tabs1Ref" @changeArea="changeArea" @reset="reset" :treeData="treeData" />
<tabs1
ref="tabs1Ref"
@changeArea="changeArea"
@reset="reset"
@reload="reload"
:treeData="treeData" />
</a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render>
<tabs2 />
@@ -103,9 +109,9 @@
// 所有楼层的数据
const floorData = ref([]);
// 当前选择的楼层
const thisFloor = ref(1);
const thisFloor = ref('1');
// 左上角分层切换
const changeFloor = (area: any, floor: number) => {
const changeFloor = (area: any, floor: string) => {
thisFloor.value = floor;
// 重置数据
reset();
@@ -115,6 +121,7 @@
treeData.value = area;
// 默认选择第一项
treeData.value[0].selected = true;
tabs1Ref.value.changeArea(treeData.value[0]);
};
// 分区业务 =====================================================
@@ -232,7 +239,7 @@
};
// 获得所有分区
const getAllArea = () => {
const getAllArea = (realod = false) => {
http.get(lightingManage.getTree, { projectId: state.projectId }).then((res) => {
const data = res.data;
floorData.value = data;
@@ -254,12 +261,23 @@
});
});
});
// 默认展示 线路 1-1
treeData.value = data[0].childList;
// 默认展示 线路 1-1,重载则使用thisFloor当前选中的楼层数
let index = 0;
if (realod) {
data.find((item: any, i: number) => {
if (item.dataCode == thisFloor.value) {
return (index = i);
}
});
}
treeData.value = data[index].childList;
// 开始预加载
preload.value = true;
});
};
const reload = () => {
getAllArea(true);
};
// 设备业务 小灯泡 ==============================================