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/alarmManagement/alarmOverview.ts b/hx-ai-intelligent/src/api/alarmManagement/alarmOverview.ts new file mode 100644 index 0000000..ca7f26f --- /dev/null +++ b/hx-ai-intelligent/src/api/alarmManagement/alarmOverview.ts @@ -0,0 +1,8 @@ +export enum alarmOverviewApi { + getAlarmEquipment = '/carbon-smart/api/AlarmOverview/alarmEquipment', //设备告警 数量 + getAlarmEnergyConsumption = '/carbon-smart/api/AlarmOverview/alarmEnergyConsumption', //能碳告警 数量 + getAlarmGateway = '/carbon-smart/api/AlarmOverview/alarmGateway', //网关告警 数量 + getPriority = '/carbon-smart/api/AlarmOverview/priority', //优先级 数量 + getProcessProgress = '/carbon-smart/api/AlarmOverview/processProgress', //进度 数量 + getAlarmTrend = '/carbon-smart/api/AlarmOverview/alarmTrend', //30天告警 数量 +} diff --git a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts index 8358746..c9b0f97 100644 --- a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts +++ b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts @@ -52,7 +52,7 @@ export enum carbonInventoryCheck { update = '/carbon-smart/api/carbon/inventory/update', del = '/carbon-smart/api/carbon/inventory/del', // 获取排放源表格数据 - findUnitById = '/carbon-smartapi/carbon/inventory/findById', + findUnitById = '/carbon-smart/api/carbon/inventory/findById', getDetailsList = '/carbon-smart/api/carbon/inventory/details/getDetailsList', updateTable = '/carbon-smart/api/carbon/inventory/details/update', // 排放统计接口 @@ -79,7 +79,15 @@ export enum uploadPic { // 碳规划 export enum carbonPlanning { // 全部 + whole = '/carbon-smart/api/carbon/planning/whole', // 详情 searchListByYear = '/carbon-smart/api/carbon/planning/searchListByYear', searchListByMonth = '/carbon-smart/api/carbon/planning/searchListByMonth', + yearAndMonthAchievement = '/carbon-smart/api/carbon/planning/yearAndMonthAchievement', + annualElectricityConsumption = '/carbon-smart/api/carbon/planning/annualElectricityConsumption', + electricityUsageBackThen = '/carbon-smart/api/carbon/planning/electricityUsageBackThen', + detailedStatisticalDataTable = '/carbon-smart/api/carbon/planning/detailedStatisticalDataTable', + detailedStatisticalDataChart = '/carbon-smart/api/carbon/planning/detailedStatisticalDataChart', + batchOrUpdate = '/carbon-smart/api/carbon/planning/batchOrUpdate', + addNodes = '/carbon-smart/api/carbon/planning/addNodes', } diff --git a/hx-ai-intelligent/src/api/deviceManage.ts b/hx-ai-intelligent/src/api/deviceManage.ts index d4b2fd4..b0b008d 100644 --- a/hx-ai-intelligent/src/api/deviceManage.ts +++ b/hx-ai-intelligent/src/api/deviceManage.ts @@ -29,4 +29,9 @@ export enum group { dropGroupFilter = `${BASE_URL}/deviceGroup/dropGroupFilter`, // 分组列表查询 dropGroupInfoFilter = `${BASE_URL}/deviceGroup/dropGroupInfoFilter`, // 计算列表查询 queryDeviceToEnergy = `${BASE_URL}/deviceGroup/queryDeviceToEnergy`, // 能耗监测用查询设备(能耗监测设备树) + + getCarbonGroupList = `${BASE_URL}/deviceGroup/carbonEmissions/getGroupList`, // 分组管理-碳排放-分组查询设备 + deleteCarbonDevice = `${BASE_URL}/deviceGroup/carbonEmissions/deleteDevice`, // 分组管理-碳排放-删除设备 + addCarbonDevice = `${BASE_URL}/deviceGroup/carbonEmissions/addDevice`, // 分组管理-碳排放-添加设备 + updateCarbonFactor = `${BASE_URL}/deviceGroup/carbonEmissions/updateFactor`, // 分组管理-碳排放-设置因子 } 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/config/app.config.ts b/hx-ai-intelligent/src/config/app.config.ts index 22f2982..2a80768 100644 --- a/hx-ai-intelligent/src/config/app.config.ts +++ b/hx-ai-intelligent/src/config/app.config.ts @@ -98,6 +98,7 @@ export const appConfig = { adminFlag: 'adminFlag', }); sessionStorage.setItem('ORGID', info.orgId); + sessionStorage.setItem('LINKLIST', JSON.stringify(info.linkList)); sessionStorage.setItem('ISADMIN', trD?.adminFlag === '1'); selectDefaultDisabled.value = info?.adminFlag === '1'; selectDefaultValue.value = info.orgId; diff --git a/hx-ai-intelligent/src/icon/carbonPlanningDown.svg b/hx-ai-intelligent/src/icon/carbonPlanningDown.svg new file mode 100644 index 0000000..cbf6941 --- /dev/null +++ b/hx-ai-intelligent/src/icon/carbonPlanningDown.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/hx-ai-intelligent/src/icon/carbonPlanningUp.svg b/hx-ai-intelligent/src/icon/carbonPlanningUp.svg new file mode 100644 index 0000000..cbf6941 --- /dev/null +++ b/hx-ai-intelligent/src/icon/carbonPlanningUp.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/hx-ai-intelligent/src/router/equipmentControl.ts b/hx-ai-intelligent/src/router/equipmentControl.ts index bd6ccb5..e6a13b3 100644 --- a/hx-ai-intelligent/src/router/equipmentControl.ts +++ b/hx-ai-intelligent/src/router/equipmentControl.ts @@ -29,11 +29,11 @@ const equipmentControl = { name: 'liftSystem', meta: { title: '电梯系统', hideChildren: true, icon: 'shebeiqunkong' }, component: Base, - redirect: { name: 'liftSystem' }, + redirect: { name: 'liftSystemIndex' }, children: [ { path: 'index', - name: 'liftSystem', + name: 'liftSystemIndex', component: () => import('/@/view/equipmentControl/liftSystem/index.vue'), meta: { title: '电梯系统', @@ -81,25 +81,25 @@ const equipmentControl = { }, ], }, - // { - // path: 'ventilationSystem', - // name: 'ventilationSystem', - // meta: { title: '通风系统', hideChildren: true, icon: 'shebeiqunkong' }, - // component: Base, - // redirect: { name: 'ventilationSystemIndex' }, - // children: [ - // { - // path: 'index', - // name: 'ventilationSystemIndex', - // component: () => import('/@/view/equipmentControl/ventilationSystem/index.vue'), - // meta: { - // title: '通风系统', - // keepAlive: false, - // // backApi: [], - // }, - // }, - // ], - // }, + { + path: 'ventilationSystem', + name: 'ventilationSystem', + meta: { title: '通风系统', hideChildren: true, icon: 'shebeiqunkong' }, + component: Base, + redirect: { name: 'ventilationSystemIndex' }, + children: [ + { + path: 'index', + name: 'ventilationSystemIndex', + component: () => import('/@/view/equipmentControl/ventilationSystem/index.vue'), + meta: { + title: '通风系统', + keepAlive: false, + // backApi: [], + }, + }, + ], + }, { path: 'airConditionControlSystem', name: 'airConditionControlSystem', diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/decline.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/decline.png new file mode 100644 index 0000000..8c27202 Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/decline.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/energyAlarm.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/energyAlarm.png new file mode 100644 index 0000000..baa6dc2 Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/energyAlarm.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/equipmentAlarm.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/equipmentAlarm.png new file mode 100644 index 0000000..cbc5613 Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/equipmentAlarm.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/gatewayAlarm.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/gatewayAlarm.png new file mode 100644 index 0000000..0e172c2 Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/gatewayAlarm.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/icon.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/icon.png new file mode 100644 index 0000000..fe12a72 Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/icon.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/priority.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/priority.png new file mode 100644 index 0000000..1265e19 Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/priority.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/rise.png b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/rise.png new file mode 100644 index 0000000..f440c6c Binary files /dev/null and b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/img/rise.png differ diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/index.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/index.vue index b4a2cc2..2b19531 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/index.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmOverview/index.vue @@ -1,60 +1,141 @@ diff --git a/hx-ai-intelligent/src/view/equipmentControl/liftSystem/liftInfo.vue b/hx-ai-intelligent/src/view/equipmentControl/liftSystem/liftInfo.vue index ff7a321..e14bf23 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/liftSystem/liftInfo.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/liftSystem/liftInfo.vue @@ -26,26 +26,73 @@ +
- +
-
开启
+
{{ { '0': '正常', '1': '维修', '2': '故障', '3': '告警' }[3] }}
+
- +
-
开启
+
{{ + { + '0': '上行', //上行 + '1': '下行', //下行 + '2': '暂停', //暂停 + '3': '急停', //急停 + '4': '未知', //未知 + }[2] + }}
@@ -56,6 +103,15 @@ + diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less index 382533c..3d550c5 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less @@ -45,7 +45,12 @@ border: 2px solid transparent; border-image: linear-gradient(to bottom, #0077ff, #00f6ff, #000000) 1; .title-img { - padding-top: 6px; + margin-top: 6px; + } + .title-text { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; } } .imgText { diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue index 35df6a3..a82d117 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue @@ -7,6 +7,7 @@ v-for="(item, index) in floorData" :key="index" class="btn-item" + :style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }" @click="changeFloor(item.childList, item.dataCode)" >{{ item.name }} @@ -56,7 +57,12 @@ :maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> - + @@ -103,9 +109,9 @@ // 所有楼层的数据 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; // 重置数据 reset(); @@ -115,6 +121,7 @@ treeData.value = area; // 默认选择第一项 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) => { const data = res.data; floorData.value = data; @@ -254,12 +261,23 @@ }); }); }); - // 默认展示 线路 1-1 - treeData.value = data[0].childList; + // 默认展示 线路 1-1,重载则使用thisFloor当前选中的楼层数 + 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; }); }; + const reload = () => { + getAllArea(true); + }; // 设备业务 小灯泡 ============================================== diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs1.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs1.vue deleted file mode 100644 index 78fd0a6..0000000 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs1.vue +++ /dev/null @@ -1,2190 +0,0 @@ - - - - diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue index b2017f6..108a086 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue @@ -5,12 +5,6 @@
照明区域 -
@@ -142,7 +136,7 @@ title="刷新将会取消已作出的修改" ok-text="确定" cancel-text="取消" - @confirm="refresh" + @confirm="refresh(false)" @cancel="changeCancel"> @@ -233,7 +227,14 @@
- + + +
@@ -277,18 +278,12 @@ /** 向上传递方法 * @method changeArea 用于控制俯视图的选中状态 * @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); // 被选中的分区 默认为1 用于选中样式渲染 @@ -396,15 +391,9 @@ // 储存当前选中的回路 const thisButton2 = ref({ - code: '', + dataCode: '', name: '', - pcode: '', - mode: { - value: -1, - }, - scene: { - value: -1, - }, + treePid: '', childList: [], }); // 照明回路的按钮切换 @@ -443,11 +432,15 @@ // 发生了选中事件 thisButton2.value = button; // 获得启动模式 - thisButton3.value = button.childList.find((item: any) => { - if (item.selectAble) { - return item.childList ? item.childList : []; - } - }); + if (button.childList) { + thisButton3.value = button.childList.find((item: any) => { + if (item.selectAble) { + return item.childList ? item.childList : []; + } + }); + } else { + thisButton3.value = { childList: [] }; + } } else { // 未发生选中 或 多选的其中一个按钮被取消 resetMode(); @@ -479,52 +472,113 @@ // 控制场景业务 ===================================================================== // 控制场景 - 按钮切换 - const selectButton4 = (button4) => { - // 当前选中的回路数据 - const data = thisButton2.value; - // 修改前的数据 - let before = data.scene.value; - // 修改后的数据 - let after = button4.value; + const selectButton4 = (button4: any) => { + const after = button4.dataCode; + let before = ''; // 如果是多选模式 if (!singleSelection.value) { + // 操作线路总数 + let sum = 0; + // 没有这个选项的线路 + // let nofind = 0; + // 修改无效的数量 + let checked = 0; + // 可修改的数量 + let changed = 0; 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) { - changeScene(item, item.scene.value, after); - item.scene.value = after; + item.childList.forEach((v: any) => { + 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 { - // 如果没有产生实质性的修改(修改前后相同,则跳出) - if (before === after) { + // 如果按钮已经被选择 + if (button4.executeStatus.value == 1) { return message.info('未产生实际修改'); - // 产生了修改 } 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 before 回路场景的初始值(撤回时需使用) * @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) => { item.index = index; - return item.deviceGroup == button.dataCode; + return item.deviceGroup == button.treePid.split('_')[0]; }); // 如果已产生过修改 if (result) { // 改回了原有的值,则从数组中移除 if (after == result.before) { changeList.value.splice(result.index, 1); - // 修改为新值,则只修改after + // 修改为新值,则只修改场景 } else { result.scene = after; // 临时flag,用后移除 @@ -532,20 +586,27 @@ } // 如果未产生过修改 } else { + let nowButton; + // 多选,则使用第四个参数 + if (line) { + nowButton = line; + // 如果是单选,则使用thisbotton2 + } else { + nowButton = thisButton2.value; + } changeList.value.push({ // 回路 - deviceGroup: button.dataCode, - deviceGroupName: button.name, + deviceGroup: nowButton.dataCode, + deviceGroupName: nowButton.name, // 分区 - region: button.pcode, + region: nowButton.treePid, regionName: '', // 修改前 - before: before, - // 修改后 + before, scene: after, }); } - thisButton2.value.scene.value = after; + button.executeStatus.value = 1; }; // 底部按钮区 ====================================================================== @@ -554,7 +615,7 @@ // 执行按钮loading const buttonLoading = ref(false); // 刷新 - const refresh = () => { + const refresh = (reload = false) => { // 关闭执行弹窗 executeVisible.value = false; // 设置当前选中的序列 @@ -562,16 +623,51 @@ // 重置选中样式 和 按钮选中状态 emit('changeArea', ['1']); emit('reset'); + // 如果是中途刷新,需要将所有修改改回 + if (!reload) { + changeList.value.forEach((item: any) => { + resetChangeList(item); + }); + } + changeList.value = []; // 默认选择第一个楼层 let data = props.treeData[0]; - // 清空保存的修改 - changeList.value = []; // 默认选中 data.selected = true; // 默认选中 1-1 分区 回路 buttons2.value = data.childList; 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 = () => { if (!changeList.value.length) { @@ -580,7 +676,8 @@ buttonLoading.value = true; http .post(lightingManage.getChangeList, { - infoList: changeList.value, + sceneList: changeList.value, + lockList: [], projectId: state.projectId, siteId: state.siteId, }) @@ -612,13 +709,9 @@ 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; + obj.scene = obj.stateAfter.scene.value; + obj.before = obj.stateBefore.scene.value; + resetChangeList(obj); // 将 changeList 与 diffList 中记录的修改移除 (排除极端情况) changeList.value = changeList.value.filter((item: any) => { return item.deviceGroup !== obj.deviceGroup; @@ -633,22 +726,29 @@ 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 = () => { thisButton2.value = { - code: '', + dataCode: '', name: '', - pcode: '', - mode: { - value: -1, - }, - scene: { - value: -1, - }, + treePid: '', childList: [], }; }; diff --git a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue index 05bb3c6..6bff15e 100644 --- a/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue +++ b/hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue @@ -1,6 +1,18 @@ diff --git a/hx-ai-intelligent/src/view/equipmentManage/group/config.ts b/hx-ai-intelligent/src/view/equipmentManage/group/config.ts index d1c0c36..40615fa 100644 --- a/hx-ai-intelligent/src/view/equipmentManage/group/config.ts +++ b/hx-ai-intelligent/src/view/equipmentManage/group/config.ts @@ -1,6 +1,8 @@ import { http } from '/nerv-lib/util'; -import { group } from '/@/api/deviceManage'; +import { group, device } from '/@/api/deviceManage'; +import { carbonEmissionFactorLibrary, quickCalculation } from '/@/api/carbonEmissionFactorLibrary'; import { dict } from '/@/api'; +import { ref } from 'vue'; const tableCalKeyMap = [ { title: '来源企业', @@ -38,6 +40,54 @@ const tableCalKeyMap = [ }, }, ]; + +const tableCarbonKeyMap = [ + { + title: '能源类型', + dataIndex: 'energyTypeName', + // textEllipsis: true, + textNumber: 5, + }, + { + title: '设备名称', + textNumber: 10, + dataIndex: 'deviceName', + // textEllipsis: true, + }, + { + title: '设备id', + dataIndex: 'deviceInfoCode', + textNumber: 10, + }, + { + textNumber: 5, + title: '碳排因子值', + dataIndex: 'emissionFactor', + }, + { + title: '设备品牌/型号', + textNumber: 10, + dataIndex: 'deviceModel', + }, + { + title: '来源企业', + textNumber: 10, + dataIndex: 'manufacturer', + }, + { + title: '分组名称', + textNumber: 10, + dataIndex: 'deviceNameType', + }, + { + textNumber: 5, + title: '设备状态', + dataIndex: 'status', + customRender: ({ value }) => { + return value === '0' ? '启用' : '停用'; + }, + }, +]; const tableKeyMap = [ { title: '来源企业', @@ -333,11 +383,19 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => { }; }; -export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => { +export const tableConfigCal = ( + el, + elGroup, + elFormula, + defaultParams, + isCarbon, + editCarbonEquipmentRef, + setFactorRef, +) => { // 计算节点 return { title: '点位信息', - api: group.queryGroupInfoPage, + api: isCarbon ? group.getCarbonGroupList : group.queryGroupInfoPage, params: defaultParams.value, headerActions: [ { @@ -345,9 +403,32 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => { name: 'GroupPointEdit', type: 'primary', handle: (a, b) => { - el.value.toggle(); + if (isCarbon) { + editCarbonEquipmentRef.value.toggle(); + } else { + el.value.toggle(); + } }, }, + isCarbon + ? { + label: '关联因子值', + name: 'SetFactor', + type: 'primary', + dynamicDisabled: (data: any) => { + return data.list.length === 0; + }, + handle: ({ list }) => { + // 过滤出 id 大于 0 的项 + const filteredList = list.filter(({ id }) => id > 0); + + // 提取出 id 值 + const ids = filteredList.map(({ id }) => id); + + setFactorRef.value.toggle(ids); + }, + } + : {}, { label: '批量删除', name: 'GroupPointDelete', @@ -355,11 +436,17 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => { dynamicDisabled: (data: any) => { return data.list.length === 0; }, - dynamicParams: { ids: 'id[]' }, + dynamicParams: isCarbon + ? { + deviceInfoCodeList: 'id[]', + } + : { + ids: 'id[]', + }, confirm: true, isReload: true, isClearCheck: true, - api: group.delComputeList, + api: isCarbon ? group.deleteCarbonDevice : group.delComputeList, }, { label: '批量导出', @@ -425,18 +512,39 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => { }, ], scroll: { x: 1400 }, - columns: tableCalKeyMap, + columns: isCarbon ? tableCarbonKeyMap : tableCalKeyMap, columnActions: { title: '操作', actions: [ { + label: '关联因子', + name: 'SetFactor', + dynamicDisabled: (record) => { + // 这里根据record的某个字段值判断是否禁用删除按钮 + return record.id < 0; + }, + handle: (row) => { + setFactorRef.value.toggle([row.id]); + }, + }, + { label: '删除', name: 'GroupPointDelete', - dynamicParams: { ids: 'id[]' }, + dynamicDisabled: (record) => { + // 这里根据record的某个字段值判断是否禁用删除按钮 + return record.id < 0; + }, + dynamicParams: isCarbon + ? { + deviceInfoCodeList: 'id[]', + } + : { + ids: 'id[]', + }, confirm: true, isReload: true, isClearCheck: true, - api: group.delComputeList, + api: isCarbon ? group.deleteCarbonDevice : group.delComputeList, }, ], }, @@ -522,7 +630,338 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => { }, ], }, - // pagination: { pageSizeOptions: false }, + pagination: isCarbon ? false : true, rowKey: 'id', + rowSelection: { checkStrictly: false }, }; }; + +export const editCarbonEquipmentConfig = (orgId) => { + return ref({ + title: '设备信息', + api: device.queryDevicePage, + params: { orgId }, + treeConfig: { + header: { + icon: 'deviceType', + title: '设备类别', + }, + params: { orgId }, + dynamicParams: { deviceCode: 'code' }, + defaultExpandAll: true, + api: device.queryDeviceTree, + fieldNames: { title: 'deviceType', key: 'code' }, + formConfig: { + schemas: [ + { + field: 'energyType', + label: '', + component: 'NsSelectApi', + autoSubmit: true, + componentProps: { + api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }), + // params: { dicKey: 'ENERGY_TYPE' }, + immediate: true, + // resultField: 'data.ENERGY_TYPE', + labelField: 'cnValue', + valueField: 'dicKey', + placeholder: '请选择能耗种类', + autoSelectFirst: true, + }, + }, + { + field: 'deviceType', + label: '设备名称', + component: 'NsInput', + autoSubmit: true, + componentProps: { + placeholder: '请输入设备类型', + }, + }, + ], + }, + }, + // rowSelection: null, + rowSelection: true, + // scroll: { x: 2000 }, + columns: [ + { + title: '设备名称', + dataIndex: 'deviceName', + }, + { + title: '设备型号', + dataIndex: 'deviceModel', + }, + { + title: 'SN码', + dataIndex: 'snCode', + textNumber: 5, + textEllipsis: true, + }, + { + title: '设备一级区域', + dataIndex: 'device1Area', + textWidth: 88, + // width: 130, + textEllipsis: true, + }, + { + title: '设备二级区域', + dataIndex: 'device2Area', + textWidth: 88, + // width: 130, + textEllipsis: true, + }, + { + title: '设备详细位置', + dataIndex: 'deviceAddress', + textNumber: 5, + textEllipsis: true, + }, + ], + formConfig: { + schemas: [ + { + field: 'areas', + label: '设备区域', + component: 'NsCascader', + format: (record) => { + console.log(record); + + return record?.reduce( + (pre, cur) => { + const len = cur?.length - 1; + pre[len].push(cur[len]); + return pre; + }, + [[], []], + ); + }, + fieldMap: ['area1', 'area2'], + componentProps: { + placeholder: '请选择设备区域', + multiple: true, + loadData: (selectedOptions, options) => { + const targetOption = selectedOptions[selectedOptions.length - 1]; + if (!selectedOptions.length) { + http.post(device.dropArea, { orgId, filterField: 'DEVICE_AREA' }).then((res) => { + options.value = res.data?.map((item) => { + return { label: item, value: item, children: [], isLeaf: false }; + }); + }); + } + const value = targetOption?.value; + if (targetOption) { + targetOption.loading = true; + http + .post(device.dropArea, { device1Area: value, orgId, filterField: 'DEVICE_AREA' }) + .then((res) => { + targetOption.loading = false; + targetOption.children = res.data?.map((item) => { + return { label: item, value: item, children: [], isLeaf: true }; + }); + }); + } + }, + }, + }, + { + field: 'deviceName', + label: '设备名称', + component: 'NsSelectApi', + componentProps: { + placeholder: '请选择设备名称', + api: (params) => { + return http.post(device.dropArea, params).then((res) => { + const result = res.data?.reduce((pre, cur) => { + !pre.includes(cur.deviceName) && pre.push(cur.deviceName); + return pre; + }, []); + return { data: result }; + }); + }, + resultField: 'data', + params: { orgId, filterField: 'DEVICE_NAME_FACTORY' }, + // labelField: 'deviceName', + // valueField: 'deviceName', + filterOption: (input: string, option: any) => { + return option.deviceName?.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + showSearch: true, + immediate: true, + dropdownReload: true, + allowClear: true, + }, + }, + ], + params: {}, + }, + // pagination: { pageSizeOptions: false }, + rowKey: 'deviceInfoCode', + }); +}; + +export const setFactorConfig = (orgId) => { + return ref({ + title: '排放因子库', + // api: carbonEmissionFactorLibrary.getTableList, + api: quickCalculation.queryCarbonEmissionPage, + + params: { orgId, pageNum: 1, pageSize: 9999 }, + treeConfig: { + header: { + icon: 'deviceType', + title: '因子分类', + }, + params: { orgId }, + dynamicParams: { energyType: 'id' }, + defaultExpandAll: true, + // api: carbonEmissionFactorLibrary.getCarbonFactorTree, + api: quickCalculation.carbonQuickTree, + fieldNames: { title: 'energyType', key: 'id' }, + formConfig: { + schemas: [ + { + field: 'deviceType', + label: '设备名称', + component: 'NsInput', + autoSubmit: true, + componentProps: { + placeholder: '请输入关键字', + }, + }, + ], + }, + }, + // rowSelection: null, + rowSelection: { type: 'radio' }, + // scroll: { x: 2000 }, + columns: [ + { + title: '序号', + textNumber: 2, + dataIndex: 'address', + customRender: (text: any) => { + return text.index + 1; + }, + }, + { + title: '因子值', + dataIndex: 'emissionFactors', + textNumber: 3, + }, + { + title: '计量单位', + dataIndex: 'carbonEmissionSuffix', + textNumber: 4, + textEllipsis: true, + }, + { + title: '更新时间', + dataIndex: 'updateTime', + textWidth: 88, + // width: 130, + textEllipsis: true, + }, + { + title: '启用时间', + dataIndex: 'startTime', + textWidth: 88, + // width: 130, + textEllipsis: true, + }, + { + title: '结束时间', + dataIndex: 'endTime', + textNumber: 5, + textEllipsis: true, + }, + { + title: '数据来源', + dataIndex: 'dataSources', + textNumber: 5, + textEllipsis: true, + }, + ], + // formConfig: { + // schemas: [ + // { + // field: 'areas', + // label: '设备区域', + // component: 'NsCascader', + // format: (record) => { + // console.log(record); + + // return record?.reduce( + // (pre, cur) => { + // const len = cur?.length - 1; + // pre[len].push(cur[len]); + // return pre; + // }, + // [[], []], + // ); + // }, + // fieldMap: ['area1', 'area2'], + // componentProps: { + // placeholder: '请选择设备区域', + // multiple: true, + // loadData: (selectedOptions, options) => { + // const targetOption = selectedOptions[selectedOptions.length - 1]; + // if (!selectedOptions.length) { + // http.post(device.dropArea, { orgId, filterField: 'DEVICE_AREA' }).then((res) => { + // options.value = res.data?.map((item) => { + // return { label: item, value: item, children: [], isLeaf: false }; + // }); + // }); + // } + // const value = targetOption?.value; + // if (targetOption) { + // targetOption.loading = true; + // http + // .post(device.dropArea, { device1Area: value, orgId, filterField: 'DEVICE_AREA' }) + // .then((res) => { + // targetOption.loading = false; + // targetOption.children = res.data?.map((item) => { + // return { label: item, value: item, children: [], isLeaf: true }; + // }); + // }); + // } + // }, + // }, + // }, + // { + // field: 'deviceName', + // label: '设备名称', + // component: 'NsSelectApi', + // componentProps: { + // placeholder: '请选择设备名称', + // api: (params) => { + // return http.post(device.dropArea, params).then((res) => { + // const result = res.data?.reduce((pre, cur) => { + // !pre.includes(cur.deviceName) && pre.push(cur.deviceName); + // return pre; + // }, []); + // return { data: result }; + // }); + // }, + // resultField: 'data', + // params: { orgId, filterField: 'DEVICE_NAME_FACTORY' }, + // // labelField: 'deviceName', + // // valueField: 'deviceName', + // filterOption: (input: string, option: any) => { + // return option.deviceName?.toLowerCase().indexOf(input.toLowerCase()) >= 0; + // }, + // showSearch: true, + // immediate: true, + // dropdownReload: true, + // allowClear: true, + // }, + // }, + // ], + // params: {}, + // }, + // pagination: { pageSizeOptions: false }, + rowKey: 'id', + }); +}; diff --git a/hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue b/hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue new file mode 100644 index 0000000..6fcedcb --- /dev/null +++ b/hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue @@ -0,0 +1,123 @@ + + + diff --git a/hx-ai-intelligent/src/view/equipmentManage/group/index.vue b/hx-ai-intelligent/src/view/equipmentManage/group/index.vue index 5cc1b0e..2a00e91 100644 --- a/hx-ai-intelligent/src/view/equipmentManage/group/index.vue +++ b/hx-ai-intelligent/src/view/equipmentManage/group/index.vue @@ -4,6 +4,8 @@ + +
@@ -41,7 +43,24 @@
- + + + + +