From 533f0cc63333ced666d3a8b25f2b8bfd720d1c52 Mon Sep 17 00:00:00 2001
From: fks-xuxinyue <2822784518@qq.com>
Date: Thu, 11 Jul 2024 16:23:42 +0800
Subject: [PATCH] taskid:083 remark:commit
---
.../carbonEmissionFactorLibrary/index.vue | 26 ++-
.../carbonEmissionStatistics/config.ts | 38 ++--
.../energyConsumption/index.vue | 195 +++++++++++++++------
3 files changed, 187 insertions(+), 72 deletions(-)
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
index f2397f7..6f07629 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
@@ -135,7 +135,7 @@ import { log } from 'node:console';
const casData = ref([]);
const treeData = ref([]);
const userAuthList = ref([]);
- const orgId = JSON.parse(sessionStorage.getItem(import.meta.env.VITE_PUBLIC_PATH)).orgId;
+ const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
const dynamicDisabled = computed(() => {
return formRef.value?.validateResult && userAuthList.value?.length;
});
@@ -493,7 +493,7 @@ import { log } from 'node:console';
isReload: true,
isClearCheck: true,
api: carbonEmissionFactorLibrary.del,
- dynamicParams: { id: 'id[]' },
+ dynamicParams: { ids: 'id[]' },
},
],
columns: [
@@ -573,7 +573,7 @@ import { log } from 'node:console';
{
label: '删除',
name: 'userDelete',
- dynamicParams: 'id',
+ dynamicParams: { ids: 'id[]' },
confirm: true,
isReload: true,
api: carbonEmissionFactorLibrary.del,
@@ -617,11 +617,27 @@ import { log } from 'node:console';
options: [
{
label: 'CO2',
- value: 0,
+ value: 'CO2',
},
{
label: 'CO2e',
- value: 1,
+ value: 'CO2e',
+ },
+ {
+ label: 'SF6',
+ value:'SF6',
+ },
+ {
+ label: 'CH4',
+ value: 'CH4',
+ },
+ {
+ label: 'PFCs',
+ value: 'PFCs',
+ },
+ {
+ label: 'HFCs',
+ value: 'HFCs',
},
],
},
diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
index e12f23a..d3bc6e8 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
@@ -7,64 +7,70 @@ export const tableColumns = [
},
{
title: '能源种类',
- dataIndex: 'money',
+ dataIndex: 'energyType',
},
{
title: '计量单位',
- className: 'column-money',
- dataIndex: 'money',
+ className: 'unit',
+ dataIndex: 'unit',
},
{
title: '全年',
- dataIndex: 'address',
+ dataIndex: 'yearly',
},
{
title: '1月',
- dataIndex: 'address',
+ dataIndex: 'jan',
+ customRender: ({ text, record }) => ({
+ children: text,
+ attrs: {
+ style: record.janFlag === 1 ? 'color: red' : 'color: blue'
+ }
+ })
},
{
title: '2月',
- dataIndex: 'address',
+ dataIndex: 'feb',
},
{
title: '3月',
- dataIndex: 'address',
+ dataIndex: 'mar',
},
{
title: '4月',
- dataIndex: 'address',
+ dataIndex: 'apr',
},
{
title: '5月',
- dataIndex: 'address',
+ dataIndex: 'may',
},
{
title: '6月',
- dataIndex: 'address',
+ dataIndex: 'jun',
},
{
title: '7月',
- dataIndex: 'address',
+ dataIndex: 'jul',
},
{
title: '8月',
- dataIndex: 'address',
+ dataIndex: 'aug',
},
{
title: '9月',
- dataIndex: 'address',
+ dataIndex: 'sep',
},
{
title: '10月',
- dataIndex: 'address',
+ dataIndex: 'oct',
},
{
title: '11月',
- dataIndex: 'address',
+ dataIndex: 'nov',
},
{
title: '12月',
- dataIndex: 'address',
+ dataIndex: 'dec',
},
{
title: '操作',
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 f13ffe3..a209ff2 100644
--- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
+++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
@@ -16,7 +16,7 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
- sss
- {{ title }}
-
-
-
- 是
- 否
+
+
+ 是
+ 否
-
-
- Zone one
- Zone two
+
+
+ 直接排放
+ 间接排放
+ 其他
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
取消
@@ -95,46 +136,81 @@
import { ref,reactive, toRaw } from 'vue';
import type { UnwrapRef } from 'vue';
import type { Rule } from 'ant-design-vue/es/form';
+ import { Pagination } from 'ant-design-vue';
import type { CascaderProps,TreeSelectProps } from 'ant-design-vue';
import type { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http';
import { tableColumns } from '../config';
import { energyConsumption } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({
- name: 'EnergyConsumption', // 与页面路由name一致缓存才可生效
+ energyType: 'EnergyConsumption', // 与页面路由name一致缓存才可生效
+ components: {
+ 'a-pagination': Pagination,
+ },
});
- const orgId = JSON.parse(sessionStorage.getItem(import.meta.env.VITE_PUBLIC_PATH)).orgId;
+ const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
const fetch = (api, params = { orgId }) => {
return http.post(api, params);
};
const selectYear = ref();
const current = ref(1);
const pageSize = ref(10);
+ const total = ref()
+ const queryParams = ref({
+ pageNum:current.value,
+ pageSize:pageSize.value,
+ })
const visible = ref(false);
- const value = ref([]);
const data = ref([]);
interface FormState {
- name: string;
- region: string | undefined;
- delivery: boolean;
- resource: string;
+ energyType: string;
+ unit: string;
+ collectionNode: string;
+ emissionType: string | undefined;
+ isComputeCarbon: string;
+ janFlag: boolean;
+ febFlag: boolean;
+ marFlag: boolean;
+ aprFlag: boolean;
+ mayFlag: boolean;
+ junFlag: boolean;
+ julFlag: boolean;
+ augFlag: boolean;
+ sepFlag: boolean;
+ octFlag: boolean;
+ novFlag: boolean;
+ decFlag: boolean;
}
const formRef = ref();
const labelCol = { span: 5 };
- const wrapperCol = { span: 13 };
+ const wrapperCol = { span: 19 };
+ const switchLabelCol = { span: 10 };
+ const switchWrapperCol = { span: 14 };
const formState: UnwrapRef = reactive({
- name: '',
- region: undefined,
- delivery: false,
- resource: '',
+ energyType: '',
+ unit: '',
+ collectionNode: '',
+ emissionType: undefined,
+ isComputeCarbon: '',
+ janFlag: false,
+ febFlag: false,
+ marFlag: false,
+ aprFlag: false,
+ mayFlag: false,
+ junFlag: false,
+ julFlag: false,
+ augFlag: false,
+ sepFlag: false,
+ octFlag: false,
+ novFlag: false,
+ decFlag: false,
});
// 定义form表单的必填
const rules: Record = {
- name: [
- { required: true, message: '请输入能源种类', trigger: 'change' },
- ],
- resource: [{ required: true, message: 'Please select activity resource', trigger: 'change' }],
+ energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
+ isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }],
+ emissionType : [{ required: false, message: '请输入选择排放类型', trigger: 'change' }]
};
// 定义计量单位级联选择的变量
const options: CascaderProps['options'] = [
@@ -172,7 +248,6 @@
},
];
// 定义自动采集节点数的变量
- const treeValue = ref();
const treeData = ref([
{
title: 'parent 1',
@@ -199,13 +274,33 @@
],
},
]);
+ // 年份选择改变触发
+ const changeYearData = () => {
+ queryParams.value.year = selectYear.value.format('YYYY')
+ getTableList()
+ }
// 获取表格数据
const getTableList = () => {
- fetch(energyConsumption.pageList).then((res) => {
- console.log(res,'aaaaaa');
+ fetch(energyConsumption.pageList , queryParams.value).then((res) => {
+ data.value = res.data.records
+ total.value = res.data.total
});
};
getTableList()
+ // 分页器
+ const onChange = (pageNumber: number,size: number) => {
+ current.value = pageNumber;
+ pageSize.value = size;
+ };
+ // 计算碳排切换
+ const changeRadio = (e) => {
+ if(e.target.value==='0'){
+ rules.emissionType.required = true
+ }else{
+ rules.emissionType.required = false
+ }
+ console.log(rules);
+ };
// 点击确定提交
const onSubmit = () => {
formRef.value
@@ -217,9 +312,6 @@
console.log('error', error);
});
};
- const resetForm = () => {
- formRef.value.resetFields();
- };
// 点击新增按钮
const addNewData = () => {
visible.value = true
@@ -227,6 +319,7 @@
// 关闭新增抽屉
const onClose = () => {
visible.value = false;
+ formRef.value.resetFields();
};