add:空调系统群控-对接新接口以及逻辑修改

This commit is contained in:
chenpingsen
2024-08-02 16:28:35 +08:00
parent ea25c22383
commit bb9be7b4e0
14 changed files with 2597 additions and 52 deletions

View File

@@ -7,7 +7,7 @@
v-for="(item, index) in floorData"
:key="index"
class="btn-item"
@click="changeFloor(item.childList, item.code)"
@click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button
>
</div>
@@ -233,7 +233,7 @@
// 获得所有分区
const getAllArea = () => {
http.get(lightingManage.getArea, { projectId: state.projectId }).then((res) => {
http.get(lightingManage.getTree, { projectId: state.projectId }).then((res) => {
const data = res.data;
floorData.value = data;
/** 只在前端使用的变量

View File

@@ -98,27 +98,26 @@
</div>
</div>
<!-- 控制模式部分 -->
<div>
<div class="control-area" v-show="thisButton2.code">
<div v-show="thisButton2.dataCode">
<div class="control-area">
<div class="control-tab"></div>
<span class="control-text"> 控制模式 </span>
</div>
<!-- 控制模式按钮部分 -->
<div class="control-mode-btn-area" v-show="thisButton2.code">
<div class="control-mode-btn-area">
<button
v-for="(button3, index) in controlMode"
v-for="(button3, index) in thisButton2.childList"
:key="index"
class="btn"
:disabled="button3.value != 3"
:class="{ selected: thisButton2.mode.value == button3.value }"
:class="{ selected: button3.selectAble }"
@click="selectButton3(button3)">
{{ button3.label }}
{{ button3.name }}
</button>
</div>
</div>
<!-- 控制场景部分 -->
<div>
<div class="control-scene-area" v-show="thisButton2.mode.value == 3">
<div v-show="thisButton2.dataCode">
<div class="control-scene-area">
<div class="control-scene-tab"></div>
<span class="control-scene-text"> 控制场景 </span>
<div v-if="!singleSelection" style="flex: 1; color: red; text-align: right"
@@ -126,13 +125,13 @@
>
</div>
<!-- 控制场景按钮部分 -->
<div class="control-scene-btn-area" v-show="thisButton2.mode.value == 3">
<div class="control-scene-btn-area">
<button
v-for="(button4, index) in controlScene"
v-for="(button4, index) in thisButton3.childList"
:key="index"
:class="{ btn: true, selected: thisButton2.scene.value == button4.value }"
:class="{ btn: true, selected: button4.executeStatus.value != 0 }"
@click="selectButton4(button4)">
{{ button4.label }}
{{ button4.name }}
</button>
</div>
</div>
@@ -156,7 +155,7 @@
<!-- 点击执行时的弹出框 -->
<div class="out-dialog" v-if="executeVisible">
<div class="content" v-if="executeVisible">
<div class="content">
<div>
<div class="div-operation"></div>
<span class="text-operation">变更内容 </span>
@@ -247,7 +246,6 @@
// 请求
import { http } from '/nerv-lib/util/http';
import { lightingManage } from '/@/api/IlluminationInfo';
import { getAllEnum } from '/@/api/index';
// 全局变量
import { items } from '/@/store/item';
@@ -256,19 +254,7 @@
onMounted(() => {
// 分区初始化
setArea();
// 获得枚举
getEnum(['IlluminationMode', 'IlluminationScene']);
});
// 获得枚举
const getEnum = (arr: any) => {
getAllEnum({ params: arr }).then((res) => {
const data = res.data;
// 控制模式
controlMode.value = data.IlluminationMode;
// 控制场景
controlScene.value = data.IlluminationScene;
});
};
// 分区初始化,以 1-1 作为默认回路
const setArea = () => {
const data = props.treeData[0];
@@ -346,7 +332,7 @@
isLoading.value = true;
http
.get(lightingManage.setDisable, {
deviceGroup: btn.code,
deviceGroup: btn.dataCode,
panel,
projectId: state.projectId,
siteId: state.siteId,
@@ -419,6 +405,7 @@
scene: {
value: -1,
},
childList: [],
});
// 照明回路的按钮切换
const changeLine = (button: any) => {
@@ -455,6 +442,12 @@
if (button.selected) {
// 发生了选中事件
thisButton2.value = button;
// 获得启动模式
thisButton3.value = button.childList.find((item: any) => {
if (item.selectAble) {
return item.childList ? item.childList : [];
}
});
} else {
// 未发生选中 或 多选的其中一个按钮被取消
resetMode();
@@ -471,23 +464,20 @@
// 控制模式业务 ====================================================================
const thisButton3 = ref({
childList: [],
});
// 控制模式 - 按钮切换
const selectButton3 = (button3: any) => {
let checked = thisButton2.value.mode;
console.log(button3.value, '---', checked.value);
// 如果点击了相同的按钮,则未作出修改
if (checked.value === button3.value) {
return;
console.log(button3);
if (!button3.selectAble) {
return message.warning(`${button3.name} 暂不支持`);
}
checked.value = button3.value;
thisButton3.value = button3;
};
// 控制场景业务 =====================================================================
// 控制模式枚举
const controlMode = ref([]);
// 场景枚举
const controlScene = ref([]);
// 控制场景 - 按钮切换
const selectButton4 = (button4) => {
// 当前选中的回路数据
@@ -527,7 +517,7 @@
// 查询之前是否修改过
const result = changeList.value.find((item: any, index: number) => {
item.index = index;
return item.deviceGroup == button.code;
return item.deviceGroup == button.dataCode;
});
// 如果已产生过修改
if (result) {
@@ -544,7 +534,7 @@
} else {
changeList.value.push({
// 回路
deviceGroup: button.code,
deviceGroup: button.dataCode,
deviceGroupName: button.name,
// 分区
region: button.pcode,
@@ -659,6 +649,7 @@
scene: {
value: -1,
},
childList: [],
};
};