Browse Source

taskid:083 remark:commit

temp
fks-xuxinyue 4 months ago
parent
commit
533f0cc633
  1. 26
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  2. 38
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  3. 187
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

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

@ -135,7 +135,7 @@ import { log } from 'node:console';
const casData = ref([]); const casData = ref([]);
const treeData = ref([]); const treeData = ref([]);
const userAuthList = 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(() => { const dynamicDisabled = computed(() => {
return formRef.value?.validateResult && userAuthList.value?.length; return formRef.value?.validateResult && userAuthList.value?.length;
}); });
@ -493,7 +493,7 @@ import { log } from 'node:console';
isReload: true, isReload: true,
isClearCheck: true, isClearCheck: true,
api: carbonEmissionFactorLibrary.del, api: carbonEmissionFactorLibrary.del,
dynamicParams: { id: 'id[]' }, dynamicParams: { ids: 'id[]' },
}, },
], ],
columns: [ columns: [
@ -573,7 +573,7 @@ import { log } from 'node:console';
{ {
label: '删除', label: '删除',
name: 'userDelete', name: 'userDelete',
dynamicParams: 'id', dynamicParams: { ids: 'id[]' },
confirm: true, confirm: true,
isReload: true, isReload: true,
api: carbonEmissionFactorLibrary.del, api: carbonEmissionFactorLibrary.del,
@ -617,11 +617,27 @@ import { log } from 'node:console';
options: [ options: [
{ {
label: 'CO2', label: 'CO2',
value: 0, value: 'CO2',
}, },
{ {
label: 'CO2e', label: 'CO2e',
value: 1, value: 'CO2e',
},
{
label: 'SF6',
value:'SF6',
},
{
label: 'CH4',
value: 'CH4',
},
{
label: 'PFCs',
value: 'PFCs',
},
{
label: 'HFCs',
value: 'HFCs',
}, },
], ],
}, },

38
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts

@ -7,64 +7,70 @@ export const tableColumns = [
}, },
{ {
title: '能源种类', title: '能源种类',
dataIndex: 'money', dataIndex: 'energyType',
}, },
{ {
title: '计量单位', title: '计量单位',
className: 'column-money', className: 'unit',
dataIndex: 'money', dataIndex: 'unit',
}, },
{ {
title: '全年', title: '全年',
dataIndex: 'address', dataIndex: 'yearly',
}, },
{ {
title: '1月', title: '1月',
dataIndex: 'address', dataIndex: 'jan',
customRender: ({ text, record }) => ({
children: text,
attrs: {
style: record.janFlag === 1 ? 'color: red' : 'color: blue'
}
})
}, },
{ {
title: '2月', title: '2月',
dataIndex: 'address', dataIndex: 'feb',
}, },
{ {
title: '3月', title: '3月',
dataIndex: 'address', dataIndex: 'mar',
}, },
{ {
title: '4月', title: '4月',
dataIndex: 'address', dataIndex: 'apr',
}, },
{ {
title: '5月', title: '5月',
dataIndex: 'address', dataIndex: 'may',
}, },
{ {
title: '6月', title: '6月',
dataIndex: 'address', dataIndex: 'jun',
}, },
{ {
title: '7月', title: '7月',
dataIndex: 'address', dataIndex: 'jul',
}, },
{ {
title: '8月', title: '8月',
dataIndex: 'address', dataIndex: 'aug',
}, },
{ {
title: '9月', title: '9月',
dataIndex: 'address', dataIndex: 'sep',
}, },
{ {
title: '10月', title: '10月',
dataIndex: 'address', dataIndex: 'oct',
}, },
{ {
title: '11月', title: '11月',
dataIndex: 'address', dataIndex: 'nov',
}, },
{ {
title: '12月', title: '12月',
dataIndex: 'address', dataIndex: 'dec',
}, },
{ {
title: '操作', title: '操作',

187
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

@ -16,7 +16,7 @@
</template> </template>
</template> </template>
<template #title> <template #title>
<a-date-picker v-model:value="selectYear" picker="year" /> <a-date-picker v-model:value="selectYear" picker="year" @change="changeYearData" />
<div class="buttonGroup"> <div class="buttonGroup">
<a-button type="primary" @click="addNewData">新增</a-button> <a-button type="primary" @click="addNewData">新增</a-button>
<a-button type="primary">导入</a-button> <a-button type="primary">导入</a-button>
@ -29,9 +29,12 @@
</a-table> </a-table>
<a-pagination <a-pagination
:current="current" :current="current"
:total="total"
:page-size="pageSize" :page-size="pageSize"
:total="0" style="display: flex;justify-content: center;margin-top: 16px;"
:show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`" /> :show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" />
<!-- 新增数据库数据 --> <!-- 新增数据库数据 -->
<a-drawer <a-drawer
:width="500" :width="500"
@ -47,42 +50,80 @@
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol" :wrapper-col="wrapperCol"
> >
<a-form-item ref="name" label="能源种类" name="name"> <a-form-item ref="name" label="能源种类" name="energyType">
<a-input v-model:value="formState.name" /> <a-input v-model:value="formState.energyType" placeholder="请输入能源种类" />
</a-form-item> </a-form-item>
<a-form-item label="计量单位"> <a-form-item label="计量单位" name="unit">
<a-cascader v-model:value="value" :options="options" placeholder="Please select" /> <a-cascader v-model:value="formState.unit" :options="options" />
</a-form-item> </a-form-item>
<a-form-item label="自动采集节点"> <a-form-item label="自动采集节点" name="collectionNode">
<a-tree-select <a-tree-select
v-model:value="treeValue" v-model:value="formState.collectionNode"
style="width: 300px"
placeholder="Please select"
:tree-line="true" :tree-line="true"
:tree-data="treeData" :tree-data="treeData"
tree-node-filter-prop="title" tree-node-filter-prop="title"
> >
<template #title="{ value: val, title }">
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
<template v-else>{{ title }}</template>
</template>
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-item>
<a-form-item label="计算碳排" name="resource"> <a-form-item label="计算碳排" name="isComputeCarbon">
<a-radio-group v-model:value="formState.resource"> <a-radio-group v-model:value="formState.isComputeCarbon" @change="changeRadio">
<a-radio value="1"></a-radio> <a-radio value="0"></a-radio>
<a-radio value="2"></a-radio> <a-radio value="1"></a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="排放类型" name="region"> <a-form-item label="排放类型" name="emissionType">
<a-select v-model:value="formState.region" placeholder="请选择排放类型"> <a-select v-model:value="formState.emissionType" placeholder="请选择排放类型">
<a-select-option value="shanghai">Zone one</a-select-option> <a-select-option value="直接排放">直接排放</a-select-option>
<a-select-option value="beijing">Zone two</a-select-option> <a-select-option value="间接排放">间接排放</a-select-option>
<a-select-option value="其他">其他</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="1月" name="delivery"> <a-row>
<a-switch v-model:checked="formState.delivery" /> <a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="1月" name="janFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.janFlag" />
</a-form-item>
<a-form-item label="2月" name="febFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.febFlag" />
</a-form-item>
<a-form-item label="3月" name="marFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.marFlag" />
</a-form-item>
</a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="4月" name="aprFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.aprFlag" />
</a-form-item>
<a-form-item label="5月" name="mayFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.mayFlag" />
</a-form-item>
<a-form-item label="6月" name="junFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.junFlag" />
</a-form-item>
</a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="7月" name="julFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.julFlag" />
</a-form-item>
<a-form-item label="8月" name="augFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.augFlag" />
</a-form-item>
<a-form-item label="9月" name="sepFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.sepFlag" />
</a-form-item>
</a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="10月" name="octFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.octFlag" />
</a-form-item>
<a-form-item label="11月" name="novFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.novFlag" />
</a-form-item>
<a-form-item label="12月" name="decFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.decFlag" />
</a-form-item> </a-form-item>
</a-col>
</a-row>
</a-form> </a-form>
<template #footer> <template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> <a-button style="margin-right: 8px" @click="onClose">取消</a-button>
@ -95,46 +136,81 @@
import { ref,reactive, toRaw } from 'vue'; import { ref,reactive, toRaw } from 'vue';
import type { UnwrapRef } from 'vue'; import type { UnwrapRef } from 'vue';
import type { Rule } from 'ant-design-vue/es/form'; 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 { CascaderProps,TreeSelectProps } from 'ant-design-vue';
import type { Dayjs } from 'dayjs'; import type { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { tableColumns } from '../config'; import { tableColumns } from '../config';
import { energyConsumption } from '/@/api/carbonEmissionFactorLibrary'; import { energyConsumption } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({ 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 }) => { const fetch = (api, params = { orgId }) => {
return http.post(api, params); return http.post(api, params);
}; };
const selectYear = ref<Dayjs>(); const selectYear = ref<Dayjs>();
const current = ref<number>(1); const current = ref<number>(1);
const pageSize = ref<number>(10); const pageSize = ref<number>(10);
const total = ref<number>()
const queryParams = ref({
pageNum:current.value,
pageSize:pageSize.value,
})
const visible = ref(false); const visible = ref(false);
const value = ref<string[]>([]);
const data = ref([]); const data = ref([]);
interface FormState { interface FormState {
name: string; energyType: string;
region: string | undefined; unit: string;
delivery: boolean; collectionNode: string;
resource: 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 formRef = ref();
const labelCol = { span: 5 }; const labelCol = { span: 5 };
const wrapperCol = { span: 13 }; const wrapperCol = { span: 19 };
const switchLabelCol = { span: 10 };
const switchWrapperCol = { span: 14 };
const formState: UnwrapRef<FormState> = reactive({ const formState: UnwrapRef<FormState> = reactive({
name: '', energyType: '',
region: undefined, unit: '',
delivery: false, collectionNode: '',
resource: '', 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 // form
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
name: [ energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
{ required: true, message: '请输入能源种类', trigger: 'change' }, isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }],
], emissionType : [{ required: false, message: '请输入选择排放类型', trigger: 'change' }]
resource: [{ required: true, message: 'Please select activity resource', trigger: 'change' }],
}; };
// //
const options: CascaderProps['options'] = [ const options: CascaderProps['options'] = [
@ -172,7 +248,6 @@
}, },
]; ];
// //
const treeValue = ref<string>();
const treeData = ref<TreeSelectProps['treeData']>([ const treeData = ref<TreeSelectProps['treeData']>([
{ {
title: 'parent 1', title: 'parent 1',
@ -199,13 +274,33 @@
], ],
}, },
]); ]);
//
const changeYearData = () => {
queryParams.value.year = selectYear.value.format('YYYY')
getTableList()
}
// //
const getTableList = () => { const getTableList = () => {
fetch(energyConsumption.pageList).then((res) => { fetch(energyConsumption.pageList , queryParams.value).then((res) => {
console.log(res,'aaaaaa'); data.value = res.data.records
total.value = res.data.total
}); });
}; };
getTableList() 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 = () => { const onSubmit = () => {
formRef.value formRef.value
@ -217,9 +312,6 @@
console.log('error', error); console.log('error', error);
}); });
}; };
const resetForm = () => {
formRef.value.resetFields();
};
// //
const addNewData = () => { const addNewData = () => {
visible.value = true visible.value = true
@ -227,6 +319,7 @@
// //
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
formRef.value.resetFields();
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

Loading…
Cancel
Save