修改测试问题
This commit is contained in:
@@ -60,3 +60,13 @@ export const getEnum = async ({
|
|||||||
const res = await http.get(api, params);
|
const res = await http.get(api, params);
|
||||||
return Promise.resolve(res);
|
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);
|
||||||
|
};
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
v-model:value="queryParams.year"
|
v-model:value="queryParams.year"
|
||||||
placeholder="请选择账期"
|
placeholder="请选择账期"
|
||||||
|
:allowClear="false"
|
||||||
picker="year"
|
picker="year"
|
||||||
valueFormat="YYYY" />
|
valueFormat="YYYY" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -63,10 +64,7 @@
|
|||||||
<a-button type="primary" v-if="queryParams.accountType === 1" @click="getTotalTable(1)">
|
<a-button type="primary" v-if="queryParams.accountType === 1" @click="getTotalTable(1)">
|
||||||
全国配额
|
全国配额
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button type="primary" v-if="queryParams.accountType === 2" @click="getTotalTable(2)">
|
||||||
type="primary"
|
|
||||||
v-if="queryParams.accountType === 2"
|
|
||||||
@click="getTotalTable(2)">
|
|
||||||
地方配额
|
地方配额
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" v-if="queryParams.accountType === 3" @click="getTotalTable(3)">
|
<a-button type="primary" v-if="queryParams.accountType === 3" @click="getTotalTable(3)">
|
||||||
@@ -431,7 +429,7 @@
|
|||||||
// 创建一个 <a> 标签,用于触发下载
|
// 创建一个 <a> 标签,用于触发下载
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute('download', 'carbonTradeDetails.xlsx'); // 设置下载的文件名
|
link.setAttribute('download', '碳资产导出.xlsx'); // 设置下载的文件名
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
|
|
||||||
@@ -701,6 +699,7 @@
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
message.success('操作成功!');
|
message.success('操作成功!');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
formState.value = {};
|
||||||
delIds.value = [];
|
delIds.value = [];
|
||||||
// getDetailList();
|
// getDetailList();
|
||||||
mainRef.value?.nsTableRef.reload();
|
mainRef.value?.nsTableRef.reload();
|
||||||
@@ -713,6 +712,7 @@
|
|||||||
message.success('操作成功!');
|
message.success('操作成功!');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
delIds.value = [];
|
delIds.value = [];
|
||||||
|
formState.value = {};
|
||||||
// getDetailList();
|
// getDetailList();
|
||||||
mainRef.value?.nsTableRef.reload();
|
mainRef.value?.nsTableRef.reload();
|
||||||
}
|
}
|
||||||
|
@@ -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, // 文件的URL,这里假设用示例的URL格式
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
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>
|
|
@@ -129,7 +129,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<img width="24" height="24" src="../../../../src/icon/carbonAssetsTitle-3.svg" />
|
<img width="24" height="24" src="../../../../src/icon/carbonAssetsTitle-3.svg" />
|
||||||
<span>全国碳账户余额</span>
|
<span>CCER账户余额</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<div class="calculation BLCard">
|
<div class="calculation BLCard">
|
||||||
|
@@ -558,6 +558,11 @@
|
|||||||
const onSelectKeys = ref([]);
|
const onSelectKeys = ref([]);
|
||||||
const onSelect = (selectedKey: string[], info: any) => {
|
const onSelect = (selectedKey: string[], info: any) => {
|
||||||
if (selectedKey.length === 1) {
|
if (selectedKey.length === 1) {
|
||||||
|
if (info.selectedNodes[0].emissionName === '全部') {
|
||||||
|
onSelectKeys.value = [];
|
||||||
|
} else {
|
||||||
|
onSelectKeys.value = [info.selectedNodes[0].id];
|
||||||
|
}
|
||||||
selectedKeys.value = selectedKey;
|
selectedKeys.value = selectedKey;
|
||||||
editTreeNode.value = {
|
editTreeNode.value = {
|
||||||
id: info.selectedNodes[0].id,
|
id: info.selectedNodes[0].id,
|
||||||
@@ -566,7 +571,6 @@
|
|||||||
sortNumber: info.selectedNodes[0].sortNumber,
|
sortNumber: info.selectedNodes[0].sortNumber,
|
||||||
parentEmissionId: info.selectedNodes[0].parentEmissionId,
|
parentEmissionId: info.selectedNodes[0].parentEmissionId,
|
||||||
};
|
};
|
||||||
onSelectKeys.value = [info.selectedNodes[0].id];
|
|
||||||
emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
|
emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
|
||||||
mainRef.value?.nsTableRef.reload();
|
mainRef.value?.nsTableRef.reload();
|
||||||
}
|
}
|
||||||
@@ -700,12 +704,17 @@
|
|||||||
label: '导出',
|
label: '导出',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handle: () => {
|
handle: () => {
|
||||||
// console.log( mainRef.value.nsTableRef.tableState.selectedRowKeys)
|
// console.log(mainRef.value.nsTableRef.formParamsRef)
|
||||||
const exportQuery = {
|
const exportQuery = {
|
||||||
orgId: orgId.value,
|
orgId: orgId.value,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 999,
|
pageSize: 999,
|
||||||
ids: mainRef.value.nsTableRef.tableState.selectedRowKeys,
|
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 = {
|
const config = {
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
@@ -717,7 +726,7 @@
|
|||||||
// 创建一个 <a> 标签,用于触发下载
|
// 创建一个 <a> 标签,用于触发下载
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute('download', 'carbonFactor.xlsx'); // 设置下载的文件名
|
link.setAttribute('download', '碳排因子库导出.xlsx'); // 设置下载的文件名
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
|
|
||||||
@@ -1254,12 +1263,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:deep(
|
// :deep(
|
||||||
.ant-form-item-label
|
// .ant-form-item-label
|
||||||
> label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before
|
// > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before
|
||||||
) {
|
// ) {
|
||||||
display: none !important;
|
// display: none !important;
|
||||||
}
|
// }
|
||||||
:deep(.ant-form-item-label) {
|
:deep(.ant-form-item-label) {
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
@@ -149,7 +149,7 @@ export const drawerColumns = [
|
|||||||
export const setFactorConfig = (orgId) => {
|
export const setFactorConfig = (orgId) => {
|
||||||
return ref({
|
return ref({
|
||||||
api: carbonEmissionFactorLibrary.getTableList,
|
api: carbonEmissionFactorLibrary.getTableList,
|
||||||
params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [] },
|
params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [0] },
|
||||||
treeConfig: {
|
treeConfig: {
|
||||||
header: {
|
header: {
|
||||||
icon: 'deviceType',
|
icon: 'deviceType',
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
<a-radio :value="1">否</a-radio>
|
<a-radio :value="1">否</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="排放类型" name="emissionType" :required="isRequired">
|
<a-form-item label="排放类型" name="emissionType" :required="isRequired" v-if="isRequired">
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="formState.emissionType"
|
v-model:value="formState.emissionType"
|
||||||
placeholder="请选择排放类型"
|
placeholder="请选择排放类型"
|
||||||
@@ -330,7 +330,7 @@
|
|||||||
// 创建一个 <a> 标签,用于触发下载
|
// 创建一个 <a> 标签,用于触发下载
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute('download', 'carbonStats.xlsx'); // 设置下载的文件名
|
link.setAttribute('download', '能耗统计导出.xlsx'); // 设置下载的文件名
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
|
|
||||||
@@ -342,13 +342,13 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: '模板下载',
|
// label: '模板下载',
|
||||||
type: 'primary',
|
// type: 'primary',
|
||||||
handle: () => {
|
// handle: () => {
|
||||||
doWnload('/hx-ai-intelligent/asset/file/energyConsumption.xlsx');
|
// doWnload('/hx-ai-intelligent/asset/file/energyConsumption.xlsx');
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// label: '上传凭证',
|
// label: '上传凭证',
|
||||||
// type: 'primary',
|
// type: 'primary',
|
||||||
@@ -782,24 +782,18 @@
|
|||||||
// 获取自动采集节点的数据
|
// 获取自动采集节点的数据
|
||||||
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
|
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
|
||||||
treeData.value = res.data;
|
treeData.value = res.data;
|
||||||
treeData.value = treeData.value.map((item) => ({
|
treeData.value = transformData(treeData.value);
|
||||||
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,
|
|
||||||
}))
|
|
||||||
: [],
|
|
||||||
}))
|
|
||||||
: [],
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// 将数据转换为树形结构
|
||||||
|
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 emissionType = ref();
|
||||||
const changeRadio = (e) => {
|
const changeRadio = (e) => {
|
||||||
@@ -819,7 +813,9 @@
|
|||||||
.validate()
|
.validate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('values', formState, toRaw(formState));
|
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) {
|
if (formState.value.unit) {
|
||||||
formState.value.unit = formState.value.unit.join(',').split(',')[1];
|
formState.value.unit = formState.value.unit.join(',').split(',')[1];
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -308,80 +308,82 @@
|
|||||||
<div class="ns-form-title-edit">
|
<div class="ns-form-title-edit">
|
||||||
<div class="title">编辑</div>
|
<div class="title">编辑</div>
|
||||||
</div>
|
</div>
|
||||||
<a-form
|
<a-spin :spinning="spinning">
|
||||||
ref="editFormRef"
|
<a-form
|
||||||
:model="editFormState"
|
ref="editFormRef"
|
||||||
:label-col="labelCol"
|
:model="editFormState"
|
||||||
:wrapper-col="wrapperCol">
|
:label-col="labelCol"
|
||||||
<a-row>
|
:wrapper-col="wrapperCol">
|
||||||
<a-col :span="24">
|
<a-row>
|
||||||
<a-form-item ref="name" label="数据来源" name="dataSources">
|
<a-col :span="24">
|
||||||
<a-select
|
<a-form-item ref="name" label="数据来源" name="dataSources">
|
||||||
ref="select"
|
<a-select
|
||||||
v-model:value="editFormState.dataSources"
|
ref="select"
|
||||||
@change="changeSelect">
|
v-model:value="editFormState.dataSources"
|
||||||
<a-select-option value="1">自行推估</a-select-option>
|
@change="changeSelect">
|
||||||
<a-select-option value="2">定期量测</a-select-option>
|
<a-select-option value="1">自行推估</a-select-option>
|
||||||
<a-select-option value="3">自动测量</a-select-option>
|
<a-select-option value="2">定期量测</a-select-option>
|
||||||
</a-select>
|
<a-select-option value="3">自动测量</a-select-option>
|
||||||
</a-form-item>
|
</a-select>
|
||||||
</a-col>
|
</a-form-item>
|
||||||
<a-col :span="24">
|
</a-col>
|
||||||
<a-form-item ref="name" label="消耗量" name="consumption">
|
<a-col :span="24">
|
||||||
<ns-input-number
|
<a-form-item ref="name" label="消耗量" name="consumption">
|
||||||
v-model:value="editFormState.consumption"
|
<ns-input-number
|
||||||
:maxlength="20"
|
v-model:value="editFormState.consumption"
|
||||||
@keydown="handleKeyDown"
|
:maxlength="20"
|
||||||
:disabled="canEdit" />
|
@keydown="handleKeyDown"
|
||||||
</a-form-item>
|
:disabled="canEdit" />
|
||||||
</a-col>
|
</a-form-item>
|
||||||
</a-row>
|
</a-col>
|
||||||
<a-row v-if="automatic">
|
</a-row>
|
||||||
<a-col :span="24">
|
<a-row v-if="automatic">
|
||||||
<a-form-item label="能耗类型">
|
<a-col :span="24">
|
||||||
<a-select
|
<a-form-item label="能耗类型">
|
||||||
v-model:value="editFormState.energyConsumptionType"
|
<a-select
|
||||||
@change="changeEnergyType"
|
v-model:value="editFormState.energyConsumptionType"
|
||||||
placeholder="请选择能耗类型">
|
@change="changeEnergyType"
|
||||||
<a-select-option
|
placeholder="请选择能耗类型">
|
||||||
v-for="(item, index) in energyTypeOptions"
|
<a-select-option
|
||||||
:key="index"
|
v-for="(item, index) in energyTypeOptions"
|
||||||
:value="item.dicKey">
|
:key="index"
|
||||||
{{ item.cnValue }}
|
:value="item.dicKey">
|
||||||
</a-select-option>
|
{{ item.cnValue }}
|
||||||
</a-select>
|
</a-select-option>
|
||||||
</a-form-item>
|
</a-select>
|
||||||
</a-col>
|
</a-form-item>
|
||||||
<a-col :span="24">
|
</a-col>
|
||||||
<a-form-item ref="name" label="采集节点" name="collectionNode">
|
<a-col :span="24">
|
||||||
<a-tree-select
|
<a-form-item ref="name" label="采集节点" name="collectionNode">
|
||||||
v-model:value="editFormState.collectionNode"
|
<a-tree-select
|
||||||
:tree-line="true"
|
v-model:value="editFormState.collectionNode"
|
||||||
@select="selectNode"
|
:tree-line="true"
|
||||||
:tree-data="collectingNodes">
|
@select="selectNode"
|
||||||
</a-tree-select>
|
:tree-data="collectingNodes">
|
||||||
</a-form-item>
|
</a-tree-select>
|
||||||
</a-col>
|
</a-form-item>
|
||||||
</a-row>
|
</a-col>
|
||||||
<a-row>
|
</a-row>
|
||||||
<a-col :span="24">
|
<a-row>
|
||||||
<a-form-item ref="name" label="因子值" name="emissionFactors">
|
<a-col :span="24">
|
||||||
<ns-input
|
<a-form-item ref="name" label="因子值" name="emissionFactors">
|
||||||
v-model:value="editFormState.emissionFactors"
|
<ns-input
|
||||||
:maxlength="20"
|
v-model:value="editFormState.emissionFactors"
|
||||||
@keydown="handleKeyDown" />
|
:maxlength="20"
|
||||||
</a-form-item>
|
@keydown="handleKeyDown" />
|
||||||
</a-col>
|
</a-form-item>
|
||||||
<a-col :span="24">
|
</a-col>
|
||||||
<a-form-item ref="name" label="关键字" name="key">
|
<a-col :span="24">
|
||||||
<a-input-search
|
<a-form-item ref="name" label="关键字" name="key">
|
||||||
v-model:value="editFormState.key"
|
<a-input-search
|
||||||
@search="searchKey"
|
v-model:value="editFormState.key"
|
||||||
placeholder="请输入关键字" />
|
@search="searchKey"
|
||||||
</a-form-item>
|
placeholder="请输入关键字" />
|
||||||
</a-col>
|
</a-form-item>
|
||||||
</a-row>
|
</a-col>
|
||||||
</a-form>
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
<div class="ns-form-title-edit" style="display: flex">
|
<div class="ns-form-title-edit" style="display: flex">
|
||||||
<div class="titleEdit">因子列表</div>
|
<div class="titleEdit">因子列表</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1121,19 +1123,21 @@
|
|||||||
// 获取自动采集节点的数据
|
// 获取自动采集节点的数据
|
||||||
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
|
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
|
||||||
collectingNodes.value = res.data;
|
collectingNodes.value = res.data;
|
||||||
collectingNodes.value = collectingNodes.value.map((item) => ({
|
collectingNodes.value = collectingNodes.value = transformData(collectingNodes.value);
|
||||||
value: item.id,
|
|
||||||
label: item.pointName,
|
|
||||||
children: item.children
|
|
||||||
? item.children.map((child) => ({
|
|
||||||
value: child.id,
|
|
||||||
label: child.pointName,
|
|
||||||
}))
|
|
||||||
: [],
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// 将数据转换为树形结构
|
||||||
|
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) => {
|
const selectNode = (value) => {
|
||||||
|
spinning.value = true;
|
||||||
const getConsumeData = ref({
|
const getConsumeData = ref({
|
||||||
acquisitionDate: acquisitionDate.value,
|
acquisitionDate: acquisitionDate.value,
|
||||||
collectionNode: value,
|
collectionNode: value,
|
||||||
@@ -1142,6 +1146,7 @@
|
|||||||
});
|
});
|
||||||
fetch(carbonInventoryCheck.nodeCancellationConsumption, getConsumeData.value).then((res) => {
|
fetch(carbonInventoryCheck.nodeCancellationConsumption, getConsumeData.value).then((res) => {
|
||||||
editFormState.value.consumption = res.data;
|
editFormState.value.consumption = res.data;
|
||||||
|
spinning.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 上传附件
|
// 上传附件
|
||||||
@@ -1696,6 +1701,13 @@
|
|||||||
background: #c9e4ff;
|
background: #c9e4ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:deep(.ant-empty) {
|
||||||
|
height: 80%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -1811,4 +1823,11 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: right;
|
justify-content: right;
|
||||||
}
|
}
|
||||||
|
:deep(.ant-empty) {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -39,7 +39,11 @@
|
|||||||
placeholder="请输入报告名称" />
|
placeholder="请输入报告名称" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item ref="name" label="报告年度" name="reportYear">
|
<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>
|
||||||
<a-form-item ref="name" label="适用标准" name="genericStandard">
|
<a-form-item ref="name" label="适用标准" name="genericStandard">
|
||||||
<a-input
|
<a-input
|
||||||
@@ -60,6 +64,7 @@
|
|||||||
<a-form-item ref="name" label="报告范围" name="reportScope">
|
<a-form-item ref="name" label="报告范围" name="reportScope">
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
v-model:value="formState.reportScope"
|
v-model:value="formState.reportScope"
|
||||||
|
:defaultPickerValue="defaultPickerValue"
|
||||||
picker="month"
|
picker="month"
|
||||||
:disabledDate="disabledDate"
|
:disabledDate="disabledDate"
|
||||||
valueFormat="YYYY-MM" />
|
valueFormat="YYYY-MM" />
|
||||||
@@ -79,6 +84,7 @@
|
|||||||
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
|
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
|
||||||
import fillIn from './fillInPage/index.vue';
|
import fillIn from './fillInPage/index.vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
import dayjs, { Dayjs } from 'dayjs';
|
||||||
defineOptions({ name: 'CarbonInventoryCheck' });
|
defineOptions({ name: 'CarbonInventoryCheck' });
|
||||||
const orgId = ref('');
|
const orgId = ref('');
|
||||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||||
@@ -105,6 +111,17 @@
|
|||||||
const selectChange = (value) => {
|
const selectChange = (value) => {
|
||||||
formState.value.reportScope = '';
|
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表单的必填
|
// 定义form表单的必填
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = {
|
||||||
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],
|
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],
|
||||||
|
@@ -360,6 +360,9 @@
|
|||||||
background: #f2f2f2 !important;
|
background: #f2f2f2 !important;
|
||||||
color: black !important;
|
color: black !important;
|
||||||
}
|
}
|
||||||
|
:deep(.ant-picker) {
|
||||||
|
border-radius: unset;
|
||||||
|
}
|
||||||
.month {
|
.month {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@@ -96,28 +96,32 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<!-- <template #summary>
|
<template #summary>
|
||||||
<a-table-summary-row>
|
<a-table-summary-row>
|
||||||
<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-table-summary-cell :colSpan="2">合计</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-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-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-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-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>-</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>{{ totalBudget + unit }}</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-table-summary-row>
|
</a-table-summary-row>
|
||||||
</template> -->
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -135,16 +139,16 @@
|
|||||||
v-model:value="formState.conversionRate"
|
v-model:value="formState.conversionRate"
|
||||||
:maxlength="15"
|
:maxlength="15"
|
||||||
@keydown="handleKeyDown"
|
@keydown="handleKeyDown"
|
||||||
suffix="%"
|
|
||||||
:disabled="disabled" />
|
:disabled="disabled" />
|
||||||
|
<span class="unit">%</span>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="预算值" :required="true">
|
<a-form-item label="预算值" :required="true">
|
||||||
<a-input-number
|
<a-input-number
|
||||||
v-model:value="formState.budget"
|
v-model:value="formState.budget"
|
||||||
:maxlength="15"
|
:maxlength="15"
|
||||||
@keydown="handleKeyDown"
|
@keydown="handleKeyDown"
|
||||||
suffix="kWh"
|
|
||||||
:disabled="!disabled" />
|
:disabled="!disabled" />
|
||||||
|
<span class="unit">kWh</span>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
@@ -247,6 +251,7 @@
|
|||||||
QuestionCircleOutlined,
|
QuestionCircleOutlined,
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
|
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
|
||||||
|
import { getEnumEnergy } from '/@/api';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
import { any, string } from 'vue-types';
|
import { any, string } from 'vue-types';
|
||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
@@ -265,8 +270,10 @@
|
|||||||
nodeName: {
|
nodeName: {
|
||||||
type: string,
|
type: string,
|
||||||
},
|
},
|
||||||
|
resourceType: {
|
||||||
|
type: string,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(props, 'xxy');
|
|
||||||
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;
|
||||||
@@ -291,11 +298,29 @@
|
|||||||
itemizeId: props.parentId,
|
itemizeId: props.parentId,
|
||||||
type: props.type,
|
type: props.type,
|
||||||
});
|
});
|
||||||
|
console.log(props.type, '6666');
|
||||||
const ids = ref([]);
|
const ids = ref([]);
|
||||||
|
const lastActualUsageList = ref([]);
|
||||||
|
// 获取单位
|
||||||
|
const unit = ref();
|
||||||
|
const totalActualUsage = ref();
|
||||||
|
const totalBudget = ref();
|
||||||
|
const totalLastYearActualUsage = ref();
|
||||||
|
const totalReferenceValue = ref();
|
||||||
const getTableData = () => {
|
const getTableData = () => {
|
||||||
fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then((res) => {
|
fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then(async (res) => {
|
||||||
data.value = res.data;
|
let resUnit = await getEnumEnergy({ params: { code: props.resourceType } });
|
||||||
ids.value = data.value.map((item) => item.id);
|
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();
|
getTableData();
|
||||||
@@ -313,14 +338,17 @@
|
|||||||
{
|
{
|
||||||
title: Number(props.year) - 1 + '年实际用量',
|
title: Number(props.year) - 1 + '年实际用量',
|
||||||
dataIndex: 'lastYearActualUsage',
|
dataIndex: 'lastYearActualUsage',
|
||||||
|
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: props.year + '年实际用量',
|
title: props.year + '年实际用量',
|
||||||
dataIndex: 'actualUsage',
|
dataIndex: 'actualUsage',
|
||||||
|
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '基准值',
|
title: '基准值',
|
||||||
dataIndex: 'referenceValue',
|
dataIndex: 'referenceValue',
|
||||||
|
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '是否按去年折算',
|
title: '是否按去年折算',
|
||||||
@@ -329,10 +357,12 @@
|
|||||||
{
|
{
|
||||||
title: '折算率',
|
title: '折算率',
|
||||||
dataIndex: 'conversionRate',
|
dataIndex: 'conversionRate',
|
||||||
|
customRender: ({ text }: { text: number }) => `${text}%`, // 在这里添加单位
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '2024年预算',
|
title: '2024年预算',
|
||||||
dataIndex: 'budget',
|
dataIndex: 'budget',
|
||||||
|
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, // 在这里添加单位
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@@ -346,10 +376,10 @@
|
|||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const formState = ref({});
|
const formState = ref({});
|
||||||
const labelCol = { span: 6 };
|
const labelCol = { span: 6 };
|
||||||
const wrapperCol = { span: 18 };
|
const wrapperCol = { span: 17 };
|
||||||
const editData = (record) => {
|
const editData = (record) => {
|
||||||
open.value = true;
|
open.value = true;
|
||||||
if (record.isLastYear) {
|
if (record.isLastYear !== undefined) {
|
||||||
formState.value.ids = [record.id];
|
formState.value.ids = [record.id];
|
||||||
if (record.lastYear === '是') {
|
if (record.lastYear === '是') {
|
||||||
formState.value.isLastYear = 1;
|
formState.value.isLastYear = 1;
|
||||||
@@ -357,6 +387,7 @@
|
|||||||
formState.value.isLastYear = 0;
|
formState.value.isLastYear = 0;
|
||||||
}
|
}
|
||||||
formState.value.conversionRate = record.conversionRate;
|
formState.value.conversionRate = record.conversionRate;
|
||||||
|
formState.value.lastYearList = [record.lastYearActualUsage];
|
||||||
formState.value.budget = record.budget;
|
formState.value.budget = record.budget;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -593,7 +624,7 @@
|
|||||||
'基准值',
|
'基准值',
|
||||||
],
|
],
|
||||||
top: '0',
|
top: '0',
|
||||||
left: '0',
|
right: '0',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#666',
|
color: '#666',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -649,6 +680,30 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
series: [
|
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 + '年实际用量',
|
name: Number(props.year) - 1 + '年实际用量',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
@@ -707,28 +762,6 @@
|
|||||||
},
|
},
|
||||||
data: actualUsageList.value,
|
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);
|
chartInstance = echarts.init(chartRef.value);
|
||||||
@@ -827,8 +860,8 @@
|
|||||||
background: #f7f9ff;
|
background: #f7f9ff;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(222, 255, 246, 1) 100%);
|
background: linear-gradient(180deg, #ffffff 0%, #defff663 100%);
|
||||||
border: 1px solid rgba(18, 174, 132, 1);
|
border: 1px solid #12ae8424;
|
||||||
.quantity {
|
.quantity {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -900,6 +933,11 @@
|
|||||||
) {
|
) {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
.unit {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.editable-row-operations a {
|
.editable-row-operations a {
|
||||||
|
@@ -69,7 +69,8 @@
|
|||||||
:parentId="parentId"
|
:parentId="parentId"
|
||||||
:year="year"
|
:year="year"
|
||||||
:type="type"
|
:type="type"
|
||||||
:nodeName="nodeName" />
|
:nodeName="nodeName"
|
||||||
|
:resourceType="resourceType" />
|
||||||
</div>
|
</div>
|
||||||
<!-- 新增节点 -->
|
<!-- 新增节点 -->
|
||||||
<a-drawer :visible="visible" :width="500" @close="onClose" :footer-style="{ textAlign: 'right' }">
|
<a-drawer :visible="visible" :width="500" @close="onClose" :footer-style="{ textAlign: 'right' }">
|
||||||
@@ -111,6 +112,7 @@
|
|||||||
import categoryDeatil from './categoryDeatil.vue';
|
import categoryDeatil from './categoryDeatil.vue';
|
||||||
import { group } from '/@/api/deviceManage';
|
import { group } from '/@/api/deviceManage';
|
||||||
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
|
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
|
||||||
|
import { getEnumEnergy } from '/@/api';
|
||||||
import type { TreeProps } from 'ant-design-vue';
|
import type { TreeProps } from 'ant-design-vue';
|
||||||
import 'echarts-liquidfill';
|
import 'echarts-liquidfill';
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -125,8 +127,6 @@
|
|||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(props, 'xxy');
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -306,8 +306,8 @@
|
|||||||
symbolSize: [14, 4],
|
symbolSize: [14, 4],
|
||||||
symbolMargin: 0.5,
|
symbolMargin: 0.5,
|
||||||
symbolPosition: 'start',
|
symbolPosition: 'start',
|
||||||
z: -20,
|
|
||||||
data: actualUsage.value,
|
data: actualUsage.value,
|
||||||
|
barGap: '5%',
|
||||||
label: {
|
label: {
|
||||||
normal: {
|
normal: {
|
||||||
show: false,
|
show: false,
|
||||||
@@ -327,8 +327,8 @@
|
|||||||
symbolSize: [14, 4],
|
symbolSize: [14, 4],
|
||||||
symbolMargin: 0.5,
|
symbolMargin: 0.5,
|
||||||
symbolPosition: 'start',
|
symbolPosition: 'start',
|
||||||
z: -20,
|
|
||||||
data: budget.value,
|
data: budget.value,
|
||||||
|
barGap: '5%',
|
||||||
label: {
|
label: {
|
||||||
normal: {
|
normal: {
|
||||||
show: false,
|
show: false,
|
||||||
@@ -346,7 +346,8 @@
|
|||||||
color: '#f4664a',
|
color: '#f4664a',
|
||||||
width: 2,
|
width: 2,
|
||||||
},
|
},
|
||||||
data: referenceValue.value,
|
// data: referenceValue.value,
|
||||||
|
data: [600],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@@ -393,7 +394,7 @@
|
|||||||
textStyle: {
|
textStyle: {
|
||||||
color: !selectedTime.value ? 'rgba(68, 197, 253,1)' : 'rgba(12, 168, 126, 1)',
|
color: !selectedTime.value ? 'rgba(68, 197, 253,1)' : 'rgba(12, 168, 126, 1)',
|
||||||
insideColor: '#12786f',
|
insideColor: '#12786f',
|
||||||
fontSize: 40,
|
fontSize: Number(ballData) > 1000 ? 20 : 40,
|
||||||
},
|
},
|
||||||
formatter: (params) => {
|
formatter: (params) => {
|
||||||
// return `${(params.value * 100).toFixed(2)}%`;
|
// return `${(params.value * 100).toFixed(2)}%`;
|
||||||
@@ -438,7 +439,7 @@
|
|||||||
const selectedKeys = ref<string[]>([]);
|
const selectedKeys = ref<string[]>([]);
|
||||||
const treeCheckedKeys = ref<string[]>([]);
|
const treeCheckedKeys = ref<string[]>([]);
|
||||||
const checkTreeNode = (checkedKeys, info) => {
|
const checkTreeNode = (checkedKeys, info) => {
|
||||||
treeCheckedKeys.value = checkedKeys;
|
treeCheckedKeys.value = checkedKeys.checked;
|
||||||
addTreeNode.value.itemizeIds = treeCheckedKeys.value;
|
addTreeNode.value.itemizeIds = treeCheckedKeys.value;
|
||||||
};
|
};
|
||||||
const formatTreeData = (treeData) => {
|
const formatTreeData = (treeData) => {
|
||||||
@@ -457,7 +458,9 @@
|
|||||||
year: selectYearValue.value.format('YYYY'),
|
year: selectYearValue.value.format('YYYY'),
|
||||||
});
|
});
|
||||||
const onSubmit = () => {
|
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;
|
data.value = res.data;
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
changeToYear();
|
changeToYear();
|
||||||
@@ -466,49 +469,6 @@
|
|||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
visible.value = false;
|
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({
|
const yearQueryParams = ref({
|
||||||
orgId: orgId.value,
|
orgId: orgId.value,
|
||||||
@@ -522,9 +482,13 @@
|
|||||||
addTreeNode.value.year = selectYearValue.value;
|
addTreeNode.value.year = selectYearValue.value;
|
||||||
getYearData();
|
getYearData();
|
||||||
};
|
};
|
||||||
|
// 获取单位
|
||||||
|
const unit = ref();
|
||||||
const getYearData = () => {
|
const getYearData = () => {
|
||||||
treeCheckedKeys.value = [];
|
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;
|
data.value = res.data;
|
||||||
res.data.forEach((item) => {
|
res.data.forEach((item) => {
|
||||||
treeCheckedKeys.value.push(item.itemizeId.toString());
|
treeCheckedKeys.value.push(item.itemizeId.toString());
|
||||||
@@ -548,7 +512,9 @@
|
|||||||
getMonthData();
|
getMonthData();
|
||||||
};
|
};
|
||||||
const 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;
|
data.value = res.data;
|
||||||
getMonthPillarData();
|
getMonthPillarData();
|
||||||
});
|
});
|
||||||
@@ -561,12 +527,61 @@
|
|||||||
const year = ref(selectYearValue.value.format('YYYY'));
|
const year = ref(selectYearValue.value.format('YYYY'));
|
||||||
const type = ref();
|
const type = ref();
|
||||||
const nodeName = ref();
|
const nodeName = ref();
|
||||||
|
const resourceType = ref();
|
||||||
const detailData = (record) => {
|
const detailData = (record) => {
|
||||||
electricTotal.value = false;
|
electricTotal.value = false;
|
||||||
parentId.value = record.itemizeId;
|
parentId.value = record.itemizeId;
|
||||||
type.value = props.tabId;
|
type.value = props.tabId;
|
||||||
nodeName.value = record.itemizeName;
|
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) => {
|
const customRow = (record) => {
|
||||||
return {
|
return {
|
||||||
//点击 行 进行查看详情
|
//点击 行 进行查看详情
|
||||||
|
@@ -70,7 +70,7 @@
|
|||||||
});
|
});
|
||||||
} else if (key === '4') {
|
} else if (key === '4') {
|
||||||
tabId.value = 6;
|
tabId.value = 6;
|
||||||
energyType.value = 'gongshuiliang';
|
energyType.value = 'GAS_USAGE';
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (provideWaterRef.value) {
|
if (provideWaterRef.value) {
|
||||||
provideWaterRef.value.electricTotal = true;
|
provideWaterRef.value.electricTotal = true;
|
||||||
|
Reference in New Issue
Block a user