diff --git a/hx-ai-intelligent/src/api/IlluminationInfo.ts b/hx-ai-intelligent/src/api/IlluminationInfo.ts index 29fc6df..c76417f 100644 --- a/hx-ai-intelligent/src/api/IlluminationInfo.ts +++ b/hx-ai-intelligent/src/api/IlluminationInfo.ts @@ -1,31 +1,24 @@ +const prefix = '/carbon-smart'; // 照明系统及相关接口 export enum lightingManage { // 主页 ======================================================== // 获得分区与线路 - getTree = '/carbon-smart/api/illuminationCtrl/getCtrlPanelTree', + getTree = prefix + '/illuminationCtrl/getCtrlPanelTree', // 修改线路的可用/禁用状态 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', - // 获得计划列表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', + // 右侧表格修改数据提交 + submitTableData = prefix + '/illuminationCtrl/refreshPlanStatus', } diff --git a/hx-ai-intelligent/src/api/airConditionControlSystem.ts b/hx-ai-intelligent/src/api/airConditionControlSystem.ts index ae3ea58..f5b8f1d 100644 --- a/hx-ai-intelligent/src/api/airConditionControlSystem.ts +++ b/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', } diff --git a/hx-ai-intelligent/src/api/planManage.ts b/hx-ai-intelligent/src/api/planManage.ts new file mode 100644 index 0000000..678c291 --- /dev/null +++ b/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', +} diff --git a/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue b/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue index 6a1c010..449e1d7 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue @@ -121,6 +121,7 @@ treeData.value = area; // 默认选择第一项 treeData.value[0].selected = true; + tabs1Ref.value.changeArea(treeData.value[0]); }; // 分区业务 ===================================================== diff --git a/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue b/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue index 41392d6..1fbe132 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue @@ -34,7 +34,7 @@ - +
@@ -136,7 +136,7 @@ title="刷新将会取消已作出的修改" ok-text="确定" cancel-text="取消" - @confirm="refresh" + @confirm="refresh(false)" @cancel="changeCancel"> @@ -186,7 +186,7 @@
亮度
- + {{ item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--' }} @@ -231,7 +231,7 @@ title="此操作将提交以上修改内容" ok-text="确定" cancel-text="取消" - @click="submitChangeList" + @confirm="submitChangeList" @cancel="changeCancel"> @@ -320,7 +320,7 @@ const togglePlan2 = () => { // 如果未交互任何按钮 if (handleButton.value == '') { - return message.info('请选择照明回路'); + return message.info('请选择空调分组'); } // 获取最近交互过的按钮 const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value); @@ -399,7 +399,6 @@ }); // 照明回路的按钮切换 const changeLine = (button: any) => { - console.log(button, 'button2mmmm'); // 存储一次按钮ID,用于禁用/启用交互 handleButton.value = button.id; // 根据按钮状态,展示禁用/启用按钮文本 @@ -482,7 +481,7 @@ // 操作线路总数 let sum = 0; // 没有这个选项的线路 - let nofind = 0; + // let nofind = 0; // 修改无效的数量 let checked = 0; // 可修改的数量 @@ -515,19 +514,20 @@ return (checked += 1); // 修改 } else { - alert(v.treePid + '---' + before + '---' + after); changed += 1; - resetScene(item.childList); - changeScene(v1, before, after); + changeScene(v1, before, after, item); v1.executeStatus.value = 1; } + // 不符合条件的全部重置 + } else { + v1.executeStatus.value = 0; } }); } }); } }); - alert(`共修改${sum}条,${checked}条无需修改,${nofind}条不具有该选项,${changed}条生效`); + message.info(`共修改${sum}条数据,其中${checked}条无需修改,${changed}条修改有效`); // 如果是单选模式 } else { // 如果按钮已经被选择 @@ -565,15 +565,15 @@ /** 控制场景 - 按钮切换通用方法(单选 & 多选) * @param button 当前被选中的场景(单选 & 多选) * @param before 当前回路场景的初始值(撤回时需使用) + * @param after 修改后的值(修改时使用) + * @param anyButton 多选时使用 */ - const changeScene = (button: any, before: string | undefined, after: string) => { - console.log(changeList.value, 'vvvvvvvvvvvvvv-----', button, 'bbbbbbbb---------'); + const changeScene = (button: any, before: string | undefined, after: string, line = null) => { // 通过分组ID,查询之前是否修改过 const result = changeList.value.find((item: any, index: number) => { item.index = index; return item.deviceGroup == button.treePid.split('_')[0]; }); - console.log(result, 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr'); // 如果已产生过修改 if (result) { // 改回了原有的值,则从数组中移除 @@ -587,12 +587,20 @@ } // 如果未产生过修改 } else { + let nowButton; + // 多选,则使用第四个参数 + if (line) { + nowButton = line; + // 如果是单选,则使用thisbotton2 + } else { + nowButton = thisButton2.value; + } changeList.value.push({ // 回路 - deviceGroup: thisButton2.value.dataCode, - deviceGroupName: thisButton2.value.name, + deviceGroup: nowButton.dataCode, + deviceGroupName: nowButton.name, // 分区 - region: thisButton2.value.treePid, + region: nowButton.treePid, regionName: '', // 修改前 before, @@ -608,7 +616,7 @@ // 执行按钮loading const buttonLoading = ref(false); // 刷新 - const refresh = () => { + const refresh = (reload = false) => { // 关闭执行弹窗 executeVisible.value = false; // 设置当前选中的序列 @@ -616,10 +624,12 @@ // 重置选中样式 和 按钮选中状态 emit('changeArea', ['1']); emit('reset'); - // 将所有修改改回 - changeList.value.forEach((item: any) => { - resetChangeList(item); - }); + // 如果是中途刷新(对应提交后刷新),需要将所有修改改回 + if (!reload) { + changeList.value.forEach((item: any) => { + resetChangeList(item); + }); + } changeList.value = []; // 默认选择第一个楼层 let data = props.treeData[0]; @@ -644,6 +654,10 @@ 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; @@ -695,6 +709,7 @@ const diffList = ref([]); //撤销 const delBtn = (obj: any) => { + console.log(obj, '当前选择的修改内容'); // 将treeData对应回路的数据改回,数据以后端为准 obj.scene = obj.stateAfter.scene.value; obj.before = obj.stateBefore.scene.value; @@ -722,9 +737,9 @@ projectId: state.projectId, siteId: state.siteId, }) - .then((res) => { + .then(() => { emit('reload'); - refresh(); + refresh(true); }); }; diff --git a/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue b/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue index 99a1949..d766a90 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue @@ -1,7 +1,9 @@