zhaohy 3 months ago
parent
commit
fb38527edf
  1. BIN
      hx-ai-intelligent/public/asset/file/emissionSource.xlsx
  2. 1
      hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
  3. 4
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  4. 952
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index copy.vue
  5. 189
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  6. 15
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  7. 1555
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue
  8. 185
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  9. 14
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue
  10. 37
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue
  11. 4
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue

BIN
hx-ai-intelligent/public/asset/file/emissionSource.xlsx

Binary file not shown.

1
hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts

@ -26,6 +26,7 @@ export enum energyConsumption {
update = '/carbon-smart/api/carbon/stats/update', update = '/carbon-smart/api/carbon/stats/update',
del = '/carbon-smart/api/carbon/stats/del', del = '/carbon-smart/api/carbon/stats/del',
voucherDownloadList = '/carbon-smart/api/carbon/stats/voucherDownloadList', voucherDownloadList = '/carbon-smart/api/carbon/stats/voucherDownloadList',
energyAcquisition = '/carbon-smart/api/carbon/stats/energyAcquisition',
} }
// 碳排管理-碳排速算接口 // 碳排管理-碳排速算接口
export enum quickCalculation { export enum quickCalculation {

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

@ -644,8 +644,8 @@
params: { params: {
orgId, orgId,
}, },
title: '设备信息', // title title: '排放源', // title
templateName: 'whiteListUser', // 使 templateName: 'emissionSource', // 使
indexName: '设备id', // indexName: '设备id', //
message: [ message: [
{ label: '1、若必填项未填写,则不能进行导入操作' }, { label: '1、若必填项未填写,则不能进行导入操作' },

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

@ -0,0 +1,952 @@
<template>
<div>
<!-- <a-table
:columns="tableColumns"
:data-source="data"
bordered
:pagination="false"
:scroll="{ x: 2000 }">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'">
<span>
<a @click="editData(record)">编辑</a>
<a-divider type="vertical" />
<a @click="delData(record)">删除</a>
</span>
</template>
</template>
<template #title>
<a-date-picker v-model:value="selectYear" picker="year" @change="changeYearData" valueFormat="YYYY" />
<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" @click="uploadVoucher">上传凭证</a-button>
<a-button type="primary">凭证下载</a-button>
</div>
</template>
</a-table> -->
<ns-view-list-table
v-bind="tableConfig"
:model="data"
ref="mainRef"
:scroll="{ x: 1500, y: 350 }">
<!-- <template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'janFlag'">
<span v-if="record.janFlag===1" style="color: rgba(243, 97, 99, 1);">{{text}}</span>
<span v-else style="color: rgba(57, 215, 287, 1);">{{text}}</span>
</template>
</template> -->
</ns-view-list-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" /> -->
<!-- 新增数据库数据 -->
<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="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入能源种类" />
</a-form-item>
<a-form-item label="计量单位" name="unit">
<a-cascader v-model:value="formState.unit" :options="measurementUnit" />
</a-form-item>
<a-form-item label="能耗类型" name="emissionType" :required="isRequired">
<a-select v-model:value="formState.emissionType" 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-form-item label="自动采集节点" name="collectionNode">
<a-tree-select
v-model:value="formState.collectionNode"
:tree-line="true"
:tree-data="treeData">
</a-tree-select>
</a-form-item>
<a-form-item label="计算碳排" name="isComputeCarbon">
<a-radio-group v-model:value="formState.isComputeCarbon" @change="changeRadio">
<a-radio :value="0"></a-radio>
<a-radio :value="1"></a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排放类型" name="emissionType" :required="isRequired">
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型">
<a-select-option v-for="(item, index) in emissionTypeDic" :key="index" :value="item.id">
{{ item.cnValue }}
</a-select-option>
</a-select>
</a-form-item>
<a-row>
<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"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="2月"
name="febFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.febFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="3月"
name="marFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.marFlag"
:checked-value="1"
:unCheckedValue="0" />
</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"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="5月"
name="mayFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.mayFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="6月"
name="junFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.junFlag"
:checked-value="1"
:unCheckedValue="0" />
</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"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="8月"
name="augFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.augFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="9月"
name="sepFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.sepFlag"
:checked-value="1"
:unCheckedValue="0" />
</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"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="11月"
name="novFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.novFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item
label="12月"
name="decFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.decFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
</a-col>
</a-row>
<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>
<!-- 上传凭证弹窗 -->
<!-- <a-modal :visible="openUpload" title="凭证上传" @ok="handleOk" @cancel="closeOpenUpload">
<a-upload-dragger
v-model:fileList="fileList"
name="file"
:multiple="true"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
@change="handleChange"
@drop="handleDrop"
>
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
</p>
<p class="ant-upload-hint" style="display: flex;flex-direction: column;">
<p>1.仅支持pdf格式文件或文件夹</p>
<p>2.文件命名规则为能源种类_年份</p>
<p>3.每次上传自动覆盖</p>
</p>
</a-upload-dragger>
</a-modal> -->
<!-- 凭证下载 -->
<a-drawer
:visible="downLoadVisible"
title="凭证列表"
:width="500"
@close="onCloseDownLoad"
:footer-style="{ textAlign: 'right' }">
<div></div>
<a-table
:columns="downLoadColumns"
:data-source="downLoadData"
bordered
rowKey="id"
:rowSelection="{
selectedRowKeys: selectedRowKeysSet,
onChange: onSelectionChangeSet,
}"
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'">
<span>
<a @click="downLoad(record)">下载</a>
</span>
</template>
</template>
</a-table>
<template #footer>
<a-button style="margin-right: 8px" @click="onCloseDownLoad">取消</a-button>
<a-button type="primary" @click="onSubmitDownLoad">确定</a-button>
</template>
</a-drawer>
</div>
</template>
<script lang="ts" setup>
import { ref, toRaw, defineExpose } from 'vue';
import type { Rule } from 'ant-design-vue/es/form';
import { Pagination, message, Modal } from 'ant-design-vue';
import { UploadOutlined } from '@ant-design/icons-vue';
import type { TreeSelectProps, UploadChangeParam, UploadProps } from 'ant-design-vue';
import { NsMessage } from '/nerv-lib/component';
import dayjs, { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http';
import { Cookies } from '/nerv-lib/util/cookie';
import { tableColumns } from '../config';
import {
energyConsumption,
carbonEmissionFactorLibrary,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary';
import { dict } from '/@/api';
import { group } from '/@/api/deviceManage';
defineOptions({
energyType: 'EnergyConsumption', // name
components: {
'a-pagination': Pagination,
},
});
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 selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
const total = ref<number>();
const queryParams = ref({
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
year: selectYear.value.format('YYYY'),
});
const isRequired = ref(false);
const visible = ref(false);
const openUpload = ref<boolean>(false);
const data = ref([]);
interface FormState {
energyType: string;
unit: string;
collectionNode: string;
emissionType: string | undefined;
isComputeCarbon: string;
janFlag: string;
febFlag: string;
marFlag: string;
aprFlag: string;
mayFlag: string;
junFlag: string;
julFlag: string;
augFlag: string;
sepFlag: string;
octFlag: string;
novFlag: string;
decFlag: string;
}
const formRef = ref();
const labelCol = { span: 5 };
const wrapperCol = { span: 19 };
const switchLabelCol = { span: 10 };
const switchWrapperCol = { span: 14 };
const formState = ref({
orgId: orgId.value,
});
// form
const rules: Record<string, Rule[]> = {
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }],
unit: [{ required: true, message: '请选择计量单位', trigger: 'change' }],
};
//
const emissionTypeDic = ref();
//
const measurementUnit = ref([]);
//
const treeData = ref<TreeSelectProps['treeData']>([]);
//
const changeYearData = () => {
queryParams.value.year = selectYear.value;
getTableList();
};
const mainRef = ref();
const year = selectYear.value.format('YYYY');
const tableConfig = ref({
title: '能耗统计',
api: energyConsumption.pageList,
params: queryParams.value,
headerActions: [
{
label: '新增',
name: 'userAdd',
type: 'primary',
handle: () => {
getDictList();
visible.value = true;
},
},
{
label: '导入',
type: 'primary',
name: 'userImport',
handle: () => {},
},
{
label: '导出',
type: 'primary',
name: 'userExports',
},
{
label: '模板下载',
type: 'primary',
},
// {
// label: '',
// type: 'primary',
// handle: () => {
// openUpload.value = true;
// },
// },
{
label: '凭证下载',
type: 'primary',
handle: () => {
fetch(energyConsumption.voucherDownloadList, { bizType: 3 }).then((res) => {
downLoadData.value = res.data;
});
downLoadVisible.value = true;
},
},
],
columns: [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '能源种类',
dataIndex: 'energyType',
},
{
title: '计量单位',
className: 'unitName',
dataIndex: 'unitName',
},
{
title: '全年',
dataIndex: 'yearly',
},
{
title: '1月',
dataIndex: 'jan',
// customRender: ({ text }: { text: string }) => {
// return <span :style="{ color: getColor(text) }">{text}</span>;
// }
},
{
title: '2月',
dataIndex: 'feb',
},
{
title: '3月',
dataIndex: 'mar',
},
{
title: '4月',
dataIndex: 'apr',
},
{
title: '5月',
dataIndex: 'may',
},
{
title: '6月',
dataIndex: 'jun',
},
{
title: '7月',
dataIndex: 'jul',
},
{
title: '8月',
dataIndex: 'aug',
},
{
title: '9月',
dataIndex: 'sep',
},
{
title: '10月',
dataIndex: 'oct',
},
{
title: '11月',
dataIndex: 'nov',
},
{
title: '12月',
dataIndex: 'dec',
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'userEdit',
handle: (record: any) => {
getDictList();
visible.value = true;
fetch(energyConsumption.findById, { id: record.id }).then((res) => {
if (res.data.emissionType) {
res.data.emissionType = Number(res.data.emissionType);
}
if (res.data.unit) {
let selectDevice = ref([Number(res.data.unit)]);
findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
res.data.unit = selectDevice;
}
formState.value = res.data;
emissionType.value = res.data.emissionType;
if (formState.value.isComputeCarbon === 0) {
isRequired.value = true;
} else {
isRequired.value = false;
}
});
fetch(uploadPic.select, { bizId: record.id, bizType: 3 }).then((res) => {
fileList.value = res.data.map((item) => ({
uid: item.id.toString(), // 使id
name: item.fileName, //
status: 'done', //
type: 'done',
url: item.filePath, // URLURL
}));
});
},
},
{
label: '删除',
name: 'userDelete',
dynamicParams: { id: 'id' },
confirm: true,
isReload: true,
api: energyConsumption.del,
},
],
},
formConfig: {
schemas: [
{
field: 'year',
label: '年份',
component: 'NsDatePicker',
componentProps: {
picker: 'year',
valueFormat: 'YYYY',
defaultValue: selectYear.value.format('YYYY'),
},
},
],
params: {},
},
rowKey: 'id',
});
const getColor = (value: string | number): string => {
debugger;
if (typeof value === 'string') {
switch (value) {
case 'active':
return 'green';
case 'inactive':
return 'red';
default:
return 'black';
}
} else if (typeof value === 'number') {
return value > 30 ? 'blue' : 'purple'; //
}
return 'black';
};
defineExpose({
mainRef,
});
// 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 getTableList = () => {
fetch(energyConsumption.pageList, queryParams.value).then((res) => {
data.value = res.data.records;
});
};
//
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
mainRef.value?.nsTableRef.reload();
};
//
const emissionType = ref();
const changeRadio = (e) => {
if (e.target.value === 0) {
isRequired.value = true;
if (emissionType.value) {
formState.value.emissionType = emissionType.value;
}
} else {
isRequired.value = false;
formState.value.emissionType = '';
}
};
//
const onSubmit = () => {
formRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
formState.value.year = selectYear.value.format('YYYY');
if (formState.value.unit) {
formState.value.unit = formState.value.unit.join(',').split(',')[1];
}
if (formState.value.id) {
fetch(energyConsumption.update, formState.value).then((res) => {
if (fileList.value.length !== 0) {
const formData = ref(new FormData());
fileList.value.forEach((file) => {
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj);
}
});
formData.value.append('bizType', 3);
formData.value.append('bizId', formState.value.id);
delIds.value.forEach((item) => {
formData.value.append('deleteList', item);
});
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
mainRef.value?.nsTableRef.reload();
})
.catch((error) => {
console.log('error', error);
});
} else {
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
}
});
} else {
fetch(energyConsumption.creat, formState.value).then((res) => {
if (res.data === '新增数据已存在') {
visible.value = false;
delIds.value = [];
NsMessage.warning(res.data);
} else {
if (fileList.value.length !== 0) {
const formData = ref(new FormData());
fileList.value.forEach((file) => {
formData.value.append('files', file.originFileObj);
});
formData.value.append('bizType', 3);
formData.value.append('bizId', res.data);
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
mainRef.value?.nsTableRef.reload();
})
.catch((error) => {
console.log('error', error);
});
} else {
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
}
}
});
}
})
.catch((error) => {
console.log('error', error);
});
};
const energyTypeOptions = ref([]);
//
const getDictList = async () => {
//
const options = await dict({ params: { dicKey: 'ENERGY_TYPE' } });
energyTypeOptions.value = options.data.data
console.log(energyTypeOptions);
debugger
//
fetch(energyConsumption.getDicList, { grp: 'EMISSION_TYPE' }).then((res) => {
emissionTypeDic.value = res.data;
});
//
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT' }).then(
(res) => {
measurementUnit.value = res.data;
measurementUnit.value = measurementUnit.value.map((item) => ({
value: item.id,
label: item.cnValue,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.cnValue,
}))
: [],
}));
},
);
//
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE', 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,
}))
: [],
}));
},
);
};
//
const addNewData = () => {
getDictList();
visible.value = true;
};
//
const editData = (record) => {
getDictList();
visible.value = true;
fetch(energyConsumption.findById, { id: record.id }).then((res) => {
if (res.data.unitName) {
res.data.unitName = res.data.unitName.split(',');
}
formState.value = res.data;
});
};
//
const delData = (record) => {
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(energyConsumption.del, { id: record.id }).then((res) => {
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
});
},
onCancel() {
console.log('Cancel');
},
});
};
//
const onClose = () => {
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
formRef.value.resetFields();
};
//
const uploadVoucher = () => {
openUpload.value = true;
};
//
const handleOk = (e: MouseEvent) => {
console.log(e);
openUpload.value = false;
};
//
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 closeOpenUpload = () => {
openUpload.value = false;
};
//
const downLoadVisible = ref(false);
const downLoadColumns = [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '能源类型',
dataIndex: 'bizName',
},
{
title: '文件名',
dataIndex: 'fileName',
ellipsis: true,
},
{
title: '操作',
key: 'action',
},
];
const downLoadData = ref([]);
const selectedRowKeysSet = ref([]);
const onSelectionChangeSet = (selectedKeys, selectedRows) => {
selectedRowKeysSet.value = selectedKeys;
};
const downLoad = (record) => {
const deleteId = ref(new FormData());
deleteId.value.append('id', record.id);
const config = {
headers: {
responseType: 'blob',
},
};
fetch(uploadPic.download, deleteId.value, config)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res.data]));
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', record.fileName); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
})
.catch((error) => {
console.error('下载图片失败:', error);
});
};
const onSubmitDownLoad = () => {
const deleteIds = ref(new FormData());
selectedRowKeysSet.value.forEach((item) => {
deleteIds.value.append('ids', item);
});
fetch(uploadPic.downloadZip, deleteIds.value)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res.data]));
// <a>
const link = document.createElement('a');
link.href = url;
debugger;
link.setAttribute('download', ''); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
onCloseDownLoad();
})
.catch((error) => {
console.error('下载图片失败:', error);
});
};
const onCloseDownLoad = () => {
selectedRowKeysSet.value = [];
downLoadVisible.value = false;
};
</script>
<style scoped lang="less">
:deep(.ant-table-title) {
display: flex;
}
: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>

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

@ -32,15 +32,10 @@
:model="data" :model="data"
ref="mainRef" ref="mainRef"
:scroll="{ x: 1500, y: 350 }"> :scroll="{ x: 1500, y: 350 }">
<!-- <template #bodyCell="{ record, column }"> <!-- <template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'enableRules'"> <template v-if="column.dataIndex === 'janFlag'">
<a-switch <span v-if="record.janFlag===1" style="color: rgba(243, 97, 99, 1);">{{text}}</span>
:checked="record.enableRules === 1 ? true : false" <span v-else style="color: rgba(57, 215, 287, 1);">{{text}}</span>
:class="{
'blue-background': record.enableRules === 1 ? true : false,
'grey-background': record.enableRules === 1 ? false : true,
}"
@click="clickSwitch({ enableRules: record.enableRules, record: record })" />
</template> </template>
</template> --> </template> -->
</ns-view-list-table> </ns-view-list-table>
@ -60,18 +55,29 @@
:footer-style="{ textAlign: 'right' }" :footer-style="{ textAlign: 'right' }"
destroyOnClose destroyOnClose
@close="onClose"> @close="onClose">
<div class="ns-form-title"><div class="title">能源种类</div></div>
<a-form <a-form
ref="formRef" ref="formRef"
:model="formState" :model="formState"
:rules="rules" :rules="rules"
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol"> :wrapper-col="wrapperCol">
<a-form-item ref="name" label="能源种类" name="energyType"> <a-form-item ref="name" label="能耗名称" name="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入能源种类" /> <a-input v-model:value="formState.energyType" placeholder="请输入能源种类" />
</a-form-item> </a-form-item>
<a-form-item label="计量单位" name="unit"> <a-form-item label="计量单位" name="unit">
<a-cascader v-model:value="formState.unit" :options="measurementUnit" /> <a-cascader v-model:value="formState.unit" :options="measurementUnit" />
</a-form-item> </a-form-item>
<a-form-item label="能耗类型" name="emissionType" :required="isRequired">
<a-select v-model:value="formState.emissionType" 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-form-item label="自动采集节点" name="collectionNode"> <a-form-item label="自动采集节点" name="collectionNode">
<a-tree-select <a-tree-select
v-model:value="formState.collectionNode" v-model:value="formState.collectionNode"
@ -92,7 +98,8 @@
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-row> </a-form>
<!-- <a-row>
<a-col :span="24" style="display: flex; justify-content: space-around"> <a-col :span="24" style="display: flex; justify-content: space-around">
<a-form-item <a-form-item
label="1月" label="1月"
@ -221,22 +228,35 @@
:unCheckedValue="0" /> :unCheckedValue="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row> -->
<a-form-item ref="name" label="上传凭证"> <div class="ns-form-title"><div class="title">能耗统计</div></div>
<a-upload <a-table :columns="addColumns" :data-source="addData" size="small" :pagination="false">
:file-list="fileList" <template #bodyCell="{ column, text, record }">
name="file" <template v-if="column.key === 'action'">
accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf" <a-switch
@remove="handleFileRemove" :checked="record.age === 1 ? true : false"
:before-upload="beforeUpload" :class="{
@change="handleChange"> 'blue-background': record.age === 1 ? true : false,
<a-button> 'grey-background': record.age === 1 ? false : true,
<upload-outlined></upload-outlined> }"
上传 @click="changeSwitch(record)" />
</a-button> </template>
</a-upload> </template>
</a-form-item> </a-table>
</a-form> <div class="ns-form-title"><div class="title">凭证上传</div></div>
<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>
<template #footer> <template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> <a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">确定</a-button> <a-button type="primary" @click="onSubmit">确定</a-button>
@ -304,12 +324,14 @@
import { NsMessage } from '/nerv-lib/component'; import { NsMessage } from '/nerv-lib/component';
import dayjs, { Dayjs } from 'dayjs'; import dayjs, { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { Cookies } from '/nerv-lib/util/cookie';
import { tableColumns } from '../config'; import { tableColumns } from '../config';
import { import {
energyConsumption, energyConsumption,
carbonEmissionFactorLibrary, carbonEmissionFactorLibrary,
uploadPic, uploadPic,
} from '/@/api/carbonEmissionFactorLibrary'; } from '/@/api/carbonEmissionFactorLibrary';
import { dict } from '/@/api';
import { group } from '/@/api/deviceManage'; import { group } from '/@/api/deviceManage';
defineOptions({ defineOptions({
energyType: 'EnergyConsumption', // name energyType: 'EnergyConsumption', // name
@ -320,8 +342,8 @@
const orgId = ref(''); const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result; orgId.value = result;
const fetch = (api, params = { orgId }) => { const fetch = (api, params = { orgId }, config) => {
return http.post(api, params); return http.post(api, params, config);
}; };
const selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString())); const selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
const total = ref<number>(); const total = ref<number>();
@ -392,6 +414,7 @@
type: 'primary', type: 'primary',
handle: () => { handle: () => {
getDictList(); getDictList();
getSummaryMethod();
visible.value = true; visible.value = true;
}, },
}, },
@ -451,12 +474,9 @@
{ {
title: '1月', title: '1月',
dataIndex: 'jan', dataIndex: 'jan',
// customRender: ({ text, record }) => ({ // customRender: ({ text }: { text: string }) => {
// children: text, // return <span :style="{ color: getColor(text) }">{text}</span>;
// attrs: { // }
// style: record.janFlag === 1 ? 'color: red' : 'color: blue'
// }
// })
}, },
{ {
title: '2月', title: '2月',
@ -568,7 +588,39 @@
}, },
rowKey: 'id', rowKey: 'id',
}); });
const getColor = (value: string | number): string => {
if (typeof value === 'string') {
switch (value) {
case 'active':
return 'green';
case 'inactive':
return 'red';
default:
return 'black';
}
} else if (typeof value === 'number') {
return value > 30 ? 'blue' : 'purple'; //
}
return 'black';
};
const getSummaryMethod = () => {
fetch(energyConsumption.energyAcquisition, { orgId: orgId.value }).then((res) => {
addData.value = res.data.records;
});
};
const addColumns = [
{ title: '月份', dataIndex: 'key' },
{ title: '汇总方式', dataIndex: 'name' },
{ title: '操作', key: 'action', dataIndex: 'age' },
];
const addData = ref([]);
//
const changeSwitch = (data: any) => {
data.age = data.age === 1 ? 0 : 1;
data.name = data.age === 1 ? '自动' : '手动';
addData.value = [...addData.value];
console.log(addData.value);
};
defineExpose({ defineExpose({
mainRef, mainRef,
}); });
@ -700,8 +752,12 @@
console.log('error', error); console.log('error', error);
}); });
}; };
const energyTypeOptions = ref([]);
// //
const getDictList = () => { const getDictList = async () => {
//
const options = await dict({ params: { dicKey: 'ENERGY_TYPE' } });
energyTypeOptions.value = options.data.data;
// //
fetch(energyConsumption.getDicList, { grp: 'EMISSION_TYPE' }).then((res) => { fetch(energyConsumption.getDicList, { grp: 'EMISSION_TYPE' }).then((res) => {
emissionTypeDic.value = res.data; emissionTypeDic.value = res.data;
@ -854,10 +910,16 @@
const downLoad = (record) => { const downLoad = (record) => {
const deleteId = ref(new FormData()); const deleteId = ref(new FormData());
deleteId.value.append('id', record.id); deleteId.value.append('id', record.id);
fetch(uploadPic.download, deleteId.value) const config = {
headers: {
responseType: 'blob',
},
};
fetch(uploadPic.download, deleteId.value, config)
.then((res) => { .then((res) => {
debugger
// URL blob // URL blob
const url = window.URL.createObjectURL(new Blob([res.data])); const url = window.URL.createObjectURL(new Blob([res]));
// <a> // <a>
const link = document.createElement('a'); const link = document.createElement('a');
link.href = url; link.href = url;
@ -884,20 +946,20 @@
// <a> // <a>
const link = document.createElement('a'); const link = document.createElement('a');
link.href = url; link.href = url;
debugger
link.setAttribute('download', ''); // link.setAttribute('download', ''); //
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
// URL // URL
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
onCloseDownLoad();
}) })
.catch((error) => { .catch((error) => {
console.error('下载图片失败:', error); console.error('下载图片失败:', error);
}); });
}; };
const onCloseDownLoad = () => { const onCloseDownLoad = () => {
selectedRowKeysSet.value = [] selectedRowKeysSet.value = [];
downLoadVisible.value = false; downLoadVisible.value = false;
}; };
</script> </script>
@ -914,6 +976,51 @@
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} }
.ns-form-title {
font-weight: bold;
user-select: text;
}
.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;
}
.blue-background.ant-switch-checked {
background-color: linear-gradient(
180deg,
rgba(1, 206, 255, 1) 0%,
rgba(57, 215, 187, 1) 100%
) !important;
}
.blue-background.ant-switch-checked .ant-switch-handle {
background-color: linear-gradient(
180deg,
rgba(1, 206, 255, 1) 0%,
rgba(57, 215, 187, 1) 100%
) !important;
}
.grey-background.ant-switch {
background-color: rgba(238, 238, 238, 1) !important;
}
.grey-background.ant-switch .ant-switch-handle {
background-color: rgba(238, 238, 238, 1) !important;
}
</style> </style>
<style scoped> <style scoped>
th.column-money, th.column-money,

15
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue

@ -72,7 +72,7 @@
@change="onChange" /> @change="onChange" />
<!-- 新增/编辑 --> <!-- 新增/编辑 -->
<a-drawer <a-drawer
:width="700" :width="500"
:visible="visible" :visible="visible"
:body-style="{ paddingBottom: '80px' }" :body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }" :footer-style="{ textAlign: 'right' }"
@ -85,7 +85,7 @@
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol"> :wrapper-col="wrapperCol">
<a-row> <a-row>
<a-col :span="12"> <a-col :span="24">
<a-form-item ref="name" label="日期范围" name="dateRange"> <a-form-item ref="name" label="日期范围" name="dateRange">
<a-range-picker <a-range-picker
v-model:value="formState.dateRange" v-model:value="formState.dateRange"
@ -93,16 +93,21 @@
valueFormat="YYYY-MM" /> valueFormat="YYYY-MM" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="24">
<a-form-item ref="name" label="排放因子" name="emissionFactors"> <a-form-item ref="name" label="排放因子" name="emissionFactors">
<ns-input v-model:value="formState.emissionFactors" disabled /> <ns-input v-model:value="formState.emissionFactors" disabled />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<span
key=""
style="font-size: 16px; font-weight: 700; color: rgba(51, 51, 51, 1); text-align: left">
因子列表
</span>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-item ref="name" label="关键词"> <a-form-item ref="name">
<ns-input v-model:value="selectData" @change="keyChange" /> <ns-input style="margin-top: 5px;" v-model:value="selectData" @change="keyChange" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>

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

File diff suppressed because it is too large

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

@ -45,7 +45,7 @@
</template> </template>
</a-tree> </a-tree>
</div> </div>
<div class="bottom"> <!-- <div class="bottom">
<a-form style="width: 100%; margin: 0 auto"> <a-form style="width: 100%; margin: 0 auto">
<div class="ns-form-title"><div class="title">报告相关</div></div> <div class="ns-form-title"><div class="title">报告相关</div></div>
<div class="button" style="padding: 0 16px !important"> <div class="button" style="padding: 0 16px !important">
@ -53,80 +53,82 @@
<div :class="{ tplx: isClickedTplx }" @click="showTplx">碳排流向</div> <div :class="{ tplx: isClickedTplx }" @click="showTplx">碳排流向</div>
</div> </div>
</a-form> </a-form>
</div> </div> -->
</div> </div>
<div class="right"> <div class="right">
<div style="display: flex"> <a-tabs v-model:activeKey="activeKey" @change="handleTabChange" style="height: 100%">
<div class="ns-table-title ns-title-extra-box">排放源</div> <a-tab-pane key="1" tab="排放源">
<a-button type="primary" style="margin-left: 12px" @click="changeParentData">返回</a-button> <div style="display: flex; height: 100%">
</div> <div class="mainLeft">
<div style="display: flex; height: 100%" v-if="fillInPage"> <a-tree
<div class="mainLeft"> :expandedKeys="expandedKeysR"
<a-tree :selectedKeys="selectedKeysR"
:expandedKeys="expandedKeysR" :checkedKeys="checkedKeys"
:selectedKeys="selectedKeysR" :tree-data="treeData"
:checkedKeys="checkedKeys" @select="onSelectR"
:tree-data="treeData" block-node>
@select="onSelectR" <template #title="data">
block-node> <div class="treeRow">
<template #title="data"> <div>
<div class="treeRow"> <span>{{ data.emissionSource }}</span>
<div> </div>
<span>{{ data.emissionSource }}</span> <div class="actionMore">
</div> <EditOutlined @click="editUnit(data)" />
<div class="actionMore"> <MinusCircleOutlined style="margin-left: 6px" @click="delUnit(data)" />
<EditOutlined @click="editUnit(data)" /> </div>
<MinusCircleOutlined style="margin-left: 6px" @click="delUnit(data)" /> </div>
</div> </template>
</a-tree>
<div class="addTreeNode">
<a-button type="primary" style="width: 100%" @click="addTreeNodeData"
>新增</a-button
>
</div> </div>
</template> </div>
</a-tree> <div class="mainRight">
<div class="addTreeNode"> <a-table
<a-button type="primary" style="width: 100%" @click="addTreeNodeData">新增</a-button> :columns="columns"
:data-source="data"
:pagination="false"
bordered
size="middle"
:scroll="{ y: 500 }">
<template #title>
<a-button type="primary" @click="downLoadVoucher">凭证</a-button>
</template>
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'dataSources'">
<span v-if="record.dataSources">{{ record.dataSources.label }}</span>
</template>
<template v-if="column.dataIndex === 'carbonSource'">
<span v-if="record.carbonSource">{{ record.carbonSource.label }}</span>
</template>
<template v-if="column.key === 'action'">
<span>
<a @click="edit(record)">编辑</a>
</span>
</template>
</template>
</a-table>
</div>
</div> </div>
</div> </a-tab-pane>
<div class="mainRight"> <a-tab-pane key="2" tab="排放统计">
<a-table <a-table
:columns="columns" :columns="pftjColumn"
:data-source="data" :data-source="pftjData"
:pagination="false"
bordered bordered
size="middle" :pagination="false"
:scroll="{ y: 480 }"> :scroll="{ x: 2000, y: 500 }">
<template #title>
<a-button type="primary" @click="downLoadVoucher">凭证</a-button>
</template>
<template #bodyCell="{ column, text, record }"> <template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'dataSources'"> {{ text || '-' }}
<span v-if="record.dataSources">{{ record.dataSources.label }}</span>
</template>
<template v-if="column.dataIndex === 'carbonSource'">
<span v-if="record.carbonSource">{{ record.carbonSource.label }}</span>
</template>
<template v-if="column.key === 'action'">
<span>
<a @click="edit(record)">编辑</a>
</span>
</template>
</template> </template>
</a-table> </a-table>
</div> </a-tab-pane>
</div> <a-tab-pane key="3" tab="碳排流向">
<div v-if="isClickedPftj"> <div ref="tplxChart" style="width: 100%; height: 68vh"></div>
<a-table </a-tab-pane>
:columns="pftjColumn" </a-tabs>
:data-source="pftjData"
bordered
:pagination="false"
:scroll="{ x: 2000 }">
<template #bodyCell="{ column, text, record }">
{{ text || '-' }}
</template>
</a-table>
</div>
<div v-if="isClickedTplx" style="width: 100%; height: 100%">
<div ref="tplxChart" style="width: 100%; height: 68vh"></div>
</div>
</div> </div>
<!-- 类别配置 --> <!-- 类别配置 -->
<a-drawer <a-drawer
@ -225,6 +227,7 @@
:columns="voucherColumns" :columns="voucherColumns"
:data-source="voucherData" :data-source="voucherData"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectionChange }" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectionChange }"
rowKey="id"
:pagination="false"> :pagination="false">
<template #bodyCell="{ column, text }"> <template #bodyCell="{ column, text }">
<template v-if="column.dataIndex === 'name'"> <template v-if="column.dataIndex === 'name'">
@ -340,7 +343,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch, toRaw, defineEmits } from 'vue'; import { ref, watch, toRaw, defineEmits, nextTick } from 'vue';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { Pagination, Modal, message } from 'ant-design-vue'; import { Pagination, Modal, message } from 'ant-design-vue';
import type { TreeProps, UploadChangeParam } from 'ant-design-vue'; import type { TreeProps, UploadChangeParam } from 'ant-design-vue';
@ -381,7 +384,7 @@
type: String, type: String,
}, },
}); });
const activeKey = ref('1');
const orgId = ref(''); const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result; orgId.value = result;
@ -859,7 +862,33 @@
}; };
const voucherData = ref([]); const voucherData = ref([]);
const downLoadMore = () => {
const deleteIds = ref(new FormData());
selectedRowKeys.value.forEach((item) => {
deleteIds.value.append('ids', item);
});
fetch(uploadPic.downloadZip, deleteIds.value)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res.data]));
// <a>
const link = document.createElement('a');
link.href = url;
debugger;
link.setAttribute('download', ''); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
onCloseVoucher();
})
.catch((error) => {
console.error('下载图片失败:', error);
});
};
const onCloseVoucher = () => { const onCloseVoucher = () => {
selectedRowKeys.value = [];
openVoucher.value = false; openVoucher.value = false;
}; };
// //
@ -1361,6 +1390,20 @@
chartInstance = echarts.init(tplxChart.value); chartInstance = echarts.init(tplxChart.value);
chartInstance.setOption(option); chartInstance.setOption(option);
}; };
const handleTabChange = (key) => {
console.log('Tab changed:', key);
//
if (key === '2') {
nextTick(() => {
getEmissionStatistic();
});
} else if (key === '3') {
nextTick(() => {
getCarbonFlowDirection();
});
}
};
// //
const emit = defineEmits(['change-data']); const emit = defineEmits(['change-data']);
const changeParentData = () => { const changeParentData = () => {
@ -1386,7 +1429,7 @@
flex-direction: column; flex-direction: column;
.top { .top {
position: relative; position: relative;
height: 80%; height: 100%;
margin-bottom: 20px; margin-bottom: 20px;
.ns-form-title { .ns-form-title {
font-weight: bold; font-weight: bold;
@ -1465,10 +1508,12 @@
flex: 1; flex: 1;
min-width: 0; min-width: 0;
height: 100%; height: 100%;
padding: @ns-gap;
background-color: @white; background-color: @white;
border-radius: @ns-border-radius; border-radius: @ns-border-radius;
box-shadow: @ns-content-box-shadow; box-shadow: @ns-content-box-shadow;
:deep(.ant-tabs-content-holder) {
padding: 20px;
}
.ns-table-title { .ns-table-title {
text-align: left; text-align: left;
font-size: 16px; font-size: 16px;

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

@ -41,7 +41,7 @@
<div class="quantityTitle">基准值</div> <div class="quantityTitle">基准值</div>
</div> </div>
<div class="model"> <div class="model">
<div class="quantity"> <div class="quantity" style="align-items: center; display: flex">
<img <img
width="20px" width="20px"
height="28px" height="28px"
@ -278,8 +278,12 @@
.validate() .validate()
.then(() => { .then(() => {
console.log('values', formState, toRaw(formState)); console.log('values', formState, toRaw(formState));
if (formState.value.ids[0] === undefined) { if (formState.value.ids === undefined) {
formState.value.ids = ids.value; formState.value.ids = ids.value;
} else {
if (formState.value.ids[0] === undefined) {
formState.value.ids = ids.value;
}
} }
fetch(carbonPlanning.batchOrUpdate, formState.value).then((res) => { fetch(carbonPlanning.batchOrUpdate, formState.value).then((res) => {
open.value = false; open.value = false;
@ -314,7 +318,11 @@
]; ];
const newTableData = ref([]); const newTableData = ref([]);
const setBasicData = () => { const setBasicData = () => {
fetch(carbonPlanning.benchmarkSetting, { orgId: orgId.value }).then((res) => { fetch(carbonPlanning.benchmarkSetting, {
orgId: orgId.value,
type: props.type,
itemizeId: props.parentId,
}).then((res) => {
newTableData.value = res.data; newTableData.value = res.data;
}); });
visible.value = true; visible.value = true;

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

@ -8,6 +8,7 @@
v-if="selectedTime" v-if="selectedTime"
style="margin-left: 5%" style="margin-left: 5%"
v-model:value="selectYearValue" v-model:value="selectYearValue"
:disabled-date="disabledDate"
valueFormat="YYYY" valueFormat="YYYY"
@change="changeYear" @change="changeYear"
picker="year" /> picker="year" />
@ -35,6 +36,9 @@
:data-source="data" :data-source="data"
bordered bordered
:pagination="false" :pagination="false"
row-key="itemizeId"
:onRow="onRow"
:customRow="customRow"
:scroll="{ x: 1300, y: 250 }"> :scroll="{ x: 1300, y: 250 }">
<template #bodyCell="{ column, text, record }"> <template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
@ -115,6 +119,10 @@
const selectYearValue = ref<Dayjs>(dayjs(new Date().getFullYear().toString())); const selectYearValue = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
const selectMonthValue = ref<Dayjs>(dayjs().startOf('year').month(0)); const selectMonthValue = ref<Dayjs>(dayjs().startOf('year').month(0));
const electricTotal = ref(true); const electricTotal = ref(true);
const disabledDate = (current: any) => {
return current && current.year() > new Date().getFullYear();
};
// / // /
const monthStyles = ref('background: #f2f2f2'); const monthStyles = ref('background: #f2f2f2');
const yearStyles = ref('background: #2778ff'); const yearStyles = ref('background: #2778ff');
@ -127,7 +135,6 @@
selectedTime.value = false; selectedTime.value = false;
getMonthData(); getMonthData();
getBallQuery.value.yearAndMonth = 'month'; getBallQuery.value.yearAndMonth = 'month';
getBallData();
getMonthPillarData(); getMonthPillarData();
}; };
const changeToYear = () => { const changeToYear = () => {
@ -138,7 +145,6 @@
selectedTime.value = true; selectedTime.value = true;
getYearData(); getYearData();
getBallQuery.value.yearAndMonth = 'year'; getBallQuery.value.yearAndMonth = 'year';
getBallData();
getYearPillarData(); getYearPillarData();
}; };
// echarts // echarts
@ -148,6 +154,7 @@
orgId: orgId.value, orgId: orgId.value,
type: props.tabId, type: props.tabId,
year: selectYearValue.value.format('YYYY'), year: selectYearValue.value.format('YYYY'),
selectedMonth: selectMonthValue.value.format('YYYY-DD'),
}); });
const xAxisData = ref([]); const xAxisData = ref([]);
const referenceValue = ref([]); const referenceValue = ref([]);
@ -160,6 +167,8 @@
budget.value = res.data.budget; budget.value = res.data.budget;
actualUsage.value = res.data.actualUsage; actualUsage.value = res.data.actualUsage;
drawPillarChart(); drawPillarChart();
getBallQuery.value.selectActualUsage = res.data.selectActualUsage;
getBallData();
}); });
}; };
const getMonthPillarData = () => { const getMonthPillarData = () => {
@ -169,6 +178,8 @@
budget.value = res.data.budget; budget.value = res.data.budget;
actualUsage.value = res.data.actualUsage; actualUsage.value = res.data.actualUsage;
drawPillarChart(); drawPillarChart();
getBallQuery.value.selectActualUsage = res.data.selectActualUsage;
getBallData();
}); });
}; };
const drawPillarChart = () => { const drawPillarChart = () => {
@ -445,9 +456,11 @@
}); });
const changeYear = () => { const changeYear = () => {
yearQueryParams.value.year = selectYearValue.value; yearQueryParams.value.year = selectYearValue.value;
year.value = selectYearValue.value; getPillarQuery.value.year = selectYearValue.value;
getBallQuery.value.year = selectYearValue.value;
addTreeNode.value.year = selectYearValue.value; addTreeNode.value.year = selectYearValue.value;
getYearData(); getYearData();
getYearPillarData();
}; };
const getYearData = () => { const getYearData = () => {
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then((res) => { fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then((res) => {
@ -466,9 +479,10 @@
}); });
const changeMonth = () => { const changeMonth = () => {
monthQueryParams.value.yearMonth = selectMonthValue.value; monthQueryParams.value.yearMonth = selectMonthValue.value;
getPillarQuery.value.selectedMonth = selectMonthValue.value;
getBallQuery.value.yearMonth = selectMonthValue.value; getBallQuery.value.yearMonth = selectMonthValue.value;
getMonthData(); getMonthData();
getBallData(); getMonthPillarData();
}; };
const getMonthData = () => { const getMonthData = () => {
fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then((res) => { fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then((res) => {
@ -489,6 +503,21 @@
type.value = props.tabId; type.value = props.tabId;
nodeName.value = record.itemizeName; nodeName.value = record.itemizeName;
}; };
const customRow = (record) => {
return {
//
onClick: (event) => {
getPillarQuery.value.itemizeId = record.itemizeId;
getBallQuery.value.itemizeId = record.itemizeId;
if (selectedTime.value) {
getYearPillarData();
} else {
getMonthPillarData();
}
},
};
};
// //
const updateData = (type) => { const updateData = (type) => {
electricTotal.value = type; electricTotal.value = type;

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

@ -78,7 +78,7 @@
} }
}); });
} else if (key === '5') { } else if (key === '5') {
tabId.value = 4; tabId.value = 5;
energyType.value = 'CARBON_EMISSIONS' energyType.value = 'CARBON_EMISSIONS'
nextTick(() => { nextTick(() => {
if (carbonEmissionsRef.value) { if (carbonEmissionsRef.value) {
@ -87,7 +87,7 @@
} }
}); });
} else if (key === '6') { } else if (key === '6') {
tabId.value = 5; tabId.value = 4;
energyType.value = 'HEAT_SUPPLY' energyType.value = 'HEAT_SUPPLY'
nextTick(() => { nextTick(() => {
if (provideHotRef.value) { if (provideHotRef.value) {

Loading…
Cancel
Save