Browse Source

修改测试问题

temp
fks-xuxinyue 3 months ago
parent
commit
440b43ba42
  1. 10
      hx-ai-intelligent/src/api/index.ts
  2. 10
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  3. 642
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue
  4. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue
  5. 27
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  6. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  7. 48
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  8. 1632
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue
  9. 187
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  10. 19
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  11. 3
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue
  12. 122
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue
  13. 123
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue
  14. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue

10
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);
};

10
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" />
</a-form-item>
@ -63,10 +64,7 @@
<a-button type="primary" v-if="queryParams.accountType === 1" @click="getTotalTable(1)">
全国配额
</a-button>
<a-button
type="primary"
v-if="queryParams.accountType === 2"
@click="getTotalTable(2)">
<a-button type="primary" v-if="queryParams.accountType === 2" @click="getTotalTable(2)">
地方配额
</a-button>
<a-button type="primary" v-if="queryParams.accountType === 3" @click="getTotalTable(3)">
@ -431,7 +429,7 @@
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'carbonTradeDetails.xlsx'); //
link.setAttribute('download', '碳资产导出.xlsx'); //
document.body.appendChild(link);
link.click();
@ -701,6 +699,7 @@
.then((res) => {
message.success('操作成功!');
visible.value = false;
formState.value = {};
delIds.value = [];
// getDetailList();
mainRef.value?.nsTableRef.reload();
@ -713,6 +712,7 @@
message.success('操作成功!');
visible.value = false;
delIds.value = [];
formState.value = {};
// getDetailList();
mainRef.value?.nsTableRef.reload();
}

642
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue

@ -1,642 +0,0 @@
<template>
<div class="search">
<a-card style="border-radius: 12px">
<div class="ns-form-title">
<div class="title">查询</div>
<div class="operation">
<a-button type="primary" @click="changeParentData"> 返回 </a-button>
</div>
</div>
<a-form layout="inline">
<a-form-item>
<a-select
v-model:value="queryParams.accountType"
style="width: 200px"
placeholder="请输入账户类型">
<a-select-option :value="1">全国账户</a-select-option>
<a-select-option :value="2">地方账户</a-select-option>
<a-select-option :value="3">CCER</a-select-option>
</a-select>
</a-form-item>
<a-form-item>
<a-cascader
v-model:value="queryParams.transactionType"
multiple
style="width: 200px"
:options="options"
placeholder="请选择交易类型"
suffix-icon="Shopping Around">
<template #tagRender="data">
<a-tag :key="data.value" color="blue">{{ data.label }}</a-tag>
</template>
</a-cascader>
</a-form-item>
<a-form-item>
<a-date-picker
style="width: 200px"
v-model:value="queryParams.year"
placeholder="请选择账期"
picker="year"
valueFormat="YYYY" />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="searchTableList">查询</a-button>
<a-button html-type="submit" style="margin-left: 6px" @click="reset">重置</a-button>
</a-form-item>
</a-form>
</a-card>
</div>
<div style="display: flex; margin-top: 20px; height: calc(84% - 20px)">
<div class="detailTable">
<div class="ns-form-title">
<div class="title">交易明细</div>
<div class="operation" style="display: flex">
<a-button type="primary" @click="addDetail">新增</a-button>
<a-upload
v-model:file-list="importFileList"
name="file"
accept=".xlsx"
:showUploadList="false"
:custom-request="importFile">
<a-button type="primary" style="margin-left: 6px">导入</a-button>
</a-upload>
<a-button type="primary" style="margin-left: 6px" @click="exportFile">导出</a-button>
<a-button
type="primary"
style="margin-left: 6px"
:disabled="selectedRowKeys.length === 0"
@click="deleteMore"
>批量删除</a-button
>
</div>
</div>
<a-table
:columns="columns"
:data-source="data"
rowKey="id"
@change="onChange"
:rowSelection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectionChange,
}"
:scroll="{ x: 1500, y: 400 }"
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'accountType'">
<span v-if="record.accountType">{{ record.accountType.label }}</span>
</template>
<template v-if="column.key === 'action'">
<span>
<a @click="editData(record)">编辑</a>
<a-divider type="vertical" />
<a @click="delData(record)">删除</a>
</span>
</template>
</template>
</a-table>
<a-pagination
:current="queryParams.pageNum"
:total="total"
:page-size="queryParams.pageSize"
style="display: flex; justify-content: center; margin-top: 16px"
:show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" />
</div>
<div class="total">
<div class="ns-form-title">
<div class="title">配额统计</div>
<div class="operation" style="display: flex; justify-content: space-around; width: 63%">
<a-button type="primary" @click="getTotalTable(1)">全国配额</a-button>
<a-button type="primary" @click="getTotalTable(2)">地方配额</a-button>
<a-button type="primary" @click="getTotalTable(3)">CCER配额</a-button>
</div>
</div>
<a-table :columns="totalColumns" :data-source="totalData" bordered :pagination="false">
<template #bodyCell="{ column, text }">
<template v-if="column.dataIndex === 'name'">
<a>{{ text }}</a>
</template>
</template>
</a-table>
</div>
</div>
<!-- 新增报告弹窗 -->
<a-drawer
:width="500"
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<div class="ns-form-title" style="display: flex">
<div class="title">{{ text }}</div>
</div>
<a-form
ref="formRef"
:model="formState"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol">
<a-form-item ref="name" label="账户类型" name="accountType">
<a-select v-model:value="formState.accountType" placeholder="请输入账户类型">
<a-select-option value="1">全国账户</a-select-option>
<a-select-option value="2">地方账户</a-select-option>
<a-select-option value="3">CCER</a-select-option>
</a-select>
</a-form-item>
<a-form-item ref="name" label="交易类型" name="transactionType">
<a-cascader
v-model:value="formState.transactionType"
:options="options"
placeholder="请选择交易类型" />
</a-form-item>
<a-form-item ref="name" label="交易日期" name="transactionDate">
<a-date-picker v-model:value="formState.transactionDate" valueFormat="YYYY-MM-DD" />
</a-form-item>
<a-form-item ref="name" label="交易数量" name="transactionQuantity">
<a-input v-model:value="formState.transactionQuantity" placeholder="请输入交易数量" />
</a-form-item>
<a-form-item ref="name" label="发生金额" name="amountIncurred">
<a-input v-model:value="formState.amountIncurred" placeholder="请输入发生金额" />
</a-form-item>
<a-form-item ref="name" label="交易对象" name="tradingPartner">
<a-input v-model:value="formState.tradingPartner" placeholder="请输入交易对象" />
</a-form-item>
<a-form-item ref="name" label="交易凭证">
<a-upload
:file-list="fileList"
name="file"
accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf"
@remove="handleFileRemove"
:before-upload="beforeUpload"
@change="handleChange">
<a-button>
<upload-outlined></upload-outlined>
上传
</a-button>
</a-upload>
</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>
</template>
<script lang="ts" setup>
import { ref, defineEmits, toRaw } from 'vue';
import { http } from '/nerv-lib/util/http';
import { UploadOutlined } from '@ant-design/icons-vue';
import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
import { Pagination, Modal, message } from 'ant-design-vue';
import {
carbonAssets,
carbonEmissionFactorLibrary,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary';
import { log } from 'console';
defineOptions({
energyType: 'carbonAssets', // name
components: {
'a-pagination': Pagination,
},
});
// id
const props = defineProps({
parentId: {
type: Number,
},
});
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId }, config) => {
return http.post(api, params, config);
};
//
const selectedRowKeys = ref([]);
const onSelectionChange = (selectedKeys, selectedRows) => {
selectedRowKeys.value = selectedKeys;
};
const total = ref<number>();
const thisYear = ref(new Date().getFullYear().toString());
const queryParams = ref({
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
accountType: props.parentId,
year: thisYear.value,
});
const searchTableList = () => {
getDetailList();
};
//
const getDetailList = () => {
fetch(carbonAssets.carbonDetailsList, queryParams.value).then((res) => {
data.value = res.data.records;
total.value = res.data.total;
});
};
getDetailList();
const columns = [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '资产类别',
dataIndex: 'accountType',
},
{
title: '交易方式',
dataIndex: 'transactionTypeName',
},
{
title: '交易日期',
dataIndex: 'transactionDate',
sorter: (a, b) => a.transactionDate - b.transactionDate,
},
{
title: '本期收入(tCO2)',
dataIndex: 'income',
sorter: (a, b) => a.income - b.income,
},
{
title: '本期支出(tCO2)',
dataIndex: 'expenditure',
sorter: (a, b) => a.expenditure - b.expenditure,
},
{
title: '发生金额(¥)',
dataIndex: 'amountIncurredValue',
},
{
title: '交易对象',
dataIndex: 'tradingPartner',
},
{
title: '更新人',
dataIndex: 'updateUser',
},
{
title: '更新时间',
dataIndex: 'updateTime',
},
{
title: '操作',
key: 'action',
width: 130,
},
];
const data = ref([]);
const reset = () => {
queryParams.value = {
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
year: new Date().getFullYear(),
};
getDetailList();
};
const editData = (record) => {
getDictList();
text.value = '编辑';
visible.value = true;
formState.value.id = record.id;
fetch(uploadPic.select, { bizId: record.id, bizType: 1 }).then((res) => {
fileList.value = res.data.map((item) => ({
uid: item.id.toString(), // 使id
name: item.fileName, //
status: 'done', //
type: 'done',
url: item.filePath, // URLURL
}));
});
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);
formState.value.transactionType = selectDevice;
formState.value.transactionType = formState.value.transactionType;
}, 500);
};
// id
function findParentIds(tree: any, targetId: number, result: any) {
for (let item of tree) {
if (item.children && item.children.length > 0) {
if (item.children.some((child: any) => child.value === targetId)) {
result.unshift(item.value); // id
findParentIds(tree, item.value, result); // id
break; // 退
}
}
}
}
const delData = (record) => {
const id = [record.id];
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(carbonAssets.delete, { ids: id }).then((res) => {
message.success('操作成功!');
getDetailList();
});
},
onCancel() {
console.log('Cancel');
},
});
};
const deleteMore = () => {
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(carbonAssets.delete, { ids: selectedRowKeys.value }).then((res) => {
message.success('操作成功!');
getDetailList();
});
},
onCancel() {
console.log('Cancel');
},
});
};
//
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
getDetailList();
};
//
const visible = ref(false);
const text = ref('新增');
const formState = ref({
orgId: orgId.value,
});
const formRef = ref();
const labelCol = { span: 5 };
const wrapperCol = { span: 19 };
const options = ref([]);
//
const getDictList = () => {
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'TRANSACTION_TYPE' }).then(
(res) => {
options.value = res.data;
options.value = options.value.map((item) => ({
value: item.id,
label: item.cnValue,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.cnValue,
}))
: [],
}));
},
);
};
getDictList();
//
const addDetail = () => {
text.value = '新增';
visible.value = true;
getDictList();
};
const importFileList = ref<UploadProps['fileList']>([]);
const importFile = (options: UploadRequestOption) => {
const { file, onSuccess, onError } = options;
const formData = ref(new FormData());
formData.value.append('file', file as any);
formData.value.append('orgId', orgId.value);
formData.value.append('year', queryParams.value.year);
fetch(carbonAssets.import, formData.value)
.then((res) => {
message.success('操作成功!');
getDetailList();
})
.catch((error) => {
console.log('error', error);
});
};
const exportFile = () => {
const exportQuery = ref({
orgId: orgId.value,
pageNum: 1,
pageSize: 999,
year: queryParams.value.year,
ids: selectedRowKeys.value,
});
const config = {
responseType: 'blob',
};
fetch(carbonAssets.export, exportQuery.value, config)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res]));
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'carbonTradeDetails.xlsx'); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
selectedRowKeys.value = [];
})
.catch((error) => {
console.error('下载失败:', error);
});
};
//
const fileList = ref<UploadProps['fileList']>([]);
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
return false;
};
const handleChange = (info: UploadChangeParam) => {
fileList.value = [...info.fileList];
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(`${info.file.name} 文件上传成功`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`);
}
};
const delIds = ref([]);
const handleFileRemove = (file) => {
delIds.value.push(file.uid);
const newFileList = [];
fileList.value.forEach((item) => {
if (item.uid !== file.uid) {
newFileList.push(item);
}
});
fileList.value = newFileList;
};
const onSubmit = () => {
formRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
if (formState.value.transactionType) {
formState.value.transactionType = formState.value.transactionType.join(',').split(',')[1];
}
if (formState.value.accountType.value) {
formState.value.accountType = formState.value.accountType.value;
}
fetch(carbonAssets.createOrUpdate, formState.value).then((res) => {
if (res.data.id && fileList.value.length !== 0) {
// uploadQuery.value.bizId = res.data.id;
const formData = ref(new FormData());
fileList.value.forEach((file) => {
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj);
}
});
formData.value.append('bizType', 1);
formData.value.append('bizId', res.data.id);
delIds.value.forEach((item) => {
formData.value.append('deleteList', item);
});
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
getDetailList();
getTotalTable();
})
.catch((error) => {
console.log('error', error);
});
} else {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
getDetailList();
}
});
})
.catch((error) => {
console.log('error', error);
});
};
// form
const rules: Record<string, Rule[]> = {
accountType: [{ required: true, message: '请输入账户类型', trigger: 'change' }],
transactionType: [{ required: true, message: '请选择交易类型', trigger: 'change' }],
transactionDate: [{ required: true, message: '请选择交易日期', trigger: 'change' }],
transactionQuantity: [{ required: true, message: '请输入交易数量', trigger: 'change' }],
amountIncurred: [{ required: true, message: '请输入发生金额', trigger: 'change' }],
tradingPartner: [{ required: true, message: '请输入交易对象', trigger: 'change' }],
};
//
const onClose = () => {
visible.value = false;
delIds.value = [];
formState.value = {};
fileList.value = [];
formRef.value.resetFields();
};
//
const getTotalTable = (type) => {
if (type) {
queryParams.value.accountType = type;
}
fetch(carbonAssets.quotaStatistics, queryParams.value).then((res) => {
totalData.value = res.data;
});
};
getTotalTable();
const totalColumns = [
{
title: '统计类型',
dataIndex: 'statisticType',
},
{
title: '小计',
dataIndex: 'subtotal',
},
{
title: '合计',
dataIndex: 'amountTo',
},
];
const totalData = ref([]);
//
const emit = defineEmits(['change-data']);
const changeParentData = () => {
emit('change-data', true);
};
</script>
<style lang="less" scoped>
.ns-form-title {
font-weight: bold;
user-select: text;
padding-bottom: 10px;
display: flex;
justify-content: space-between;
}
.title {
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778ff;
}
:deep(.ant-card-body) {
padding: 16px;
}
.search {
height: 16%;
}
.detailTable {
width: 65%;
margin-right: 20px;
height: 100%;
background: white;
border-radius: 12px;
padding: 16px;
}
.total {
width: calc(35% - 20px);
height: 100%;
background: white;
border-radius: 12px;
padding: 16px;
}
</style>

2
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue

@ -129,7 +129,7 @@
</div>
<div class="title">
<img width="24" height="24" src="../../../../src/icon/carbonAssetsTitle-3.svg" />
<span>全国碳账户余额</span>
<span>CCER账户余额</span>
</div>
<div class="bottom">
<div class="calculation BLCard">

27
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 @@
// <a>
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;

2
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',

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

@ -57,7 +57,7 @@
<a-radio :value="1"></a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排放类型" name="emissionType" :required="isRequired">
<a-form-item label="排放类型" name="emissionType" :required="isRequired" v-if="isRequired">
<a-select
v-model:value="formState.emissionType"
placeholder="请选择排放类型"
@ -330,7 +330,7 @@
// <a>
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];
}

1632
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue

File diff suppressed because it is too large

187
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue

@ -308,80 +308,82 @@
<div class="ns-form-title-edit">
<div class="title">编辑</div>
</div>
<a-form
ref="editFormRef"
:model="editFormState"
:label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="数据来源" name="dataSources">
<a-select
ref="select"
v-model:value="editFormState.dataSources"
@change="changeSelect">
<a-select-option value="1">自行推估</a-select-option>
<a-select-option value="2">定期量测</a-select-option>
<a-select-option value="3">自动测量</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="消耗量" name="consumption">
<ns-input-number
v-model:value="editFormState.consumption"
:maxlength="20"
@keydown="handleKeyDown"
:disabled="canEdit" />
</a-form-item>
</a-col>
</a-row>
<a-row v-if="automatic">
<a-col :span="24">
<a-form-item label="能耗类型">
<a-select
v-model:value="editFormState.energyConsumptionType"
@change="changeEnergyType"
placeholder="请选择能耗类型">
<a-select-option
v-for="(item, index) in energyTypeOptions"
:key="index"
:value="item.dicKey">
{{ item.cnValue }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="采集节点" name="collectionNode">
<a-tree-select
v-model:value="editFormState.collectionNode"
:tree-line="true"
@select="selectNode"
:tree-data="collectingNodes">
</a-tree-select>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="因子值" name="emissionFactors">
<ns-input
v-model:value="editFormState.emissionFactors"
:maxlength="20"
@keydown="handleKeyDown" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="关键字" name="key">
<a-input-search
v-model:value="editFormState.key"
@search="searchKey"
placeholder="请输入关键字" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<a-spin :spinning="spinning">
<a-form
ref="editFormRef"
:model="editFormState"
:label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="数据来源" name="dataSources">
<a-select
ref="select"
v-model:value="editFormState.dataSources"
@change="changeSelect">
<a-select-option value="1">自行推估</a-select-option>
<a-select-option value="2">定期量测</a-select-option>
<a-select-option value="3">自动测量</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="消耗量" name="consumption">
<ns-input-number
v-model:value="editFormState.consumption"
:maxlength="20"
@keydown="handleKeyDown"
:disabled="canEdit" />
</a-form-item>
</a-col>
</a-row>
<a-row v-if="automatic">
<a-col :span="24">
<a-form-item label="能耗类型">
<a-select
v-model:value="editFormState.energyConsumptionType"
@change="changeEnergyType"
placeholder="请选择能耗类型">
<a-select-option
v-for="(item, index) in energyTypeOptions"
:key="index"
:value="item.dicKey">
{{ item.cnValue }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="采集节点" name="collectionNode">
<a-tree-select
v-model:value="editFormState.collectionNode"
:tree-line="true"
@select="selectNode"
:tree-data="collectingNodes">
</a-tree-select>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="因子值" name="emissionFactors">
<ns-input
v-model:value="editFormState.emissionFactors"
:maxlength="20"
@keydown="handleKeyDown" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="关键字" name="key">
<a-input-search
v-model:value="editFormState.key"
@search="searchKey"
placeholder="请输入关键字" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
<div class="ns-form-title-edit" style="display: flex">
<div class="titleEdit">因子列表</div>
</div>
@ -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;
}
</style>

19
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue

@ -39,7 +39,11 @@
placeholder="请输入报告名称" />
</a-form-item>
<a-form-item ref="name" label="报告年度" name="reportYear">
<a-date-picker v-model:value="formState.reportYear" picker="year" valueFormat="YYYY" />
<a-date-picker
v-model:value="formState.reportYear"
@openChange="openChange"
picker="year"
valueFormat="YYYY" />
</a-form-item>
<a-form-item ref="name" label="适用标准" name="genericStandard">
<a-input
@ -60,6 +64,7 @@
<a-form-item ref="name" label="报告范围" name="reportScope">
<a-range-picker
v-model:value="formState.reportScope"
:defaultPickerValue="defaultPickerValue"
picker="month"
:disabledDate="disabledDate"
valueFormat="YYYY-MM" />
@ -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<string, Rule[]> = {
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],

3
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;

122
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue

@ -96,28 +96,32 @@
</span>
</template>
</template>
<!-- <template #summary>
<template #summary>
<a-table-summary-row>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell>合计</a-table-summary-cell>
<a-table-summary-cell :colSpan="2">合计</a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text type="danger">{{ 111 }}</a-typography-text>
<a-typography-text>{{ totalLastYearActualUsage + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ 222 }}</a-typography-text>
<a-typography-text>{{ totalActualUsage + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ 222 }}</a-typography-text>
<a-typography-text>{{ totalReferenceValue + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>-</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>-</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ 222 }}</a-typography-text>
<a-typography-text>{{ totalBudget + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
</a-table-summary-row>
</template> -->
</template>
</a-table>
</a-card>
</div>
@ -135,16 +139,16 @@
v-model:value="formState.conversionRate"
:maxlength="15"
@keydown="handleKeyDown"
suffix="%"
:disabled="disabled" />
<span class="unit">%</span>
</a-form-item>
<a-form-item label="预算值" :required="true">
<a-input-number
v-model:value="formState.budget"
:maxlength="15"
@keydown="handleKeyDown"
suffix="kWh"
:disabled="!disabled" />
<span class="unit">kWh</span>
</a-form-item>
</a-form>
</a-modal>
@ -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;
}
</style>
<style scoped>
.editable-row-operations a {

123
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue

@ -69,7 +69,8 @@
:parentId="parentId"
:year="year"
:type="type"
:nodeName="nodeName" />
:nodeName="nodeName"
:resourceType="resourceType" />
</div>
<!-- 新增节点 -->
<a-drawer :visible="visible" :width="500" @close="onClose" :footer-style="{ textAlign: 'right' }">
@ -111,6 +112,7 @@
import categoryDeatil from './categoryDeatil.vue';
import { group } from '/@/api/deviceManage';
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
import { getEnumEnergy } from '/@/api';
import type { TreeProps } from 'ant-design-vue';
import 'echarts-liquidfill';
defineOptions({
@ -125,8 +127,6 @@
type: String,
},
});
console.log(props, 'xxy');
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
@ -306,8 +306,8 @@
symbolSize: [14, 4],
symbolMargin: 0.5,
symbolPosition: 'start',
z: -20,
data: actualUsage.value,
barGap: '5%',
label: {
normal: {
show: false,
@ -327,8 +327,8 @@
symbolSize: [14, 4],
symbolMargin: 0.5,
symbolPosition: 'start',
z: -20,
data: budget.value,
barGap: '5%',
label: {
normal: {
show: false,
@ -346,7 +346,8 @@
color: '#f4664a',
width: 2,
},
data: referenceValue.value,
// data: referenceValue.value,
data: [600],
},
],
};
@ -393,7 +394,7 @@
textStyle: {
color: !selectedTime.value ? 'rgba(68, 197, 253,1)' : 'rgba(12, 168, 126, 1)',
insideColor: '#12786f',
fontSize: 40,
fontSize: Number(ballData) > 1000 ? 20 : 40,
},
formatter: (params) => {
// return `${(params.value * 100).toFixed(2)}%`;
@ -438,7 +439,7 @@
const selectedKeys = ref<string[]>([]);
const treeCheckedKeys = ref<string[]>([]);
const checkTreeNode = (checkedKeys, info) => {
treeCheckedKeys.value = checkedKeys;
treeCheckedKeys.value = checkedKeys.checked;
addTreeNode.value.itemizeIds = treeCheckedKeys.value;
};
const formatTreeData = (treeData) => {
@ -457,7 +458,9 @@
year: selectYearValue.value.format('YYYY'),
});
const onSubmit = () => {
fetch(carbonPlanning.addNodes, addTreeNode.value).then((res) => {
fetch(carbonPlanning.addNodes, addTreeNode.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.energyType } });
unit.value = resUnit.data.unit;
data.value = res.data;
visible.value = false;
changeToYear();
@ -466,49 +469,6 @@
const onClose = () => {
visible.value = false;
};
//
const columns = ref([
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '分项名称',
dataIndex: 'itemizeName',
},
{
title: '年份',
dataIndex: 'year',
},
{
title: '实际用量',
dataIndex: 'actualUsage',
},
{
title: '预算量',
dataIndex: 'budget',
},
{
title: '基准值',
dataIndex: 'referenceValue',
},
{
title: '节能量',
dataIndex: 'energyConservation',
},
{
title: '预算达成率',
dataIndex: 'budgetAchievement',
},
{
title: '操作',
key: 'action',
},
]);
const data = ref([]);
//
const yearQueryParams = ref({
orgId: orgId.value,
@ -522,9 +482,13 @@
addTreeNode.value.year = selectYearValue.value;
getYearData();
};
//
const unit = ref();
const getYearData = () => {
treeCheckedKeys.value = [];
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then((res) => {
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.energyType } });
unit.value = resUnit.data.unit;
data.value = res.data;
res.data.forEach((item) => {
treeCheckedKeys.value.push(item.itemizeId.toString());
@ -548,7 +512,9 @@
getMonthData();
};
const getMonthData = () => {
fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then((res) => {
fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.energyType } });
unit.value = resUnit.data.unit;
data.value = res.data;
getMonthPillarData();
});
@ -561,12 +527,61 @@
const year = ref(selectYearValue.value.format('YYYY'));
const type = ref();
const nodeName = ref();
const resourceType = ref();
const detailData = (record) => {
electricTotal.value = false;
parentId.value = record.itemizeId;
type.value = props.tabId;
nodeName.value = record.itemizeName;
resourceType.value = props.energyType;
};
//
const columns = ref([
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '分项名称',
dataIndex: 'itemizeName',
},
{
title: '年份',
dataIndex: 'year',
},
{
title: '实际用量',
dataIndex: 'actualUsage',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '预算量',
dataIndex: 'budget',
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: '节能量',
dataIndex: 'energyConservation',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '预算达成率',
dataIndex: 'budgetAchievement',
},
{
title: '操作',
key: 'action',
},
]);
const data = ref([]);
const customRow = (record) => {
return {
//

2
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue

@ -70,7 +70,7 @@
});
} else if (key === '4') {
tabId.value = 6;
energyType.value = 'gongshuiliang';
energyType.value = 'GAS_USAGE';
nextTick(() => {
if (provideWaterRef.value) {
provideWaterRef.value.electricTotal = true;

Loading…
Cancel
Save