update 综合
This commit is contained in:
@@ -6,25 +6,123 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="elec-cost">elec cost</div>
|
||||
<LineChartBase
|
||||
v-if="1"
|
||||
:legend="legend"
|
||||
:series="series"
|
||||
:xAxis="xAxis"
|
||||
in="elecCost"
|
||||
class="elec-cost"
|
||||
/>
|
||||
<BarChartBase
|
||||
v-else
|
||||
:legend="legend"
|
||||
:series="series"
|
||||
:xAxis="xAxis"
|
||||
in="elecCost"
|
||||
class="elec-cost"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BarChartBaseVue from "@/views/copilot/components/BarChartBase.vue";
|
||||
import LineChartBaseVue from "@/views/copilot/components/LineChartBase.vue";
|
||||
|
||||
export default {
|
||||
name: "ElecCost",
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
return {};
|
||||
components: {
|
||||
BarChartBase: BarChartBaseVue,
|
||||
LineChartBase: LineChartBaseVue,
|
||||
},
|
||||
props: {
|
||||
period: {
|
||||
type: String,
|
||||
default: "日",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
// 城市数组的顺序必须是固定的
|
||||
const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
|
||||
return {
|
||||
xAxis: cities,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
legend() {
|
||||
switch (this.period) {
|
||||
case "日":
|
||||
return [{ label: "昨日", color: "#12f7f1" }];
|
||||
case "周":
|
||||
return [{ label: "本周", color: "#12f7f1" }];
|
||||
case "月": {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
return [
|
||||
{ label: `${year - 1}年${month}月`, color: "#12f7f1" },
|
||||
{ label: `${year}年${month}月`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
case "年": {
|
||||
const year = new Date().getFullYear();
|
||||
return [
|
||||
{ label: `${year - 1}年`, color: "#12f7f1" },
|
||||
{ label: `${year}年`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
default:
|
||||
return [
|
||||
{ label: `${year - 1}年`, color: "#12f7f1" },
|
||||
{ label: `${year}年`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
},
|
||||
series() {
|
||||
const { ftoInvest } = this.$store.getters.copilot.yield;
|
||||
let dataList = null;
|
||||
|
||||
switch (this.period) {
|
||||
case "日":
|
||||
case "周":
|
||||
dataList = ftoInvest?.current;
|
||||
break;
|
||||
default:
|
||||
dataList = [];
|
||||
dataList[0] = ftoInvest?.pervious;
|
||||
dataList[1] = ftoInvest?.current;
|
||||
}
|
||||
|
||||
return getTemplate(this.period, dataList);
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
methods: {},
|
||||
};
|
||||
|
||||
function getTemplate(period, dataList) {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
return period == "日" || period == "周"
|
||||
? [
|
||||
{
|
||||
name: period == "日" ? "昨日" : "本周",
|
||||
data: dataList ?? [],
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
name: period == "年" ? `${year - 1}年` : `${year - 1}年${month}月`,
|
||||
data: dataList ? dataList[0] : [],
|
||||
},
|
||||
{
|
||||
name: period == "年" ? `${year}年` : `${year}年${month}月`,
|
||||
data: dataList ? dataList[1] : [],
|
||||
// : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)),
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.elec-cost {
|
||||
background: #cc03;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,25 +6,110 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="nat-gas">nat-gas</div>
|
||||
<BarChartBase
|
||||
:legend="legend"
|
||||
:series="series"
|
||||
:xAxis="xAxis"
|
||||
in="nat-gas"
|
||||
class="nat-gas"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BarChartBase from "@/views/copilot/components/BarChartBase.vue";
|
||||
|
||||
export default {
|
||||
name: "NatGas",
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
return {};
|
||||
name: "NatGasCost",
|
||||
components: { BarChartBase },
|
||||
props: {
|
||||
period: {
|
||||
type: String,
|
||||
default: "日",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
// 城市数组的顺序必须是固定的
|
||||
const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
|
||||
return {
|
||||
xAxis: cities,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
legend() {
|
||||
switch (this.period) {
|
||||
case "日":
|
||||
return [{ label: "昨日", color: "#12f7f1" }];
|
||||
case "周":
|
||||
return [{ label: "本周", color: "#12f7f1" }];
|
||||
case "月": {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
return [
|
||||
{ label: `${year - 1}年${month}月`, color: "#12f7f1" },
|
||||
{ label: `${year}年${month}月`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
case "年": {
|
||||
const year = new Date().getFullYear();
|
||||
return [
|
||||
{ label: `${year - 1}年`, color: "#12f7f1" },
|
||||
{ label: `${year}年`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
default:
|
||||
return [
|
||||
{ label: `${year - 1}年`, color: "#12f7f1" },
|
||||
{ label: `${year}年`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
},
|
||||
series() {
|
||||
const { ftoInvest } = this.$store.getters.copilot.yield;
|
||||
let dataList = null;
|
||||
|
||||
switch (this.period) {
|
||||
case "日":
|
||||
case "周":
|
||||
dataList = ftoInvest?.current;
|
||||
break;
|
||||
default:
|
||||
dataList = [];
|
||||
dataList[0] = ftoInvest?.pervious;
|
||||
dataList[1] = ftoInvest?.current;
|
||||
}
|
||||
|
||||
return getTemplate(this.period, dataList);
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
methods: {},
|
||||
};
|
||||
|
||||
function getTemplate(period, dataList) {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
return period == "日" || period == "周"
|
||||
? [
|
||||
{
|
||||
name: period == "日" ? "昨日" : "本周",
|
||||
data: dataList ?? [],
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
name: period == "年" ? `${year - 1}年` : `${year - 1}年${month}月`,
|
||||
data: dataList ? dataList[0] : [],
|
||||
},
|
||||
{
|
||||
name: period == "年" ? `${year}年` : `${year}年${month}月`,
|
||||
data: dataList ? dataList[1] : [],
|
||||
// : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)),
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.nat-gas {
|
||||
background: #31f2;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,16 +6,36 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="stock-monitor">仓库监控</div>
|
||||
<div class="stock-monitor">
|
||||
<MonitorItem
|
||||
:cities="['成都', '邯郸', '株洲', '瑞昌', '佳木斯']"
|
||||
:legendList="dhgList"
|
||||
/>
|
||||
<MonitorItem :cities="['凯盛光伏', '蚌埠兴科']" :legendList="otherList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MonitorItemVue from "./sub/monitor/MonitorItem.vue";
|
||||
|
||||
export default {
|
||||
name: "StockMonitor",
|
||||
components: {},
|
||||
components: { MonitorItem: MonitorItemVue },
|
||||
props: {},
|
||||
data() {
|
||||
return {};
|
||||
return {
|
||||
dhgList: [
|
||||
{ name: "总库存", value: "1000" },
|
||||
{ name: "已用库存", value: "500" },
|
||||
{ name: "剩余库存", value: "500" },
|
||||
],
|
||||
otherList: [
|
||||
{ name: "分类1", value: "1000" },
|
||||
{ name: "分类2", value: "1000" },
|
||||
{ name: "分类3", value: "1000" },
|
||||
{ name: "分类4", value: "1000" },
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
methods: {},
|
||||
@@ -24,7 +44,20 @@ export default {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.stock-monitor {
|
||||
background: #fff2;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0;
|
||||
width: 3px;
|
||||
height: 100%;
|
||||
transform: translateX(-50%);
|
||||
background: linear-gradient(to bottom, transparent, #00f2ff, transparent);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,25 +6,123 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="water-cost">water cost</div>
|
||||
<LineChartBase
|
||||
v-if="0"
|
||||
:legend="legend"
|
||||
:series="series"
|
||||
:xAxis="xAxis"
|
||||
in="waterCost"
|
||||
class="water-cost"
|
||||
/>
|
||||
<BarChartBase
|
||||
v-else
|
||||
:legend="legend"
|
||||
:series="series"
|
||||
:xAxis="xAxis"
|
||||
in="waterCost"
|
||||
class="water-cost"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BarChartBaseVue from "@/views/copilot/components/BarChartBase.vue";
|
||||
import LineChartBaseVue from "@/views/copilot/components/LineChartBase.vue";
|
||||
|
||||
export default {
|
||||
name: "WaterCost",
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
return {};
|
||||
components: {
|
||||
BarChartBase: BarChartBaseVue,
|
||||
LineChartBase: LineChartBaseVue,
|
||||
},
|
||||
props: {
|
||||
period: {
|
||||
type: String,
|
||||
default: "日",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
// 城市数组的顺序必须是固定的
|
||||
const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
|
||||
return {
|
||||
xAxis: cities,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
legend() {
|
||||
switch (this.period) {
|
||||
case "日":
|
||||
return [{ label: "昨日", color: "#12f7f1" }];
|
||||
case "周":
|
||||
return [{ label: "本周", color: "#12f7f1" }];
|
||||
case "月": {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
return [
|
||||
{ label: `${year - 1}年${month}月`, color: "#12f7f1" },
|
||||
{ label: `${year}年${month}月`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
case "年": {
|
||||
const year = new Date().getFullYear();
|
||||
return [
|
||||
{ label: `${year - 1}年`, color: "#12f7f1" },
|
||||
{ label: `${year}年`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
default:
|
||||
return [
|
||||
{ label: `${year - 1}年`, color: "#12f7f1" },
|
||||
{ label: `${year}年`, color: "#58adfa" },
|
||||
];
|
||||
}
|
||||
},
|
||||
series() {
|
||||
const { ftoInvest } = this.$store.getters.copilot.yield;
|
||||
let dataList = null;
|
||||
|
||||
switch (this.period) {
|
||||
case "日":
|
||||
case "周":
|
||||
dataList = ftoInvest?.current;
|
||||
break;
|
||||
default:
|
||||
dataList = [];
|
||||
dataList[0] = ftoInvest?.pervious;
|
||||
dataList[1] = ftoInvest?.current;
|
||||
}
|
||||
|
||||
return getTemplate(this.period, dataList);
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
methods: {},
|
||||
};
|
||||
|
||||
function getTemplate(period, dataList) {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
return period == "日" || period == "周"
|
||||
? [
|
||||
{
|
||||
name: period == "日" ? "昨日" : "本周",
|
||||
data: dataList ?? [],
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
name: period == "年" ? `${year - 1}年` : `${year - 1}年${month}月`,
|
||||
data: dataList ? dataList[0] : [],
|
||||
},
|
||||
{
|
||||
name: period == "年" ? `${year}年` : `${year}年${month}月`,
|
||||
data: dataList ? dataList[1] : [],
|
||||
// : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)),
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.water-cost {
|
||||
background: #f002;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
139
src/views/copilot/energy/components/sub/monitor/MonitorItem.vue
Normal file
139
src/views/copilot/energy/components/sub/monitor/MonitorItem.vue
Normal file
@@ -0,0 +1,139 @@
|
||||
<!--
|
||||
filename: ChipRateItem.vue
|
||||
author: liubin
|
||||
date: 2024-04-29 14:25:18
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="monitor-item">
|
||||
<div class="cities">
|
||||
<CopilotButtons :options="cities" @update:active="handleCityUpdate" />
|
||||
</div>
|
||||
<div class="chart" ref="chart"></div>
|
||||
<div class="legend" v-if="1">
|
||||
<div class="legend-item" v-for="lgd in legendList" :key="lgd.name">
|
||||
<span class="legend-item__label">{{ lgd.name }}</span>
|
||||
<span class="legend-item__value">{{ lgd.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CopilotButtons from "@/views/copilot/components/select.vue";
|
||||
import chartMixin from "@/mixins/chart.js";
|
||||
import fullscreenMixin from "@/mixins/fullscreen.js";
|
||||
import getOptions from "../../../options/monitorOptions.js";
|
||||
|
||||
export default {
|
||||
name: "ChipRateItem",
|
||||
components: { CopilotButtons },
|
||||
mixins: [chartMixin, fullscreenMixin],
|
||||
props: {
|
||||
cities: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
legendList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
color: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
period: "月",
|
||||
valueTuple: [100, 100, 200],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
options() {
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
const vt = this.valueTuple;
|
||||
let titleValue =
|
||||
vt[0] != null && vt[2] != null && vt[2] !== 0
|
||||
? `${((vt[1] / vt[2]) * 100).toFixed(0)}%`
|
||||
: "0%",
|
||||
subtitle =
|
||||
this.period == "月" ? `${month}月累计产出` : `${year}年累计产出`;
|
||||
|
||||
return getOptions({
|
||||
single: true,
|
||||
color: this.color == 1 ? "#4CF0E8" : "#1065ff",
|
||||
titleValue,
|
||||
subtitle,
|
||||
previousSum: this.valueTuple[0],
|
||||
currentSum: this.valueTuple[1],
|
||||
targetSum: this.valueTuple[2],
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initOptions(this.options);
|
||||
},
|
||||
methods: {
|
||||
handleCityUpdate() {},
|
||||
fullscreenCallback(isFullscreen) {
|
||||
console.log("isFullscreen--->", isFullscreen);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.monitor-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 3px;
|
||||
backdrop-filter: blur(24px);
|
||||
|
||||
.cities {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.chart {
|
||||
align-self: stretch;
|
||||
height: 280px;
|
||||
}
|
||||
|
||||
.legend {
|
||||
height: 80px;
|
||||
display: flex;
|
||||
gap: 40px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
|
||||
&:first-child {
|
||||
.legend-item__value {
|
||||
color: #0e61f5;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
.legend-item__value {
|
||||
color: #0fd5d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.legend-item__value {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
l
|
||||
Reference in New Issue
Block a user