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

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

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

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

@ -40,40 +40,11 @@
</div> </div>
</div> </div>
<div class="right"> <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 <ns-view-list-table
v-bind="tableConfig" v-bind="tableConfig"
:model="tableData" :model="tableData"
ref="mainRef" ref="mainRef"
:scroll="{ x: 1000 }" /> :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 <a-drawer
:width="500" :width="500"
@ -93,20 +64,20 @@
:wrapper-col="wrapperCol"> :wrapper-col="wrapperCol">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item ref="name" label="日期范围" name="dateRange"> <a-form-item ref="name" label="适用日期" name="dateRange">
<a-range-picker <a-range-picker
v-model:value="formState.dateRange" v-model:value="formState.dateRange"
picker="month" picker="month"
valueFormat="YYYY-MM" /> valueFormat="YYYY-MM" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <!-- <a-col :span="24">
<a-form-item ref="name" label="排放因子" name="emissionFactors"> <a-form-item ref="name" label="排放因子" name="emissionFactors">
<ns-input v-model:value="formState.emissionFactors" disabled /> <ns-input v-model:value="formState.emissionFactors" disabled />
</a-form-item> </a-form-item>
</a-col> </a-col> -->
</a-row> </a-row>
<span <!-- <span
key="" key=""
style="font-size: 16px; font-weight: 700; color: rgba(51, 51, 51, 1); text-align: left"> 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" /> <ns-input style="margin-top: 5px" v-model:value="selectData" @change="keyChange" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row> -->
</a-form> </a-form>
<a-button type="primary" style="margin-bottom: 10px" @click="selectFactor"
>选择因子</a-button
>
<a-table <a-table
:columns="drawerColumns" :columns="drawerColumns"
:data-source="newTableData" :data-source="newTableData"
@ -142,6 +116,15 @@
</template> </template>
</a-drawer> </a-drawer>
</div> </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> </div>
</template> </template>
@ -156,6 +139,7 @@
carbonEmissionFactorLibrary, carbonEmissionFactorLibrary,
} from '/@/api/carbonEmissionFactorLibrary'; } from '/@/api/carbonEmissionFactorLibrary';
import { or } from '@vueuse/core'; import { or } from '@vueuse/core';
import { setFactorConfig } from '../config';
defineOptions({ defineOptions({
energyType: 'quickCalculation', // name energyType: 'quickCalculation', // name
components: { components: {
@ -499,6 +483,11 @@
}, },
}); });
}; };
const openVisible = ref(false);
const config = setFactorConfig(orgId.value);
const selectFactor = () => {
openVisible.value = true;
};
// //
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
@ -611,6 +600,12 @@
:deep(.ant-table-container) { :deep(.ant-table-container) {
padding: unset; padding: unset;
} }
:deep(.ant-modal-header) {
border-bottom: 10px solid #f0f0f0 !important;
}
:deep(.ant-modal-footer) {
border-top: 10px solid #f0f0f0 !important;
}
</style> </style>
<style scoped> <style scoped>
th.column-money, 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 { http } from '/nerv-lib/util/http';
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary'; import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
import fillIn from './fillInPage/index.vue'; import fillIn from './fillInPage/index.vue';
import { message } from 'ant-design-vue';
defineOptions({ name: 'CarbonInventoryCheck' }); defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref(''); const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
@ -241,6 +242,9 @@
}; };
fetch(carbonInventoryCheck.downloadZip, deleteId.value, config) fetch(carbonInventoryCheck.downloadZip, deleteId.value, config)
.then((res) => { .then((res) => {
if (res.type === 'application/json') {
handlerResponseError(res);
} else {
// URL blob // URL blob
const url = window.URL.createObjectURL(new Blob([res])); const url = window.URL.createObjectURL(new Blob([res]));
// <a> // <a>
@ -252,6 +256,7 @@
// URL // URL
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
}
}) })
.catch((error) => { .catch((error) => {
console.error('下载图片失败:', error); console.error('下载图片失败:', error);
@ -295,6 +300,21 @@
}, },
rowKey: 'id', 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) => { const updateData = (newDataOne, newDataTwo) => {
isMainPage.value = newDataOne; isMainPage.value = newDataOne;

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

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

Loading…
Cancel
Save