|
|
@@ -19,21 +19,25 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</a-form>
|
|
|
|
</a-form>
|
|
|
|
<a-tree
|
|
|
|
<a-tree
|
|
|
|
:expanded-keys="expandedKeys"
|
|
|
|
:expanded-keys="expandedKeysL"
|
|
|
|
|
|
|
|
:selectedKeys="selectedKeysL"
|
|
|
|
:auto-expand-parent="autoExpandParent"
|
|
|
|
:auto-expand-parent="autoExpandParent"
|
|
|
|
:tree-data="gData"
|
|
|
|
:tree-data="gData"
|
|
|
|
|
|
|
|
v-if="gData && gData.length > 0"
|
|
|
|
:height="233"
|
|
|
|
:height="233"
|
|
|
|
show-line
|
|
|
|
show-line
|
|
|
|
style="padding: 0 16px !important;"
|
|
|
|
style="padding: 0 16px !important;"
|
|
|
|
@expand="onExpand"
|
|
|
|
@expand="onExpandL"
|
|
|
|
|
|
|
|
@select="onSelectL"
|
|
|
|
|
|
|
|
block-node
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #title="{ title }">
|
|
|
|
<template #title="{ cnValue }">
|
|
|
|
<span v-if="title.indexOf(searchValue) > -1">
|
|
|
|
<span v-if="cnValue && searchValue && cnValue.indexOf(searchValue) > -1">
|
|
|
|
{{ title.substring(0, title.indexOf(searchValue)) }}
|
|
|
|
{{ cnValue.substring(0, cnValue.indexOf(searchValue)) }}
|
|
|
|
<span style="color: #f50">{{ searchValue }}</span>
|
|
|
|
<span style="color: #f50">{{ searchValue }}</span>
|
|
|
|
{{ title.substring(title.indexOf(searchValue) + searchValue.length) }}
|
|
|
|
{{ cnValue.substring(cnValue.indexOf(searchValue) + searchValue.length) }}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<span v-else>{{ title }}</span>
|
|
|
|
<span v-else>{{ cnValue }}</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</a-tree>
|
|
|
|
</a-tree>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@@ -55,22 +59,21 @@
|
|
|
|
<div style="display: flex;" v-if="fillInPage">
|
|
|
|
<div style="display: flex;" v-if="fillInPage">
|
|
|
|
<div class="mainLeft">
|
|
|
|
<div class="mainLeft">
|
|
|
|
<a-tree
|
|
|
|
<a-tree
|
|
|
|
v-model:expandedKeys="expandedKeysR"
|
|
|
|
:expandedKeys="expandedKeysR"
|
|
|
|
v-model:selectedKeys="selectedKeys"
|
|
|
|
:selectedKeys="selectedKeysR"
|
|
|
|
v-model:checkedKeys="checkedKeys"
|
|
|
|
:checkedKeys="checkedKeys"
|
|
|
|
:tree-data="treeData"
|
|
|
|
:tree-data="treeData"
|
|
|
|
|
|
|
|
@select="onSelectR"
|
|
|
|
block-node
|
|
|
|
block-node
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #title="data">
|
|
|
|
<template #title="data">
|
|
|
|
<div class="treeRow">
|
|
|
|
<div class="treeRow">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<span>{{ data.title }}</span>
|
|
|
|
<span>{{ data.emissionSource }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="actionMore">
|
|
|
|
<div class="actionMore">
|
|
|
|
<EditOutlined v-if="!data.parentId" @click="editGroup(data)" />
|
|
|
|
<EditOutlined @click="editUnit(data)" />
|
|
|
|
<EditOutlined v-else @click="editUnit(data)" />
|
|
|
|
|
|
|
|
<MinusCircleOutlined style="margin-left: 6px;" @click="delUnit(data)" />
|
|
|
|
<MinusCircleOutlined style="margin-left: 6px;" @click="delUnit(data)" />
|
|
|
|
<PlusCircleOutlined v-if="!data.parentId" style="margin-left: 6px;" @click="addUnit(data)" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@@ -110,7 +113,7 @@
|
|
|
|
:scroll="{ x: 2000 }">
|
|
|
|
:scroll="{ x: 2000 }">
|
|
|
|
</a-table>
|
|
|
|
</a-table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-if="isClickedTplx">
|
|
|
|
<div v-if="isClickedTplx" style="width: 100%; height: 100%">
|
|
|
|
<div ref="tplxChart" style="width: 100%; height: 68vh"></div>
|
|
|
|
<div ref="tplxChart" style="width: 100%; height: 68vh"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@@ -136,9 +139,11 @@
|
|
|
|
<a-tree
|
|
|
|
<a-tree
|
|
|
|
:expanded-keys="categoryExpandedKeys"
|
|
|
|
:expanded-keys="categoryExpandedKeys"
|
|
|
|
:selectedKeys="categorySelectedKeys"
|
|
|
|
:selectedKeys="categorySelectedKeys"
|
|
|
|
|
|
|
|
:checkedKeys="categoryCheckedKeys"
|
|
|
|
:tree-data="categoryTreeData"
|
|
|
|
:tree-data="categoryTreeData"
|
|
|
|
v-if="categoryTreeData && categoryTreeData.length > 0"
|
|
|
|
v-if="categoryTreeData && categoryTreeData.length > 0"
|
|
|
|
class="draggable-tree"
|
|
|
|
class="draggable-tree"
|
|
|
|
|
|
|
|
@check="checkTreeNode"
|
|
|
|
checkable
|
|
|
|
checkable
|
|
|
|
block-node>
|
|
|
|
block-node>
|
|
|
|
<template #title="data">
|
|
|
|
<template #title="data">
|
|
|
@@ -152,7 +157,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<a-button style="margin-right: 8px" @click="closeCategoryConfig">取消</a-button>
|
|
|
|
<a-button style="margin-right: 8px" @click="closeCategoryConfig">取消</a-button>
|
|
|
|
<a-button type="primary" @click="closeUnitManag">确定</a-button>
|
|
|
|
<a-button type="primary" @click="submitCategory">确定</a-button>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</a-drawer>
|
|
|
|
</a-drawer>
|
|
|
|
<!-- 新增/编辑排放源树节点 -->
|
|
|
|
<!-- 新增/编辑排放源树节点 -->
|
|
|
@@ -170,41 +175,24 @@
|
|
|
|
: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="emissionSource">
|
|
|
|
|
|
|
|
<a-input v-model:value="formState.emissionSource" placeholder="请输入排放源" />
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
<a-form-item ref="name" label="计量单位" name="unitId">
|
|
|
|
|
|
|
|
<a-cascader v-model:value="formState.unitId" :options="measurementUnit" />
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
<a-form-item ref="name" label="温室气体" name="greenhouseGases">
|
|
|
|
<a-select
|
|
|
|
<a-select
|
|
|
|
ref="select"
|
|
|
|
ref="select"
|
|
|
|
v-model:value="formState.unit"
|
|
|
|
v-model:value="formState.greenhouseGases"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<a-select-option value="jack">Jack</a-select-option>
|
|
|
|
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id">
|
|
|
|
<a-select-option value="lucy">Lucy</a-select-option>
|
|
|
|
{{ item.cnValue }}
|
|
|
|
|
|
|
|
</a-select-option>
|
|
|
|
</a-select>
|
|
|
|
</a-select>
|
|
|
|
</a-form-item>
|
|
|
|
</a-form-item>
|
|
|
|
<a-form-item ref="name" label="计量单位" name="energyType">
|
|
|
|
<a-form-item ref="name" label="碳排单位" name="carbonEmissionUnits">
|
|
|
|
<a-select
|
|
|
|
<a-cascader v-model:value="formState.carbonEmissionUnits" :options="CarbonUnit" />
|
|
|
|
ref="select"
|
|
|
|
|
|
|
|
v-model:value="formState.unit"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-select-option value="jack">Jack</a-select-option>
|
|
|
|
|
|
|
|
<a-select-option value="lucy">Lucy</a-select-option>
|
|
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
<a-form-item ref="name" label="温室气体" name="energyType">
|
|
|
|
|
|
|
|
<a-select
|
|
|
|
|
|
|
|
ref="select"
|
|
|
|
|
|
|
|
v-model:value="formState.unit"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-select-option value="jack">Jack</a-select-option>
|
|
|
|
|
|
|
|
<a-select-option value="lucy">Lucy</a-select-option>
|
|
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
<a-form-item ref="name" label="碳排单位" name="energyType">
|
|
|
|
|
|
|
|
<a-select
|
|
|
|
|
|
|
|
ref="select"
|
|
|
|
|
|
|
|
v-model:value="formState.unit"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-select-option value="jack">Jack</a-select-option>
|
|
|
|
|
|
|
|
<a-select-option value="lucy">Lucy</a-select-option>
|
|
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
|
|
</a-form-item>
|
|
|
|
</a-form-item>
|
|
|
|
<!-- <a-form-item label="排放类型" name="emissionType" :required="isRequired">
|
|
|
|
<!-- <a-form-item label="排放类型" name="emissionType" :required="isRequired">
|
|
|
|
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型">
|
|
|
|
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型">
|
|
|
@@ -345,14 +333,14 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref, watch } from 'vue';
|
|
|
|
import { ref, watch, toRaw } from 'vue';
|
|
|
|
import { http } from '/nerv-lib/util/http';
|
|
|
|
import { http } from '/nerv-lib/util/http';
|
|
|
|
import { Pagination } from 'ant-design-vue';
|
|
|
|
import { Pagination, Modal, message } from 'ant-design-vue';
|
|
|
|
import type { TreeProps,TableColumnsType,UploadChangeParam } from 'ant-design-vue';
|
|
|
|
import type { TreeProps,TableColumnsType,UploadChangeParam } from 'ant-design-vue';
|
|
|
|
import { EditOutlined,PlusCircleOutlined,MinusCircleOutlined,UploadOutlined } from '@ant-design/icons-vue';
|
|
|
|
import { EditOutlined,PlusCircleOutlined,MinusCircleOutlined,UploadOutlined } from '@ant-design/icons-vue';
|
|
|
|
import * as echarts from 'echarts';
|
|
|
|
import * as echarts from 'echarts';
|
|
|
|
import { columns,voucherColumns,drawerColumns } from '../config';
|
|
|
|
import { columns,voucherColumns,drawerColumns } from '../config';
|
|
|
|
import { energyConsumption,carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
|
|
|
|
import { energyConsumption,carbonEmissionFactorLibrary,carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
|
|
|
|
defineOptions({
|
|
|
|
defineOptions({
|
|
|
|
energyType: 'fillInPage', // 与页面路由name一致缓存才可生效
|
|
|
|
energyType: 'fillInPage', // 与页面路由name一致缓存才可生效
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
@@ -362,7 +350,7 @@
|
|
|
|
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:orgId.value } ) => {
|
|
|
|
return http.post(api, params);
|
|
|
|
return http.post(api, params);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 左侧树结构
|
|
|
|
// 左侧树结构
|
|
|
@@ -424,13 +412,14 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return parentKey;
|
|
|
|
return parentKey;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const expandedKeys = ref<(string | number)[]>([]);
|
|
|
|
const expandedKeysL = ref<(string | number)[]>([]);
|
|
|
|
|
|
|
|
const selectedKeysL = ref<string[]>(['0-0']);
|
|
|
|
const searchValue = ref<string>('');
|
|
|
|
const searchValue = ref<string>('');
|
|
|
|
const autoExpandParent = ref<boolean>(true);
|
|
|
|
const autoExpandParent = ref<boolean>(true);
|
|
|
|
const gData = ref<TreeProps['treeData']>(genData);
|
|
|
|
const gData = ref<TreeProps['treeData']>(genData);
|
|
|
|
|
|
|
|
|
|
|
|
const onExpand = (keys: string[]) => {
|
|
|
|
const onExpandL = (keys: string[]) => {
|
|
|
|
expandedKeys.value = keys;
|
|
|
|
expandedKeysL.value = keys;
|
|
|
|
autoExpandParent.value = false;
|
|
|
|
autoExpandParent.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@@ -443,10 +432,34 @@
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.filter((item, i, self) => item && self.indexOf(item) === i);
|
|
|
|
.filter((item, i, self) => item && self.indexOf(item) === i);
|
|
|
|
expandedKeys.value = expanded;
|
|
|
|
expandedKeysL.value = expanded;
|
|
|
|
searchValue.value = value;
|
|
|
|
searchValue.value = value;
|
|
|
|
autoExpandParent.value = true;
|
|
|
|
autoExpandParent.value = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 被选中的树节点
|
|
|
|
|
|
|
|
const categoryId = ref()
|
|
|
|
|
|
|
|
const onSelectL = (selectedKey: string[], info: any) => {
|
|
|
|
|
|
|
|
selectedKeysL.value = selectedKey;
|
|
|
|
|
|
|
|
categoryId.value = info.node.id
|
|
|
|
|
|
|
|
formState.value.categoryId = categoryId.value
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// 获取碳盘查报告树
|
|
|
|
|
|
|
|
const selectedIds = ref([]);
|
|
|
|
|
|
|
|
const getReportTree = () => {
|
|
|
|
|
|
|
|
fetch(carbonInventoryCheck.getCategoryTree).then((res) => {
|
|
|
|
|
|
|
|
gData.value = res.data
|
|
|
|
|
|
|
|
if(res.data.length > 0){
|
|
|
|
|
|
|
|
categoryId.value = res.data[0].id
|
|
|
|
|
|
|
|
formState.value.categoryId = categoryId.value
|
|
|
|
|
|
|
|
selectedIds.value = getAllIds(gData.value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
getEmissionSourceTree();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
getReportTree();
|
|
|
|
|
|
|
|
const getAllIds = (nodes: TreeNode[]): number[] => {
|
|
|
|
|
|
|
|
return nodes.flatMap(node => [node.id, ...(node.children ? getAllIds(node.children) : [])]);
|
|
|
|
|
|
|
|
};
|
|
|
|
// 填报表格数据
|
|
|
|
// 填报表格数据
|
|
|
|
const data = [...Array(12)].map((_, i) => ({
|
|
|
|
const data = [...Array(12)].map((_, i) => ({
|
|
|
|
key: i,
|
|
|
|
key: i,
|
|
|
@@ -460,36 +473,25 @@
|
|
|
|
gender: 'M',
|
|
|
|
gender: 'M',
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
// 右侧树数据
|
|
|
|
// 右侧树数据
|
|
|
|
const treeData: TreeProps['treeData'] = [
|
|
|
|
const treeData = ref<TreeProps['treeData']>(genData);
|
|
|
|
{
|
|
|
|
// 获取数据
|
|
|
|
title: 'parent 1',
|
|
|
|
const getEmissionSourceTree = () => {
|
|
|
|
key: '0-0',
|
|
|
|
fetch(carbonInventoryCheck.getInventoryTree, { categoryId: categoryId.value }).then((res) => {
|
|
|
|
children: [
|
|
|
|
treeData.value = res.data
|
|
|
|
{
|
|
|
|
});
|
|
|
|
title: 'parent 1-0',
|
|
|
|
};
|
|
|
|
key: '0-0-0',
|
|
|
|
// 排放源树中被选中的树节点
|
|
|
|
children: [
|
|
|
|
const onSelectR = (selectedKey: string[], info: any) => {
|
|
|
|
{ title: 'leaf', key: '0-0-0-0'},
|
|
|
|
selectedKeysR.value = selectedKey;
|
|
|
|
{ title: 'leaf', key: '0-0-0-1' },
|
|
|
|
};
|
|
|
|
],
|
|
|
|
const expandedKeysR = ref<string[]>([]);
|
|
|
|
},
|
|
|
|
const selectedKeysR = ref<string[]>(['0-0']);
|
|
|
|
{
|
|
|
|
const checkedKeys = ref<string[]>([]);
|
|
|
|
title: 'parent 1-1',
|
|
|
|
|
|
|
|
key: '0-0-1',
|
|
|
|
|
|
|
|
children: [{ key: '0-0-1-0', title: 'sss' }],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const expandedKeysR = ref<string[]>(['0-0-0', '0-0-1']);
|
|
|
|
|
|
|
|
const selectedKeys = ref<string[]>(['0-0-0', '0-0-1']);
|
|
|
|
|
|
|
|
const checkedKeys = ref<string[]>(['0-0-0', '0-0-1']);
|
|
|
|
|
|
|
|
watch(expandedKeysR, () => {
|
|
|
|
watch(expandedKeysR, () => {
|
|
|
|
console.log('expandedKeysR', expandedKeysR);
|
|
|
|
console.log('expandedKeysR', expandedKeysR);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
watch(selectedKeys, () => {
|
|
|
|
watch(selectedKeysR, () => {
|
|
|
|
console.log('selectedKeys', selectedKeys);
|
|
|
|
console.log('selectedKeys', selectedKeysR);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
watch(checkedKeys, () => {
|
|
|
|
watch(checkedKeys, () => {
|
|
|
|
console.log('checkedKeys', checkedKeys);
|
|
|
|
console.log('checkedKeys', checkedKeys);
|
|
|
@@ -500,14 +502,44 @@
|
|
|
|
const categoryTreeData = ref<TreeProps['treeData']>(genData);
|
|
|
|
const categoryTreeData = ref<TreeProps['treeData']>(genData);
|
|
|
|
const categoryExpandedKeys = ref<string[]>();
|
|
|
|
const categoryExpandedKeys = ref<string[]>();
|
|
|
|
const categorySelectedKeys = ref<string[]>([]);
|
|
|
|
const categorySelectedKeys = ref<string[]>([]);
|
|
|
|
|
|
|
|
const categoryCheckedKeys = ref<string[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const checkTreeNode = (checkedKeys, info) => {
|
|
|
|
|
|
|
|
categoryCheckedKeys.value = checkedKeys
|
|
|
|
|
|
|
|
queryConfigure.value.dictionaryIdList = categoryCheckedKeys.value
|
|
|
|
|
|
|
|
}
|
|
|
|
const getUnitTree = () => {
|
|
|
|
const getUnitTree = () => {
|
|
|
|
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement).then((res) => {
|
|
|
|
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement,{grp:'CATEGORY_CONFIGURATION'}).then((res) => {
|
|
|
|
categoryTreeData.value = res.data
|
|
|
|
categoryTreeData.value = res.data
|
|
|
|
|
|
|
|
categoryCheckedKeys.value = selectedIds.value.map(id => String(id));
|
|
|
|
|
|
|
|
// 格式化树节点数据并设置 key
|
|
|
|
|
|
|
|
categoryTreeData.value = formatTreeData(categoryTreeData.value);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getUnitTree()
|
|
|
|
|
|
|
|
|
|
|
|
const formatTreeData = (treeData) => {
|
|
|
|
|
|
|
|
return treeData.map(node => {
|
|
|
|
|
|
|
|
const newNode = { ...node };
|
|
|
|
|
|
|
|
newNode.key = String(node.id); // 将 id 转换为字符串作为 key
|
|
|
|
|
|
|
|
if (node.children) {
|
|
|
|
|
|
|
|
newNode.children = formatTreeData(node.children);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return newNode;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
const openCategoryConfig = () => {
|
|
|
|
const openCategoryConfig = () => {
|
|
|
|
categoryConfig.value = true;
|
|
|
|
categoryConfig.value = true;
|
|
|
|
|
|
|
|
getUnitTree()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// 类别配置树点击确定
|
|
|
|
|
|
|
|
const queryConfigure = ref({
|
|
|
|
|
|
|
|
orgId:orgId.value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const submitCategory = () => {
|
|
|
|
|
|
|
|
fetch(carbonInventoryCheck.updateCategoryTree,queryConfigure.value).then((res) => {
|
|
|
|
|
|
|
|
categoryConfig.value = false;
|
|
|
|
|
|
|
|
getReportTree();
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const closeCategoryConfig = () => {
|
|
|
|
const closeCategoryConfig = () => {
|
|
|
|
categoryConfig.value = false;
|
|
|
|
categoryConfig.value = false;
|
|
|
@@ -518,15 +550,138 @@
|
|
|
|
const labelCol = { span: 5 };
|
|
|
|
const labelCol = { span: 5 };
|
|
|
|
const wrapperCol = { span: 19 };
|
|
|
|
const wrapperCol = { span: 19 };
|
|
|
|
const formState = ref({
|
|
|
|
const formState = ref({
|
|
|
|
orgId: orgId.value,
|
|
|
|
orgId: orgId.value
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
// 计量单位的变量
|
|
|
|
|
|
|
|
const measurementUnit = ref([])
|
|
|
|
|
|
|
|
// 碳排单位变量
|
|
|
|
|
|
|
|
const CarbonUnit = ref([])
|
|
|
|
|
|
|
|
// 温室气体变量
|
|
|
|
|
|
|
|
const groupData = ref([])
|
|
|
|
// 定义form表单的必填
|
|
|
|
// 定义form表单的必填
|
|
|
|
const rules: Record<string, Rule[]> = {
|
|
|
|
const rules: Record<string, Rule[]> = {
|
|
|
|
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
|
|
|
|
emissionSource: [{ required: true, message: '请输入排放源', trigger: 'change' }],
|
|
|
|
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }]
|
|
|
|
unitId: [{ required: true, message: '请选择计量单位', trigger: 'change' }],
|
|
|
|
|
|
|
|
greenhouseGases: [{ required: true, message: '请选择温室气体', trigger: 'change' }],
|
|
|
|
|
|
|
|
carbonEmissionUnits: [{ required: true, message: '请选择碳排单位', trigger: 'change' }],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const addTreeNodeData = () => {
|
|
|
|
const addTreeNodeData = () => {
|
|
|
|
addTreeNodeVisible.value = true;
|
|
|
|
addTreeNodeVisible.value = true;
|
|
|
|
|
|
|
|
getDictData()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// 获取字典值
|
|
|
|
|
|
|
|
const getDictData = () => {
|
|
|
|
|
|
|
|
// 获取计量单位的数据
|
|
|
|
|
|
|
|
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(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'GREENHOUSE_GASES'}).then((res) => {
|
|
|
|
|
|
|
|
CarbonUnit.value = res.data
|
|
|
|
|
|
|
|
CarbonUnit.value = CarbonUnit.value.map(item => ({
|
|
|
|
|
|
|
|
value: item.id,
|
|
|
|
|
|
|
|
label: item.cnValue,
|
|
|
|
|
|
|
|
children: item.children ? item.children.map(child => ({
|
|
|
|
|
|
|
|
value: child.id,
|
|
|
|
|
|
|
|
label: child.cnValue
|
|
|
|
|
|
|
|
})) : []
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// 获取温室气体数据
|
|
|
|
|
|
|
|
fetch(carbonEmissionFactorLibrary.findOutermost,{grp:'GREENHOUSE_GASES'}).then((res) => {
|
|
|
|
|
|
|
|
groupData.value = res.data
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
|
|
|
|
|
formRef.value
|
|
|
|
|
|
|
|
.validate()
|
|
|
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
|
|
console.log('values', formState, toRaw(formState));
|
|
|
|
|
|
|
|
if(formState.value.unitId){
|
|
|
|
|
|
|
|
formState.value.unitId = formState.value.unitId.join(',').split(',')[1]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(formState.value.carbonEmissionUnits){
|
|
|
|
|
|
|
|
formState.value.carbonEmissionUnits = formState.value.carbonEmissionUnits.join(',').split(',')[1]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(formState.value.id){
|
|
|
|
|
|
|
|
fetch(carbonInventoryCheck.update , formState.value).then((res) => {
|
|
|
|
|
|
|
|
addTreeNodeVisible.value = false
|
|
|
|
|
|
|
|
formState.value = {
|
|
|
|
|
|
|
|
orgId: orgId.value,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message.success('操作成功!');
|
|
|
|
|
|
|
|
getEmissionSourceTree();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
fetch(carbonInventoryCheck.create , formState.value).then((res) => {
|
|
|
|
|
|
|
|
addTreeNodeVisible.value = false
|
|
|
|
|
|
|
|
formState.value = {
|
|
|
|
|
|
|
|
orgId: orgId.value,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message.success('操作成功!');
|
|
|
|
|
|
|
|
getEmissionSourceTree();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
console.log('error', error);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const editUnit = (data) => {
|
|
|
|
|
|
|
|
getDictData()
|
|
|
|
|
|
|
|
addTreeNodeVisible.value = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
let selectDevice = ref([Number(data.unitId)]);
|
|
|
|
|
|
|
|
findParentIds(measurementUnit.value, data.unitId, selectDevice.value);
|
|
|
|
|
|
|
|
data.unitId = selectDevice
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let selectDeviceC = ref([Number(data.carbonEmissionUnits)]);
|
|
|
|
|
|
|
|
findParentIds(CarbonUnit.value, data.carbonEmissionUnits, selectDeviceC.value);
|
|
|
|
|
|
|
|
data.carbonEmissionUnits = selectDeviceC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formState.value.id = data.id
|
|
|
|
|
|
|
|
formState.value = data
|
|
|
|
|
|
|
|
}, 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 delUnit = (data) => {
|
|
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
|
|
title: '警告',
|
|
|
|
|
|
|
|
content: '确定要删除吗?',
|
|
|
|
|
|
|
|
okText: '确定',
|
|
|
|
|
|
|
|
okType: 'primary',
|
|
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
|
|
onOk() {
|
|
|
|
|
|
|
|
fetch(carbonInventoryCheck.del , {id:data.id}).then((res) => {
|
|
|
|
|
|
|
|
message.success('操作成功!');
|
|
|
|
|
|
|
|
getEmissionSourceTree();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
|
|
|
|
console.log('Cancel');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const onClose = () => {
|
|
|
|
const onClose = () => {
|
|
|
|
addTreeNodeVisible.value = false;
|
|
|
|
addTreeNodeVisible.value = false;
|
|
|
@@ -637,7 +792,9 @@
|
|
|
|
fillInPage.value = false
|
|
|
|
fillInPage.value = false
|
|
|
|
isClickedPftj.value = false
|
|
|
|
isClickedPftj.value = false
|
|
|
|
isClickedTplx.value = true
|
|
|
|
isClickedTplx.value = true
|
|
|
|
drawEcharts();
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
drawEcharts();
|
|
|
|
|
|
|
|
}, 500);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 排放统计表头
|
|
|
|
// 排放统计表头
|
|
|
|
const pftjColumn = [
|
|
|
|
const pftjColumn = [
|
|
|
@@ -939,8 +1096,8 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
itemStyleColor.push(datalist[d]);
|
|
|
|
itemStyleColor.push(datalist[d]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
option = {
|
|
|
|
const option = {
|
|
|
|
backgroundColor: "#031d7a",
|
|
|
|
backgroundColor: "transparent",
|
|
|
|
tooltip: {
|
|
|
|
tooltip: {
|
|
|
|
trigger: "item",
|
|
|
|
trigger: "item",
|
|
|
|
triggerOn: "mousemove",
|
|
|
|
triggerOn: "mousemove",
|
|
|
@@ -1171,7 +1328,7 @@
|
|
|
|
height: 5vh;
|
|
|
|
height: 5vh;
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-evenly;
|
|
|
|
margin-left: 10%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.treePart{
|
|
|
|
.treePart{
|
|
|
|
width: 70%;
|
|
|
|
width: 70%;
|
|
|
|