Browse Source

fix:电梯系统/照明系统 代码规范

temp
chenpingsen 2 months ago
parent
commit
a9e6998430
  1. 24
      hx-ai-intelligent/src/view/equipmentControl/liftSystem/index.vue
  2. 13
      hx-ai-intelligent/src/view/equipmentControl/liftSystem/liftInfo.vue
  3. 166
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue
  4. 25
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/light.vue
  5. 303
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue
  6. 67
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue
  7. 38
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs3.vue

24
hx-ai-intelligent/src/view/equipmentControl/liftSystem/index.vue

@ -1,46 +1,41 @@
<template> <template>
<div class="map-box"> <div class="map-box">
<div class="map"> <div class="map">
<liftInfo></liftInfo> <liftInfo />
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import liftInfo from './liftInfo.vue' import liftInfo from './liftInfo.vue';
// //
import { message } from 'ant-design-vue';
// =========================================================== // ===========================================================
onMounted(() => { onMounted(() => {});
})
// tab ======================================================== // tab ========================================================
// //
const dataSource = ref([]); const dataSource = ref([]);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.map-box { .map-box {
// //
// - - - // - - -
--on: #0DFFA4; --on: #0dffa4;
// //
--off: #BFCDE2; --off: #bfcde2;
// - // -
--pause: #FFBC46; --pause: #ffbc46;
// - // -
--stop: #F36163; --stop: #f36163;
// //
--fault: #FF7636; --fault: #ff7636;
// //
--unknown: #A742FF; --unknown: #a742ff;
width: 100%; width: 100%;
height: 100%; height: 100%;
.map { .map {
@ -49,5 +44,4 @@ const dataSource = ref([]);
background-image: url(../image/bg.jpg); background-image: url(../image/bg.jpg);
} }
} }
</style> </style>

13
hx-ai-intelligent/src/view/equipmentControl/liftSystem/liftInfo.vue

@ -10,7 +10,7 @@
<div class="item-box"> <div class="item-box">
<div class="icon"> <div class="icon">
<div class="icon-item"> <div class="icon-item">
<img src="../image/liftState/lift-normal.svg" alt=""> <img src="../image/liftState/lift-normal.svg" alt="" />
</div> </div>
</div> </div>
</div> </div>
@ -21,7 +21,7 @@
<div class="item-box"> <div class="item-box">
<div class="icon"> <div class="icon">
<div class="icon-item"> <div class="icon-item">
<img src="../image/liftState/lift-normal.svg" alt=""> <img src="../image/liftState/lift-normal.svg" alt="" />
</div> </div>
</div> </div>
</div> </div>
@ -32,7 +32,7 @@
<div class="item-box"> <div class="item-box">
<div class="icon"> <div class="icon">
<div class="icon-item"> <div class="icon-item">
<img src="../image/liftState/lift-normal.svg" alt=""> <img src="../image/liftState/lift-normal.svg" alt="" />
</div> </div>
</div> </div>
</div> </div>
@ -49,9 +49,7 @@ import { ref, onMounted } from 'vue';
// =========================================================== // ===========================================================
onMounted(() => { onMounted(() => {});
})
// tab ======================================================== // tab ========================================================
@ -59,8 +57,6 @@ onMounted(() => {
const runState = ref('1'); const runState = ref('1');
// //
const liftState = ref('2'); const liftState = ref('2');
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
// //
@ -147,5 +143,4 @@ const liftState = ref('2');
} }
} }
} }
</style> </style>

166
hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue

@ -3,7 +3,9 @@
<div class="lighting-img-box"> <div class="lighting-img-box">
<!-- 左上角区域切换 --> <!-- 左上角区域切换 -->
<div class="btn-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 in floorData" class="btn-item" @click="changeFloor(item.childList)">{{
item.name
}}</button>
</div> </div>
<!-- 楼层区域 --> <!-- 楼层区域 -->
<div class="area"> <div class="area">
@ -21,12 +23,12 @@
</div> </div>
<!-- 照明设备 --> <!-- 照明设备 -->
<div class="lights"> <div class="lights">
<light v-for="(item, index) in bulbs" <light
v-for="(item, index) in bulbs"
:key="index" :key="index"
:styleObject="item.styleText" :styleObject="item.styleText"
:type="item.type" :type="item.type"
:visible="item.visible"> :visible="item.visible" />
</light>
</div> </div>
</div> </div>
<!-- 右侧抽屉的触发按钮 --> <!-- 右侧抽屉的触发按钮 -->
@ -35,7 +37,7 @@
</div> </div>
<!-- 左侧抽屉的关闭按钮 --> <!-- 左侧抽屉的关闭按钮 -->
<div class="drawer-box-out" v-if="visible" @click="toggleDrawer"> <div class="drawer-box-out" v-if="visible" @click="toggleDrawer">
<double-right-outlined class="drawer-icon" style="color: white;" /> <double-right-outlined class="drawer-icon" style="color: white" />
</div> </div>
<!-- 右侧抽屉 --> <!-- 右侧抽屉 -->
<a-drawer <a-drawer
@ -50,18 +52,13 @@
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> :maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<tabs1 <tabs1 ref="tabs1Ref" @changeArea="changeArea" @reset="reset" :treeData="treeData" />
ref="tabs1Ref"
@changeArea="changeArea"
@reset="reset"
:treeData="treeData"
></tabs1>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render> <a-tab-pane key="2" tab="计划列表" force-render>
<tabs2></tabs2> <tabs2 />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="3" tab="日志"> <a-tab-pane key="3" tab="日志">
<tabs3></tabs3> <tabs3 />
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</a-drawer> </a-drawer>
@ -69,170 +66,163 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
// //
import light from './light.vue'; import light from './light.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';
// //
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { lightingManage } from '/@/api/IlluminationInfo'; import { lightingManage } from '/@/api/IlluminationInfo';
// ICON // ICON
import { import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons-vue';
DoubleLeftOutlined,
DoubleRightOutlined
} from '@ant-design/icons-vue';
// ======================================================= // =======================================================
onMounted(() => { onMounted(() => {
// 线 // 线
getAllArea() getAllArea();
}) });
// flagref // flagref
const preload = ref(false) const preload = ref(false);
// ===================================================== // =====================================================
// //
const floorData = ref([]) const floorData = ref([]);
// //
const changeFloor = (area: any) => { const changeFloor = (area: any) => {
// //
reset() reset();
// //
changeArea(['1']) changeArea(['1']);
// //
treeData.value = area treeData.value = area;
// //
treeData.value[0].selected = true treeData.value[0].selected = true;
} };
// ===================================================== // =====================================================
// //
const treeData = ref([]) const treeData = ref([]);
// - // -
const area = ref(['1']) const area = ref(['1']);
// 线 - // 线 -
const bulbs = ref([ const bulbs = ref([
{ {
styleText: { left: '180px', bottom: '200px' }, styleText: { left: '180px', bottom: '200px' },
area: 1, area: 1,
type: 1, type: 1,
visible: true visible: true,
}, },
{ {
styleText: { left: '230px', bottom: '125px' }, styleText: { left: '230px', bottom: '125px' },
area: 1, area: 1,
type: 2, type: 2,
visible: true visible: true,
}, },
{ {
styleText: { left: '320px', bottom: '140px' }, styleText: { left: '320px', bottom: '140px' },
area: 1, area: 1,
type: 3, type: 3,
visible: true visible: true,
}, },
{ {
styleText: { left: '245px', bottom: '230px' }, styleText: { left: '245px', bottom: '230px' },
area: 1, area: 1,
type: 3, type: 3,
visible: true visible: true,
}, },
{ {
styleText: { left: '405px', bottom: '230px' }, styleText: { left: '405px', bottom: '230px' },
area: 2, area: 2,
type: 3, type: 3,
visible: true visible: true,
}, },
{ {
styleText: { left: '460px', bottom: '180px' }, styleText: { left: '460px', bottom: '180px' },
area: 2, area: 2,
type: 3, type: 3,
visible: true visible: true,
}, },
{ {
styleText: { left: '360px', bottom: '275px' }, styleText: { left: '360px', bottom: '275px' },
area: 2, area: 2,
type: 3, type: 3,
visible: true visible: true,
}, },
{ {
styleText: { left: '715px', bottom: '320px' }, styleText: { left: '715px', bottom: '320px' },
area: 3, area: 3,
type: 1, type: 1,
visible: true visible: true,
}, },
]) ]);
// 线 // 线
const changeArea = (result: any) => { const changeArea = (result: any) => {
console.log(result,'changeArea') console.log(result, 'changeArea');
// //
if (Array.isArray(result)) { if (Array.isArray(result)) {
area.value = result area.value = result;
// //
} else { } else {
area.value.length = 0 area.value.length = 0;
area.value[0] = String(result) area.value[0] = String(result);
}
} }
};
// //
const changeThisArea = (result: any) => { const changeThisArea = (result: any) => {
console.log(result, 'changeThisArea') console.log(result, 'changeThisArea');
// //
reset() reset();
let level1 = result[0]; let level1 = result[0];
area.value.length = 0 area.value.length = 0;
// //
if (result.length === 1) { if (result.length === 1) {
result[0].selected = true result[0].selected = true;
area.value.push(result[0].id) area.value.push(result[0].id);
// //
tabs1Ref.value.changeArea(result[0]) tabs1Ref.value.changeArea(result[0]);
// + 线 // + 线
} else if (result.length === 2) { } else if (result.length === 2) {
// //
if (!level1) { if (!level1) {
level1 = treeData.value[0] level1 = treeData.value[0];
} }
// true // true
level1.selected = result[1].selected = true level1.selected = result[1].selected = true;
area.value.splice(0, 0, level1.id, result[1].id) area.value.splice(0, 0, level1.id, result[1].id);
// //
tabs1Ref.value.changeArea(result[0]) tabs1Ref.value.changeArea(result[0]);
tabs1Ref.value.changeLine(result[1]) tabs1Ref.value.changeLine(result[1]);
}
} }
};
// //
const reset = () => { const reset = () => {
treeData.value.forEach((item: any) => { treeData.value.forEach((item: any) => {
item.selected = false item.selected = false;
item.childList.forEach((i: any) => { item.childList.forEach((i: any) => {
i.selected = false i.selected = false;
}) });
}) });
} };
// //
const computedClass = (string: string) => { const computedClass = (string: string) => {
if (area.value.indexOf(string) != -1) { if (area.value.indexOf(string) != -1) {
return `isActive area-item area${string}` return `isActive area-item area${string}`;
} else { } else {
return `area-item area${string}` return `area-item area${string}`;
}
} }
};
// //
const getAllArea = () => { const getAllArea = () => {
http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then(res => { http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then((res) => {
const data = res.data const data = res.data;
floorData.value = data floorData.value = data;
/** 使 /** 使
* @param id 用于判断样式和层级的前端属性 * @param id 用于判断样式和层级的前端属性
* @param selected 用于表示是否选中的前端属性 * @param selected 用于表示是否选中的前端属性
@ -240,23 +230,23 @@ const getAllArea = () => {
data.forEach((floor: any) => { data.forEach((floor: any) => {
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;
} else { } else {
item.selected = false item.selected = false;
} }
item.id = String(index + 1) item.id = String(index + 1);
item.childList.forEach((v: any, i: number) => { item.childList.forEach((v: any, i: number) => {
v.selected = false v.selected = false;
v.id = (index + 1) + '-' + (i + 1) v.id = index + 1 + '-' + (i + 1);
}) });
}) });
}) });
// 线 1-1 // 线 1-1
treeData.value = data[0].childList treeData.value = data[0].childList;
// //
preload.value = true preload.value = true;
}) });
} };
// ===================================================== // =====================================================
@ -269,18 +259,18 @@ const toggleDrawer = () => {
visible.value = !visible.value; visible.value = !visible.value;
}; };
// tab1 // tab1
const tabs1Ref = ref() const tabs1Ref = ref();
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "./index.less"; @import './index.less';
// //
.isActive { .isActive {
border: 3px solid white !important; border: 3px solid white !important;
} }
// tab // tab
:deep(.ant-tabs-tab-btn) { :deep(.ant-tabs-tab-btn) {
color: white; color: white;
} }
</style> </style>

25
hx-ai-intelligent/src/view/equipmentControl/lightingManage/light.vue

@ -34,9 +34,9 @@
</div> </div>
</template> </template>
<div class="icon-box" :style="styleObject" v-show="visible"> <div class="icon-box" :style="styleObject" v-show="visible">
<img v-if="type == 1" class="icon-item" src="/asset/image/bulbLogo/22394.png" alt=""> <img v-if="type == 1" class="icon-item" src="/asset/image/bulbLogo/22394.png" alt="" />
<img v-if="type == 2" class="icon-item" src="/asset/image/bulbLogo/22396.png" alt=""> <img v-if="type == 2" class="icon-item" src="/asset/image/bulbLogo/22396.png" alt="" />
<img v-if="type == 3" class="icon-item" src="/asset/image/bulbLogo/22400.png" alt=""> <img v-if="type == 3" class="icon-item" src="/asset/image/bulbLogo/22400.png" alt="" />
</div> </div>
</a-popover> </a-popover>
</template> </template>
@ -49,8 +49,8 @@ defineProps({
type: Number, type: Number,
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}); });
const result = ref({ const result = ref({
@ -65,39 +65,44 @@ const result = ref({
brightness3: '4000k', brightness3: '4000k',
brightness4: '3800k', brightness4: '3800k',
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.icon-box { .icon-box {
width: 25px; width: 25px;
height: 25px; height: 25px;
position: absolute; position: absolute;
.icon-item { .icon-item {
width: 25px; width: 25px;
cursor: pointer; cursor: pointer;
transition: all ease 0.1s; transition: all ease 0.1s;
} }
.icon-item:active { .icon-item:active {
transform: scale(1.2); transform: scale(1.2);
} }
} }
// //
.light-tag { .light-tag {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
// //
.light-tag-tit { .light-tag-tit {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
vertical-align: middle; vertical-align: middle;
height: 30px; height: 30px;
.tag-text { .tag-text {
font-size: 16px; font-size: 16px;
font-weight: 700; font-weight: 700;
color: white; color: white;
padding-left: 10px; padding-left: 10px;
} }
.right-button { .right-button {
width: 50px; width: 50px;
height: 26px; height: 26px;
@ -108,33 +113,37 @@ const result = ref({
} }
} }
} }
// 4 // 4
.light-tag-box { .light-tag-box {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr; grid-template-rows: 1fr 1fr;
grid-gap: 10px; grid-gap: 10px;
.tag-box-item { .tag-box-item {
position: relative; position: relative;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
img { img {
width: 120px; width: 120px;
vertical-align: middle; vertical-align: middle;
} }
.title { .title {
position: absolute; position: absolute;
left: 60px; left: 60px;
top: 13px; top: 13px;
color: rgba(64, 255, 252, 1); color: rgba(64, 255, 252, 1);
} }
.result { .result {
line-height: 50px; line-height: 50px;
font-size: 16px; font-size: 16px;
font-weight: 700; font-weight: 700;
color: white; color: white;
}; }
} }
} }
</style> </style>

303
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue

@ -5,15 +5,21 @@
<div class="light-area"> <div class="light-area">
<div class="light-area-tab"></div> <div class="light-area-tab"></div>
<span class="light-area-text"> 照明区域 </span> <span class="light-area-text"> 照明区域 </span>
<button class="plan" :class="{ enabled: isPlanEnabled, disabled: !isPlanEnabled }" @click="togglePlan"> <button
class="plan"
:class="{ enabled: isPlanEnabled, disabled: !isPlanEnabled }"
@click="togglePlan">
{{ isPlanEnabled ? '计划启用' : '计划禁用' }} {{ isPlanEnabled ? '计划启用' : '计划禁用' }}
</button> </button>
</div> </div>
<!-- 照明区域按钮部分 --> <!-- 照明区域按钮部分 -->
<div class="area"> <div class="area">
<template v-if="!showAllButtonsArea"> <template v-if="!showAllButtonsArea">
<button v-for="(button, index) in limitedButtons1" :key="index" <button
:class="{ btn: true, selected: button.selected }" @click="changeArea(button)"> v-for="(button, index) in limitedButtons1"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }} {{ button.name }}
</button> </button>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
@ -21,7 +27,10 @@
</div> </div>
</template> </template>
<template v-else> <template v-else>
<button v-for="(button, index) in props.treeData" :key="index" :class="{ btn: true, selected: button.selected }" <button
v-for="(button, index) in props.treeData"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)"> @click="changeArea(button)">
{{ button.name }} {{ button.name }}
</button> </button>
@ -37,13 +46,20 @@
<div class="circuit-tab"></div> <div class="circuit-tab"></div>
<span class="circuit-text">照明回路</span> <span class="circuit-text">照明回路</span>
<div class="btn2"> <div class="btn2">
<button class="openPlan" :class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }" @click="togglePlan2"> <button
class="openPlan"
:class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }"
@click="togglePlan2">
{{ isPlanEnabled2 ? '启用面板' : '禁用面板' }} {{ isPlanEnabled2 ? '启用面板' : '禁用面板' }}
</button> </button>
<a-switch v-model:checked="selectAllCheckbox" :disabled="singleSelection" :class="{ <a-switch
v-model:checked="selectAllCheckbox"
:disabled="singleSelection"
:class="{
'blue-background': selectAllCheckbox, 'blue-background': selectAllCheckbox,
'grey-background': !selectAllCheckbox, 'grey-background': !selectAllCheckbox,
}" @change="toggleAllSelection" /> }"
@change="toggleAllSelection" />
<button class="allBtn">全选</button> <button class="allBtn">全选</button>
<button class="both" @click="selectAll"> <button class="both" @click="selectAll">
{{ singleSelection ? '多选' : '单选' }} {{ singleSelection ? '多选' : '单选' }}
@ -52,8 +68,12 @@
</div> </div>
<div class="btnArea"> <div class="btnArea">
<template v-if="!showAllButtons"> <template v-if="!showAllButtons">
<button v-for="(button, index) in limitedButtons2" :key="index" <button
:class="{ btn: true, selected: button.selected }" class="zmhlbtn" @click="changeLine(button)"> v-for="(button, index) in limitedButtons2"
:key="index"
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" /> <stop-outlined v-if="button.ctrlStatus" />
{{ button.name }} {{ button.name }}
</button> </button>
@ -62,8 +82,12 @@
</div> </div>
</template> </template>
<template v-else> <template v-else>
<button v-for="(button, index) in buttons2" :key="index" <button
:class="{ btn: true, selected: button.selected }" class="zmhlbtn" @click="changeLine(button)"> v-for="(button, index) in buttons2"
:key="index"
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" /> <stop-outlined v-if="button.ctrlStatus" />
{{ button.name }} {{ button.name }}
</button> </button>
@ -81,10 +105,13 @@
</div> </div>
<!-- 控制模式按钮部分 --> <!-- 控制模式按钮部分 -->
<div class="control-mode-btn-area" v-show="thisButton2.code"> <div class="control-mode-btn-area" v-show="thisButton2.code">
<button v-for="(button3, index) in controlMode" :key="index" <button
v-for="(button3, index) in controlMode"
:key="index"
class="btn" class="btn"
:disabled="button3.value != 3" :disabled="button3.value != 3"
:class="{ selected: thisButton2.mode.value == button3.value }" @click="selectButton3(button3)"> :class="{ selected: thisButton2.mode.value == button3.value }"
@click="selectButton3(button3)">
{{ button3.label }} {{ button3.label }}
</button> </button>
</div> </div>
@ -97,8 +124,11 @@
</div> </div>
<!-- 控制场景按钮部分 --> <!-- 控制场景按钮部分 -->
<div class="control-scene-btn-area" v-show="thisButton2.mode.value == 3"> <div class="control-scene-btn-area" v-show="thisButton2.mode.value == 3">
<button v-for="(button4, index) in controlScene" :key="index" <button
:class="{ btn: true, selected: thisButton2.scene.value == button4.value }" @click="selectButton4(button4)"> v-for="(button4, index) in controlScene"
:key="index"
:class="{ btn: true, selected: thisButton2.scene.value == button4.value }"
@click="selectButton4(button4)">
{{ button4.label }} {{ button4.label }}
</button> </button>
</div> </div>
@ -110,8 +140,7 @@
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
@confirm="changeConfirm" @confirm="changeConfirm"
@cancel="changeCancel" @cancel="changeCancel">
>
<button class="flushed">刷新</button> <button class="flushed">刷新</button>
</a-popconfirm> </a-popconfirm>
<button class="execute" @click="showModal">执行</button> <button class="execute" @click="showModal">执行</button>
@ -129,7 +158,11 @@
<div class="imgText"> <div class="imgText">
<div class="zjzm"> <div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp; <img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span class="title-text" style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)">{{ item.name }}</span> <span
class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.name }}</span
>
</div> </div>
<button class="cxbtn" @click="delBtn(item.id)">撤销</button> <button class="cxbtn" @click="delBtn(item.id)">撤销</button>
</div> </div>
@ -143,9 +176,7 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> <div class="left"> 亮度 </div>
亮度
</div>
<div class="right"> <div class="right">
<span>100lux</span> <span>100lux</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
@ -153,9 +184,7 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> <div class="left"> 控制场景 </div>
控制场景
</div>
<div class="right"> <div class="right">
<span>手动</span> <span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
@ -163,9 +192,7 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> <div class="left"> 色温 </div>
色温
</div>
<div class="right"> <div class="right">
<span>4000k</span> <span>4000k</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
@ -176,7 +203,7 @@
</div> </div>
</div> </div>
</div> </div>
<div style="width: 100%; height: 60px;"></div> <div style="width: 100%; height: 60px"></div>
<div class="button-box"> <div class="button-box">
<button class="cancel" @click="executeVisible = false">取消</button> <button class="cancel" @click="executeVisible = false">取消</button>
<button class="execute">执行</button> <button class="execute">执行</button>
@ -187,40 +214,36 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { import { DownOutlined, UpOutlined, StopOutlined } from '@ant-design/icons-vue';
DownOutlined,
UpOutlined,
StopOutlined,
} from '@ant-design/icons-vue';
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 { lightingManage } from '/@/api/IlluminationInfo';
import { getAllEnum } from '/@/api/index' import { getAllEnum } from '/@/api/index';
// ========================================================================= // =========================================================================
onMounted(() => { onMounted(() => {
// //
setArea() setArea();
// //
getEnum(['IlluminationMode', 'IlluminationScene']) getEnum(['IlluminationMode', 'IlluminationScene']);
}) });
// //
const getEnum = (arr: any) => { const getEnum = (arr: any) => {
getAllEnum({ params: arr }).then(res => { getAllEnum({ params: arr }).then((res) => {
const data = res.data const data = res.data;
// //
controlMode.value = data.IlluminationMode controlMode.value = data.IlluminationMode;
// //
controlScene.value = data.IlluminationScene controlScene.value = data.IlluminationScene;
}) });
} };
// 1-1 线 // 1-1 线
const setArea = () => { const setArea = () => {
const data = props.treeData[0] const data = props.treeData[0];
buttons2.value = data.childList buttons2.value = data.childList;
} };
// =================================================================== // ===================================================================
@ -228,8 +251,8 @@ const props = defineProps({
// > // >
treeData: { treeData: {
type: Array, type: Array,
default: [] default: [],
} },
}); });
// //
/** /**
@ -257,17 +280,17 @@ const changeArea = (button: any) => {
// //
selectedButton.value = button.id; selectedButton.value = button.id;
// 线 // 线
buttons2.value = button.childList buttons2.value = button.childList;
// //
emit('reset') emit('reset');
// //
button.selected = true button.selected = true;
// //
emit('changeArea', button.id); emit('changeArea', button.id);
// 线 - // 线 -
resetMode() resetMode();
// - // -
handleButton.value = '' handleButton.value = '';
}; };
// 8 // 8
const limitedButtons1 = computed(() => props.treeData.slice(0, 8)); const limitedButtons1 = computed(() => props.treeData.slice(0, 8));
@ -286,50 +309,55 @@ const togglePlan2 = () => {
return message.info('请选择照明回路'); return message.info('请选择照明回路');
} }
// //
const btn: any = buttons2.value.find((button) => button.id === handleButton.value) const btn: any = buttons2.value.find((button) => button.id === handleButton.value);
let panel = +(!btn.ctrlStatus) let panel = +!btn.ctrlStatus;
isLoading.value = true isLoading.value = true;
http.get(lightingManage.setDisable, { deviceGroup: btn.code, panel }).then(res => { http
.get(lightingManage.setDisable, { deviceGroup: btn.code, panel })
.then((res) => {
if (res.msg === 'success') { if (res.msg === 'success') {
// - - - loading // - - - loading
isPlanEnabled2.value = !isPlanEnabled2.value; isPlanEnabled2.value = !isPlanEnabled2.value;
btn.ctrlStatus = panel btn.ctrlStatus = panel;
isLoading.value = false isLoading.value = false;
} else { } else {
isLoading.value = false isLoading.value = false;
} }
}).catch(() => { isLoading.value = false }) })
.catch(() => {
isLoading.value = false;
});
}; };
// //
let singleSelection = ref(true); let singleSelection = ref(true);
// //
const selectAll = () => { const selectAll = () => {
selectAllCheckbox.value = false selectAllCheckbox.value = false;
buttons2.value.forEach((button) => { buttons2.value.forEach((button) => {
button.selected = false; button.selected = false;
}); });
singleSelection.value = !singleSelection.value; singleSelection.value = !singleSelection.value;
// 线 - // 线 -
resetMode() resetMode();
// //
emit('changeArea', [selectedButton.value]) emit('changeArea', [selectedButton.value]);
}; };
// //
const selectAllCheckbox = ref(false); const selectAllCheckbox = ref(false);
// switch // switch
const toggleAllSelection = () => { const toggleAllSelection = () => {
let arr = [selectedButton.value] let arr = [selectedButton.value];
// //
if (selectAllCheckbox.value) { if (selectAllCheckbox.value) {
buttons2.value.forEach((item, index) => { buttons2.value.forEach((item, index) => {
// 线- // 线-
if (index == 0) { if (index == 0) {
thisButton2.value = item thisButton2.value = item;
} }
item.selected = true; item.selected = true;
arr.push(item.id) arr.push(item.id);
}); });
// //
} else { } else {
@ -337,62 +365,62 @@ const toggleAllSelection = () => {
item.selected = false; item.selected = false;
}); });
// - // -
resetMode() resetMode();
} }
emit('changeArea', arr) emit('changeArea', arr);
}; };
// 线 // 线
const thisButton2 = ref({ const thisButton2 = ref({
code: '', code: '',
mode: { mode: {
value: -1 value: -1,
}, },
scene: { scene: {
value: -1 value: -1,
} },
}) });
// //
const changeLine = (button: any) => { const changeLine = (button: any) => {
// ID/ // ID/
handleButton.value = button.id handleButton.value = button.id;
// / // /
if (button.ctrlStatus) { if (button.ctrlStatus) {
isPlanEnabled2.value = true isPlanEnabled2.value = true;
} else { } else {
isPlanEnabled2.value = false isPlanEnabled2.value = false;
} }
// //
let level1 = selectedButton.value let level1 = selectedButton.value;
let level2 = button.id let level2 = button.id;
// false // false
if (singleSelection.value) { if (singleSelection.value) {
buttons2.value.forEach(item => { buttons2.value.forEach((item) => {
item.selected = false; item.selected = false;
}); });
button.selected = !button.selected; button.selected = !button.selected;
emit('changeArea', [level1, level2]) emit('changeArea', [level1, level2]);
} else { } else {
// //
button.selected = !button.selected; button.selected = !button.selected;
const arr = [level1] const arr = [level1];
buttons2.value.forEach(item => { buttons2.value.forEach((item) => {
if (item.selected) { if (item.selected) {
arr.push(item.id) arr.push(item.id);
} }
}); });
emit('changeArea', arr) emit('changeArea', arr);
} }
// //
if (button.selected) { if (button.selected) {
// //
thisButton2.value = button thisButton2.value = button;
} else { } else {
// //
resetMode() resetMode();
} }
console.log(thisButton2,'button') console.log(thisButton2, 'button');
}; };
// //
@ -406,52 +434,52 @@ const limitedButtons2 = computed(() => buttons2.value.slice(0, 8));
// - // -
const selectButton3 = (button3) => { const selectButton3 = (button3) => {
let checked = thisButton2.value.mode let checked = thisButton2.value.mode;
console.log(button3.value,'---', checked.value) console.log(button3.value, '---', checked.value);
// //
if (checked.value === button3.value) { if (checked.value === button3.value) {
return return;
} }
checked.value = button3.value checked.value = button3.value;
}; };
// ===================================================================== // =====================================================================
// //
const controlMode = ref([]) const controlMode = ref([]);
// //
const controlScene = ref([]) const controlScene = ref([]);
// - // -
const selectedButton4 = ref(null); const selectedButton4 = ref(null);
// - // -
const selectButton4 = (button4) => { const selectButton4 = (button4) => {
// 线 // 线
const data = thisButton2.value const data = thisButton2.value;
// //
let before = data.scene.value let before = data.scene.value;
// //
let after = button4.value let after = button4.value;
// //
if (before === after) { if (before === after) {
return return;
// //
} else { } else {
thisButton2.value.scene.value = after thisButton2.value.scene.value = after;
// //
const result = changeList.value.find((item, index) => { const result = changeList.value.find((item, index) => {
item.index = index item.index = index;
return item.deviceGroup == data.code return item.deviceGroup == data.code;
}) });
// //
if (result) { if (result) {
// //
if (after == result.before) { if (after == result.before) {
changeList.value.splice(result.index, 1) changeList.value.splice(result.index, 1);
// after // after
} else { } else {
result.scene = after result.scene = after;
// flag // flag
delete result.index delete result.index;
} }
// //
} else { } else {
@ -465,23 +493,23 @@ const selectButton4 = (button4) => {
// //
before: before, before: before,
// //
scene: after scene: after,
}) });
} }
console.log(changeList.value, 'changeList') console.log(changeList.value, 'changeList');
} }
thisButton2.value.scene.value = after thisButton2.value.scene.value = after;
console.log(thisButton2,'222222') console.log(thisButton2, '222222');
console.log(button4,'44444') console.log(button4, '44444');
}; };
// ======================================================================== // ========================================================================
// //
const changeList: any = ref([]) const changeList: any = ref([]);
// //
const submitList = ref([]) const submitList = ref([]);
const cxList = ref([ const cxList = ref([
{ {
id: '1', id: '1',
@ -532,69 +560,68 @@ const delBtn = () => {
// ======================================================================== // ========================================================================
const isLoading = ref(false) const isLoading = ref(false);
// //
const refresh = () => { const refresh = () => {
// //
executeVisible.value = false executeVisible.value = false;
// //
selectedButton.value = '1'; selectedButton.value = '1';
emit('changeArea', ['1']); emit('changeArea', ['1']);
emit('reset') emit('reset');
let data = props.treeData[0] let data = props.treeData[0];
// //
data.selected = true data.selected = true;
buttons2.value = data.childList buttons2.value = data.childList;
selectedButton4.value = null; selectedButton4.value = null;
resetMode() resetMode();
}; };
// //
const executeVisible = ref<boolean>(false); const executeVisible = ref<boolean>(false);
const showModal = () => { const showModal = () => {
http.post(lightingManage.getChangeList, { infoList: changeList.value, projectId: 'HLlmTZp8' }).then(res => { http
.post(lightingManage.getChangeList, { infoList: changeList.value, projectId: 'HLlmTZp8' })
.then((res) => {
if (res.msg === 'success') { if (res.msg === 'success') {
isLoading.value = true isLoading.value = true;
console.log(res) console.log(res);
} else { } else {
isLoading.value = false isLoading.value = false;
} }
}) });
executeVisible.value = true; executeVisible.value = true;
}; };
// //
const changeConfirm = () => { const changeConfirm = () => {
refresh() refresh();
} };
// //
const changeCancel = () => { const changeCancel = () => {};
}
// 线 // 线
const resetMode = () => { const resetMode = () => {
thisButton2.value = { thisButton2.value = {
code: '', code: '',
mode: { mode: {
value: -1 value: -1,
}, },
scene: { scene: {
value: -1 value: -1,
} },
} };
} };
// //
defineExpose({ defineExpose({
// //
changeArea, changeArea,
// 线 // 线
changeLine changeLine,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "./dialogStyle.less"; @import './dialogStyle.less';
@import "./tabs1.less"; @import './tabs1.less';
</style> </style>

67
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue

@ -45,8 +45,7 @@
title="此操作将永久删除该条数据" title="此操作将永久删除该条数据"
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
@confirm="deletePlan(row.id)" @confirm="deletePlan(row.id)">
>
<div class="tabDelete">删除</div> <div class="tabDelete">删除</div>
</a-popconfirm> </a-popconfirm>
</td> </td>
@ -70,7 +69,7 @@
@search="handleSearch" @search="handleSearch"
:listStyle="{ border: '2px solid rgba(25,74,125,1)', height: 'calc(100vh - 200px)' }" /> :listStyle="{ border: '2px solid rgba(25,74,125,1)', height: 'calc(100vh - 200px)' }" />
</div> </div>
<div style="width: 100%; height: 60px;"></div> <div style="width: 100%; height: 60px"></div>
<div class="button-box"> <div class="button-box">
<button class="cancel" @click="addVisible = false">取消</button> <button class="cancel" @click="addVisible = false">取消</button>
<button class="execute" @click="sendPlan">确定</button> <button class="execute" @click="sendPlan">确定</button>
@ -89,10 +88,10 @@ import { message } from 'ant-design-vue';
onMounted(() => { onMounted(() => {
// //
getTable() getTable();
// 穿 // 穿
getLeftPlan() getLeftPlan();
}) });
// tab ======================================================== // tab ========================================================
@ -100,24 +99,24 @@ onMounted(() => {
const dataSource = ref([]); const dataSource = ref([]);
// //
const getTable = () => { const getTable = () => {
http.get(lightingManage.getPlanTable, {}).then(res => { http.get(lightingManage.getPlanTable, {}).then((res) => {
dataSource.value = res.data dataSource.value = res.data;
}) });
} };
// //
const deletePlan = (id: String) => { const deletePlan = (id: String) => {
http.delete(lightingManage.deletePlan, [id]).then(() => { http.delete(lightingManage.deletePlan, [id]).then(() => {
message.success('操作成功') message.success('操作成功');
getTable() getTable();
}) });
} };
// //
const restartPlan = (id: String) => { const restartPlan = (id: String) => {
http.post(lightingManage.restartPlan, { planId: id }).then(() => { http.post(lightingManage.restartPlan, { planId: id }).then(() => {
message.success('操作成功') message.success('操作成功');
getTable() getTable();
}) });
} };
// tab ==================================================== // tab ====================================================
@ -134,17 +133,17 @@ const addModal = () => {
const transferData = ref([]) as any; const transferData = ref([]) as any;
// 穿 // 穿
const getLeftPlan = () => { const getLeftPlan = () => {
http.get(lightingManage.getLeftPlan, {}).then(res => { http.get(lightingManage.getLeftPlan, {}).then((res) => {
let arr = [] let arr = [];
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
arr.push({ arr.push({
key: item.id, key: item.id,
title: item.planName title: item.planName,
}) });
}) });
transferData.value = arr transferData.value = arr;
}) });
} };
const handleChange = (keys: string[], direction: string, moveKeys: string[]) => { const handleChange = (keys: string[], direction: string, moveKeys: string[]) => {
console.log(keys, direction, moveKeys); console.log(keys, direction, moveKeys);
@ -160,21 +159,19 @@ const sendPlan = () => {
return message.info('没有选择任何计划'); return message.info('没有选择任何计划');
} }
http.post(lightingManage.submitLeftPlan, targetKeys.value).then(() => { http.post(lightingManage.submitLeftPlan, targetKeys.value).then(() => {
message.success('添加成功') message.success('添加成功');
// //
getTable() getTable();
getLeftPlan() 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;
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "./dialogStyle.less"; @import './dialogStyle.less';
// //
.div-add { .div-add {
@ -248,6 +245,4 @@ const filterOption = (inputValue: string, option: any) => {
background: black; background: black;
} }
} }
</style> </style>

38
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs3.vue

@ -9,7 +9,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(row, index) in dataSource1" :key="index" @click="handleRowClick(row.key)" <tr
v-for="(row, index) in dataSource1"
:key="index"
@click="handleRowClick(row.key)"
:class="row.key === trIndex ? 'isTrIndex' : ''"> :class="row.key === trIndex ? 'isTrIndex' : ''">
<td>{{ row.key }}</td> <td>{{ row.key }}</td>
<td>{{ row.data }}</td> <td>{{ row.data }}</td>
@ -19,7 +22,7 @@
</tbody> </tbody>
</table> </table>
<div class="out-dialog" :class="{ 'showDialog' : logModalVisible }" v-if="logModalVisible"> <div class="out-dialog" :class="{ showDialog: logModalVisible }" v-if="logModalVisible">
<div class="content" v-if="logModalVisible"> <div class="content" v-if="logModalVisible">
<div> <div>
<div class="div-operation"></div> <div class="div-operation"></div>
@ -30,7 +33,11 @@
<div class="imgText"> <div class="imgText">
<div class="zjzm"> <div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp; <img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span class="title-text" style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)">{{ item.name }}</span> <span
class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.name }}</span
>
</div> </div>
</div> </div>
<div class="btn-box"> <div class="btn-box">
@ -43,9 +50,7 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> <div class="left"> 亮度 </div>
亮度
</div>
<div class="right"> <div class="right">
<span>100lux</span> <span>100lux</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
@ -53,9 +58,7 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> <div class="left"> 控制场景 </div>
控制场景
</div>
<div class="right"> <div class="right">
<span>手动</span> <span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
@ -63,9 +66,7 @@
</div> </div>
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> <div class="left"> 色温 </div>
色温
</div>
<div class="right"> <div class="right">
<span>4000k</span> <span>4000k</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
@ -76,7 +77,7 @@
</div> </div>
</div> </div>
</div> </div>
<div style="height: 60px;"></div> <div style="height: 60px"></div>
<div class="button-box"> <div class="button-box">
<button class="cancel" @click="logModalVisible = false">取消</button> <button class="cancel" @click="logModalVisible = false">取消</button>
</div> </div>
@ -90,15 +91,13 @@
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
// //
onMounted(() => { onMounted(() => {});
})
// =================================================================== // ===================================================================
const props = defineProps({ const props = defineProps({
// > // >
treeData: { treeData: {
type: Array type: Array,
}, },
}); });
const emit = defineEmits(['changeArea']); const emit = defineEmits(['changeArea']);
@ -172,11 +171,9 @@ const handleRowClick = (index: any) => {
// //
logModalVisible.value = true; logModalVisible.value = true;
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "./dialogStyle.less"; @import './dialogStyle.less';
// //
.div-add { .div-add {
@ -246,7 +243,6 @@ const handleRowClick = (index: any) => {
} }
::v-deep(.ant-transfer) { ::v-deep(.ant-transfer) {
// hover // hover
.ant-transfer-list-content-item:hover { .ant-transfer-list-content-item:hover {
background: black; background: black;

Loading…
Cancel
Save