This commit is contained in:
zhaohy
2024-08-21 14:47:17 +08:00
17 changed files with 396 additions and 193 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -5,75 +5,84 @@
<div class="light-tag-tit"> <div class="light-tag-tit">
<div> <div>
<img src="/asset/image//bulbLogo/21962.png" alt="" /> <img src="/asset/image//bulbLogo/21962.png" alt="" />
<span class="tag-text">{{ result.name }}</span> <span class="tag-text">{{
</div> device.regionName + ' > ' + device.deviceGroupName
<button class="right-button">{{ type == 1 ? '正常' : '关闭' }}</button> }}</span></div
>
<button class="right-button">{{
record?.runStatus?.label ? record.runStatus.label : '--'
}}</button>
</div> </div>
<div class="light-tag-box"> <div class="light-tag-box">
<div class="tag-box-item"> <div class="tag-box-item">
<img src="/asset/image//bulbLogo/22496.png" alt="" /> <img src="/asset/image//bulbLogo/22496.png" alt="" />
<span class="title">控制模式</span> <span class="title">控制模式</span>
<span class="result">自动</span> <span class="result">{{ record.autoStatus.label }}</span>
</div> </div>
<div class="tag-box-item"> <div class="tag-box-item">
<img src="/asset/image//bulbLogo/22496.png" alt="" /> <img src="/asset/image//bulbLogo/22496.png" alt="" />
<span class="title"></span> <span class="title"></span>
<span class="result">{{ result.brightness }}</span> <span class="result">{{ record.temp + record.tempUnit }}</span>
</div> </div>
<div class="tag-box-item"> <div class="tag-box-item">
<img src="/asset/image//bulbLogo/22496.png" alt="" /> <img src="/asset/image//bulbLogo/22496.png" alt="" />
<span class="title">控制场景</span> <span class="title">控制场景</span>
<span class="result">{{ result.automatic2 }}</span> <span class="result">{{ device.scene.label }}</span>
</div> </div>
<div class="tag-box-item"> <div class="tag-box-item">
<img src="/asset/image//bulbLogo/22496.png" alt="" /> <img src="/asset/image//bulbLogo/22496.png" alt="" />
<span class="title">色温</span> <span class="title">风速</span>
<span class="result">{{ result.brightness3 }}</span> <span class="result">{{ record.windSpeed + record.windSpeedUnit }}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<div class="icon-box" :style="styleObject" v-show="visible"> <div class="icon-box" :style="props.device.styleText">
<img v-if="type == 1" class="icon-item" src="/asset/image/bulbLogo/22394.png" alt="" /> <!-- 正常=0 -->
<img v-if="type == 2" class="icon-item" src="/asset/image/bulbLogo/22396.png" alt="" /> <img
<img v-if="type == 3" class="icon-item" src="/asset/image/bulbLogo/22400.png" alt="" /> v-if="record?.runStatus?.value == 0"
class="icon-item"
src="/asset/image/bulbLogo/on1.png"
alt="" />
<!-- 故障=1 -->
<img
v-if="record?.runStatus?.value == 1"
class="icon-item"
src="/asset/image/bulbLogo/off1.png"
alt="" />
<!-- 维修=2 -->
<img
v-if="record?.runStatus?.value == 2"
class="icon-item"
src="/asset/image/bulbLogo/repair1.png"
alt="" />
<!-- 警告=3 -->
<img
v-if="record?.runStatus?.value == 3"
class="icon-item"
src="/asset/image/bulbLogo/alarm1.png"
alt="" />
</div> </div>
</a-popover> </a-popover>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { computed } from 'vue';
const props = defineProps({
defineProps({ device: Object,
styleObject: Object,
type: Number,
visible: {
type: Boolean,
default: false,
},
});
const result = ref({
id: '1',
name: '站厅照明 1区',
manual: '手动',
automatic: '自动',
brightness: '100lux',
brightness2: '30lux',
manual2: '手动',
automatic2: '舒适',
brightness3: '4000k',
brightness4: '3800k',
}); });
//
const device = computed(() => props.device);
//
const record = computed(() => props.device.record);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.icon-box { .icon-box {
width: 25px; width: 35px;
height: 25px;
position: absolute; position: absolute;
.icon-item { .icon-item {
width: 25px; width: 35px;
cursor: pointer; cursor: pointer;
transition: all ease 0.1s; transition: all ease 0.1s;
} }
@@ -104,7 +113,7 @@
} }
.right-button { .right-button {
width: 50px; width: 5em;
height: 26px; height: 26px;
background: rgba(57, 215, 187, 0.1); background: rgba(57, 215, 187, 0.1);
border: 1px solid rgba(57, 215, 187, 1); border: 1px solid rgba(57, 215, 187, 1);
@@ -140,7 +149,7 @@
.result { .result {
line-height: 50px; line-height: 50px;
font-size: 16px; font-size: 14px;
font-weight: 700; font-weight: 700;
color: white; color: white;
} }

View File

@@ -0,0 +1,10 @@
// 此文件只定义device即空调小图标的位置
// 与显示状态和分组信息无关
export const devicePosition = [
{ left: '200px', bottom: '290px' },
{ left: '320px', bottom: '320px' },
{ left: '260px', bottom: '190px' },
{ left: '390px', bottom: '230px' },
];
export const devicePosition1 = [];

View File

@@ -10,10 +10,13 @@
width: 1280px; width: 1280px;
height: 720px; height: 720px;
user-select: none; user-select: none;
background-image: url(../image/bg.jpg); background-image: url(../image/floor-1.png);
background-size: 100% 100%;
background-repeat: no-repeat;
background-color: linear-gradient(top to bottom,#c0deff, #8eadf0);
// 由于背景是俯视图,会产生有交点的透视效果,故使用透视属性 // 由于背景是俯视图,会产生有交点的透视效果,故使用透视属性
perspective: 1000px; perspective: 900px;
perspective-origin: 850px -160px; perspective-origin: 900px -120px;
// 左上角区域切换功能 // 左上角区域切换功能
.btn-box { .btn-box {
width: 100px; width: 100px;
@@ -45,18 +48,20 @@
// 大区分区 // 大区分区
.area{ .area{
position: absolute; position: absolute;
bottom: 170px; bottom: 210px;
left: 240px; left: 250px;
width: 780px; width: 700px;
height: 240px; height: 270px;
transform: rotateX(79deg) rotateZ(-22deg) skew(29deg); transform: rotateX(73deg) rotateZ(340deg) skew(31deg);
display: flex; display: flex;
gap: 5px; gap: 5px;
.area1 { .area1 {
width: 65px; width: 200px;
background: rgba(0, 251, 91, 0.3); background: rgba(0, 251, 91, 0.3);
border: 2px solid rgb(0, 251, 91); border: 2px solid rgb(0, 251, 91);
display: flex; display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
} }
.area2 { .area2 {
width: 100px; width: 100px;
@@ -93,7 +98,95 @@
} }
.area-item { .area-item {
cursor: pointer; cursor: pointer;
transition: all ease 0.2s; transition: transform ease 0.2s;
>.light-group {
height: auto;
flex: 1;
display:flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
padding: 10px;
// border: 2px solid red;
.shadow-box {
width: 60px;
height: 60px;
border-radius: 30px;
background: rgba(0, 0, 0, 0.2);
}
}
}
}
}
.lightingImgBox1 {
position: relative;
width: 1280px;
height: 720px;
user-select: none;
background-image: url(../image/floor-2.png);
background-size: 100% 100%;
background-repeat: no-repeat;
background-color: linear-gradient(top to bottom,#c0deff, #8eadf0);
// 由于背景是俯视图,会产生有交点的透视效果,故使用透视属性
perspective: 900px;
perspective-origin: 900px -120px;
// 左上角区域切换功能
.btn-box {
width: 100px;
position: sticky;
top: 15px;
margin-left: 10px;
display: flex;
flex-direction: column;
gap: 8px;
.btn-item {
cursor: pointer;
width: 100%;
height: 35px;
border-radius: 4px;
// background: rgba(39, 120, 255, 1);
background: rgb(7, 72, 116);
border: 1px solid rgba(51, 199, 255, 1);
box-shadow: 0px 10px 15px rgba(0, 54, 136, 0.3);
font-size: 16px;
color: white;
}
.btnActive {
background: rgba(39, 120, 255, 1);
}
.btn-item:hover {
color: white;
}
}
// 大区分区
.area{
position: absolute;
bottom: 320px;
left: 240px;
width: 950px;
height: 270px;
transform: rotateX(76deg) rotateZ(-22deg) skew(30deg);
display: flex;
justify-content: space-between;
gap: 5px;
.area1 {
width: 170px;
background: rgba(0, 251, 91, 0.3);
border: 2px solid rgb(0, 251, 91);
display: flex;
}
.area2 {
width: 150px;
background: rgba(255, 165, 0, 0.3);
border: 2px solid rgb(255, 165, 0);
display: flex;
}
.area-item:hover {
transform: scale(1.05);
}
.area-item {
cursor: pointer;
transition: transform ease 0.2s;
>.light-group { >.light-group {
height: 100%; height: 100%;
flex: 1; flex: 1;
@@ -105,7 +198,7 @@
// border: 2px solid red; // border: 2px solid red;
.shadow-box { .shadow-box {
width: 30px; width: 30px;
height: 200px; height: 230px;
border-radius: 20px; border-radius: 20px;
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="lighting-box"> <div class="lighting-box">
<div class="lighting-img-box"> <div class="lighting-img-box" :class="{ lightingImgBox1: thisFloor == '2' }">
<!-- 左上角区域切换 --> <!-- 左上角区域切换 -->
<div class="btn-box"> <div class="btn-box">
<button <button
@@ -26,14 +26,9 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 照明设备 --> <!-- 空调设备 -->
<div class="lights"> <div class="lights">
<light <device v-for="(item, index) in devices" :key="index" :device="item" />
v-for="(item, index) in bulbs"
:key="index"
:styleObject="item.styleText"
:type="item.type"
:visible="item.visible" />
</div> </div>
</div> </div>
<!-- 右侧抽屉 --> <!-- 右侧抽屉 -->
@@ -55,16 +50,17 @@
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<tabs1 <tabs1
ref="tabs1Ref" ref="tabs1Ref"
@changeArea="changeArea"
@reset="reset" @reset="reset"
@reload="reload" @reload="reload"
@reset-all="resetDrawer"
@change-area="changeArea"
:treeData="treeData" /> :treeData="treeData" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render> <a-tab-pane key="2" tab="计划列表" force-render>
<tabs2 /> <tabs2 ref="tabs2Ref" @reset-all="resetDrawer" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="3" tab="日志"> <a-tab-pane key="3" tab="日志">
<tabs3 /> <tabs3 ref="tabs3Ref" @reset-all="resetDrawer" />
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</a-drawer> </a-drawer>
@@ -73,8 +69,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { devicePosition, devicePosition1 } from './devicePosition';
// 组件 // 组件
import light from './light.vue'; import device from './device.vue';
import tabs1 from './tabs1.vue'; import tabs1 from './tabs1.vue';
import tabs2 from './tabs2.vue'; import tabs2 from './tabs2.vue';
import tabs3 from './tabs3.vue'; import tabs3 from './tabs3.vue';
@@ -91,7 +88,7 @@
onMounted(() => { onMounted(() => {
// 获得分区与线路的结构 // 获得分区与线路的结构
getAllArea(); getAllArea();
// 获得俯视图中的小灯泡 // 获得俯视图中的空调设备图例
getBulbs(); getBulbs();
}); });
@@ -108,7 +105,15 @@
const thisFloor = ref('1'); const thisFloor = ref('1');
// 左上角分层切换 // 左上角分层切换
const changeFloor = (area: any, floor: string) => { const changeFloor = (area: any, floor: string) => {
if (floor == thisFloor.value) {
return;
}
// 切换前还原修改内容
tabs1Ref.value.refresh(false);
// 清空设备点阵
devices.value = [];
thisFloor.value = floor; thisFloor.value = floor;
getBulbs();
// 重置数据 // 重置数据
reset(); reset();
// 重置视图 // 重置视图
@@ -127,56 +132,7 @@
// 当前选中的分区序列 - 用于样式渲染 // 当前选中的分区序列 - 用于样式渲染
const area = ref(['1']); const area = ref(['1']);
// 线路内小灯泡 - 此处位置需前端写死 // 线路内小灯泡 - 此处位置需前端写死
const bulbs = ref([ const devices = ref([]);
{
styleText: { left: '180px', bottom: '200px' },
area: 1,
type: 1,
visible: true,
},
{
styleText: { left: '230px', bottom: '125px' },
area: 1,
type: 2,
visible: true,
},
{
styleText: { left: '320px', bottom: '140px' },
area: 1,
type: 3,
visible: true,
},
{
styleText: { left: '245px', bottom: '230px' },
area: 1,
type: 3,
visible: true,
},
{
styleText: { left: '405px', bottom: '230px' },
area: 2,
type: 3,
visible: true,
},
{
styleText: { left: '460px', bottom: '180px' },
area: 2,
type: 3,
visible: true,
},
{
styleText: { left: '360px', bottom: '275px' },
area: 2,
type: 3,
visible: true,
},
{
styleText: { left: '715px', bottom: '320px' },
area: 3,
type: 1,
visible: true,
},
]);
// 由子组件控制的分区与线路切换 // 由子组件控制的分区与线路切换
const changeArea = (result: any) => { const changeArea = (result: any) => {
console.log(result, 'changeArea'); console.log(result, 'changeArea');
@@ -243,9 +199,7 @@
* @param id 用于判断样式和层级的前端属性 * @param id 用于判断样式和层级的前端属性
* @param selected 用于表示是否选中的前端属性 * @param selected 用于表示是否选中的前端属性
*/ */
// 楼层 1
data.forEach((floor: any) => { data.forEach((floor: any) => {
// 分区 2
floor.childList.forEach((item: any, index: number) => { floor.childList.forEach((item: any, index: number) => {
if (index == 0) { if (index == 0) {
item.selected = true; item.selected = true;
@@ -270,6 +224,10 @@
}); });
} }
treeData.value = data[index].childList; treeData.value = data[index].childList;
// 反向刷新
try {
tabs1Ref.value.setButtons2(treeData.value[0].childList);
} catch {}
// 开始预加载 // 开始预加载
preload.value = true; preload.value = true;
}); });
@@ -278,9 +236,16 @@
getAllArea(true); getAllArea(true);
}; };
// 设备业务 小灯泡 ============================================== // 设备业务 空调图例 ==============================================
const getBulbs = () => { const getBulbs = () => {
const floor = thisFloor.value;
let arr: Array<Object> = [];
if (floor == '1') {
arr = devicePosition;
} else if (floor == '2') {
arr = devicePosition1;
}
http http
.get(airConditionControl.getDeviceList, { .get(airConditionControl.getDeviceList, {
floor: thisFloor.value, floor: thisFloor.value,
@@ -288,7 +253,11 @@
siteId: state.siteId, siteId: state.siteId,
}) })
.then((res) => { .then((res) => {
console.log(res); const data = res.data;
data.forEach((item: any, index: number) => {
item.styleText = arr[index];
});
devices.value = data;
}); });
}; };
@@ -302,8 +271,29 @@
const toggleDrawer = () => { const toggleDrawer = () => {
visible.value = !visible.value; visible.value = !visible.value;
}; };
// 当其中一个tab产生了数据修改可以调用该方法重置所有tab
const resetDrawer = () => {
// 设备点阵重置
getBulbs();
// tab1重置
reload();
tabs1Ref.value.refresh();
// tab2 tab3 可能未加载
try {
// tab2重置
tabs2Ref.value.reset();
} catch {}
try {
// tab3重置
tabs3Ref.value.reset();
} catch {}
};
// 抽屉tab1组件的引用 // 抽屉tab1组件的引用
const tabs1Ref = ref(); const tabs1Ref = ref();
// 抽屉tab2组件的引用
const tabs2Ref = ref();
// 抽屉tab3组件的引用
const tabs3Ref = ref();
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import './index.less'; @import './index.less';

View File

@@ -1,3 +0,0 @@
// 此文件只定义light即俯视图小灯泡的位置信息
// 与显示状态和分组信息无关
export const lightPosition = [];

View File

@@ -171,6 +171,7 @@
title="此操作将会撤销修改" title="此操作将会撤销修改"
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
placement="bottomRight"
@confirm="delBtn(item)" @confirm="delBtn(item)"
@cancel="changeCancel"> @cancel="changeCancel">
<button class="cxbtn">撤销</button> <button class="cxbtn">撤销</button>
@@ -180,22 +181,24 @@
<div class="btn-item"> <div class="btn-item">
<div class="left">控制模式</div> <div class="left">控制模式</div>
<div class="right"> <div class="right">
<span>手动</span> <span>{{ item.stateBefore.autoStatus.label.replace('模式', '') }}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span> <span>{{ item.stateAfter.autoStatus.label.replace('模式', '') }}</span>
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> </div> <div class="left"> </div>
<div class="right"> <div class="right">
<!-- 数字0也会被判为false故只判断undefined null --> <!-- 数字0也会被判为false故只判断undefined null -->
<span>{{ <span>{{
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--' item.stateBefore.temperature != null ? item.stateBefore.temperature + '℃' : '--'
}}</span> }}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{ <span>
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--' {{
}}</span> item.stateAfter.temperature != null ? item.stateAfter.temperature + '℃' : '--'
}}
</span>
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
@@ -211,14 +214,14 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> 色温 </div> <div class="left"> 风速 </div>
<div class="right"> <div class="right">
<span>{{ <span>{{
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--' item.stateBefore.windSpeed != null ? item.stateBefore.windSpeed + 'm/s' : '--'
}}</span> }}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span> <span>
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }} {{ item.stateAfter.windSpeed != null ? item.stateAfter.windSpeed + 'm/s' : '--' }}
</span> </span>
</div> </div>
</div> </div>
@@ -269,8 +272,8 @@
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
// 请求 // 请求
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { lightingManage } from '/@/api/IlluminationInfo';
import { airConditionControl } from '/@/api/airConditionControlSystem'; import { airConditionControl } from '/@/api/airConditionControlSystem';
import { planManage } from '/@/api/planManage';
// 全局变量 // 全局变量
import { items } from '/@/store/item'; import { items } from '/@/store/item';
@@ -303,8 +306,9 @@
* @method changeArea 用于控制俯视图的选中状态 * @method changeArea 用于控制俯视图的选中状态
* @method reset 用于重置按钮区 * @method reset 用于重置按钮区
* @method reload 用于刷新一次页面 * @method reload 用于刷新一次页面
* @method resetAll 刷新所有tab对计划进行修改时需刷新tab2与tab3
*/ */
const emit = defineEmits(['changeArea', 'reset', 'reload']); const emit = defineEmits(['changeArea', 'reset', 'reload', 'resetAll']);
// 照明区域业务 ======================================================================= // 照明区域业务 =======================================================================
@@ -439,6 +443,10 @@
treePid: '', treePid: '',
childList: [], childList: [],
}); });
// 依托父组件传值,重置回路
const setButtons2 = (data: any) => {
buttons2.value = data;
};
// 照明回路的按钮切换 // 照明回路的按钮切换
const changeLine = (button: any) => { const changeLine = (button: any) => {
// 根据按钮状态,展示禁用/启用按钮文本 // 根据按钮状态,展示禁用/启用按钮文本
@@ -666,22 +674,20 @@
changeList.value.forEach((item: any) => { changeList.value.forEach((item: any) => {
resetChangeList(item); resetChangeList(item);
}); });
}
changeList.value = [];
if (!reload) {
lockList.value.forEach((item: any) => { lockList.value.forEach((item: any) => {
resetLockList(item); resetLockList(item);
}); });
// 默认选择第一个楼层
let data = props.treeData[0];
// 默认选中
data.selected = true;
// 默认选中 1-1 分区 回路
buttons2.value = data.childList;
// 将选中线路重置
resetMode();
} }
changeList.value = [];
lockList.value = []; lockList.value = [];
// 默认选择第一个楼层
let data = props.treeData[0];
// 默认选中
data.selected = true;
// 默认选中 1-1 分区 回路
buttons2.value = data.childList;
// 将选中线路重置
resetMode();
}; };
// 将已修改的禁用/启用状态改回 // 将已修改的禁用/启用状态改回
const resetLockList = (item: any) => { const resetLockList = (item: any) => {
@@ -727,9 +733,58 @@
}; };
// 右下角的执行事件 // 右下角的执行事件
const showModal = () => { const showModal = () => {
if (!changeList.value.length) { if (!changeList.value.length && !lockList.value.length) {
return message.info('未产生任何修改'); return message.info('未产生任何修改');
} }
http
.get(planManage.getRunningPlan, {
deviceType: 2,
projectId: state.projectId,
siteId: state.siteId,
})
.then((res) => {
// 如果有计划正在执行
if (res.data && res.data.length) {
// 此处框架本身存在问题弹出层在本地环境无法关闭暂时使用浏览器自带的confirm方法
// Modal.confirm({
// title: '提示信息',
// content: '有计划正在执行,点击"确定"将暂停当前计划',
// onOk() {
// return new Promise((resolve, reject) => {
// });
// },
// onCancel() { },
// });
let flag = window.confirm('有计划正在执行,点击"确定"将暂停当前计划');
if (flag) {
// 如果点击了确定,将先终止所有进行中的计划
http
.post(airConditionControl.submitChangeList, {
projectId: state.projectId,
siteId: state.siteId,
lockList: [],
sceneList: [],
})
.then((res) => {
console.log(res, '成功');
// 如果重置成功,则获取修改前后对比数据
if (res.retcode == 0) {
sendChangeList();
// 未成功提示
} else {
message.error('关闭进行中的任务操作失败,请重新尝试');
}
});
}
// 没有计划正在执行,则直接请求
} else {
sendChangeList();
}
});
};
// 提交控制场景 与 禁用/启用 修改
const sendChangeList = () => {
http http
.post(airConditionControl.getChangeList, { .post(airConditionControl.getChangeList, {
sceneList: changeList.value, sceneList: changeList.value,
@@ -738,7 +793,7 @@
siteId: state.siteId, siteId: state.siteId,
}) })
.then((res) => { .then((res) => {
if (res.msg === 'success') { if (res.retcode == 0) {
diffList.value = res.data; diffList.value = res.data;
executeVisible.value = true; executeVisible.value = true;
} else { } else {
@@ -790,10 +845,24 @@
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })
.then(() => { .then((res) => {
emit('reload'); let data = res.data;
// 修改请求发送了,但操作时产生了失败结果
if (res.retcode != 0) {
// 直接提示并跳出
return message.warning(data.msg);
}
// 所有修改均生效
if (data.allSucceed) {
message.success('修改完成');
// allSucceed不为true则至少有一条数据修改失败
} else {
message.info(`${data.successList.length}条修改成功,${data.failList.length}条修改失败`);
}
refresh(true); refresh(true);
}); emit('resetAll');
})
.catch(() => {});
}; };
// 其他业务 ======================================================================== // 其他业务 ========================================================================
@@ -814,6 +883,10 @@
changeArea, changeArea,
// 回路切换 // 回路切换
changeLine, changeLine,
// 重置当前选择
refresh,
// 由父组件反向刷新当前选中的回路
setButtons2,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@@ -99,11 +99,10 @@
// 初始化 =========================================================== // 初始化 ===========================================================
onMounted(() => { onMounted(() => {
// 获得枚举
getStateEnum(); getStateEnum();
// 计划表格 // 获得穿梭框 与 表格数据
getTable(); reset();
// 穿梭框原始数据
getLeftPlan();
}); });
// 全局变量 // 全局变量
const state = items(); const state = items();
@@ -111,6 +110,10 @@
let enumData = await getEnum({ params: { enumType: 'PlanExecuteStatus' } }); let enumData = await getEnum({ params: { enumType: 'PlanExecuteStatus' } });
stateList.value = enumData.data; stateList.value = enumData.data;
}; };
/**
* @method resetAll 刷新3个tab中的全部数据修改计划会影响tab1数据信息生成tab3日志
*/
const emit = defineEmits(['resetAll']);
// tab页部分 ======================================================== // tab页部分 ========================================================
@@ -190,14 +193,21 @@
.then((res) => { .then((res) => {
if (res.retcode == 0) { if (res.retcode == 0) {
message.success('操作成功'); message.success('操作成功');
getTable(); // 刷新数据
getLeftPlan(); emit('resetAll');
} else { } else {
message.info(res.msg); message.info(res.msg);
} }
}); });
}; };
const reset = () => {
// 计划表格
getTable();
// 穿梭框原始数据
getLeftPlan();
};
// tab页弹窗部分 ==================================================== // tab页弹窗部分 ====================================================
// 添加弹窗控制变量 // 添加弹窗控制变量
@@ -221,7 +231,7 @@
deviceType: 2, deviceType: 2,
}) })
.then((res) => { .then((res) => {
let arr = []; let arr: Array<Object> = [];
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
arr.push({ arr.push({
key: item.id, key: item.id,
@@ -248,14 +258,18 @@
http.post(planManage.submitTransData, targetKeys.value).then(() => { http.post(planManage.submitTransData, targetKeys.value).then(() => {
message.success('添加成功'); message.success('添加成功');
// 如果发送成功,则刷新表格 // 如果发送成功,则刷新表格
getTable(); reset();
getLeftPlan();
}); });
}; };
// 穿梭框交互 // 穿梭框交互
const filterOption = (inputValue: string, option: any) => { const filterOption = (inputValue: string, option: any) => {
return option.description.indexOf(inputValue) > -1; return option.description.indexOf(inputValue) > -1;
}; };
// 向外暴露方法
defineExpose({
reset,
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import '../style/dialogStyle.less'; @import '../style/dialogStyle.less';

View File

@@ -31,6 +31,7 @@
show-size-changer show-size-changer
:total="pagination.total" :total="pagination.total"
@change="getTable(true)" /> @change="getTable(true)" />
<div style="width: 100%; height: 40px"></div>
<div class="out-dialog" :class="{ showDialog: logModalVisible }" v-if="logModalVisible"> <div class="out-dialog" :class="{ showDialog: logModalVisible }" v-if="logModalVisible">
<div class="content"> <div class="content">
@@ -54,18 +55,29 @@
<div class="btn-item"> <div class="btn-item">
<div class="left">控制模式</div> <div class="left">控制模式</div>
<div class="right"> <div class="right">
<span>手动</span> <span>{{
item.autoStatusBefore.label.indexOf('模式') != -1
? item.autoStatusBefore.label.replace('模式', '')
: item.autoStatusBefore.label
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span></div <span>{{
item.autoStatusAfter.label.indexOf('模式') != -1
? item.autoStatusAfter.label.replace('模式', '')
: item.autoStatusAfter.label
}}</span></div
> >
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> </div> <div class="left"> </div>
<div class="right"> <div class="right">
<!-- 由于数字0也会被判为false故只判断undefined null --> <span>{{
<span>{{ item.brightnessBefore != null ? item.brightnessBefore : '--' }}</span> item.temperatureBefore != null ? item.temperatureBefore + '℃' : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{ item.brightnessAfter != null ? item.brightnessAfter : '--' }}</span> <span>
{{ item.temperatureAfter != null ? item.temperatureAfter + '℃' : '--' }}
</span>
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
@@ -77,13 +89,11 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> 色温 </div> <div class="left"> 风速 </div>
<div class="right"> <div class="right">
<span>{{ item.colorBefore != null ? item.colorBefore : '--' }}</span> <span>{{ item.windSpeedBefore ? item.windSpeedBefore + 'm/s' : '--' }}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span> <span>{{ item.windSpeedAfter ? item.windSpeedAfter + 'm/s' : '--' }}</span>
{{ item.colorAfter != null ? item.colorAfter : '--' }}
</span>
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
@@ -194,7 +204,13 @@
} }
}); });
}; };
// 日志详情
const cxList = ref([]); const cxList = ref([]);
// 向外暴露方法
defineExpose({
reset,
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import '../style/dialogStyle.less'; @import '../style/dialogStyle.less';

View File

@@ -227,6 +227,10 @@
}); });
} }
treeData.value = data[index].childList; treeData.value = data[index].childList;
// 反向刷新
try {
tabs1Ref.value.setButtons2(treeData.value[0].childList);
} catch {}
// 开始预加载 // 开始预加载
preload.value = true; preload.value = true;
}); });

View File

@@ -265,7 +265,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { DownOutlined, UpOutlined, StopOutlined } from '@ant-design/icons-vue'; import { DownOutlined, UpOutlined, StopOutlined } from '@ant-design/icons-vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
// 请求 // 请求
@@ -301,16 +301,6 @@
}, },
}); });
watch(
() => props.treeData,
(newValue) => {
// 重新为照明回路赋值
// buttons2.value = newValue[0].childList;
},
{
deep: true,
},
);
/** 向上传递方法 /** 向上传递方法
* @method changeArea 用于控制俯视图的选中状态 * @method changeArea 用于控制俯视图的选中状态
* @method reset 用于重置按钮区 * @method reset 用于重置按钮区
@@ -452,6 +442,10 @@
treePid: '', treePid: '',
childList: [], childList: [],
}); });
// 依托父组件传值,重置回路
const setButtons2 = (data: any) => {
buttons2.value = data;
};
// 照明回路的按钮切换 // 照明回路的按钮切换
const changeLine = (button: any) => { const changeLine = (button: any) => {
// 根据按钮状态,展示禁用/启用按钮文本 // 根据按钮状态,展示禁用/启用按钮文本
@@ -688,6 +682,7 @@
data.selected = true; data.selected = true;
// 默认选中 1-1 分区 回路 // 默认选中 1-1 分区 回路
buttons2.value = data.childList; buttons2.value = data.childList;
// 将选中线路重置
resetMode(); resetMode();
} }
changeList.value = []; changeList.value = [];
@@ -890,6 +885,8 @@
changeLine, changeLine,
// 重置当前选择 // 重置当前选择
refresh, refresh,
// 由父组件反向刷新当前选中的回路
setButtons2,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@@ -89,8 +89,8 @@
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
// 请求 // 请求
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { lightingManage } from '/@/api/IlluminationInfo';
import { planManage } from '/@/api/planManage'; import { planManage } from '/@/api/planManage';
import { lightingManage } from '/@/api/IlluminationInfo';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { getEnum } from '/@/api'; import { getEnum } from '/@/api';
// 全局变量 // 全局变量

View File

@@ -231,7 +231,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { DownOutlined, UpOutlined, StopOutlined } from '@ant-design/icons-vue'; import { DownOutlined, UpOutlined, StopOutlined } from '@ant-design/icons-vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
// 请求 // 请求
@@ -289,16 +289,6 @@
}, },
}); });
watch(
() => props.treeData,
(newValue) => {
// 重新为照明回路赋值
// buttons2.value = newValue[0].childList;
},
{
deep: true,
},
);
/** 向上传递方法 /** 向上传递方法
* @method changeArea 用于控制俯视图的选中状态 * @method changeArea 用于控制俯视图的选中状态
* @method reset 用于重置按钮区 * @method reset 用于重置按钮区
@@ -412,6 +402,10 @@
treePid: '', treePid: '',
childList: [], childList: [],
}); });
// 依托父组件传值,重置回路
const setButtons2 = (data: any) => {
buttons2.value = data;
};
// 照明回路的按钮切换 // 照明回路的按钮切换
const changeLine = (button: any) => { const changeLine = (button: any) => {
// 根据按钮状态,展示禁用/启用按钮文本 // 根据按钮状态,展示禁用/启用按钮文本
@@ -839,6 +833,8 @@
changeLine, changeLine,
// 重置当前选择 // 重置当前选择
refresh, refresh,
// 由父组件反向刷新当前选中的回路
setButtons2,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@@ -376,6 +376,10 @@
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;
treeData.value = data[0].childList; treeData.value = data[0].childList;
// 反向刷新
try {
tabs1Ref.value.setButtons2(treeData.value[0].childList);
} catch {}
}); });
}; };