Browse Source

优化碳排管理

temp
fks-xuxinyue 3 months ago
parent
commit
15811933c3
  1. 37
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  2. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts
  3. 29
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  4. 106
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  5. 1
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  6. 63
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  7. 20
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  8. 10
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue

37
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue

@ -60,15 +60,18 @@
<div class="ns-form-title">
<div class="title">配额统计</div>
<div class="operation" style="display: flex; justify-content: flex-end; width: 63%">
<a-button type="primary" v-if="parentId === 1" @click="getTotalTable(1)"
>全国配额</a-button
>
<a-button type="primary" v-if="parentId === 2" @click="getTotalTable(2)"
>地方配额</a-button
>
<a-button type="primary" v-if="parentId === 3" @click="getTotalTable(3)"
>CCER配额</a-button
>
<a-button type="primary" v-if="queryParams.accountType === 1" @click="getTotalTable(1)">
全国配额
</a-button>
<a-button
type="primary"
v-if="queryParams.accountType === 2"
@click="getTotalTable(2)">
地方配额
</a-button>
<a-button type="primary" v-if="queryParams.accountType === 3" @click="getTotalTable(3)">
CCER配额
</a-button>
</div>
</div>
<a-table :columns="totalColumns" :data-source="totalData" bordered :pagination="false">
@ -205,6 +208,7 @@
year.value = queryParams.value.year;
transactionType.value = queryParams.value.transactionType;
accountType.value = queryParams.value.accountType;
getTotalTable(queryParams.value.accountType);
mainRef.value?.nsTableRef.reload();
// getDetailList();
};
@ -299,11 +303,11 @@
}));
});
formState.value = JSON.parse(JSON.stringify(record));
if (formState.value.expenditure === 0) {
formState.value.transactionQuantity = formState.value.income;
} else {
formState.value.transactionQuantity = formState.value.expenditure;
}
// if (formState.value.expenditure === 0) {
// formState.value.transactionQuantity = formState.value.income;
// } else {
// formState.value.transactionQuantity = formState.value.expenditure;
// }
setTimeout(() => {
let selectDevice = ref([Number(formState.value.transactionType)]);
findParentIds(options.value, formState.value.transactionType, selectDevice.value);
@ -523,11 +527,6 @@
}));
});
formState.value = JSON.parse(JSON.stringify(record));
if (formState.value.expenditure === 0) {
formState.value.transactionQuantity = formState.value.income;
} else {
formState.value.transactionQuantity = formState.value.expenditure;
}
setTimeout(() => {
let selectDevice = ref([Number(formState.value.transactionType)]);
findParentIds(options.value, formState.value.transactionType, selectDevice.value);

2
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts

@ -167,7 +167,7 @@ export const formConfig = (disabled) => {
label: '已引用数',
field: 'numberOfReferences',
component: 'NsInput',
show:disabled,
show: disabled,
componentProps: {
defaultValue: '',
disabled: true,

29
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue

@ -299,13 +299,7 @@
const x = 3;
const y = 2;
const z = 1;
const genData: TreeProps['treeData'] = [
{
emissionName: '全部',
key: '0-0',
children: [],
},
];
const genData: TreeProps['treeData'] = [];
const checkedTreeNodeKeys = ref<string[]>();
const selectedKeys = ref<string[]>();
@ -532,7 +526,7 @@
const getOrgTree = () => {
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, getClassificationTree.value).then(
(res) => {
gData.value[0].children = res.data;
gData.value = res.data;
//
// const selectedNodes = [];
// checkedTreeNodeKeys.value.forEach(key => {
@ -565,9 +559,6 @@
const onSelect = (selectedKey: string[], info: any) => {
if (selectedKey.length === 1) {
selectedKeys.value = selectedKey;
}
if (info.selected) {
// showOperation.value = true;
editTreeNode.value = {
id: info.selectedNodes[0].id,
level: info.selectedNodes[0].level,
@ -578,12 +569,16 @@
onSelectKeys.value = [info.selectedNodes[0].id];
emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
mainRef.value?.nsTableRef.reload();
} else {
editTreeNode.value = {};
onSelectKeys.value = [];
emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
mainRef.value?.nsTableRef.reload();
}
// if (info.selected) {
// // showOperation.value = true;
// } else {
// editTreeNode.value = {};
// onSelectKeys.value = [];
// emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
// mainRef.value?.nsTableRef.reload();
// }
};
const onSearch = () => {
@ -1242,8 +1237,10 @@
flex-direction: column;
border-radius: 12px;
overflow: auto;
align-items: center;
:deep(.ant-tree) {
height: 90%;
width: 90%;
overflow: auto;
}
}

106
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts

@ -1,3 +1,5 @@
import { quickCalculation, carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
import { ref } from 'vue';
// 能耗统计表表头
export const tableColumns = [
{
@ -144,3 +146,107 @@ export const drawerColumns = [
dataIndex: 'dataSources',
},
];
export const setFactorConfig = (orgId) => {
return ref({
api: carbonEmissionFactorLibrary.getTableList,
params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [] },
treeConfig: {
header: {
icon: 'deviceType',
title: '排放分类',
},
params: { orgId},
dynamicParams: { emissionList: 'id[]' },
defaultExpandAll: true,
// checkable:true,
api: carbonEmissionFactorLibrary.getCarbonFactorTree,
fieldNames: { title: 'emissionName', key: 'id' },
formConfig: {
schemas: [
{
field: 'deviceType',
label: '设备名称',
component: 'NsInput',
autoSubmit: true,
componentProps: {
placeholder: '请输入关键字',
},
},
],
},
},
rowSelection: { type: 'radio' },
columns: [
{
title: '序号',
textNumber: 2,
dataIndex: 'address',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '名称',
dataIndex: 'emissionSources',
textNumber: 3,
},
{
title: '排放因子',
dataIndex: 'emissionFactors',
textNumber: 4,
textEllipsis: true,
},
{
title: '排放因子单位',
dataIndex: 'emissionFactorUnits',
width: 100,
textEllipsis: true,
},
{
title: '排放环节',
dataIndex: 'emissionProcess',
textWidth: 88,
textEllipsis: true,
},
{
title: '数据来源',
dataIndex: 'dataSources',
textNumber: 5,
textEllipsis: true,
},
],
formConfig: {
schemas: [
{
field: 'emissionSources',
label: '排放源',
component: 'NsInput',
componentProps: {
placeholder: '请输入排放源',
maxLength: 20,
},
},
{
field: 'emissionProcess',
label: '排放环节',
component: 'NsSelectApi',
componentProps: {
placeholder: '请选择排放环节',
api: carbonEmissionFactorLibrary.gasAndDatabase,
resultField: 'data',
params: {
orgId: orgId.value,
type: 'emissionProcess',
},
immediate: true,
labelField: 'label',
valueField: 'value',
},
},
],
params: {},
},
// pagination: { pageSizeOptions: false },
rowKey: 'id',
});
};

1
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

@ -973,6 +973,7 @@
formState.value = {
orgId: orgId.value,
};
fileList.value = [];
formRef.value.resetFields();
};
//

63
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue

@ -40,40 +40,11 @@
</div>
</div>
<div class="right">
<!-- <a-table
:columns="columns"
:data-source="tableData"
bordered
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'">
<span>
<a @click="editData(record)">编辑</a>
<a-divider type="vertical" />
<a @click="delData(record)">删除</a>
</span>
</template>
</template>
<template #title>
<div class="ns-table-title"><span>排放因子库</span></div>
<div class="buttonGroup">
<a-button type="primary" @click="addNewData">新增</a-button>
</div>
</template>
</a-table> -->
<ns-view-list-table
v-bind="tableConfig"
:model="tableData"
ref="mainRef"
:scroll="{ x: 1000 }" />
<!-- <a-pagination
:current="queryParams.pageNum"
:total="total"
:page-size="queryParams.pageSize"
style="display: flex; justify-content: center; margin-top: 16px"
:show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" /> -->
<!-- 新增/编辑 -->
<a-drawer
:width="500"
@ -93,20 +64,20 @@
:wrapper-col="wrapperCol">
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="日期范围" name="dateRange">
<a-form-item ref="name" label="适用日期" name="dateRange">
<a-range-picker
v-model:value="formState.dateRange"
picker="month"
valueFormat="YYYY-MM" />
</a-form-item>
</a-col>
<a-col :span="24">
<!-- <a-col :span="24">
<a-form-item ref="name" label="排放因子" name="emissionFactors">
<ns-input v-model:value="formState.emissionFactors" disabled />
</a-form-item>
</a-col>
</a-col> -->
</a-row>
<span
<!-- <span
key=""
style="font-size: 16px; font-weight: 700; color: rgba(51, 51, 51, 1); text-align: left">
因子列表
@ -117,8 +88,11 @@
<ns-input style="margin-top: 5px" v-model:value="selectData" @change="keyChange" />
</a-form-item>
</a-col>
</a-row>
</a-row> -->
</a-form>
<a-button type="primary" style="margin-bottom: 10px" @click="selectFactor"
>选择因子</a-button
>
<a-table
:columns="drawerColumns"
:data-source="newTableData"
@ -142,6 +116,15 @@
</template>
</a-drawer>
</div>
<!-- 选择因子 -->
<a-modal
v-model:visible="openVisible"
width="60%"
title="选择因子"
@ok="onSubmit"
@cancel="onClose">
<ns-view-list-table v-bind="config" ref="setFactorRef" style="height: 500px" />
</a-modal>
</div>
</template>
@ -156,6 +139,7 @@
carbonEmissionFactorLibrary,
} from '/@/api/carbonEmissionFactorLibrary';
import { or } from '@vueuse/core';
import { setFactorConfig } from '../config';
defineOptions({
energyType: 'quickCalculation', // name
components: {
@ -499,6 +483,11 @@
},
});
};
const openVisible = ref(false);
const config = setFactorConfig(orgId.value);
const selectFactor = () => {
openVisible.value = true;
};
//
const onClose = () => {
visible.value = false;
@ -611,6 +600,12 @@
:deep(.ant-table-container) {
padding: unset;
}
:deep(.ant-modal-header) {
border-bottom: 10px solid #f0f0f0 !important;
}
:deep(.ant-modal-footer) {
border-top: 10px solid #f0f0f0 !important;
}
</style>
<style scoped>
th.column-money,

20
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue

@ -78,6 +78,7 @@
import { http } from '/nerv-lib/util/http';
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
import fillIn from './fillInPage/index.vue';
import { message } from 'ant-design-vue';
defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
@ -241,6 +242,9 @@
};
fetch(carbonInventoryCheck.downloadZip, deleteId.value, config)
.then((res) => {
if (res.type === 'application/json') {
handlerResponseError(res);
} else {
// URL blob
const url = window.URL.createObjectURL(new Blob([res]));
// <a>
@ -252,6 +256,7 @@
// URL
window.URL.revokeObjectURL(url);
}
})
.catch((error) => {
console.error('下载图片失败:', error);
@ -295,6 +300,21 @@
},
rowKey: 'id',
});
const handlerResponseError = (data) => {
const fileReader = new FileReader();
fileReader.onload = function () {
try {
const jsonData = JSON.parse(fileReader.result); //
console.log('后台返回的信息', jsonData.data);
message.warning(jsonData.data);
// dosomething
} catch (err) {
//
console.log('success...');
}
};
fileReader.readAsText(data);
};
//
const updateData = (newDataOne, newDataTwo) => {
isMainPage.value = newDataOne;

10
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue

@ -81,6 +81,7 @@
:selectedKeys="selectedKeys"
:checkedKeys="treeCheckedKeys"
:tree-data="treeData"
:checkStrictly="true"
:show-line="{ showLeafIcon: false }"
v-if="treeData && treeData.length > 0"
class="draggable-tree"
@ -155,6 +156,9 @@
selectedTime.value = false;
getMonthData();
getBallQuery.value.yearAndMonth = 'month';
getBallQuery.value.itemizeIds = [];
getBallQuery.value.itemizeId = '';
getPillarQuery.value.itemizeId = '';
// getMonthPillarData();
};
const changeToYear = () => {
@ -167,6 +171,9 @@
selectedTime.value = true;
getYearData();
getBallQuery.value.yearAndMonth = 'year';
getBallQuery.value.itemizeIds = [];
getBallQuery.value.itemizeId = '';
getPillarQuery.value.itemizeId = '';
// getYearPillarData();
};
// echarts
@ -516,6 +523,7 @@
getYearData();
};
const getYearData = () => {
treeCheckedKeys.value = [];
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then((res) => {
data.value = res.data;
res.data.forEach((item) => {
@ -563,7 +571,9 @@
return {
//
onClick: (event) => {
getPillarQuery.value.itemizeIds = [record.itemizeId];
getPillarQuery.value.itemizeId = record.itemizeId;
getBallQuery.value.itemizeIds = [record.itemizeId];
getBallQuery.value.itemizeId = record.itemizeId;
if (selectedTime.value) {
getYearPillarData();

Loading…
Cancel
Save