From 9bd82ebbeec1dd3212e99d1d94be949b312f486d Mon Sep 17 00:00:00 2001
From: fks-xuxinyue <2822784518@qq.com>
Date: Fri, 19 Jul 2024 15:13:46 +0800
Subject: [PATCH 1/3] taskid:099 remark:"commit"
---
.../src/api/carbonEmissionFactorLibrary.ts | 7 +
.../carbonEmissionFactorLibrary/index.vue | 60 +++-
.../energyConsumption/index.vue | 21 +-
.../quickCalculation/index.vue | 22 +-
.../carbonInventoryCheck/fillInPage/index.vue | 398 ++++++++++++++++++++-
.../carbonInventoryCheck/index.vue | 96 +++--
6 files changed, 560 insertions(+), 44 deletions(-)
diff --git a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
index 708c970..edae9fa 100644
--- a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
+++ b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
@@ -35,4 +35,11 @@ export enum quickCalculation {
// 碳排管理-碳排统计接口
export enum carbonEmission {
carbonEmissionStatistics = '/carbon-smart/api/carbon/energy/correlation/carbonEmissionStatistics',
+}
+// 碳盘查接口
+export enum carbonInventoryCheck {
+ carbonInventoryList = '/carbon-smart/api/carbon/report/carbonInventoryList',
+ createOrUpdate = '/carbon-smart/api/carbon/report/createOrUpdate',
+ findById = '/carbon-smart/api/carbon/report/findById',
+ delete = '/carbon-smart/api/carbon/report/delete',
}
\ No newline at end of file
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
index 3bb69b9..8925bca 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
@@ -5,7 +5,7 @@
- 排放分类
+
@@ -562,6 +562,7 @@
});
opMap.value.fuc = (formData: any) => {
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
+ debugger
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
mainRef.value?.nsTableRef.reload();
visible.value = false;
@@ -665,14 +666,22 @@
handle: (record: any) => {
userAuthList.value.splice(0);
setTimeout(() => {
- console.log(record.id);
-
- http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
- formData.value = res.data;
+ const measurementUnit = ref([])
+ http.post(carbonEmissionFactorLibrary.getCarbonFactorTree,{}).then((res) => {
+ measurementUnit.value = res.data
+ http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
+ if (res.data.emissionType) {
+ let selectDevice = ref([Number(res.data.emissionType)]);
+ findParentIds(measurementUnit.value, res.data.emissionType, selectDevice.value);
+ res.data.emissionType = selectDevice
+ }
+ formData.value = res.data;
+ });
});
}, 10);
opMap.value.type = 'edit';
opMap.value.fuc = (formData: any) => {
+ formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
mainRef.value?.nsTableRef.reload();
visible.value = false;
@@ -790,6 +799,27 @@
// pagination: { defaultPageSize: 10 },
rowKey: 'id',
});
+ function findParentIds(tree: any, targetId: number, result: any) {
+ for (let item of tree) {
+ if (item.children && item.children.length > 0) {
+ if (item.children.some((child: any) => child.id === Number(targetId))) {
+ result.unshift(item.id); // 将当前节点的id添加到结果数组的最前面
+ findParentIds(tree, item.id, result); // 递归查找父级节点的id
+ break; // 找到后可以退出循环
+ }else{
+ for(let childsItem of item.children){
+ if(childsItem.children && childsItem.children.length > 0){
+ if (childsItem.children.some((child: any) => child.id === Number(targetId))) {
+ result.unshift(childsItem.id); // 将当前节点的id添加到结果数组的最前面
+ findParentIds(tree, childsItem.id, result); // 递归查找父级节点的id
+ break; // 找到后可以退出循环
+ }
+ }
+ }
+ }
+ }
+ }
+ }
// 单位管理
const unitExpandedKeys = ref();
@@ -977,6 +1007,26 @@
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
+ .title{
+ text-align: left;
+ height: 32px;
+ line-height: 32px;
+ font-weight: bold;
+ user-select: text;
+ position: relative;
+ padding-left: 9px;
+ }
+ .title::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ height: 13px;
+ width: 3px;
+ border-radius: 1px;
+ background-color: #2778FF;
+ }
.treeRow {
display: flex;
justify-content: space-between;
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
index c4a1582..4978f78 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
@@ -363,9 +363,11 @@
getDictList()
visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
- // if(res.data.unit){
- // res.data.unit = res.data.unit.split(',')
- // }
+ if (res.data.unit) {
+ let selectDevice = ref([Number(res.data.unit)]);
+ findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
+ res.data.unit = selectDevice
+ }
formState.value = res.data
});
},
@@ -398,6 +400,18 @@
},
rowKey: 'id',
});
+ // 定义一个递归函数来查找每一级的id 设备类型回显 层级方法
+ function findParentIds(tree: any, targetId: number, result: any) {
+ for (let item of tree) {
+ if (item.children && item.children.length > 0) {
+ if (item.children.some((child: any) => child.value === targetId)) {
+ result.unshift(item.value); // 将当前节点的id添加到结果数组的最前面
+ findParentIds(tree, item.value, result); // 递归查找父级节点的id
+ break; // 找到后可以退出循环
+ }
+ }
+ }
+ }
// 获取表格数据
const getTableList = () => {
fetch(energyConsumption.pageList , queryParams.value).then((res) => {
@@ -473,6 +487,7 @@
label: child.cnValue
})) : []
}));
+ debugger
});
// 获取自动采集节点的数据
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => {
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
index 602471f..a43aa27 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
@@ -3,7 +3,7 @@
- 因子分类
+
@@ -507,6 +507,26 @@
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
+ .title{
+ text-align: left;
+ height: 32px;
+ line-height: 32px;
+ font-weight: bold;
+ user-select: text;
+ position: relative;
+ padding-left: 9px;
+ }
+ .title::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ height: 13px;
+ width: 3px;
+ border-radius: 1px;
+ background-color: #2778FF;
+ }
::v-deep .ant-table-title{
display: flex;
height: 100%;
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
index eb62cd7..33f731f 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
@@ -1,10 +1,406 @@
-
+
+
+
+
+
+
+
+
+
+
+ {{ title.substring(0, title.indexOf(searchValue)) }}
+ {{ searchValue }}
+ {{ title.substring(title.indexOf(searchValue) + searchValue.length) }}
+
+ {{ title }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
index 89ff479..807cb39 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
@@ -5,7 +5,7 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
- {{ item.cnValue }}
-
+
+
+ 年度
+ 月度
-
-
+
+
@@ -50,9 +49,10 @@