From 15811933c3ec2d27051d36ea075afa2901ddb5f6 Mon Sep 17 00:00:00 2001 From: fks-xuxinyue <2822784518@qq.com> Date: Mon, 26 Aug 2024 16:12:26 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A2=B3=E6=8E=92?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carbonAssets/carbonAssetsDetail/index.vue | 37 ++++--- .../carbonEmissionFactorLibrary/config.ts | 2 +- .../carbonEmissionFactorLibrary/index.vue | 29 +++--- .../carbonEmissionStatistics/config.ts | 106 +++++++++++++++++++++ .../energyConsumption/index.vue | 1 + .../quickCalculation/index.vue | 63 ++++++------ .../carbonInventoryCheck/index.vue | 40 ++++++-- .../carbonPlanning/category/index.vue | 10 ++ 8 files changed, 208 insertions(+), 80 deletions(-) diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue index 0862a76..a728237 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue @@ -60,15 +60,18 @@
配额统计
- 全国配额 - 地方配额 - CCER配额 + + 全国配额 + + + 地方配额 + + + CCER配额 +
@@ -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); diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts index 25fdcf1..4b8d12d 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts +++ b/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, diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue index bdfdf63..68b486a 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue +++ b/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(); const selectedKeys = ref(); @@ -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; } } diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts index d259443..7eab9ce 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts +++ b/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', + }); +}; 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 2ef50c2..3e582e5 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue @@ -973,6 +973,7 @@ formState.value = { orgId: orgId.value, }; + fileList.value = []; formRef.value.resetFields(); }; // 点击上传凭证按钮 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 5350ea0..8f7add6 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue @@ -40,40 +40,11 @@
- - - + - + - 因子列表 @@ -117,8 +88,11 @@ - + --> + 选择因子
+ + + + @@ -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; + } diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue index b73b0d7..b03ede5 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue @@ -129,7 +129,7 @@
- 全国碳账户余额 + CCER账户余额
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue index 68b486a..cac49c8 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue @@ -558,6 +558,11 @@ const onSelectKeys = ref([]); const onSelect = (selectedKey: string[], info: any) => { if (selectedKey.length === 1) { + if (info.selectedNodes[0].emissionName === '全部') { + onSelectKeys.value = []; + } else { + onSelectKeys.value = [info.selectedNodes[0].id]; + } selectedKeys.value = selectedKey; editTreeNode.value = { id: info.selectedNodes[0].id, @@ -566,7 +571,6 @@ sortNumber: info.selectedNodes[0].sortNumber, parentEmissionId: info.selectedNodes[0].parentEmissionId, }; - onSelectKeys.value = [info.selectedNodes[0].id]; emissionList.value = [...onSelectKeys.value, ...checkedIds.value]; mainRef.value?.nsTableRef.reload(); } @@ -700,12 +704,17 @@ label: '导出', type: 'primary', handle: () => { - // console.log( mainRef.value.nsTableRef.tableState.selectedRowKeys) + // console.log(mainRef.value.nsTableRef.formParamsRef) const exportQuery = { orgId: orgId.value, pageNum: 1, pageSize: 999, ids: mainRef.value.nsTableRef.tableState.selectedRowKeys, + bibliography:mainRef.value.nsTableRef.formParamsRef.bibliography, + emissionGas:mainRef.value.nsTableRef.formParamsRef.emissionGas, + carbonDatabase:mainRef.value.nsTableRef.formParamsRef.carbonDatabase, + emissionProcess:mainRef.value.nsTableRef.formParamsRef.emissionProcess, + emissionSources:mainRef.value.nsTableRef.formParamsRef.emissionSources, }; const config = { responseType: 'blob', @@ -717,7 +726,7 @@ // 创建一个 标签,用于触发下载 const link = document.createElement('a'); link.href = url; - link.setAttribute('download', 'carbonFactor.xlsx'); // 设置下载的文件名 + link.setAttribute('download', '碳排因子库导出.xlsx'); // 设置下载的文件名 document.body.appendChild(link); link.click(); @@ -1254,12 +1263,12 @@ } } } - :deep( - .ant-form-item-label - > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before - ) { - display: none !important; - } + // :deep( + // .ant-form-item-label + // > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before + // ) { + // display: none !important; + // } :deep(.ant-form-item-label) { z-index: 20; text-align: right; diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts index 7eab9ce..2a1c2de 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts @@ -149,7 +149,7 @@ export const drawerColumns = [ export const setFactorConfig = (orgId) => { return ref({ api: carbonEmissionFactorLibrary.getTableList, - params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [] }, + params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [0] }, treeConfig: { header: { icon: 'deviceType', 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 3e582e5..33851cf 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue @@ -57,7 +57,7 @@ - + 标签,用于触发下载 const link = document.createElement('a'); link.href = url; - link.setAttribute('download', 'carbonStats.xlsx'); // 设置下载的文件名 + link.setAttribute('download', '能耗统计导出.xlsx'); // 设置下载的文件名 document.body.appendChild(link); link.click(); @@ -342,13 +342,13 @@ }); }, }, - { - label: '模板下载', - type: 'primary', - handle: () => { - doWnload('/hx-ai-intelligent/asset/file/energyConsumption.xlsx'); - }, - }, + // { + // label: '模板下载', + // type: 'primary', + // handle: () => { + // doWnload('/hx-ai-intelligent/asset/file/energyConsumption.xlsx'); + // }, + // }, // { // label: '上传凭证', // type: 'primary', @@ -782,24 +782,18 @@ // 获取自动采集节点的数据 fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => { treeData.value = res.data; - treeData.value = treeData.value.map((item) => ({ - value: item.id, - label: item.pointName, - children: item.children - ? item.children.map((child) => ({ - value: child.id, - label: child.pointName, - children: child.children - ? child.children.map((childs) => ({ - value: childs.id, - label: childs.pointName, - })) - : [], - })) - : [], - })); + treeData.value = transformData(treeData.value); }); }; + // 将数据转换为树形结构 + const transformData = (data: any[]) => { + return data.map((item) => ({ + title: item.pointName, + value: item.id, + key: item.id, + children: item.children ? transformData(item.children) : [], + })); + }; // 计算碳排切换 const emissionType = ref(); const changeRadio = (e) => { @@ -819,7 +813,9 @@ .validate() .then(() => { console.log('values', formState, toRaw(formState)); - formState.value.year = selectYear.value.format('YYYY'); + formState.value.year = mainRef.value.nsTableRef.formParamsRef.year + ? mainRef.value.nsTableRef.formParamsRef.year + : selectYear.value.format('YYYY'); if (formState.value.unit) { formState.value.unit = formState.value.unit.join(',').split(',')[1]; } diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue deleted file mode 100644 index ee8df02..0000000 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue +++ /dev/null @@ -1,1632 +0,0 @@ - - - - - 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 658c67b..f176d3c 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue @@ -308,80 +308,82 @@
编辑
- - - - - - 自行推估 - 定期量测 - 自动测量 - - - - - - - - - - - - - - - {{ item.cnValue }} - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + 自行推估 + 定期量测 + 自动测量 + + + + + + + + + + + + + + + {{ item.cnValue }} + + + + + + + + + + + + + + + + + + + + + + + + +
因子列表
@@ -1121,19 +1123,21 @@ // 获取自动采集节点的数据 fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => { collectingNodes.value = res.data; - collectingNodes.value = collectingNodes.value.map((item) => ({ - value: item.id, - label: item.pointName, - children: item.children - ? item.children.map((child) => ({ - value: child.id, - label: child.pointName, - })) - : [], - })); + collectingNodes.value = collectingNodes.value = transformData(collectingNodes.value); }); }; + // 将数据转换为树形结构 + const transformData = (data: any[]) => { + return data.map((item) => ({ + title: item.pointName, + value: item.id, + key: item.id, + children: item.children ? transformData(item.children) : [], + })); + }; + const spinning = ref(false); const selectNode = (value) => { + spinning.value = true; const getConsumeData = ref({ acquisitionDate: acquisitionDate.value, collectionNode: value, @@ -1142,6 +1146,7 @@ }); fetch(carbonInventoryCheck.nodeCancellationConsumption, getConsumeData.value).then((res) => { editFormState.value.consumption = res.data; + spinning.value = false; }); }; // 上传附件 @@ -1696,6 +1701,13 @@ background: #c9e4ff; } } + :deep(.ant-empty) { + height: 80%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + } } .right { flex: 1; @@ -1811,4 +1823,11 @@ display: flex; justify-content: right; } + :deep(.ant-empty) { + height: 100%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + } diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue index 74eb895..e3cb0f7 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue @@ -39,7 +39,11 @@ placeholder="请输入报告名称" />
- + @@ -79,6 +84,7 @@ import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary'; import fillIn from './fillInPage/index.vue'; import { message } from 'ant-design-vue'; + import dayjs, { Dayjs } from 'dayjs'; defineOptions({ name: 'CarbonInventoryCheck' }); const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -105,6 +111,17 @@ const selectChange = (value) => { formState.value.reportScope = ''; }; + const defaultPickerValue = ref([ + dayjs('2020'), // 默认开始日期 + dayjs('2020'), // 默认结束日期 + ]); + const openChange = (status) => { + if (status === false) { + if (formState.value.reportYear) { + defaultPickerValue.value = [dayjs('2022'), dayjs('2022')]; + } + } + }; // 定义form表单的必填 const rules: Record = { reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }], diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue index 4b15713..f07ea0c 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue @@ -360,6 +360,9 @@ background: #f2f2f2 !important; color: black !important; } + :deep(.ant-picker) { + border-radius: unset; + } .month { width: 50%; display: flex; diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue index 2ec3dde..8e39645 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue @@ -96,28 +96,32 @@ - +
@@ -135,16 +139,16 @@ v-model:value="formState.conversionRate" :maxlength="15" @keydown="handleKeyDown" - suffix="%" :disabled="disabled" /> + % + kWh @@ -247,6 +251,7 @@ QuestionCircleOutlined, } from '@ant-design/icons-vue'; import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary'; + import { getEnumEnergy } from '/@/api'; import * as echarts from 'echarts'; import { any, string } from 'vue-types'; import type { Dayjs } from 'dayjs'; @@ -265,8 +270,10 @@ nodeName: { type: string, }, + resourceType: { + type: string, + }, }); - console.log(props, 'xxy'); const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); orgId.value = result; @@ -291,11 +298,29 @@ itemizeId: props.parentId, type: props.type, }); + console.log(props.type, '6666'); const ids = ref([]); + const lastActualUsageList = ref([]); + // 获取单位 + const unit = ref(); + const totalActualUsage = ref(); + const totalBudget = ref(); + const totalLastYearActualUsage = ref(); + const totalReferenceValue = ref(); const getTableData = () => { - fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then((res) => { - data.value = res.data; - ids.value = data.value.map((item) => item.id); + fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then(async (res) => { + let resUnit = await getEnumEnergy({ params: { code: props.resourceType } }); + unit.value = resUnit.data.unit; + data.value = res.data.list; + totalActualUsage.value = res.data.actualUsage; + totalBudget.value = res.data.budget; + totalLastYearActualUsage.value = res.data.lastYearActualUsage; + totalReferenceValue.value = res.data.referenceValue; + if (data.value.length > 0) { + ids.value = data.value.map((item) => item.id); + lastActualUsageList.value = data.value.map((item) => item.lastYearActualUsage); + formState.value.lastYearList = lastActualUsageList.value; + } }); }; getTableData(); @@ -313,14 +338,17 @@ { title: Number(props.year) - 1 + '年实际用量', dataIndex: 'lastYearActualUsage', + customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位 }, { title: props.year + '年实际用量', dataIndex: 'actualUsage', + customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位 }, { title: '基准值', dataIndex: 'referenceValue', + customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位 }, { title: '是否按去年折算', @@ -329,10 +357,12 @@ { title: '折算率', dataIndex: 'conversionRate', + customRender: ({ text }: { text: number }) => `${text}%`, // 在这里添加单位 }, { title: '2024年预算', dataIndex: 'budget', + customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位 }, { title: '操作', @@ -346,10 +376,10 @@ const formRef = ref(); const formState = ref({}); const labelCol = { span: 6 }; - const wrapperCol = { span: 18 }; + const wrapperCol = { span: 17 }; const editData = (record) => { open.value = true; - if (record.isLastYear) { + if (record.isLastYear !== undefined) { formState.value.ids = [record.id]; if (record.lastYear === '是') { formState.value.isLastYear = 1; @@ -357,6 +387,7 @@ formState.value.isLastYear = 0; } formState.value.conversionRate = record.conversionRate; + formState.value.lastYearList = [record.lastYearActualUsage]; formState.value.budget = record.budget; } }; @@ -593,7 +624,7 @@ '基准值', ], top: '0', - left: '0', + right: '0', textStyle: { color: '#666', fontSize: 12, @@ -650,6 +681,30 @@ ], series: [ { + name: props.year + '年预算', + type: 'line', + // smooth: true, // 开启平滑曲线 + symbol: 'emptyCircle', //标记的图形为实心圆 + itemStyle: { + normal: { + color: 'rgba(255, 188, 70, 1)', + }, + }, + data: budgetList.value, + }, + { + name: '基准值', + type: 'line', + // smooth: true, // 开启平滑曲线 + symbol: 'emptyCircle', //标记的图形为实心圆 + itemStyle: { + normal: { + color: 'rgba(195, 142, 255, 1)', + }, + }, + data: referenceValueList.value, + }, + { name: Number(props.year) - 1 + '年实际用量', type: 'bar', barWidth: 18, @@ -707,28 +762,6 @@ }, data: actualUsageList.value, }, - { - name: props.year + '年预算', - type: 'line', - smooth: true, // 开启平滑曲线 - symbol: 'none', //标记的图形为实心圆 - lineStyle: { - color: 'rgba(255, 188, 70, 1)', - width: 2, - }, - data: budgetList.value, - }, - { - name: '基准值', - type: 'line', - smooth: true, // 开启平滑曲线 - symbol: 'none', //标记的图形为实心圆 - lineStyle: { - color: 'rgba(195, 142, 255, 1)', - width: 2, - }, - data: referenceValueList.value, - }, ], }; chartInstance = echarts.init(chartRef.value); @@ -827,8 +860,8 @@ background: #f7f9ff; padding: 12px; border-radius: 12px; - background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(222, 255, 246, 1) 100%); - border: 1px solid rgba(18, 174, 132, 1); + background: linear-gradient(180deg, #ffffff 0%, #defff663 100%); + border: 1px solid #12ae8424; .quantity { font-size: 12px; font-weight: 400; @@ -900,6 +933,11 @@ ) { display: none !important; } + .unit { + position: absolute; + right: 10px; + top: 5px; + }