Browse Source

taskid:282,remark:'commit'

temp
fks-xuxinyue 4 months ago
parent
commit
1990fd11e6
  1. 4
      hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
  2. 1
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/carbonEmissions/index.vue
  3. 1
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/index.vue
  4. 248
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue
  5. 117
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue
  6. 36
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue

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

@ -79,7 +79,11 @@ export enum uploadPic {
// 碳规划
export enum carbonPlanning {
// 全部
whole = '/carbon-smart/api/carbon/planning/whole',
// 详情
searchListByYear = '/carbon-smart/api/carbon/planning/searchListByYear',
searchListByMonth = '/carbon-smart/api/carbon/planning/searchListByMonth',
yearAndMonthAchievement = '/carbon-smart/api/carbon/planning/yearAndMonthAchievement',
annualElectricityConsumption = '/carbon-smart/api/carbon/planning/annualElectricityConsumption',
electricityUsageBackThen = '/carbon-smart/api/carbon/planning/electricityUsageBackThen',
}

1
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/carbonEmissions/index.vue

@ -54,7 +54,6 @@
//
const changeYearData = () => {
debugger
queryParams.value.year = selectYear.value;
getTableList();
};

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

@ -37,6 +37,7 @@
energyConsumptionRef.value.mainRef.nsTableRef.reload();
}
} else if (key === '2') {
debugger
if (carbonEmissionsRef.value) {
carbonEmissionsRef.value.getTableList(); //
}

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

@ -3,8 +3,18 @@
<div class="ns-form-title">
<div class="title">
<span>查询</span>
<a-date-picker v-if="selectedTime" style="margin-left: 5%" :value="value5" picker="year" />
<a-date-picker v-else style="margin-left: 5%" :value="value5" picker="month" />
<a-date-picker
v-if="selectedTime"
style="margin-left: 5%"
valueFormat="YYYY"
:value="selectYear"
picker="year" />
<a-date-picker
v-else
style="margin-left: 5%"
valueFormat="YYYY-MM"
:value="selectMonth"
picker="month" />
</div>
<div class="operation">
<div class="month" :style="monthStyles" @click="changeToMonth"><span></span></div>
@ -13,11 +23,11 @@
</div>
<div class="contant">
<div class="chartsPart">
<div class="electricityConsumption" ref="ydlChart"></div>
<div class="electricityConsumption" ref="ydlChart"></div>
<div class="electricityConsumption" ref="ydlChart"></div>
<div class="electricityConsumption" ref="ydlChart"></div>
<div class="electricityConsumption" ref="ydlChart"></div>
<template v-for="(item, index) in data" :key="index">
<div class="electricityConsumption">
<div :id="'ydlChart_' + index" style="height: 100%; width: 100%"></div>
</div>
</template>
</div>
<div class="tablePart">
<a-table :columns="columns" :data-source="data" bordered :pagination="false"> </a-table>
@ -27,13 +37,22 @@
</template>
<script lang="ts" setup>
import { ref,defineExpose } from 'vue';
import type { Dayjs } from 'dayjs';
import { ref, defineExpose } from 'vue';
import dayjs, { Dayjs } from 'dayjs';
import * as echarts from 'echarts';
import { http } from '/nerv-lib/util/http';
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({
energyType: 'all', // name
});
const value5 = ref<Dayjs>();
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId }) => {
return http.post(api, params);
};
const selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
const selectMonth = ref<Dayjs>();
// /
const monthStyles = ref('background: #f2f2f2');
const yearStyles = ref('background: #2778ff');
@ -41,108 +60,126 @@
const changeToMonth = () => {
monthStyles.value = 'background: #2778ff';
yearStyles.value = 'background: #f2f2f2';
queryParams.value.yearAndMonth = 'month';
queryParams.value.year = selectMonth.value;
columns.value[2].title = '月份';
columns.value[2].dataIndex = 'month';
selectedTime.value = false;
getTableData();
};
const changeToYear = () => {
monthStyles.value = 'background: #f2f2f2';
yearStyles.value = 'background: #2778ff';
queryParams.value.yearAndMonth = 'year';
queryParams.value.year = selectYear.value;
columns.value[2].title = '年份';
columns.value[2].dataIndex = 'year';
selectedTime.value = true;
getTableData();
};
//
const ydlChart = ref(null);
const ydlChart = ref({});
let chartInstance: echarts.ECharts | null = null;
const drawEcharts = () => {
chartInstance = echarts.init(ydlChart.value);
const handred = 100;
let point = 66;
const option = {
backgroundColor: 'transparent',
title: [
{
text: point + '%',
x: 'center',
y: '35%',
textStyle: {
fontSize: 14,
fontWeight: 'normal',
fontStyle: 'normal',
data.value.forEach((item, index) => {
const chart = echarts.init(document.getElementById(`ydlChart_${index}`)!);
const handred = 100;
let point = parseInt(item.budgetAchievement.replace("%", ""));
const option = {
backgroundColor: 'transparent',
title: [
{
text: point + '%',
x: 'center',
y: '35%',
textStyle: {
fontSize: 14,
fontWeight: 'normal',
fontStyle: 'normal',
},
},
},
{
text: '用电量预算达成率',
x: 'center',
y: '85%',
textStyle: {
fontSize: 14,
fontWeight: 'normal',
fontStyle: 'normal',
{
text: item.budgetAchievementName,
x: 'center',
y: '85%',
textStyle: {
fontSize: 14,
fontWeight: 'normal',
fontStyle: 'normal',
},
},
},
],
tooltip: {
formatter: function (params) {
return params.name + ':' + params.percent + ' %';
},
},
series: [
{
name: 'circle',
type: 'pie',
clockWise: true,
radius: ['40%', '50%'],
center: ['50%', '40%'],
itemStyle: {
normal: {
label: {
show: false,
},
labelLine: {
show: false,
],
// tooltip: {
// formatter: function (params) {
// return params.name + '' + params.percent + ' %';
// },
// },
series: [
{
name: 'circle',
type: 'pie',
clockWise: true,
radius: ['40%', '50%'],
center: ['50%', '40%'],
itemStyle: {
normal: {
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
hoverAnimation: false,
data: [
{
value: point,
name: '占比',
itemStyle: {
normal: {
color: '#4FADFD',
label: {
show: false,
},
labelLine: {
show: false,
hoverAnimation: false,
data: [
{
value: point,
name: '占比',
itemStyle: {
normal: {
color: '#4FADFD',
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
},
{
name: '剩余',
value: handred - point,
itemStyle: {
normal: {
color: '#E1E8EE',
{
name: '剩余',
value: handred - point,
itemStyle: {
normal: {
color: '#E1E8EE',
},
},
},
},
],
},
],
};
chartInstance = echarts.init(ydlChart.value);
chartInstance.setOption(option);
],
},
],
};
chart.setOption(option);
});
};
defineExpose({
drawEcharts,
});
//
const queryParams = ref({
orgId: orgId.value,
year: selectYear.value.format('YYYY'),
yearAndMonth: 'year',
});
const getTableData = () => {
fetch(carbonPlanning.whole, queryParams.value).then((res) => {
data.value = res.data;
setTimeout(() => {
drawEcharts();
}, 500);
});
};
const columns = ref([
{
title: '序号',
@ -152,11 +189,11 @@
},
{
title: '名称',
dataIndex: 'name',
dataIndex: 'itemizeName',
},
{
title: '年份',
dataIndex: 'name',
dataIndex: 'year',
},
{
title: '计量单位',
@ -164,46 +201,31 @@
},
{
title: '总实际用量',
dataIndex: 'money',
dataIndex: 'actualUsage',
},
{
title: '总预算量',
dataIndex: 'address',
dataIndex: 'budget',
},
{
title: '基准值',
dataIndex: 'address',
dataIndex: 'referenceValue',
},
{
title: '节能量',
dataIndex: 'address',
dataIndex: 'energyConservation',
},
{
title: '预算达成率',
dataIndex: 'address',
dataIndex: 'budgetAchievement',
},
]);
const data = [
{
key: '1',
name: 'John Brown',
money: '¥300,000.00',
address: 'New York No. 1 Lake Park',
},
{
key: '2',
name: 'Jim Green',
money: '¥1,256,000.00',
address: 'London No. 1 Lake Park',
},
{
key: '3',
name: 'Joe Black',
money: '¥120,000.00',
address: 'Sidney No. 1 Lake Park',
},
];
const data = ref([]);
getTableData();
defineExpose({
getTableData,
});
</script>
<style lang="less" scoped>

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

@ -73,6 +73,14 @@
defineOptions({
energyType: 'all', // name
});
// id
const props = defineProps({
tabId: {
type: Number,
},
});
console.log(props, 'xxy');
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
@ -93,6 +101,9 @@
columns.value[2].dataIndex = 'month';
selectedTime.value = false;
getMonthData();
getBallQuery.value.yearAndMonth = 'month';
getBallData();
getMonthPillarData();
};
const changeToYear = () => {
monthStyles.value = 'background: #f2f2f2';
@ -101,10 +112,40 @@
columns.value[2].dataIndex = 'year';
selectedTime.value = true;
getYearData();
getBallQuery.value.yearAndMonth = 'year';
getBallData();
getYearPillarData();
};
// echarts
const pillarChartRef = ref(null);
let chartInstance: echarts.ECharts | null = null;
const getPillarQuery = ref({
orgId: orgId.value,
type: props.tabId,
year: selectYearValue.value.format('YYYY'),
});
const xAxisData = ref([]);
const referenceValue = ref([]);
const budget = ref([]);
const actualUsage = ref([]);
const getYearPillarData = () => {
fetch(carbonPlanning.annualElectricityConsumption, getPillarQuery.value).then((res) => {
xAxisData.value = res.data.year;
referenceValue.value = res.data.referenceValue;
budget.value = res.data.budget;
actualUsage.value = res.data.actualUsage;
drawPillarChart();
});
};
const getMonthPillarData = () => {
fetch(carbonPlanning.electricityUsageBackThen, getPillarQuery.value).then((res) => {
xAxisData.value = res.data.year;
referenceValue.value = res.data.referenceValue;
budget.value = res.data.budget;
actualUsage.value = res.data.actualUsage;
drawPillarChart();
});
};
const drawPillarChart = () => {
chartInstance = echarts.init(pillarChartRef.value);
const option = {
@ -125,7 +166,7 @@
bottom: '10%',
},
legend: {
data: ['昨日总人数', '今日实时人数', '昨日使用率'],
data: ['实际用量', '预算量', '基准线'],
top: '0',
left: '0',
textStyle: {
@ -134,7 +175,7 @@
},
},
xAxis: {
data: ['2020', '2021', '2022', '2023', '2024'],
data: xAxisData.value,
axisLine: {
show: true, //X线
lineStyle: {
@ -182,7 +223,7 @@
],
series: [
{
name: '昨日总人数',
name: '实际用量',
type: 'bar',
barWidth: 18,
itemStyle: {
@ -190,10 +231,10 @@
color: '#6395f9',
},
},
data: [24, 45, 43, 35, 76],
data: actualUsage.value,
},
{
name: '今日实时人数',
name: '预算量',
type: 'bar',
barWidth: 18,
itemStyle: {
@ -201,10 +242,10 @@
color: '#62daab',
},
},
data: [133, 23, 114, 67, 89],
data: budget.value,
},
{
name: '昨日使用率',
name: '基准线',
type: 'line',
smooth: true, // 线
symbol: 'none', //
@ -212,7 +253,7 @@
color: '#f4664a',
width: 2,
},
data: [4.2, 3.5, 2.9, 7.8, 2],
data: referenceValue.value,
},
],
};
@ -220,25 +261,65 @@
chartInstance.setOption(option);
};
const ballChartRef = ref(null);
const getBallQuery = ref({
orgId: orgId.value,
type: props.tabId,
year: selectYearValue.value.format('YYYY'),
yearAndMonth: 'year',
});
const ballValue = ref();
const getBallData = () => {
fetch(carbonPlanning.yearAndMonthAchievement, getBallQuery.value).then((res) => {
ballValue.value = res.data;
drawSQ();
});
};
let ballChartInstance: echarts.ECharts | null = null;
const drawSQ = () => {
ballChartInstance = echarts.init(ballChartRef.value);
let ballData = (Number(ballValue.value)/100).toFixed(2)
const option = {
series: [
{
type: 'liquidFill',
data: [0.6, 0.5, 0.4, 0.3],
radius: '80%',
radius: '78.1%',
center: ['50%', '50%'],
color: ['#ecf3fe', '#c8dcfe', '#5594fa'],
data: [ballData, ballData, ballData], // data
amplitude: 5,
//
itemStyle: {
opacity: 1, //
shadowBlur: 0, //
},
label: {
show: true,
textStyle: {
color: '#5594fa',
insideColor: '#12786f',
fontSize: 40,
},
formatter: (params) => {
// return `${(params.value * 100).toFixed(2)}%`;
return `${Number(params.value * 100).toFixed(2)}%`;
},
},
outline: {
show: true,
borderDistance: 5,
itemStyle: {
borderColor: 'rgba(68, 197, 253,1)',
borderWidth: 2,
},
},
},
],
};
ballChartInstance = echarts.init(ballChartRef.value);
ballChartInstance.setOption(option);
};
setTimeout(() => {
drawPillarChart();
drawSQ();
}, 500);
//
const visible = ref(false);
const addNode = () => {
@ -293,7 +374,7 @@
//
const yearQueryParams = ref({
orgId: orgId.value,
type: 1,
type: props.tabId,
year: selectYearValue.value.format('YYYY'),
});
const changeYear = () => {
@ -308,8 +389,8 @@
//
const monthQueryParams = ref({
orgId: orgId.value,
type: 1,
yearMonth: selectMonthValue.value,
type: props.tabId,
yearMonth: selectYearValue.value.format('YYYY'),
});
const changeMonth = () => {
monthQueryParams.value.yearMonth = selectMonthValue.value;
@ -322,6 +403,8 @@
};
defineExpose({
getYearData,
getBallData,
getYearPillarData,
});
const parentId = ref();
const detailData = (record) => {

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

@ -1,10 +1,10 @@
<template>
<a-tabs v-model:activeKey="activeKey" @change="handleTabChange">
<a-tab-pane key="1" tab="全部">
<a-tab-pane key="1" tab="全部">
<all ref="allRef" />
</a-tab-pane>
<a-tab-pane key="2" tab="用电量" force-render>
<category ref="electricRef" />
<a-tab-pane key="2" tab="用电量">
<category ref="electricRef" :tabId="tabId" />
</a-tab-pane>
<a-tab-pane key="3" tab="用水量">
<category ref="useWaterRef" />
@ -21,14 +21,14 @@
</a-tabs>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { ref, nextTick } from 'vue';
import all from './all/index.vue';
import category from './category/index.vue';
defineOptions({
name: 'carbonPlanning', // name
components: {
all,
category
category,
},
});
const activeKey = ref('1');
@ -39,30 +39,38 @@
const carbonEmissionsRef = ref<InstanceType<typeof category> | null>(null);
const provideHotRef = ref<InstanceType<typeof category> | null>(null);
// tab
const tabId = ref(1);
const handleTabChange = (key) => {
console.log('Tab changed:', key);
//
if (key === '1') {
if (allRef.value) {
allRef.value.drawEcharts();
}
nextTick(() => {
if (allRef.value) {
allRef.value.getTableData();
}
});
} else if (key === '2') {
if (electricRef.value) {
electricRef.value.getYearData(); //
}
nextTick(() => {
if (electricRef.value) {
tabId.value = 1;
electricRef.value.getYearData(); //
electricRef.value.getBallData();
electricRef.value.getYearPillarData();
}
});
} else if (key === '3') {
if (useWaterRef.value) {
useWaterRef.value.getYearData();
}
}else if (key === '4') {
} else if (key === '4') {
if (provideWaterRef.value) {
provideWaterRef.value.getYearData();
}
}else if (key === '5') {
} else if (key === '5') {
if (carbonEmissionsRef.value) {
carbonEmissionsRef.value.getYearData();
}
}else if (key === '6') {
} else if (key === '6') {
if (provideHotRef.value) {
provideHotRef.value.getYearData();
}

Loading…
Cancel
Save