taskid:110 remark:'commit'

This commit is contained in:
fks-xuxinyue
2024-07-26 15:12:56 +08:00
parent e05a813a1e
commit 744aae1bba
22 changed files with 580 additions and 15 deletions

View File

@@ -355,7 +355,7 @@
carbonInventoryCheck,
} from '/@/api/carbonEmissionFactorLibrary';
import { group } from '/@/api/deviceManage';
import { debug } from 'node:console';
import { debug, log } from 'node:console';
defineOptions({
energyType: 'fillInPage', // 与页面路由name一致缓存才可生效
components: {
@@ -474,6 +474,8 @@
queryEmissionData.value.categoryId = info.node.conId;
getEmissionStatistic();
} else if (isClickedTplx.value) {
queryFlowDirection.value.categoryId = info.node.conId;
getCarbonFlowDirection();
}
};
// 获取碳盘查报告树
@@ -488,6 +490,7 @@
categoryId.value = res.data[0].children[0].conId;
formState.value.categoryId = categoryId.value;
queryEmissionData.value.categoryId = categoryId.value;
queryFlowDirection.value.categoryId = categoryId.value;
selectedIds.value = getAllIds(gData.value);
}
getEmissionSourceTree();
@@ -602,6 +605,7 @@
// 类别配置树点击确定
const queryConfigure = ref({
orgId: orgId.value,
reportId: props.reportId,
});
const submitCategory = () => {
fetch(carbonInventoryCheck.updateCategoryTree, queryConfigure.value).then((res) => {
@@ -957,8 +961,13 @@
.validate()
.then(() => {
console.log('values', editFormState, toRaw(editFormState));
editFormState.value.factorId = editFormState.value.factorId.join(',');
if (editFormState.value.collectionNode.value) {
if (editFormState.value.factorId.length > 0) {
editFormState.value.factorId = editFormState.value.factorId.join(',');
}
if (editFormState.value.dataSources.value) {
editFormState.value.dataSources = editFormState.value.dataSources.value;
}
if (editFormState.value.collectionNode) {
editFormState.value.collectionNode = editFormState.value.collectionNode.value;
}
fetch(carbonInventoryCheck.updateTable, editFormState.value).then((res) => {
@@ -1000,10 +1009,23 @@
fillInPage.value = false;
isClickedPftj.value = false;
isClickedTplx.value = true;
getCarbonFlowDirection();
setTimeout(() => {
drawEcharts();
}, 500);
};
// 获取碳排流向数据
const queryFlowDirection = ref({
orgId: orgId.value,
reportId: props.reportId,
year: props.year,
categoryId: categoryId.value,
});
const getCarbonFlowDirection = () => {
fetch(carbonInventoryCheck.carbonFlowDirection, queryFlowDirection.value).then((res) => {
console.log(res);
});
};
// 获取排放统计数据
const queryEmissionData = ref({
orgId: orgId.value,
@@ -1015,13 +1037,30 @@
const getEmissionStatistic = () => {
fetch(carbonInventoryCheck.emissionStatistic, queryEmissionData.value).then((res) => {
pftjData.value = res.data.body;
const data = res.data.title;
// 将数据表头数据按顺序组织
const orderedKeys = res.data.title.map((obj) => Object.keys(obj)[0]); // 获取原始键的顺序
const result: { [key: string]: string } = {};
res.data.title.forEach((obj) => {
const key = Object.keys(obj)[0];
result[key] = obj[key];
});
// 确保按照原始顺序返回结果
const orderedResult: { [key: string]: string } = {};
orderedKeys.forEach((key) => {
if (result[key] !== undefined) {
orderedResult[key] = result[key];
}
});
const data = orderedResult;
// 将数据转换为 DataItem 数组
tableHeader.value = [];
pftjColumn.value = [
{
title: '排放分类',
dataIndex: 'emissionCategory',
dataIndex: 'emissionClassify',
customCell: (record, rowIndex) => {
if (rowIndex == undefined) {
return {
@@ -1029,10 +1068,10 @@
colSpan: 0,
};
}
const rowSpan = getRowSpan('emissionCategory', record, pftjData.value);
const rowSpan = getRowSpan('emissionClassify', record, pftjData.value);
if (
rowIndex != 0 &&
pftjData.value[rowIndex - 1].emissionCategory == record.emissionCategory
pftjData.value[rowIndex - 1].emissionClassify == record.emissionClassify
) {
return {
rowSpan: 0,
@@ -1431,7 +1470,6 @@
min-width: fit-content;
> div {
background-color: @white;
flex: 1;
}
display: flex;

View File

@@ -4,7 +4,7 @@
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
</div>
<!-- 填报页 -->
<div v-if="fillInPage">
<div v-if="fillInPage" style="height: 100%">
<fillIn :reportId="reportId" :year="year" @change-data="updateData" />
</div>
<!-- 新增报告弹窗 -->