Browse Source

add:照明系统接口与逻辑补充

temp
chenpingsen 4 months ago
parent
commit
e14bd35fac
  1. 2
      hx-ai-intelligent/src/api/index.ts
  2. 9
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less
  3. 243
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue

2
hx-ai-intelligent/src/api/index.ts

@ -40,7 +40,7 @@ export const dict = async ({
}; };
/** /**
* () * ()
*/ */
export const getAllEnum = async ({ export const getAllEnum = async ({
api = `${BASE_URL}/operation/enum/getAllEnum`, api = `${BASE_URL}/operation/enum/getAllEnum`,

9
hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less

@ -3,7 +3,7 @@
right: 496px; right: 496px;
width: 500px; width: 500px;
height: 100%; height: 100%;
z-index: 99; z-index: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
margin: auto; margin: auto;
@ -44,6 +44,9 @@
border-radius: 12px; border-radius: 12px;
border: 2px solid transparent; border: 2px solid transparent;
border-image: linear-gradient(to bottom, #0077ff, #00f6ff, #000000) 1; border-image: linear-gradient(to bottom, #0077ff, #00f6ff, #000000) 1;
.title-img {
padding-top: 6px;
}
} }
.imgText { .imgText {
display: flex; display: flex;
@ -68,6 +71,7 @@
rgba(255, 112, 3, 1) 91.21%, rgba(255, 112, 3, 1) 91.21%,
rgba(255, 129, 3, 1) 100% rgba(255, 129, 3, 1) 100%
); );
cursor: pointer;
} }
} }
.btn-box { .btn-box {
@ -97,6 +101,9 @@
width: 140px; width: 140px;
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;
:first-child {
color: white;
}
span { span {
vertical-align: middle; vertical-align: middle;
} }

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

@ -121,6 +121,9 @@
<div class="control-scene-area" v-show="thisButton2.mode.value == 3"> <div class="control-scene-area" v-show="thisButton2.mode.value == 3">
<div class="control-scene-tab"></div> <div class="control-scene-tab"></div>
<span class="control-scene-text"> 控制场景 </span> <span class="control-scene-text"> 控制场景 </span>
<div v-if="!singleSelection" style="flex: 1; color: red; text-align: right"
>多选模式下会修改当前选中的所有回路</div
>
</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">
@ -135,15 +138,20 @@
</div> </div>
<!-- 底部按钮区 --> <!-- 底部按钮区 -->
<div class="bottom"> <div class="bottom">
<a-popconfirm <a-badge :offset="[-10, 2]" :count="changeList.length">
title="刷新将会取消已作出的修改" <a-popconfirm
ok-text="确定" title="刷新将会取消已作出的修改"
cancel-text="取消" ok-text="确定"
@confirm="changeConfirm" cancel-text="取消"
@cancel="changeCancel"> @confirm="refresh"
<button class="flushed">刷新</button> @cancel="changeCancel">
</a-popconfirm> <button class="flushed">刷新</button>
<button class="execute" @click="showModal">执行</button> </a-popconfirm>
</a-badge>
<a-spin :spinning="buttonLoading">
<button class="execute" @click="showModal">执行</button>
</a-spin>
</div> </div>
<!-- 点击执行时的弹出框 --> <!-- 点击执行时的弹出框 -->
@ -153,7 +161,7 @@
<div class="div-operation"></div> <div class="div-operation"></div>
<span class="text-operation">变更内容 </span> <span class="text-operation">变更内容 </span>
</div> </div>
<div class="j-box" v-for="item in cxList" :key="item.id"> <div class="j-box" v-for="(item, index) in diffList" :key="item.id">
<div class="journal" style="margin-top: 20px"> <div class="journal" style="margin-top: 20px">
<div class="imgText"> <div class="imgText">
<div class="zjzm"> <div class="zjzm">
@ -161,10 +169,17 @@
<span <span
class="title-text" class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)" style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.name }}</span >{{ item.regionName + ' > ' + item.deviceGroupName }}</span
> >
</div> </div>
<button class="cxbtn" @click="delBtn(item.id)">撤销</button> <a-popconfirm
title="此操作将会撤销修改"
ok-text="确定"
cancel-text="取消"
@confirm="delBtn(item)"
@cancel="changeCancel">
<button class="cxbtn">撤销</button>
</a-popconfirm>
</div> </div>
<div class="btn-box"> <div class="btn-box">
<div class="btn-item"> <div class="btn-item">
@ -178,25 +193,38 @@
<div class="btn-item"> <div class="btn-item">
<div class="left"> 亮度 </div> <div class="left"> 亮度 </div>
<div class="right"> <div class="right">
<span>100lux</span> <!-- 由于数字0也会被判为false故只判断undefined null -->
<span>{{
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>30lux</span> <span>{{
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--'
}}</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">
<span>手动</span> <span>{{
item?.stateBefore?.scene?.label ? item.stateBefore.scene.label : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span> <span>{{
item?.stateAfter?.scene?.label ? item.stateAfter.scene.label : '--'
}}</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">
<span>4000k</span> <span>{{
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>3800k</span> <span>
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }}
</span>
</div> </div>
</div> </div>
</div> </div>
@ -206,7 +234,7 @@
<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" @click="submitChangeList">执行</button>
</div> </div>
</div> </div>
</a-spin> </a-spin>
@ -239,7 +267,7 @@
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;
@ -272,14 +300,14 @@
// //
const showAllButtonsArea = ref(false); const showAllButtonsArea = ref(false);
// 1 // 1
const selectedButton = ref<string | undefined>('1'); const selectedButton = ref<string | undefined>('1');
// //
const changeArea = (button: any) => { const changeArea = (button: any) => {
// //
selectedButton.value = button.id; selectedButton.value = button.id;
// 线 //
buttons2.value = button.childList; buttons2.value = button.childList;
// //
emit('reset'); emit('reset');
@ -287,7 +315,7 @@
button.selected = true; button.selected = true;
// //
emit('changeArea', button.id); emit('changeArea', button.id);
// 线 - // -
resetMode(); resetMode();
// - // -
handleButton.value = ''; handleButton.value = '';
@ -299,7 +327,6 @@
// id // id
const handleButton = ref(''); const handleButton = ref('');
// / // /
const isPlanEnabled2 = ref(true); const isPlanEnabled2 = ref(true);
// / // /
@ -309,7 +336,7 @@
return message.info('请选择照明回路'); return message.info('请选择照明回路');
} }
// //
const btn: any = buttons2.value.find((button) => button.id === handleButton.value); const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value);
let panel = +!btn.ctrlStatus; let panel = +!btn.ctrlStatus;
isLoading.value = true; isLoading.value = true;
http http
@ -334,11 +361,12 @@
// //
const selectAll = () => { const selectAll = () => {
selectAllCheckbox.value = false; selectAllCheckbox.value = false;
buttons2.value.forEach((button) => { //
buttons2.value.forEach((button: any) => {
button.selected = false; button.selected = false;
}); });
singleSelection.value = !singleSelection.value; singleSelection.value = !singleSelection.value;
// 线 - // -
resetMode(); resetMode();
// //
emit('changeArea', [selectedButton.value]); emit('changeArea', [selectedButton.value]);
@ -351,8 +379,8 @@
let arr = [selectedButton.value]; let arr = [selectedButton.value];
// //
if (selectAllCheckbox.value) { if (selectAllCheckbox.value) {
buttons2.value.forEach((item, index) => { buttons2.value.forEach((item: any, index: number) => {
// 线- // -
if (index == 0) { if (index == 0) {
thisButton2.value = item; thisButton2.value = item;
} }
@ -361,7 +389,7 @@
}); });
// //
} else { } else {
buttons2.value.forEach((item) => { buttons2.value.forEach((item: any) => {
item.selected = false; item.selected = false;
}); });
// - // -
@ -370,9 +398,11 @@
emit('changeArea', arr); emit('changeArea', arr);
}; };
// 线 //
const thisButton2 = ref({ const thisButton2 = ref({
code: '', code: '',
name: '',
pcode: '',
mode: { mode: {
value: -1, value: -1,
}, },
@ -390,13 +420,12 @@
} 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: any) => {
item.selected = false; item.selected = false;
}); });
button.selected = !button.selected; button.selected = !button.selected;
@ -405,7 +434,7 @@
// //
button.selected = !button.selected; button.selected = !button.selected;
const arr = [level1]; const arr = [level1];
buttons2.value.forEach((item) => { buttons2.value.forEach((item: any) => {
if (item.selected) { if (item.selected) {
arr.push(item.id); arr.push(item.id);
} }
@ -433,7 +462,7 @@
// ==================================================================== // ====================================================================
// - // -
const selectButton3 = (button3) => { const selectButton3 = (button3: any) => {
let checked = thisButton2.value.mode; let checked = thisButton2.value.mode;
console.log(button3.value, '---', checked.value); console.log(button3.value, '---', checked.value);
// //
@ -449,11 +478,9 @@
const controlMode = ref([]); const controlMode = ref([]);
// //
const controlScene = ref([]); const controlScene = ref([]);
// -
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;
@ -461,12 +488,12 @@
let after = button4.value; let after = button4.value;
// //
if (before === after) { if (before === after) {
return; return message.info('未产生实际修改');
// //
} 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: any, index: number) => {
item.index = index; item.index = index;
return item.deviceGroup == data.code; return item.deviceGroup == data.code;
}); });
@ -484,7 +511,7 @@
// //
} else { } else {
changeList.value.push({ changeList.value.push({
// 线 //
deviceGroup: data.code, deviceGroup: data.code,
deviceGroupName: data.name, deviceGroupName: data.name,
// //
@ -498,112 +525,100 @@
} }
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(button4, '44444');
}; };
// ======================================================================== // ======================================================================
//
const changeList: any = ref([]);
//
const submitList = ref([]);
const cxList = ref([
{
id: '1',
name: '站厅照明 1区',
manual: '手动',
automatic: '自动',
brightness: '100lux',
brightness2: '30lux',
manual2: '手动',
automatic2: '自动',
brightness3: '4000k',
brightness4: '3800k',
},
{
id: '2',
name: '站厅照明 2区',
manual: '手动',
automatic: '自动',
brightness: '100lux',
brightness2: '30lux',
manual2: '手动',
automatic2: '自动',
brightness3: '4000k',
brightness4: '3800k',
},
{
id: '3',
name: '站厅照明 3区',
manual: '手动',
automatic: '自动',
brightness: '100lux',
brightness2: '30lux',
manual2: '手动',
automatic2: '自动',
brightness3: '4000k',
brightness4: '3800k',
},
]);
//
const delBtn = () => {
cxList.value.pop();
console.log(cxList.value.length);
if (cxList.value.length === 0) {
executeVisible.value = false;
}
};
// ========================================================================
const isLoading = ref(false); const isLoading = ref(false);
// loading
const buttonLoading = 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];
//
changeList.value = [];
// //
data.selected = true; data.selected = true;
// 1-1
buttons2.value = data.childList; buttons2.value = data.childList;
selectedButton4.value = null;
resetMode(); resetMode();
}; };
// //
const executeVisible = ref<boolean>(false);
const showModal = () => { const showModal = () => {
if (!changeList.value.length) {
return message.info('未产生任何修改');
}
buttonLoading.value = true;
http http
.post(lightingManage.getChangeList, { infoList: changeList.value, projectId: 'HLlmTZp8' }) .post(lightingManage.getChangeList, { infoList: changeList.value, projectId: 'HLlmTZp8' })
.then((res) => { .then((res) => {
if (res.msg === 'success') { if (res.msg === 'success') {
isLoading.value = true; diffList.value = res.data;
console.log(res); executeVisible.value = true;
} else { } else {
isLoading.value = false; message.warning('获取修改内容失败');
} }
buttonLoading.value = false;
})
.catch(() => {
buttonLoading.value = false;
}); });
executeVisible.value = true;
}; };
//
const changeCancel = () => {};
// ========================================================================
// //
const changeConfirm = () => { const executeVisible = ref<boolean>(false);
refresh(); //
const changeList: any = ref([]);
//
const diffList = ref([]);
//
const delBtn = (obj: any) => {
console.log(obj, '当前选择的修改内容');
// treeData
const area = props.treeData.find((item: any) => {
return item.code == obj.region;
});
const line = area.childList.find((item: any) => {
return item.code == obj.deviceGroup;
});
line.scene.value = obj.stateBefore.scene.value;
// changeList diffList ()
changeList.value = changeList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
diffList.value = diffList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
console.log(changeList, 'changeList');
console.log(diffList, 'diffList');
//
if (changeList.value.length == 0) {
executeVisible.value = false;
}
}; };
const submitChangeList = () => {};
// // ========================================================================
const changeCancel = () => {};
// 线 //
const resetMode = () => { const resetMode = () => {
thisButton2.value = { thisButton2.value = {
code: '', code: '',
name: '',
pcode: '',
mode: { mode: {
value: -1, value: -1,
}, },
@ -613,11 +628,11 @@
}; };
}; };
// //
defineExpose({ defineExpose({
// //
changeArea, changeArea,
// 线 //
changeLine, changeLine,
}); });
</script> </script>

Loading…
Cancel
Save