Browse Source

fix:通风系统抽屉控制面板改进

temp
chenpingsen 3 months ago
parent
commit
968bade95e
  1. 77
      hx-ai-intelligent/src/view/equipmentControl/ventilationSystem/components/fanControl.vue
  2. 38
      hx-ai-intelligent/src/view/equipmentControl/ventilationSystem/index.vue

77
hx-ai-intelligent/src/view/equipmentControl/ventilationSystem/components/fanControl.vue

@ -1,18 +1,52 @@
<template> <template>
<!-- 分区部分 -->
<div>
<div class="light-area">
<div class="light-area-tab"></div>
<span class="light-area-text"> 设备分区 </span>
</div>
<!-- 照明区域按钮部分 -->
<div class="area">
<template v-if="!showAllButtonsArea">
<button
v-for="(button, index) in limitedButtons1"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in props.treeData"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
</div>
<!-- 设备部分 --> <!-- 设备部分 -->
<div> <div>
<div class="circuit-area"> <div class="circuit-area">
<div class="circuit-tab"></div> <div class="circuit-tab"></div>
<span class="circuit-text">{{ props.type }}</span> <span class="circuit-text">{{ props.type }}</span>
<div class="btn2"> <div class="btn2">
<a-badge :offset="[-10, 2]" :count="lockList.length"> <!-- <a-badge :offset="[-10, 2]" :count="lockList.length">
<button <button
class="openPlan" class="openPlan"
:class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }" :class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }"
@click="togglePlan2"> @click="togglePlan2">
{{ isPlanEnabled2 ? '启用开关' : '禁用开关' }} {{ isPlanEnabled2 ? '启用开关' : '禁用开关' }}
</button> </button>
</a-badge> </a-badge> -->
<a-switch <a-switch
v-model:checked="selectAllCheckbox" v-model:checked="selectAllCheckbox"
:disabled="singleSelection" :disabled="singleSelection"
@ -35,9 +69,9 @@
:class="{ btn: true, selected: button.selected }" :class="{ btn: true, selected: button.selected }"
class="zmhlbtn" class="zmhlbtn"
@click="changeLine(button)"> @click="changeLine(button)">
<div v-if="button.lockStatus" class="btn-back"> <!-- <div v-if="button.lockStatus" class="btn-back">
<stop-outlined /> <stop-outlined />
</div> </div> -->
{{ button.name }} {{ button.name }}
</button> </button>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
@ -147,9 +181,13 @@
<div class="btn-item"> <div class="btn-item">
<div class="left">控制模式</div> <div class="left">控制模式</div>
<div class="right"> <div class="right">
<span>{{ item.stateBefore.autoStatus.label.replace('模式', '') }}</span> <span>{{
item.stateBefore.autoStatus.label ? item.stateBefore.autoStatus.label : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{ item.stateAfter.autoStatus.label.replace('模式', '') }}</span></div <span>{{
item.stateAfter.autoStatus.label ? item.stateAfter.autoStatus.label : '--'
}}</span></div
> >
</div> </div>
<div class="btn-item"> <div class="btn-item">
@ -297,6 +335,29 @@
*/ */
const emit = defineEmits(['reset', 'reload', 'resetAll']); const emit = defineEmits(['reset', 'reload', 'resetAll']);
// =====================================================================
//
const showAllButtonsArea = ref(false);
// 1
const selectedButton = ref<string | undefined>('1');
//
const changeArea = (button: any) => {
//
selectedButton.value = button.id;
//
buttons2.value = button.childList;
//
emit('reset');
//
button.selected = true;
// -
resetMode();
};
// 8
const limitedButtons1 = computed(() => props.treeData.slice(0, 8));
// ====================================================================== // ======================================================================
// / // /
@ -374,7 +435,6 @@
const selectAllCheckbox = ref(false); const selectAllCheckbox = ref(false);
// switch // switch
const toggleAllSelection = () => { const toggleAllSelection = () => {
let arr = [];
// //
if (selectAllCheckbox.value) { if (selectAllCheckbox.value) {
buttons2.value.forEach((item: any, index: number) => { buttons2.value.forEach((item: any, index: number) => {
@ -383,7 +443,6 @@
thisButton2.value = item; thisButton2.value = item;
} }
item.selected = true; item.selected = true;
arr.push(item.id);
}); });
// //
} else { } else {
@ -618,6 +677,8 @@
const refresh = (reload = false) => { const refresh = (reload = false) => {
// //
executeVisible.value = false; executeVisible.value = false;
//
selectedButton.value = '1';
// //
emit('reset'); emit('reset');
// //

38
hx-ai-intelligent/src/view/equipmentControl/ventilationSystem/index.vue

@ -139,6 +139,7 @@
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<fanControl <fanControl
ref="tabs1Ref" ref="tabs1Ref"
@reset="reset"
@reset-all="resetDrawer" @reset-all="resetDrawer"
:treeData="treeData" :treeData="treeData"
:type="`排风扇`" /> :type="`排风扇`" />
@ -200,6 +201,7 @@
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<fanControl <fanControl
ref="tabs1Ref" ref="tabs1Ref"
@reset="reset"
@reset-all="resetDrawer" @reset-all="resetDrawer"
:treeData="treeData" :treeData="treeData"
:type="`风幕机`" /> :type="`风幕机`" />
@ -260,6 +262,7 @@
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<fanControl <fanControl
ref="tabs1Ref" ref="tabs1Ref"
@reset="reset"
@reset-all="resetDrawer" @reset-all="resetDrawer"
:treeData="treeData" :treeData="treeData"
:type="`电动窗`" /> :type="`电动窗`" />
@ -374,8 +377,18 @@
// //
const reload = () => { const reload = () => {
http.get(url, { projectId: state.projectId, siteId: state.siteId }).then((res) => { http.get(url, { projectId: state.projectId, siteId: state.siteId }).then((res) => {
const data = res.data; const data = res.data[0].childList;
treeData.value = data[0].childList; //
data.forEach((item: any, index: number) => {
if (index === 0) {
item.selected = true;
} else {
item.selected = false;
}
});
treeData.value = data;
//
// selectIndex.value = index;
// //
try { try {
tabs1Ref.value.setButtons2(treeData.value[0].childList); tabs1Ref.value.setButtons2(treeData.value[0].childList);
@ -398,8 +411,16 @@
url = ventilating.getTree3; url = ventilating.getTree3;
} }
http.get(url, { projectId: state.projectId, siteId: state.siteId }).then((res) => { http.get(url, { projectId: state.projectId, siteId: state.siteId }).then((res) => {
const data = res.data; const data = res.data[0].childList;
treeData.value = data[0].childList; //
data.forEach((item: any, index: number) => {
if (index === 0) {
item.selected = true;
} else {
item.selected = false;
}
});
treeData.value = data;
selectIndex.value = index; selectIndex.value = index;
}); });
}; };
@ -442,6 +463,15 @@
} }
}); });
}; };
//
const reset = () => {
treeData.value.forEach((item: any) => {
item.selected = false;
item.childList.forEach((i: any) => {
i.selected = false;
});
});
};
// //
const sensorData = ref<any>([]); const sensorData = ref<any>([]);
// 湿 // 湿

Loading…
Cancel
Save