zhaohy 4 months ago
parent
commit
f11a374baa
  1. 25
      hx-ai-intelligent/src/api/IlluminationInfo.ts
  2. 6
      hx-ai-intelligent/src/api/airConditionControlSystem.ts
  3. 13
      hx-ai-intelligent/src/api/planManage.ts
  4. 1
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue
  5. 57
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue
  6. 23
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue
  7. 30
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue
  8. 238
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue
  9. 159
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue

25
hx-ai-intelligent/src/api/IlluminationInfo.ts

@ -1,31 +1,24 @@
const prefix = '/carbon-smart';
// 照明系统及相关接口 // 照明系统及相关接口
export enum lightingManage { export enum lightingManage {
// 主页 ======================================================== // 主页 ========================================================
// 获得分区与线路 // 获得分区与线路
getTree = '/carbon-smart/api/illuminationCtrl/getCtrlPanelTree', getTree = prefix + '/illuminationCtrl/getCtrlPanelTree',
// 修改线路的可用/禁用状态 // 修改线路的可用/禁用状态
setDisable = '/carbon-smart/api/illuminationCtrl/changePanelStatus', setDisable = '/carbon-smart/api/illuminationCtrl/changePanelStatus',
// 获得设备 - 小灯泡 // 获得设备 - 小灯泡
getBulbs = '/carbon-smart/api/illuminationCtrl/getLightState', getBulbs = prefix + '/illuminationCtrl/getDeviceState',
// 控制面板tab页 ================================================ // 主页 > 抽屉 > 控制面板 =======================================
// 获取当前修改的内容对比数据 // 获取当前修改的内容对比数据
getChangeList = '/carbon-smart/api/illuminationCtrl/getLightSceneChangeInfo', getChangeList = prefix + '/illuminationCtrl/getSceneChangeInfo',
// 提交当前修改 // 提交当前修改
submitChangeList = '/carbon-smart/api/illuminationCtrl/changeLightScene', submitChangeList = prefix + '/illuminationCtrl/changeToSceneMode',
// 计划列表tab页 ================================================ // 主页 > 抽屉 > 计划列表 =======================================
// 获得计划列表tab页的表格数据 // 右侧表格修改数据提交
getPlanTable = '/carbon-smart/api/illuminationInfo/selectPanelPlan', submitTableData = prefix + '/illuminationCtrl/refreshPlanStatus',
// 获得计划列表tab页的穿梭框左侧数据
getLeftPlan = '/carbon-smart/api/illuminationInfo/getPlan',
// 提交穿梭框被选择的数据
submitLeftPlan = '/carbon-smart/api/illuminationInfo/joinPlan',
// 删除表格中的计划
deletePlan = '/carbon-smart/api/illuminationInfo/deletePlan',
// 重启表格计划
restartPlan = '/carbon-smart/api/illuminationInfo/enable',
} }

6
hx-ai-intelligent/src/api/airConditionControlSystem.ts

@ -17,12 +17,6 @@ export enum airConditionControl {
// 主页 > 抽屉 > 计划列表 ======================================= // 主页 > 抽屉 > 计划列表 =======================================
// 穿梭框来源数据
getTransData = prefix + '/airConditioningInfo/getDeActivatedPlanList',
// 右侧表格数据
getTableData = prefix + '/airConditioningInfo/getActivatedPlanList',
// 穿梭框结果数据提交
submitTransData = prefix + '/airConditioningInfo/activePlanByIdList',
// 右侧表格修改数据提交 // 右侧表格修改数据提交
submitTableData = prefix + '/airConditioningCtrl/refreshPlanStatus', submitTableData = prefix + '/airConditioningCtrl/refreshPlanStatus',
} }

13
hx-ai-intelligent/src/api/planManage.ts

@ -0,0 +1,13 @@
const prefix = '/carbon-smart';
// 照明系统及相关接口
export enum planManage {
/**
* @param deviceType (1,2,3,4,5,6,7)
*/
// 获得未激活的计划
getTransData = prefix + '/deviceCtrlPlan/getDeActivatedPlanList',
// 获得激活的计划
getTableData = prefix + '/deviceCtrlPlan/getActivatedPlanList',
// 提交计划状态修改
submitTransData = prefix + '/deviceCtrlPlan/activePlanByIdList',
}

1
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue

@ -121,6 +121,7 @@
treeData.value = area; treeData.value = area;
// //
treeData.value[0].selected = true; treeData.value[0].selected = true;
tabs1Ref.value.changeArea(treeData.value[0]);
}; };
// ===================================================== // =====================================================

57
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue

@ -34,7 +34,7 @@
</template> </template>
</div> </div>
</div> </div>
<!-- 照明回路部分 --> <!-- 空调分组部分 -->
<div> <div>
<div class="circuit-area"> <div class="circuit-area">
<div class="circuit-tab"></div> <div class="circuit-tab"></div>
@ -136,7 +136,7 @@
title="刷新将会取消已作出的修改" title="刷新将会取消已作出的修改"
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
@confirm="refresh" @confirm="refresh(false)"
@cancel="changeCancel"> @cancel="changeCancel">
<button class="flushed">刷新</button> <button class="flushed">刷新</button>
</a-popconfirm> </a-popconfirm>
@ -186,7 +186,7 @@
<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?.brightness != undefined ? item.stateBefore.brightness : '--'
}}</span> }}</span>
@ -231,7 +231,7 @@
title="此操作将提交以上修改内容" title="此操作将提交以上修改内容"
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
@click="submitChangeList" @confirm="submitChangeList"
@cancel="changeCancel"> @cancel="changeCancel">
<button class="execute">执行</button> <button class="execute">执行</button>
</a-popconfirm> </a-popconfirm>
@ -320,7 +320,7 @@
const togglePlan2 = () => { const togglePlan2 = () => {
// //
if (handleButton.value == '') { if (handleButton.value == '') {
return message.info('请选择照明回路'); return message.info('请选择空调分组');
} }
// //
const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value); const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value);
@ -399,7 +399,6 @@
}); });
// //
const changeLine = (button: any) => { const changeLine = (button: any) => {
console.log(button, 'button2mmmm');
// ID/ // ID/
handleButton.value = button.id; handleButton.value = button.id;
// / // /
@ -482,7 +481,7 @@
// 线 // 线
let sum = 0; let sum = 0;
// 线 // 线
let nofind = 0; // let nofind = 0;
// //
let checked = 0; let checked = 0;
// //
@ -515,19 +514,20 @@
return (checked += 1); return (checked += 1);
// //
} else { } else {
alert(v.treePid + '---' + before + '---' + after);
changed += 1; changed += 1;
resetScene(item.childList); changeScene(v1, before, after, item);
changeScene(v1, before, after);
v1.executeStatus.value = 1; v1.executeStatus.value = 1;
} }
//
} else {
v1.executeStatus.value = 0;
} }
}); });
} }
}); });
} }
}); });
alert(`共修改${sum}条,${checked}条无需修改,${nofind}条不具有该选项${changed}`); message.info(`共修改${sum}条数据,其中${checked}条无需修改${changed}修改有`);
// //
} else { } else {
// //
@ -565,15 +565,15 @@
/** - & /** - &
* @param button 当前被选中的场景单选 & 多选 * @param button 当前被选中的场景单选 & 多选
* @param before 当前回路场景的初始值撤回时需使用 * @param before 当前回路场景的初始值撤回时需使用
* @param after 修改后的值修改时使用
* @param anyButton 多选时使用
*/ */
const changeScene = (button: any, before: string | undefined, after: string) => { const changeScene = (button: any, before: string | undefined, after: string, line = null) => {
console.log(changeList.value, 'vvvvvvvvvvvvvv-----', button, 'bbbbbbbb---------');
// ID // ID
const result = changeList.value.find((item: any, index: number) => { const result = changeList.value.find((item: any, index: number) => {
item.index = index; item.index = index;
return item.deviceGroup == button.treePid.split('_')[0]; return item.deviceGroup == button.treePid.split('_')[0];
}); });
console.log(result, 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr');
// //
if (result) { if (result) {
// //
@ -587,12 +587,20 @@
} }
// //
} else { } else {
let nowButton;
// 使
if (line) {
nowButton = line;
// 使thisbotton2
} else {
nowButton = thisButton2.value;
}
changeList.value.push({ changeList.value.push({
// //
deviceGroup: thisButton2.value.dataCode, deviceGroup: nowButton.dataCode,
deviceGroupName: thisButton2.value.name, deviceGroupName: nowButton.name,
// //
region: thisButton2.value.treePid, region: nowButton.treePid,
regionName: '', regionName: '',
// //
before, before,
@ -608,7 +616,7 @@
// loading // loading
const buttonLoading = ref(false); const buttonLoading = ref(false);
// //
const refresh = () => { const refresh = (reload = false) => {
// //
executeVisible.value = false; executeVisible.value = false;
// //
@ -616,10 +624,12 @@
// //
emit('changeArea', ['1']); emit('changeArea', ['1']);
emit('reset'); emit('reset');
// // ()
if (!reload) {
changeList.value.forEach((item: any) => { changeList.value.forEach((item: any) => {
resetChangeList(item); resetChangeList(item);
}); });
}
changeList.value = []; changeList.value = [];
// //
let data = props.treeData[0]; let data = props.treeData[0];
@ -644,6 +654,10 @@
if (item.scene == v3.dataCode) { if (item.scene == v3.dataCode) {
v3.executeStatus.value = 0; v3.executeStatus.value = 0;
} }
if (!item.before) {
console.log(item, '没有这个选项');
v3.executeStatus.value = 0;
}
// //
if (item.before == v3.dataCode) { if (item.before == v3.dataCode) {
v3.executeStatus.value = 1; v3.executeStatus.value = 1;
@ -695,6 +709,7 @@
const diffList = ref([]); const diffList = ref([]);
// //
const delBtn = (obj: any) => { const delBtn = (obj: any) => {
console.log(obj, '当前选择的修改内容');
// treeData // treeData
obj.scene = obj.stateAfter.scene.value; obj.scene = obj.stateAfter.scene.value;
obj.before = obj.stateBefore.scene.value; obj.before = obj.stateBefore.scene.value;
@ -722,9 +737,9 @@
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })
.then((res) => { .then(() => {
emit('reload'); emit('reload');
refresh(); refresh(true);
}); });
}; };

23
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue

@ -1,7 +1,9 @@
<template> <template>
<div class="div-add"> <div class="div-add">
<button class="add" @click="addModal">添加</button> <button class="add" @click="addModal">添加</button>
<button class="add" style="margin-left: 20px" @click="sendTable">执行</button> <a-popconfirm title="是否提交以上修改?" ok-text="确定" cancel-text="取消" @confirm="sendTable">
<button class="add" style="margin-left: 20px">执行</button>
</a-popconfirm>
</div> </div>
<div class="buttons"> <div class="buttons">
<span style="color: red; padding-top: 20px">*以下修改需执行后生效</span> <span style="color: red; padding-top: 20px">*以下修改需执行后生效</span>
@ -81,6 +83,7 @@
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 { planManage } from '/@/api/planManage';
import { airConditionControl } from '/@/api/airConditionControlSystem'; import { airConditionControl } from '/@/api/airConditionControlSystem';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { getEnum } from '/@/api'; import { getEnum } from '/@/api';
@ -138,7 +141,12 @@
// //
const getTable = () => { const getTable = () => {
http http
.get(airConditionControl.getTableData, { projectId: state.projectId, siteId: state.siteId }) .get(planManage.getTableData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
deviceType: 2,
})
.then((res) => { .then((res) => {
dataSource.value = res.data; dataSource.value = res.data;
}); });
@ -156,7 +164,7 @@
}; };
// //
const sendTable = () => { const sendTable = () => {
http.post(airConditionControl.submitTableData, dataSource.value).then((res) => { http.post(airConditionControl.submitTableData, dataSource.value).then(() => {
message.success('操作成功'); message.success('操作成功');
getTable(); getTable();
getLeftPlan(); getLeftPlan();
@ -179,7 +187,12 @@
// 穿 // 穿
const getLeftPlan = () => { const getLeftPlan = () => {
http http
.get(airConditionControl.getTransData, { projectId: state.projectId, siteId: state.siteId }) .get(planManage.getTransData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
deviceType: 2,
})
.then((res) => { .then((res) => {
let arr = []; let arr = [];
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
@ -205,7 +218,7 @@
if (targetKeys.value.length < 1) { if (targetKeys.value.length < 1) {
return message.info('没有选择任何计划'); return message.info('没有选择任何计划');
} }
http.post(airConditionControl.submitTransData, targetKeys.value).then(() => { http.post(planManage.submitTransData, targetKeys.value).then(() => {
message.success('添加成功'); message.success('添加成功');
// //
getTable(); getTable();

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

@ -7,6 +7,7 @@
v-for="(item, index) in floorData" v-for="(item, index) in floorData"
:key="index" :key="index"
class="btn-item" class="btn-item"
:style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }"
@click="changeFloor(item.childList, item.dataCode)" @click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button >{{ item.name }}</button
> >
@ -56,7 +57,12 @@
: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 ref="tabs1Ref" @changeArea="changeArea" @reset="reset" :treeData="treeData" /> <tabs1
ref="tabs1Ref"
@changeArea="changeArea"
@reset="reset"
@reload="reload"
: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 />
@ -103,9 +109,9 @@
// //
const floorData = ref([]); const floorData = ref([]);
// //
const thisFloor = ref(1); const thisFloor = ref('1');
// //
const changeFloor = (area: any, floor: number) => { const changeFloor = (area: any, floor: string) => {
thisFloor.value = floor; thisFloor.value = floor;
// //
reset(); reset();
@ -115,6 +121,7 @@
treeData.value = area; treeData.value = area;
// //
treeData.value[0].selected = true; treeData.value[0].selected = true;
tabs1Ref.value.changeArea(treeData.value[0]);
}; };
// ===================================================== // =====================================================
@ -232,7 +239,7 @@
}; };
// //
const getAllArea = () => { const getAllArea = (realod = false) => {
http.get(lightingManage.getTree, { projectId: state.projectId }).then((res) => { http.get(lightingManage.getTree, { projectId: state.projectId }).then((res) => {
const data = res.data; const data = res.data;
floorData.value = data; floorData.value = data;
@ -254,12 +261,23 @@
}); });
}); });
}); });
// 线 1-1 // 线 1-1,使thisFloor
treeData.value = data[0].childList; let index = 0;
if (realod) {
data.find((item: any, i: number) => {
if (item.dataCode == thisFloor.value) {
return (index = i);
}
});
}
treeData.value = data[index].childList;
// //
preload.value = true; preload.value = true;
}); });
}; };
const reload = () => {
getAllArea(true);
};
// ============================================== // ==============================================

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

@ -5,12 +5,6 @@
<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">
{{ isPlanEnabled ? '计划启用' : '计划禁用' }}
</button>
</div> </div>
<!-- 照明区域按钮部分 --> <!-- 照明区域按钮部分 -->
<div class="area"> <div class="area">
@ -142,7 +136,7 @@
title="刷新将会取消已作出的修改" title="刷新将会取消已作出的修改"
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
@confirm="refresh" @confirm="refresh(false)"
@cancel="changeCancel"> @cancel="changeCancel">
<button class="flushed">刷新</button> <button class="flushed">刷新</button>
</a-popconfirm> </a-popconfirm>
@ -233,7 +227,14 @@
<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" @click="submitChangeList">执行</button> <a-popconfirm
title="此操作将提交以上修改内容"
ok-text="确定"
cancel-text="取消"
@confirm="submitChangeList"
@cancel="changeCancel">
<button class="execute">执行</button>
</a-popconfirm>
</div> </div>
</div> </div>
</a-spin> </a-spin>
@ -277,18 +278,12 @@
/** /**
* @method changeArea 用于控制俯视图的选中状态 * @method changeArea 用于控制俯视图的选中状态
* @method reset 用于重置按钮区 * @method reset 用于重置按钮区
* @method reload 用于刷新一次页面
*/ */
const emit = defineEmits(['changeArea', 'reset']); const emit = defineEmits(['changeArea', 'reset', 'reload']);
// ======================================================================= // =======================================================================
//
const isPlanEnabled = ref(false);
//
const togglePlan = () => {
isPlanEnabled.value = !isPlanEnabled.value;
};
// //
const showAllButtonsArea = ref(false); const showAllButtonsArea = ref(false);
// 1 // 1
@ -396,15 +391,9 @@
// //
const thisButton2 = ref({ const thisButton2 = ref({
code: '', dataCode: '',
name: '', name: '',
pcode: '', treePid: '',
mode: {
value: -1,
},
scene: {
value: -1,
},
childList: [], childList: [],
}); });
// //
@ -443,12 +432,16 @@
// //
thisButton2.value = button; thisButton2.value = button;
// //
if (button.childList) {
thisButton3.value = button.childList.find((item: any) => { thisButton3.value = button.childList.find((item: any) => {
if (item.selectAble) { if (item.selectAble) {
return item.childList ? item.childList : []; return item.childList ? item.childList : [];
} }
}); });
} else { } else {
thisButton3.value = { childList: [] };
}
} else {
// //
resetMode(); resetMode();
} }
@ -479,52 +472,113 @@
// ===================================================================== // =====================================================================
// - // -
const selectButton4 = (button4) => { const selectButton4 = (button4: any) => {
// const after = button4.dataCode;
const data = thisButton2.value; let before = '';
//
let before = data.scene.value;
//
let after = button4.value;
// //
if (!singleSelection.value) { if (!singleSelection.value) {
// 线
let sum = 0;
// 线
// let nofind = 0;
//
let checked = 0;
//
let changed = 0;
buttons2.value.forEach((item: any) => { buttons2.value.forEach((item: any) => {
// before
if (item.childList) {
let mode = item.childList.find((lv3: any) => {
return lv3.selectAble;
});
if (mode.childList) {
mode.childList.forEach((mode: any) => {
//
if (mode.executeStatus.value == 1) {
before = mode.dataCode;
}
});
}
}
// //
if (item.selected) { if (item.selected) {
changeScene(item, item.scene.value, after); item.childList.forEach((v: any) => {
item.scene.value = after; if (v.childList) {
v.childList.forEach((v1: any) => {
//
if (v1.dataCode == after) {
sum += 1;
//
if (before == after) {
return (checked += 1);
//
} else {
changed += 1;
changeScene(v1, before, after, item);
v1.executeStatus.value = 1;
}
//
} else {
v1.executeStatus.value = 0;
}
});
} }
}); });
thisButton2.value.scene.value = after; }
return message.info('已修改X项'); });
message.info(`共修改${sum}条数据,其中${checked}条无需修改,${changed}条修改有效`);
// //
} else { } else {
// //
if (before === after) { if (button4.executeStatus.value == 1) {
return message.info('未产生实际修改'); return message.info('未产生实际修改');
//
} else { } else {
changeScene(data, before, after); // 线
let before;
thisButton2.value.childList.find((item: any) => {
if (item.childList) {
item.childList.forEach((i: any) => {
if (i.executeStatus.value == 1) {
return (before = i.dataCode);
}
});
}
});
//
resetScene(thisButton2.value.childList);
changeScene(button4, before, after);
} }
} }
}; };
//
const resetScene = (list: any) => {
list.forEach((item: any) => {
if (item.childList) {
item.childList.forEach((i: any) => {
i.executeStatus.value = 0;
});
}
});
};
/** - & /** - &
* @param button 当前被选中的回路单选 & 多选 * @param button 当前被选中的回路单选 & 多选
* @param before 回路场景的初始值撤回时需使用 * @param before 回路场景的初始值撤回时需使用
* @param after 回路场景被修改后的值 * @param after 回路场景被修改后的值
* @param anyButton 多选时使用
*/ */
const changeScene = (button: any, before: number, after: number) => { const changeScene = (button: any, before: string | undefined, after: string, line = null) => {
// // ID
const result = changeList.value.find((item: any, index: number) => { const result = changeList.value.find((item: any, index: number) => {
item.index = index; item.index = index;
return item.deviceGroup == button.dataCode; return item.deviceGroup == button.treePid.split('_')[0];
}); });
// //
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 //
} else { } else {
result.scene = after; result.scene = after;
// flag // flag
@ -532,20 +586,27 @@
} }
// //
} else { } else {
let nowButton;
// 使
if (line) {
nowButton = line;
// 使thisbotton2
} else {
nowButton = thisButton2.value;
}
changeList.value.push({ changeList.value.push({
// //
deviceGroup: button.dataCode, deviceGroup: nowButton.dataCode,
deviceGroupName: button.name, deviceGroupName: nowButton.name,
// //
region: button.pcode, region: nowButton.treePid,
regionName: '', regionName: '',
// //
before: before, before,
//
scene: after, scene: after,
}); });
} }
thisButton2.value.scene.value = after; button.executeStatus.value = 1;
}; };
// ====================================================================== // ======================================================================
@ -554,7 +615,7 @@
// loading // loading
const buttonLoading = ref(false); const buttonLoading = ref(false);
// //
const refresh = () => { const refresh = (reload = false) => {
// //
executeVisible.value = false; executeVisible.value = false;
// //
@ -562,16 +623,51 @@
// //
emit('changeArea', ['1']); emit('changeArea', ['1']);
emit('reset'); emit('reset');
//
if (!reload) {
changeList.value.forEach((item: any) => {
resetChangeList(item);
});
}
changeList.value = [];
// //
let data = props.treeData[0]; let data = props.treeData[0];
//
changeList.value = [];
// //
data.selected = true; data.selected = true;
// 1-1 // 1-1
buttons2.value = data.childList; buttons2.value = data.childList;
resetMode(); resetMode();
}; };
//
const resetChangeList = (item: any) => {
props.treeData.find((v: any) => {
if (item.region == v.dataCode) {
v.childList.find((v1: any) => {
// 线
if (item.deviceGroup == v1.dataCode) {
v1.childList.forEach((v2: any) => {
if (v2.childList) {
v2.childList.forEach((v3: any) => {
//
if (item.scene == v3.dataCode) {
v3.executeStatus.value = 0;
}
if (!item.before) {
console.log(item, '没有这个选项');
v3.executeStatus.value = 0;
}
//
if (item.before == v3.dataCode) {
v3.executeStatus.value = 1;
}
});
}
});
}
});
}
});
};
// //
const showModal = () => { const showModal = () => {
if (!changeList.value.length) { if (!changeList.value.length) {
@ -580,7 +676,8 @@
buttonLoading.value = true; buttonLoading.value = true;
http http
.post(lightingManage.getChangeList, { .post(lightingManage.getChangeList, {
infoList: changeList.value, sceneList: changeList.value,
lockList: [],
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })
@ -612,13 +709,9 @@
const delBtn = (obj: any) => { const delBtn = (obj: any) => {
console.log(obj, '当前选择的修改内容'); console.log(obj, '当前选择的修改内容');
// treeData // treeData
const area = props.treeData.find((item: any) => { obj.scene = obj.stateAfter.scene.value;
return item.code == obj.region; obj.before = obj.stateBefore.scene.value;
}); resetChangeList(obj);
const line = area.childList.find((item: any) => {
return item.code == obj.deviceGroup;
});
line.scene.value = obj.stateBefore.scene.value;
// changeList diffList () // changeList diffList ()
changeList.value = changeList.value.filter((item: any) => { changeList.value = changeList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup; return item.deviceGroup !== obj.deviceGroup;
@ -633,22 +726,29 @@
executeVisible.value = false; executeVisible.value = false;
} }
}; };
const submitChangeList = () => {}; //
const submitChangeList = () => {
http
.post(lightingManage.submitChangeList, {
sceneList: changeList.value,
lockList: [],
projectId: state.projectId,
siteId: state.siteId,
})
.then(() => {
emit('reload');
refresh(true);
});
};
// ======================================================================== // ========================================================================
// //
const resetMode = () => { const resetMode = () => {
thisButton2.value = { thisButton2.value = {
code: '', dataCode: '',
name: '', name: '',
pcode: '', treePid: '',
mode: {
value: -1,
},
scene: {
value: -1,
},
childList: [], childList: [],
}; };
}; };

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

@ -1,6 +1,18 @@
<template> <template>
<div class="div-add"> <div class="div-add">
<button class="add" @click="addModal">添加</button> <button class="add" @click="addModal">添加</button>
<a-popconfirm title="是否提交以上修改?" ok-text="确定" cancel-text="取消" @confirm="sendTable">
<button class="add" style="margin-left: 20px">执行</button>
</a-popconfirm>
</div>
<div class="buttons">
<span style="color: red; padding-top: 20px">*以下修改需执行后生效</span>
<div class="plans">
<button class="plan enabled" style="margin-right: 10px" @click="togglePlan(1)">
计划启用
</button>
<button class="plan disabled" @click="togglePlan(3)"> 计划禁用 </button>
</div>
</div> </div>
<table class="custom-table table1"> <table class="custom-table table1">
<thead> <thead>
@ -17,35 +29,25 @@
<td>{{ index + 1 }}</td> <td>{{ index + 1 }}</td>
<td>{{ row.startTime }}</td> <td>{{ row.startTime }}</td>
<td>{{ row.planName }}</td> <td>{{ row.planName }}</td>
<td v-if="row.planStatus == '2'"> <td>
<button
style="
font-size: 12px;
background: rgba(57, 215, 187, 0.1);
color: rgb(57, 215, 187);
border: 1px solid rgb(57, 215, 187);
">
已执行
</button>
</td>
<td v-if="row.planStatus == '1'">
<button <button
style=" :style="{
font-size: 12px; 'font-size': '12px',
background: rgba(243, 97, 99, 0.1); width: '5em',
border: 1px solid rgba(243, 97, 99); background: 'rgb(47, 47, 47)',
color: rgba(243, 97, 99); color: setStateColor(row.executeStatus.value),
"> border: '1px solid',
待执行 }">
{{ setStateText(row.executeStatus.value) }}
</button> </button>
</td> </td>
<td> <td>
<div class="tabReboot" @click="restartPlan(row.id)"></div> <div class="tabReboot" @click="startPlan(row)"></div>
<a-popconfirm <a-popconfirm
title="此操作将永久删除该条数据" title="此操作将移除该数据"
ok-text="确定" ok-text="确定"
cancel-text="取消" cancel-text="取消"
@confirm="deletePlan(row.id)"> @confirm="deletePlan(row)">
<div class="tabDelete">删除</div> <div class="tabDelete">删除</div>
</a-popconfirm> </a-popconfirm>
</td> </td>
@ -82,39 +84,90 @@
// //
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 { planManage } from '/@/api/planManage';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { getEnum } from '/@/api';
//
import { items } from '/@/store/item';
// =========================================================== // ===========================================================
onMounted(() => { onMounted(() => {
getStateEnum();
// //
getTable(); getTable();
// 穿 // 穿
getLeftPlan(); getLeftPlan();
}); });
//
const state = items();
const getStateEnum = async () => {
let enumData = await getEnum({ params: { enumType: 'PlanExecuteStatus' } });
stateList.value = enumData.data;
};
// tab ======================================================== // tab ========================================================
//
const stateList = ref([]);
//
const setStateColor = (state: number) => {
if (state == 0) {
return '#ccc';
} else if (state == 1) {
return 'orange';
} else if (state == 2) {
return 'rgb(57, 215, 187)';
} else if (state == 3) {
return 'rgb(255, 0, 0)';
}
};
//
const setStateText = (state: number) => {
const res = stateList.value.find((item) => {
return item.value == state;
});
return res.label;
};
// /
const togglePlan = (state: number) => {
dataSource.value.forEach((item: any) => {
item.executeStatus.value = state;
});
};
// //
const dataSource = ref([]); const dataSource = ref([]);
// //
const getTable = () => { const getTable = () => {
http.get(lightingManage.getPlanTable, {}).then((res) => { http
.get(planManage.getTableData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
deviceType: 1,
})
.then((res) => {
dataSource.value = res.data; dataSource.value = res.data;
}); });
}; };
// // =0
const deletePlan = (id: String) => { const deletePlan = (row: any) => {
http.delete(lightingManage.deletePlan, [id]).then(() => { row.executeStatus.value = 0;
message.success('操作成功'); };
getTable(); // = 1
}); const startPlan = (row: any) => {
if (row.executeStatus.value == 1) {
return message.info('该数据已是待执行状态,无需再次修改');
}
row.executeStatus.value = 1;
}; };
// //
const restartPlan = (id: String) => { const sendTable = () => {
http.post(lightingManage.restartPlan, { planId: id }).then(() => { http.post(lightingManage.submitTableData, dataSource.value).then((res) => {
message.success('操作成功'); message.success('操作成功');
getTable(); getTable();
getLeftPlan();
}); });
}; };
@ -133,7 +186,14 @@
const transferData = ref([]) as any; const transferData = ref([]) as any;
// 穿 // 穿
const getLeftPlan = () => { const getLeftPlan = () => {
http.get(lightingManage.getLeftPlan, {}).then((res) => { http
.get(planManage.getTransData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
deviceType: 1,
})
.then((res) => {
let arr = []; let arr = [];
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
arr.push({ arr.push({
@ -158,7 +218,7 @@
if (targetKeys.value.length < 1) { if (targetKeys.value.length < 1) {
return message.info('没有选择任何计划'); return message.info('没有选择任何计划');
} }
http.post(lightingManage.submitLeftPlan, targetKeys.value).then(() => { http.post(planManage.submitTransData, targetKeys.value).then(() => {
message.success('添加成功'); message.success('添加成功');
// //
getTable(); getTable();
@ -172,7 +232,31 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import './dialogStyle.less'; @import './dialogStyle.less';
.buttons {
display: flex;
justify-content: space-between;
.plan {
border: none;
font-size: 14px;
font-weight: 400;
border-radius: 5px;
width: 88px;
height: 32px;
color: white;
cursor: pointer;
margin: 15px 0;
vertical-align: middle;
}
.plan.enabled {
background: linear-gradient(180deg, rgba(103, 222, 0, 1) 0%, rgba(0, 181, 6, 1) 100%);
}
.plan.disabled {
background-color: red;
}
.plan:disabled {
cursor: not-allowed;
}
}
// //
.div-add { .div-add {
height: 64px; height: 64px;
@ -182,7 +266,7 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
right: 0; right: 0;
margin-right: 20px; margin-right: 10px;
.add { .add {
width: 74px; width: 74px;
height: 40px; height: 40px;
@ -200,7 +284,7 @@
.custom-table { .custom-table {
border-collapse: collapse; border-collapse: collapse;
width: 416px; width: 416px;
height: 60px; height: 40px;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
} }
.custom-table th, .custom-table th,
@ -211,7 +295,6 @@
text-align: center; text-align: center;
} }
.table1 { .table1 {
margin-top: 20px;
width: 100%; width: 100%;
border: 1px solid rgba(255, 255, 255); border: 1px solid rgba(255, 255, 255);
border-radius: 5px; border-radius: 5px;

Loading…
Cancel
Save