taskId:083 remark:"commit"
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
// 碳排因子库接口
|
||||||
export enum carbonEmissionFactorLibrary {
|
export enum carbonEmissionFactorLibrary {
|
||||||
getTableList = '/carbon-smart/api/carbon/emission/factor/queryCarbonFactorPage',
|
getTableList = '/carbon-smart/api/carbon/emission/factor/queryCarbonFactorPage',
|
||||||
creatOrUpdate = '/carbon-smart/api/carbon/emission/factor/creatOrUpdate',
|
creatOrUpdate = '/carbon-smart/api/carbon/emission/factor/creatOrUpdate',
|
||||||
@@ -8,3 +9,7 @@ export enum carbonEmissionFactorLibrary {
|
|||||||
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
|
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
|
||||||
delTreeNode = '/carbon-smart/api/carbon/emission/type/del',
|
delTreeNode = '/carbon-smart/api/carbon/emission/type/del',
|
||||||
}
|
}
|
||||||
|
// 碳排管理-碳排统计接口
|
||||||
|
export enum energyConsumption {
|
||||||
|
pageList = '/carbon-smart/api/carbon/stats/pageList',
|
||||||
|
}
|
@@ -83,24 +83,39 @@ export const formConfig = (disabled) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// field: 'emissionProcess',
|
||||||
|
// label: '排放环节',
|
||||||
|
// component: 'NsSelectApi',
|
||||||
|
// componentProps: {
|
||||||
|
// api: carbonEmissionFactorLibrary.getEmissionProcess,
|
||||||
|
// params: {
|
||||||
|
// emissionType: sessionStorage.getItem('checkedTreeNode'),
|
||||||
|
// },
|
||||||
|
// resultField: 'data',
|
||||||
|
// labelField: 'emissionProcess',
|
||||||
|
// valueField: 'emissionProcess',
|
||||||
|
// immediate: true,
|
||||||
|
// autoSelectFirst: false,
|
||||||
|
// filterOption:false,
|
||||||
|
// showSearch:true,
|
||||||
|
// autoClearSearchValue:false
|
||||||
|
// },
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
field: 'emissionProcess',
|
|
||||||
label: '排放环节',
|
label: '排放环节',
|
||||||
component: 'NsSelectApi',
|
field: 'emissionProcess',
|
||||||
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: carbonEmissionFactorLibrary.getEmissionProcess,
|
placeholder: '请输入排放环节',
|
||||||
params: {
|
maxLength: 20,
|
||||||
emissionType: sessionStorage.getItem('checkedTreeNode'),
|
|
||||||
},
|
|
||||||
resultField: 'data',
|
|
||||||
labelField: 'emissionProcess',
|
|
||||||
valueField: 'emissionProcess',
|
|
||||||
immediate: true,
|
|
||||||
autoSelectFirst: false,
|
|
||||||
filterOption:false,
|
|
||||||
showSearch:true,
|
|
||||||
autoClearSearchValue:false
|
|
||||||
},
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入排放环节',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '排放因子',
|
label: '排放因子',
|
||||||
|
@@ -306,6 +306,7 @@ import { log } from 'node:console';
|
|||||||
}
|
}
|
||||||
// 点击新增树节点
|
// 点击新增树节点
|
||||||
const addTreeNodeData = () => {
|
const addTreeNodeData = () => {
|
||||||
|
operationTree.value='新增'
|
||||||
treeNodeAdd.value = true;
|
treeNodeAdd.value = true;
|
||||||
editTreeNode.value.type = 'create'
|
editTreeNode.value.type = 'create'
|
||||||
};
|
};
|
||||||
@@ -389,6 +390,7 @@ import { log } from 'node:console';
|
|||||||
level:info.selectedNodes[0].level,
|
level:info.selectedNodes[0].level,
|
||||||
dataNumber:info.selectedNodes[0].dataNumber,
|
dataNumber:info.selectedNodes[0].dataNumber,
|
||||||
sortNumber:info.selectedNodes[0].sortNumber,
|
sortNumber:info.selectedNodes[0].sortNumber,
|
||||||
|
parentEmissionId:info.selectedNodes[0].parentEmissionId,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,111 +1,74 @@
|
|||||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
export const tableColumns = [
|
||||||
import data from './mock.json';
|
{
|
||||||
export const tableConfig = {
|
title: '序号',
|
||||||
title: '设备台账',
|
customRender: (text: any) => {
|
||||||
// api: '/carbon_emission/device/getDeviceList',
|
return text.index + 1;
|
||||||
value: data.dataSource,
|
},
|
||||||
params: {
|
|
||||||
page: 0,
|
|
||||||
pageSize: 10,
|
|
||||||
},
|
},
|
||||||
rowSelection: null,
|
{
|
||||||
columns: [
|
title: '能源种类',
|
||||||
{
|
dataIndex: 'money',
|
||||||
title: '序号',
|
|
||||||
customRender: (text: any) => {
|
|
||||||
return text.index + 1;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '能源种类',
|
|
||||||
dataIndex: 'id',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '计量单位',
|
|
||||||
dataIndex: 'deviceCode',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '全年',
|
|
||||||
dataIndex: 'deviceName',
|
|
||||||
textNumber: 8,
|
|
||||||
textEllipsis: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备一级区域',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备二级区域',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备详细位置',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备规格',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备厂商纳税人识别号',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '厂商联系人',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备描述',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'IP地址',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '生产日期',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '采购日期',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '启用日期',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备成本(元)',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '使用期限',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '额定功率',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '特殊参数',
|
|
||||||
dataIndex: 'position',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
formConfig: {
|
|
||||||
schemas: [
|
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
label: '生产日期',
|
|
||||||
component: 'NsRangePicker',
|
|
||||||
fieldMap: ['queryStartDate', 'queryEndDate'],
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
params: {},
|
|
||||||
},
|
},
|
||||||
// pagination: { pageSizeOptions: false },
|
{
|
||||||
rowKey: 'uuid',
|
title: '计量单位',
|
||||||
};
|
className: 'column-money',
|
||||||
|
dataIndex: 'money',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '全年',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '1月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '2月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '3月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '4月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '5月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '6月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '7月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '8月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '9月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '10月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '11月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '12月',
|
||||||
|
dataIndex: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 130
|
||||||
|
},
|
||||||
|
];
|
@@ -0,0 +1,251 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-table
|
||||||
|
:columns="tableColumns"
|
||||||
|
:data-source="data"
|
||||||
|
bordered
|
||||||
|
:pagination="false"
|
||||||
|
:scroll="{ x: 2000 }">
|
||||||
|
<template #bodyCell="{ column, text }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<span>
|
||||||
|
<a>编辑</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a>删除</a>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template #title>
|
||||||
|
<a-date-picker v-model:value="selectYear" picker="year" />
|
||||||
|
<div class="buttonGroup">
|
||||||
|
<a-button type="primary" @click="addNewData">新增</a-button>
|
||||||
|
<a-button type="primary">导入</a-button>
|
||||||
|
<a-button type="primary">导出</a-button>
|
||||||
|
<a-button type="primary">模板下载</a-button>
|
||||||
|
<a-button type="primary">上传凭证</a-button>
|
||||||
|
<a-button type="primary">凭证下载</a-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
<a-pagination
|
||||||
|
:current="current"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="0"
|
||||||
|
:show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`" />
|
||||||
|
<!-- 新增数据库数据 -->
|
||||||
|
<a-drawer
|
||||||
|
:width="500"
|
||||||
|
:visible="visible"
|
||||||
|
:body-style="{ paddingBottom: '80px' }"
|
||||||
|
:footer-style="{ textAlign: 'right' }"
|
||||||
|
destroyOnClose
|
||||||
|
@close="onClose">
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formState"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="labelCol"
|
||||||
|
:wrapper-col="wrapperCol"
|
||||||
|
>
|
||||||
|
<a-form-item ref="name" label="能源种类" name="name">
|
||||||
|
<a-input v-model:value="formState.name" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="计量单位">
|
||||||
|
<a-cascader v-model:value="value" :options="options" placeholder="Please select" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="自动采集节点">
|
||||||
|
<a-tree-select
|
||||||
|
v-model:value="treeValue"
|
||||||
|
style="width: 300px"
|
||||||
|
placeholder="Please select"
|
||||||
|
:tree-line="true"
|
||||||
|
:tree-data="treeData"
|
||||||
|
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-form-item>
|
||||||
|
<a-form-item label="计算碳排" name="resource">
|
||||||
|
<a-radio-group v-model:value="formState.resource">
|
||||||
|
<a-radio value="1">是</a-radio>
|
||||||
|
<a-radio value="2">否</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="排放类型" name="region">
|
||||||
|
<a-select v-model:value="formState.region" placeholder="请选择排放类型">
|
||||||
|
<a-select-option value="shanghai">Zone one</a-select-option>
|
||||||
|
<a-select-option value="beijing">Zone two</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="1月" name="delivery">
|
||||||
|
<a-switch v-model:checked="formState.delivery" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
<template #footer>
|
||||||
|
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
||||||
|
<a-button type="primary" @click="onSubmit">确定</a-button>
|
||||||
|
</template>
|
||||||
|
</a-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref,reactive, toRaw } from 'vue';
|
||||||
|
import type { UnwrapRef } from 'vue';
|
||||||
|
import type { Rule } from 'ant-design-vue/es/form';
|
||||||
|
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一致缓存才可生效
|
||||||
|
});
|
||||||
|
|
||||||
|
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
||||||
|
const fetch = (api, params = { orgId }) => {
|
||||||
|
return http.post(api, params);
|
||||||
|
};
|
||||||
|
const selectYear = ref<Dayjs>();
|
||||||
|
const current = ref<number>(1);
|
||||||
|
const pageSize = ref<number>(10);
|
||||||
|
const visible = ref(false);
|
||||||
|
const value = ref<string[]>([]);
|
||||||
|
const data = ref([]);
|
||||||
|
interface FormState {
|
||||||
|
name: string;
|
||||||
|
region: string | undefined;
|
||||||
|
delivery: boolean;
|
||||||
|
resource: string;
|
||||||
|
}
|
||||||
|
const formRef = ref();
|
||||||
|
const labelCol = { span: 5 };
|
||||||
|
const wrapperCol = { span: 13 };
|
||||||
|
const formState: UnwrapRef<FormState> = reactive({
|
||||||
|
name: '',
|
||||||
|
region: undefined,
|
||||||
|
delivery: false,
|
||||||
|
resource: '',
|
||||||
|
});
|
||||||
|
// 定义form表单的必填
|
||||||
|
const rules: Record<string, Rule[]> = {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入能源种类', trigger: 'change' },
|
||||||
|
],
|
||||||
|
resource: [{ required: true, message: 'Please select activity resource', trigger: 'change' }],
|
||||||
|
};
|
||||||
|
// 定义计量单位级联选择的变量
|
||||||
|
const options: CascaderProps['options'] = [
|
||||||
|
{
|
||||||
|
value: 'zhejiang',
|
||||||
|
label: 'Zhejiang',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'hangzhou',
|
||||||
|
label: 'Hangzhou',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'xihu',
|
||||||
|
label: 'West Lake',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'jiangsu',
|
||||||
|
label: 'Jiangsu',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'nanjing',
|
||||||
|
label: 'Nanjing',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'zhonghuamen',
|
||||||
|
label: 'Zhong Hua Men',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
// 定义自动采集节点数的变量
|
||||||
|
const treeValue = ref<string>();
|
||||||
|
const treeData = ref<TreeSelectProps['treeData']>([
|
||||||
|
{
|
||||||
|
title: 'parent 1',
|
||||||
|
value: 'parent 1',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: 'parent 1-0',
|
||||||
|
value: 'parent 1-0',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: 'my leaf',
|
||||||
|
value: 'leaf1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'your leaf',
|
||||||
|
value: 'leaf2',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'parent 1-1',
|
||||||
|
value: 'parent 1-1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
// 获取表格数据
|
||||||
|
const getTableList = () => {
|
||||||
|
fetch(energyConsumption.pageList).then((res) => {
|
||||||
|
console.log(res,'aaaaaa');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
getTableList()
|
||||||
|
// 点击确定提交
|
||||||
|
const onSubmit = () => {
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
console.log('values', formState, toRaw(formState));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log('error', error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const resetForm = () => {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
};
|
||||||
|
// 点击新增按钮
|
||||||
|
const addNewData = () => {
|
||||||
|
visible.value = true
|
||||||
|
}
|
||||||
|
// 关闭新增抽屉
|
||||||
|
const onClose = () => {
|
||||||
|
visible.value = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped lang="less">
|
||||||
|
::v-deep .ant-table-title{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
::v-deep .ant-table-container{
|
||||||
|
padding: 0px 16px;
|
||||||
|
}
|
||||||
|
.buttonGroup{
|
||||||
|
margin-left: 1vw;
|
||||||
|
width: 30vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped>
|
||||||
|
th.column-money,
|
||||||
|
td.column-money {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
</style>
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-tabs v-model:activeKey="activeKey">
|
<a-tabs v-model:activeKey="activeKey">
|
||||||
<a-tab-pane key="1" tab="能耗统计">
|
<a-tab-pane key="1" tab="能耗统计">
|
||||||
<ns-view-list-table v-bind="tableConfig" />
|
<energyConsumption ref="energyConsumptionRef" />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="2" tab="碳排统计" force-render>Content of Tab Pane 2</a-tab-pane>
|
<a-tab-pane key="2" tab="碳排统计" force-render>Content of Tab Pane 2</a-tab-pane>
|
||||||
<a-tab-pane key="3" tab="碳排速算">Content of Tab Pane 3</a-tab-pane>
|
<a-tab-pane key="3" tab="碳排速算">Content of Tab Pane 3</a-tab-pane>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { tableConfig } from './config';
|
import energyConsumption from './energyConsumption/index.vue';
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'CarbonEmissionStatisticsIndex', // 与页面路由name一致缓存才可生效
|
name: 'CarbonEmissionStatisticsIndex', // 与页面路由name一致缓存才可生效
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user