fix:照明系统多选功能完善,引入全局变量projectId,部分交互逻辑修改
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
<div class="lighting-img-box">
|
||||
<!-- 左上角,区域切换 -->
|
||||
<div class="btn-box">
|
||||
<button v-for="item in floorData" class="btn-item" @click="changeFloor(item.childList)">{{
|
||||
item.name
|
||||
}}</button>
|
||||
<button
|
||||
v-for="(item, index) in floorData"
|
||||
:key="index"
|
||||
class="btn-item"
|
||||
@click="changeFloor(item.childList, item.code)"
|
||||
>{{ item.name }}</button
|
||||
>
|
||||
</div>
|
||||
<!-- 楼层区域 -->
|
||||
<div class="area">
|
||||
@@ -77,14 +81,20 @@
|
||||
import { lightingManage } from '/@/api/IlluminationInfo';
|
||||
// ICON
|
||||
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons-vue';
|
||||
// 全局变量
|
||||
import { items } from '/@/store/item';
|
||||
|
||||
// 初始化 =======================================================
|
||||
|
||||
onMounted(() => {
|
||||
// 获得分区与线路的结构
|
||||
getAllArea();
|
||||
// 获得俯视图中的小灯泡
|
||||
getBulbs();
|
||||
});
|
||||
|
||||
// 获得全局变量
|
||||
const state = items();
|
||||
// 预加载flag,获得分区数据后,预加载抽屉,防止获取ref报错
|
||||
const preload = ref(false);
|
||||
|
||||
@@ -92,8 +102,11 @@
|
||||
|
||||
// 所有楼层的数据
|
||||
const floorData = ref([]);
|
||||
// 当前选择的楼层
|
||||
const thisFloor = ref(1);
|
||||
// 左上角分层切换
|
||||
const changeFloor = (area: any) => {
|
||||
const changeFloor = (area: any, floor: number) => {
|
||||
thisFloor.value = floor;
|
||||
// 重置数据
|
||||
reset();
|
||||
// 重置视图
|
||||
@@ -220,7 +233,7 @@
|
||||
|
||||
// 获得所有分区
|
||||
const getAllArea = () => {
|
||||
http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then((res) => {
|
||||
http.get(lightingManage.getArea, { projectId: state.projectId }).then((res) => {
|
||||
const data = res.data;
|
||||
floorData.value = data;
|
||||
/** 只在前端使用的变量
|
||||
@@ -248,6 +261,20 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 设备业务 小灯泡 ==============================================
|
||||
|
||||
const getBulbs = () => {
|
||||
http
|
||||
.get(lightingManage.getBulbs, {
|
||||
floor: thisFloor.value,
|
||||
projectId: state.projectId,
|
||||
siteId: state.siteId,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
|
||||
// 抽屉业务 =====================================================
|
||||
|
||||
// 抽屉 - 当前选择的tab
|
||||
|
Reference in New Issue
Block a user