diff --git a/hx-ai-intelligent/src/api/index.ts b/hx-ai-intelligent/src/api/index.ts
index 0349a92..4460e8d 100644
--- a/hx-ai-intelligent/src/api/index.ts
+++ b/hx-ai-intelligent/src/api/index.ts
@@ -60,3 +60,13 @@ export const getEnum = async ({
const res = await http.get(api, params);
return Promise.resolve(res);
};
+/**
+ * 获取谈规划单位(需传参,参数 enumType)
+ */
+export const getEnumEnergy = async ({
+ api = `${BASE_URL}/operation/enum/getEnumEnergy`,
+ params = {},
+}: dictHttpConfig) => {
+ const res = await http.get(api, params);
+ return Promise.resolve(res);
+};
diff --git a/hx-ai-intelligent/src/api/planManage.ts b/hx-ai-intelligent/src/api/planManage.ts
index beb8075..e453fbe 100644
--- a/hx-ai-intelligent/src/api/planManage.ts
+++ b/hx-ai-intelligent/src/api/planManage.ts
@@ -2,7 +2,7 @@ const prefix = '/carbon-smart/api';
// 照明系统及相关接口
export enum planManage {
/**
- * @param deviceType 设备类型(1照明,2空调,3排风扇,4风幕机,5电动窗,6进水阀,7排水泵)
+ * @param deviceType 设备类型(1照明,2空调,3排风扇,4风幕机,5电动窗,6给排水)
*/
// 获得未激活的计划
getTransData = prefix + '/deviceCtrlPlan/getDeActivatedPlanList',
diff --git a/hx-ai-intelligent/src/api/waterSystem.ts b/hx-ai-intelligent/src/api/waterSystem.ts
new file mode 100644
index 0000000..e8c282c
--- /dev/null
+++ b/hx-ai-intelligent/src/api/waterSystem.ts
@@ -0,0 +1,13 @@
+// 前缀
+const prefix = '/carbon-smart/api';
+// 通风系统相关接口
+export enum waterSys {
+ // 获得污水池状态
+ getPool1 = prefix + '/waterSysCtrl/getSewagePoolState',
+ // 获得阀门状态
+ getValve = prefix + '/waterSysCtrl/getValveState',
+ // 获得集水池状态
+ getPool2 = prefix + '/waterSysCtrl/getCollectPoolState',
+ // 获得水泵状态
+ getPump = prefix + '/waterSysCtrl/getPumpState',
+}
diff --git a/hx-ai-intelligent/src/util/Export2Excel.js b/hx-ai-intelligent/src/util/Export2Excel.js
new file mode 100644
index 0000000..d8a2af3
--- /dev/null
+++ b/hx-ai-intelligent/src/util/Export2Excel.js
@@ -0,0 +1,220 @@
+/* eslint-disable */
+import { saveAs } from 'file-saver'
+import XLSX from 'xlsx'
+
+function generateArray(table) {
+ var out = [];
+ var rows = table.querySelectorAll('tr');
+ var ranges = [];
+ for (var R = 0; R < rows.length; ++R) {
+ var outRow = [];
+ var row = rows[R];
+ var columns = row.querySelectorAll('td');
+ for (var C = 0; C < columns.length; ++C) {
+ var cell = columns[C];
+ var colspan = cell.getAttribute('colspan');
+ var rowspan = cell.getAttribute('rowspan');
+ var cellValue = cell.innerText;
+ if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
+
+ //Skip ranges
+ ranges.forEach(function (range) {
+ if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
+ for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
+ }
+ });
+
+ //Handle Row Span
+ if (rowspan || colspan) {
+ rowspan = rowspan || 1;
+ colspan = colspan || 1;
+ ranges.push({
+ s: {
+ r: R,
+ c: outRow.length
+ },
+ e: {
+ r: R + rowspan - 1,
+ c: outRow.length + colspan - 1
+ }
+ });
+ };
+
+ //Handle Value
+ outRow.push(cellValue !== "" ? cellValue : null);
+
+ //Handle Colspan
+ if (colspan)
+ for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
+ }
+ out.push(outRow);
+ }
+ return [out, ranges];
+};
+
+function datenum(v, date1904) {
+ if (date1904) v += 1462;
+ var epoch = Date.parse(v);
+ return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
+}
+
+function sheet_from_array_of_arrays(data, opts) {
+ var ws = {};
+ var range = {
+ s: {
+ c: 10000000,
+ r: 10000000
+ },
+ e: {
+ c: 0,
+ r: 0
+ }
+ };
+ for (var R = 0; R != data.length; ++R) {
+ for (var C = 0; C != data[R].length; ++C) {
+ if (range.s.r > R) range.s.r = R;
+ if (range.s.c > C) range.s.c = C;
+ if (range.e.r < R) range.e.r = R;
+ if (range.e.c < C) range.e.c = C;
+ var cell = {
+ v: data[R][C]
+ };
+ if (cell.v == null) continue;
+ var cell_ref = XLSX.utils.encode_cell({
+ c: C,
+ r: R
+ });
+
+ if (typeof cell.v === 'number') cell.t = 'n';
+ else if (typeof cell.v === 'boolean') cell.t = 'b';
+ else if (cell.v instanceof Date) {
+ cell.t = 'n';
+ cell.z = XLSX.SSF._table[14];
+ cell.v = datenum(cell.v);
+ } else cell.t = 's';
+
+ ws[cell_ref] = cell;
+ }
+ }
+ if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
+ return ws;
+}
+
+function Workbook() {
+ if (!(this instanceof Workbook)) return new Workbook();
+ this.SheetNames = [];
+ this.Sheets = {};
+}
+
+function s2ab(s) {
+ var buf = new ArrayBuffer(s.length);
+ var view = new Uint8Array(buf);
+ for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
+ return buf;
+}
+
+export function export_table_to_excel(id) {
+ var theTable = document.getElementById(id);
+ var oo = generateArray(theTable);
+ var ranges = oo[1];
+
+ /* original data */
+ var data = oo[0];
+ var ws_name = "SheetJS";
+
+ var wb = new Workbook(),
+ ws = sheet_from_array_of_arrays(data);
+
+ /* add ranges to worksheet */
+ // ws['!cols'] = ['apple', 'banan'];
+ ws['!merges'] = ranges;
+
+ /* add worksheet to workbook */
+ wb.SheetNames.push(ws_name);
+ wb.Sheets[ws_name] = ws;
+
+ var wbout = XLSX.write(wb, {
+ bookType: 'xlsx',
+ bookSST: false,
+ type: 'binary'
+ });
+
+ saveAs(new Blob([s2ab(wbout)], {
+ type: "application/octet-stream"
+ }), "test.xlsx")
+}
+
+export function export_json_to_excel({
+ multiHeader = [],
+ header,
+ data,
+ filename,
+ merges = [],
+ autoWidth = true,
+ bookType = 'xlsx'
+} = {}) {
+ /* original data */
+ filename = filename || 'excel-list'
+ data = [...data]
+ data.unshift(header);
+
+ for (let i = multiHeader.length - 1; i > -1; i--) {
+ data.unshift(multiHeader[i])
+ }
+
+ var ws_name = "SheetJS";
+ var wb = new Workbook(),
+ ws = sheet_from_array_of_arrays(data);
+
+ if (merges.length > 0) {
+ if (!ws['!merges']) ws['!merges'] = [];
+ merges.forEach(item => {
+ ws['!merges'].push(XLSX.utils.decode_range(item))
+ })
+ }
+
+ if (autoWidth) {
+ /*设置worksheet每列的最大宽度*/
+ const colWidth = data.map(row => row.map(val => {
+ /*先判断是否为null/undefined*/
+ if (val == null) {
+ return {
+ 'wch': 10
+ };
+ }
+ /*再判断是否为中文*/
+ else if (val.toString().charCodeAt(0) > 255) {
+ return {
+ 'wch': val.toString().length * 2
+ };
+ } else {
+ return {
+ 'wch': val.toString().length
+ };
+ }
+ }))
+ /*以第一行为初始值*/
+ let result = colWidth[0];
+ for (let i = 1; i < colWidth.length; i++) {
+ for (let j = 0; j < colWidth[i].length; j++) {
+ if (result[j]['wch'] < colWidth[i][j]['wch']) {
+ result[j]['wch'] = colWidth[i][j]['wch'];
+ }
+ }
+ }
+ ws['!cols'] = result;
+ }
+
+ /* add worksheet to workbook */
+ wb.SheetNames.push(ws_name);
+ wb.Sheets[ws_name] = ws;
+
+ var wbout = XLSX.write(wb, {
+ bookType: bookType,
+ bookSST: false,
+ type: 'binary'
+ });
+ saveAs(new Blob([s2ab(wbout)], {
+ type: "application/octet-stream"
+ }), `${filename}.${bookType}`);
+}
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..87ff329 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
@@ -36,6 +36,7 @@
style="width: 200px"
v-model:value="queryParams.year"
placeholder="请选择账期"
+ :allowClear="false"
picker="year"
valueFormat="YYYY" />
@@ -60,15 +61,15 @@
@@ -205,6 +206,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 +301,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);
@@ -427,7 +429,7 @@
// 创建一个 标签,用于触发下载
const link = document.createElement('a');
link.href = url;
- link.setAttribute('download', 'carbonTradeDetails.xlsx'); // 设置下载的文件名
+ link.setAttribute('download', '碳资产导出.xlsx'); // 设置下载的文件名
document.body.appendChild(link);
link.click();
@@ -523,11 +525,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);
@@ -702,6 +699,7 @@
.then((res) => {
message.success('操作成功!');
visible.value = false;
+ formState.value = {};
delIds.value = [];
// getDetailList();
mainRef.value?.nsTableRef.reload();
@@ -714,6 +712,7 @@
message.success('操作成功!');
visible.value = false;
delIds.value = [];
+ formState.value = {};
// getDetailList();
mainRef.value?.nsTableRef.reload();
}
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue
deleted file mode 100644
index 05bbc92..0000000
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue
+++ /dev/null
@@ -1,642 +0,0 @@
-
-
-
-
-
-
-
- 全国账户
- 地方账户
- CCER
-
-
-
-
-
- {{ data.label }}
-
-
-
-
-
-
-
- 查询
- 重置
-
-
-
-
-
-
-
-
-
-
- {{ record.accountType.label }}
-
-
-
- 编辑
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 全国账户
- 地方账户
- CCER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 上传
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
-
-
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/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..cac49c8 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 => {
@@ -564,10 +558,12 @@
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;
- }
- if (info.selected) {
- // showOperation.value = true;
editTreeNode.value = {
id: info.selectedNodes[0].id,
level: info.selectedNodes[0].level,
@@ -575,15 +571,18 @@
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();
- } 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 = () => {
@@ -705,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',
@@ -722,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();
@@ -1242,8 +1246,10 @@
flex-direction: column;
border-radius: 12px;
overflow: auto;
+ align-items: center;
:deep(.ant-tree) {
height: 90%;
+ width: 90%;
overflow: auto;
}
}
@@ -1257,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 d259443..2a1c2de 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: [0] },
+ 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..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];
}
@@ -973,6 +969,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/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 7f24ef6..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="请输入报告名称" />
-
+
@@ -78,6 +83,8 @@
import { http } from '/nerv-lib/util/http';
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')!);
@@ -104,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' }],
@@ -241,17 +259,21 @@
};
fetch(carbonInventoryCheck.downloadZip, deleteId.value, config)
.then((res) => {
- // 创建一个 URL 对象,指向图片数据的 blob
- const url = window.URL.createObjectURL(new Blob([res]));
- // 创建一个 标签,用于触发下载
- const link = document.createElement('a');
- link.href = url;
- link.setAttribute('download', '碳盘查凭证.zip'); // 设置下载的文件名
- document.body.appendChild(link);
- link.click();
+ if (res.type === 'application/json') {
+ handlerResponseError(res);
+ } else {
+ // 创建一个 URL 对象,指向图片数据的 blob
+ const url = window.URL.createObjectURL(new Blob([res]));
+ // 创建一个 标签,用于触发下载
+ const link = document.createElement('a');
+ link.href = url;
+ link.setAttribute('download', '碳盘查凭证.zip'); // 设置下载的文件名
+ document.body.appendChild(link);
+ link.click();
- // 清理 URL 对象
- window.URL.revokeObjectURL(url);
+ // 清理 URL 对象
+ window.URL.revokeObjectURL(url);
+ }
})
.catch((error) => {
console.error('下载图片失败:', error);
@@ -295,6 +317,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;
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;
+ }