@@ -26,7 +26,7 @@ | |||
<script> | |||
import screenfull from "screenfull"; | |||
import ChartContainer from "../../../../components/ChartContainer.vue"; | |||
import ChartContainer from "./ChartContainer.vue"; | |||
import chartMixin from "@/mixins/chart.js"; | |||
export default { |
@@ -9,6 +9,7 @@ | |||
<div class="copilot-container"> | |||
<!-- refresh btn --> | |||
<button | |||
v-if="0" | |||
style=" | |||
appearance: none; | |||
outline: none; | |||
@@ -109,7 +110,12 @@ export default { | |||
border-radius: 2px; | |||
top: 0%; | |||
left: 0; | |||
background: radial-gradient(circle at center , #024798 2%, #024798 30%, transparent); | |||
background: radial-gradient( | |||
circle at center, | |||
#024798 2%, | |||
#024798 30%, | |||
transparent | |||
); | |||
z-index: 1; | |||
} | |||
@@ -9,7 +9,7 @@ | |||
<div class="copilot-header"> | |||
<section class="menu"> | |||
<CopilotButton | |||
v-for="i in ['产量', '效率', '能源']" | |||
v-for="i in ['产量', '效率', '综合']" | |||
:key="i" | |||
:label="i" | |||
:active="i === active" | |||
@@ -0,0 +1,296 @@ | |||
<!-- | |||
filename: LineChartBase.vue | |||
author: liubin | |||
date: 2024-04-30 08:59:28 | |||
description: | |||
--> | |||
<template> | |||
<chart-container class="line-chart-base"> | |||
<div class="legend"> | |||
<span | |||
v-for="item in legend" | |||
:key="item.label" | |||
class="legend-item" | |||
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }" | |||
>{{ item.label }}</span | |||
> | |||
</div> | |||
<div | |||
ref="chart" | |||
style="max-width: 50vw" | |||
:style="{ height: vHeight + 'vh' }" | |||
></div> | |||
</chart-container> | |||
</template> | |||
<script> | |||
import screenfull from "screenfull"; | |||
import ChartContainer from "./ChartContainer.vue"; | |||
import chartMixin from "@/mixins/chart.js"; | |||
export default { | |||
name: "LineChartBase", | |||
components: { | |||
ChartContainer, | |||
}, | |||
mixins: [chartMixin], | |||
props: { | |||
vHeight: { | |||
type: Number, | |||
default: 34, | |||
}, | |||
legend: { | |||
type: Array, | |||
required: true, | |||
}, | |||
xAxis: { | |||
type: Array, | |||
required: true, | |||
}, | |||
series: { | |||
type: Array, | |||
required: true, | |||
}, | |||
in: { | |||
type: String, | |||
default: "", | |||
}, | |||
}, | |||
data() { | |||
return { | |||
isFullscreen: false, | |||
actualOptions: null, | |||
options: { | |||
grid: { | |||
left: "5%", | |||
right: "4%", | |||
bottom: "3%", | |||
top: "15%", | |||
containLabel: true, | |||
}, | |||
tooltip: {}, | |||
xAxis: { | |||
axisTick: { | |||
show: false, | |||
}, | |||
axisLine: { | |||
lineStyle: { | |||
color: "#4561AE", | |||
}, | |||
}, | |||
axisLabel: { | |||
color: "#fff", | |||
fontSize: 12, | |||
}, | |||
data: this.xAxis, | |||
}, | |||
yAxis: { | |||
name: "单位/片", | |||
nameTextStyle: { | |||
color: "#fff", | |||
fontSize: 12, | |||
}, | |||
axisTick: { | |||
show: false, | |||
}, | |||
axisLabel: { | |||
color: "#fff", | |||
fontSize: 12, | |||
}, | |||
axisLine: { | |||
show: true, | |||
lineStyle: { | |||
color: "#4561AE", | |||
}, | |||
}, | |||
splitLine: { | |||
lineStyle: { | |||
color: "#4561AE", | |||
}, | |||
}, | |||
}, | |||
series: [ | |||
{ | |||
name: "", // this.series[0].name, | |||
type: "bar", | |||
barWidth: 12, | |||
itemStyle: { | |||
borderRadius: [10, 10, 0, 0], | |||
color: { | |||
type: "linear", | |||
x: 0, | |||
y: 0, | |||
x2: 0, | |||
y2: 1, | |||
colorStops: [ | |||
{ | |||
offset: 0, | |||
color: "#12f7f1", // 0% 处的颜色 | |||
}, | |||
{ | |||
offset: 0.35, | |||
color: "#12f7f177", // 100% 处的颜色 | |||
}, | |||
{ | |||
offset: 0.75, | |||
color: "#12f7f133", // 100% 处的颜色 | |||
}, | |||
{ | |||
offset: 1, | |||
color: "transparent", // 100% 处的颜色 | |||
}, | |||
], | |||
global: false, // 缺省为 false | |||
}, | |||
}, | |||
data: [], // this.series[0].data, | |||
}, | |||
{ | |||
name: "", // this.series[1].name, | |||
type: "bar", | |||
barWidth: 12, | |||
// tooltip: { | |||
// valueFormatter: function (value) { | |||
// return value + " ml"; | |||
// }, | |||
// }, | |||
itemStyle: { | |||
borderRadius: [10, 10, 0, 0], | |||
color: { | |||
type: "linear", | |||
x: 0, | |||
y: 0, | |||
x2: 0, | |||
y2: 1, | |||
colorStops: [ | |||
{ | |||
offset: 0, | |||
color: "#57abf8", // 0% 处的颜色 | |||
}, | |||
{ | |||
offset: 1, | |||
color: "#364BFE66", // 100% 处的颜色 | |||
}, | |||
], | |||
global: false, // 缺省为 false | |||
}, | |||
}, | |||
data: [], // this.series[1].data, | |||
}, | |||
], | |||
}, | |||
}; | |||
}, | |||
watch: { | |||
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ | |||
isFullscreen(val) { | |||
this.actualOptions.series.map((item) => { | |||
item.barWidth = val ? 18 : 12; | |||
}); | |||
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; | |||
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; | |||
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; | |||
this.initOptions(this.actualOptions); | |||
}, | |||
series(val) { | |||
if (!val) { | |||
this.initOptions(this.options); | |||
return; | |||
} | |||
const actualOptions = JSON.parse(JSON.stringify(this.options)); | |||
actualOptions.series[0].data = val[0].data; | |||
actualOptions.series[0].name = val[0].name; | |||
actualOptions.series[1].data = val?.[1]?.data || []; | |||
actualOptions.series[1].name = val?.[1]?.name || ""; | |||
this.actualOptions = actualOptions; | |||
this.initOptions(actualOptions); | |||
}, | |||
}, | |||
mounted() { | |||
this.actualOptions = this.options; | |||
this.initOptions(this.options); | |||
if (screenfull.isEnabled) { | |||
screenfull.on("change", () => { | |||
this.isFullscreen = screenfull.isFullscreen; | |||
}); | |||
} | |||
}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.line-chart-base { | |||
// position: relative; | |||
.legend { | |||
position: absolute; | |||
top: 5.2vh; | |||
right: 1vw; | |||
} | |||
.legend-item { | |||
position: relative; | |||
// font-size: 12px; | |||
margin-right: 0.67vw; | |||
&::before { | |||
content: ""; | |||
display: inline-block; | |||
width: 0.432vw; | |||
height: 0.432vw; | |||
border-radius: 100%; | |||
margin-right: 0.4vw; | |||
} | |||
&::after { | |||
content: ""; | |||
display: inline-block; | |||
width: 1vw; | |||
height: 0.125vw; | |||
position: absolute; | |||
top: 54%; | |||
left: -15%; | |||
transform: translateY(-50%); | |||
border-radius: 100; | |||
margin-right: 0.22vw; | |||
} | |||
} | |||
.legend-item:nth-child(1):after, | |||
.legend-item:nth-child(1):before { | |||
background-color: #fad162; | |||
} | |||
.legend-item:nth-child(2):after, | |||
.legend-item:nth-child(2):before { | |||
background-color: #2160f3; | |||
} | |||
.legend-item:nth-child(3):after, | |||
.legend-item:nth-child(3):before { | |||
background-color: #13dbf3; | |||
} | |||
.legend-item:nth-child(4):after, | |||
.legend-item:nth-child(4):before { | |||
background-color: #88ca67; | |||
} | |||
.legend-item:nth-child(5):after, | |||
.legend-item:nth-child(5):before { | |||
background-color: #5c97fc; | |||
} | |||
.legend-item:nth-child(6):after, | |||
.legend-item:nth-child(6):before { | |||
background-color: #f48900; | |||
} | |||
.legend-item:nth-child(7):after, | |||
.legend-item:nth-child(7):before { | |||
background-color: #776bf0; | |||
} | |||
} | |||
</style> |
@@ -15,7 +15,7 @@ | |||
/> | |||
<YieldCopilot v-if="page == '产量'" :period="period" /> | |||
<EnergyCopilot v-if="page == '能源'" :period="period" /> | |||
<EnergyCopilot v-if="page == '综合'" :period="period" /> | |||
<EfficiencyCopilot v-if="page == '效率'" :period="period" /> | |||
<div class="copilot-footer">© 中建材智能自动化研究院有限公司</div> | |||
@@ -0,0 +1,110 @@ | |||
<!-- | |||
filename: ChipOee.vue | |||
author: liubin | |||
date: 2024-04-29 08:51:04 | |||
description: 芯片OEE | |||
--> | |||
<template> | |||
<BarChartBase | |||
:legend="legend" | |||
:series="series" | |||
:xAxis="xAxis" | |||
in="chipOEE" | |||
class="chip-oee" | |||
/> | |||
</template> | |||
<script> | |||
import BarChartBase from "@/views/copilot/efficiency/components/sub/bar/BarChartChipOEE.vue"; | |||
export default { | |||
name: "ChipOEE", | |||
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.efficiency.chipOee; | |||
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); | |||
}, | |||
}, | |||
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"></style> |
@@ -0,0 +1,60 @@ | |||
<!-- | |||
filename: ChipRate.vue | |||
author: liubin | |||
date: 2024-04-29 08:50:54 | |||
description: 芯片良率 | |||
--> | |||
<template> | |||
<div class="chip-rate"> | |||
<ChipRateItem | |||
:period="period" | |||
:cities="['成都', '邯郸', '株洲', '瑞昌']" | |||
:color="1" | |||
/> | |||
<ChipRateItem | |||
:period="period" | |||
:cities="['佳木斯', '凯盛光伏', '蚌埠兴科']" | |||
:color="2" | |||
/> | |||
</div> | |||
</template> | |||
<script> | |||
import ChipRateItemVue from "./sub/chip/ChipRateItem.vue"; | |||
export default { | |||
name: "ChipRate", | |||
components: { ChipRateItem: ChipRateItemVue }, | |||
props: { | |||
period: { | |||
type: String, | |||
default: "日", | |||
}, | |||
}, | |||
data() { | |||
return {}; | |||
}, | |||
computed: {}, | |||
methods: {}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.chip-rate { | |||
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> |
@@ -0,0 +1,57 @@ | |||
<!-- | |||
filename: StdRate.vue | |||
author: liubin | |||
date: 2024-04-29 08:50:43 | |||
description: 标准组件良率 | |||
--> | |||
<template> | |||
<div class="std-rate"> | |||
<div class="span-2"> | |||
<StdRateItem :city="cities[5]" /> | |||
</div> | |||
<div | |||
v-for="item in cities.filter((val, index) => index != 5)" | |||
:key="item.name" | |||
> | |||
<StdRateItem :city="item" /> | |||
</div> | |||
</div> | |||
</template> | |||
<script> | |||
import StdRateItem from "./sub/std/StdRateItem.vue"; | |||
export default { | |||
name: "StdRate", | |||
components: { StdRateItem }, | |||
props: {}, | |||
data() { | |||
return { | |||
cities: [ | |||
{ name: "瑞昌", target: 100, total: 200, thisYear: 20 }, | |||
{ name: "邯郸", target: 200, total: 300, thisYear: 20 }, | |||
{ name: "株洲", target: 300, total: 400, thisYear: 20 }, | |||
{ name: "佳木斯", target: 400, total: 500, thisYear: 20 }, | |||
{ name: "成都", target: 500, total: 600, thisYear: 20 }, | |||
{ name: "凯盛光伏", target: 400, total: 500, thisYear: 20 }, | |||
{ name: "蚌埠", target: 500, total: 600, thisYear: 20 }, | |||
], | |||
}; | |||
}, | |||
computed: {}, | |||
methods: {}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.std-rate { | |||
display: grid; | |||
gap: 8px; | |||
grid-template-columns: repeat(2, 1fr); | |||
grid-template-rows: repeat(4, 1fr); | |||
} | |||
.span-2 { | |||
grid-column: span 2; | |||
} | |||
</style> |
@@ -0,0 +1,110 @@ | |||
<!-- | |||
filename: TransformRate.vue | |||
author: liubin | |||
date: 2024-04-29 08:50:34 | |||
description: 转化效率 | |||
--> | |||
<template> | |||
<BarChartBase | |||
:legend="legend" | |||
:series="series" | |||
:xAxis="xAxis" | |||
in="chipOEE" | |||
class="chip-oee" | |||
/> | |||
</template> | |||
<script> | |||
import BarChartBase from "@/views/copilot/components/BarChartBase.vue"; | |||
export default { | |||
name: "TransformRate", | |||
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); | |||
}, | |||
}, | |||
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"></style> |
@@ -0,0 +1,257 @@ | |||
<!-- | |||
* @Author: zhp | |||
* @Date: 2024-05-07 13:22:43 | |||
* @LastEditTime: 2024-05-07 13:29:55 | |||
* @LastEditors: zhp | |||
* @Description: | |||
--> | |||
<template> | |||
<chart-container class="bar-chart-base"> | |||
<div class="legend"> | |||
<span | |||
v-for="item in legend" | |||
:key="item.label" | |||
class="legend-item" | |||
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }" | |||
>{{ item.label }}</span | |||
> | |||
</div> | |||
<div | |||
ref="chart" | |||
style="max-width: 50vw" | |||
:style="{ height: vHeight + 'vh' }" | |||
></div> | |||
</chart-container> | |||
</template> | |||
<script> | |||
import screenfull from "screenfull"; | |||
import ChartContainer from "../../../../components/ChartContainer.vue"; | |||
import chartMixin from "@/mixins/chart.js"; | |||
export default { | |||
name: "BarChartBase", | |||
components: { | |||
ChartContainer, | |||
}, | |||
mixins: [chartMixin], | |||
props: { | |||
vHeight: { | |||
type: Number, | |||
default: 34, | |||
}, | |||
legend: { | |||
type: Array, | |||
required: true, | |||
}, | |||
xAxis: { | |||
type: Array, | |||
required: true, | |||
}, | |||
series: { | |||
type: Array, | |||
required: true, | |||
}, | |||
in: { | |||
type: String, | |||
default: "", | |||
}, | |||
}, | |||
data() { | |||
return { | |||
isFullscreen: false, | |||
actualOptions: null, | |||
options: { | |||
grid: { | |||
left: "5%", | |||
right: "4%", | |||
bottom: "3%", | |||
top: "15%", | |||
containLabel: true, | |||
}, | |||
tooltip: {}, | |||
xAxis: { | |||
axisTick: { | |||
show: false, | |||
}, | |||
axisLine: { | |||
lineStyle: { | |||
color: "#4561AE", | |||
}, | |||
}, | |||
axisLabel: { | |||
color: "#fff", | |||
fontSize: 12, | |||
}, | |||
data: this.xAxis, | |||
}, | |||
yAxis: { | |||
name: "单位/%", | |||
nameTextStyle: { | |||
color: "#fff", | |||
fontSize: 12, | |||
}, | |||
axisTick: { | |||
show: false, | |||
}, | |||
axisLabel: { | |||
color: "#fff", | |||
fontSize: 12, | |||
}, | |||
axisLine: { | |||
show: true, | |||
lineStyle: { | |||
color: "#4561AE", | |||
}, | |||
}, | |||
splitLine: { | |||
lineStyle: { | |||
color: "#4561AE", | |||
}, | |||
}, | |||
}, | |||
series: [ | |||
{ | |||
name: "", // this.series[0].name, | |||
type: "bar", | |||
barWidth: 12, | |||
itemStyle: { | |||
borderRadius: [10, 10, 0, 0], | |||
color: { | |||
type: "linear", | |||
x: 0, | |||
y: 0, | |||
x2: 0, | |||
y2: 1, | |||
colorStops: [ | |||
{ | |||
offset: 0, | |||
color: "#12f7f1", // 0% 处的颜色 | |||
}, | |||
{ | |||
offset: 0.35, | |||
color: "#12f7f177", // 100% 处的颜色 | |||
}, | |||
{ | |||
offset: 0.75, | |||
color: "#12f7f133", // 100% 处的颜色 | |||
}, | |||
{ | |||
offset: 1, | |||
color: "transparent", // 100% 处的颜色 | |||
}, | |||
], | |||
global: false, // 缺省为 false | |||
}, | |||
}, | |||
data: [], // this.series[0].data, | |||
}, | |||
{ | |||
name: "", // this.series[1].name, | |||
type: "bar", | |||
barWidth: 12, | |||
// tooltip: { | |||
// valueFormatter: function (value) { | |||
// return value + " ml"; | |||
// }, | |||
// }, | |||
itemStyle: { | |||
borderRadius: [10, 10, 0, 0], | |||
color: { | |||
type: "linear", | |||
x: 0, | |||
y: 0, | |||
x2: 0, | |||
y2: 1, | |||
colorStops: [ | |||
{ | |||
offset: 0, | |||
color: "#57abf8", // 0% 处的颜色 | |||
}, | |||
{ | |||
offset: 1, | |||
color: "#364BFE66", // 100% 处的颜色 | |||
}, | |||
], | |||
global: false, // 缺省为 false | |||
}, | |||
}, | |||
data: [], // this.series[1].data, | |||
}, | |||
], | |||
}, | |||
}; | |||
}, | |||
watch: { | |||
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ | |||
isFullscreen(val) { | |||
this.actualOptions.series.map((item) => { | |||
item.barWidth = val ? 18 : 12; | |||
}); | |||
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; | |||
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; | |||
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; | |||
this.initOptions(this.actualOptions); | |||
}, | |||
series(val) { | |||
if (!val) { | |||
this.initOptions(this.options); | |||
return; | |||
} | |||
const actualOptions = JSON.parse(JSON.stringify(this.options)); | |||
actualOptions.series[0].data = val[0].data; | |||
actualOptions.series[0].name = val[0].name; | |||
actualOptions.series[1].data = val?.[1]?.data || []; | |||
actualOptions.series[1].name = val?.[1]?.name || ""; | |||
this.actualOptions = actualOptions; | |||
this.initOptions(actualOptions); | |||
}, | |||
}, | |||
mounted() { | |||
this.actualOptions = this.options; | |||
this.initOptions(this.options); | |||
if (screenfull.isEnabled) { | |||
screenfull.on("change", () => { | |||
this.isFullscreen = screenfull.isFullscreen; | |||
}); | |||
} | |||
}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.bar-chart-base { | |||
// position: relative; | |||
.legend { | |||
position: absolute; | |||
top: 5.2vh; | |||
right: 1vw; | |||
} | |||
.legend-item { | |||
position: relative; | |||
// font-size: 12px; | |||
margin-right: 0.67vw; | |||
&::before { | |||
content: ""; | |||
display: inline-block; | |||
width: 0.531vw; | |||
height: 0.531vw; | |||
background-color: #ccc; | |||
border-radius: 2px; | |||
margin-right: 0.22vw; | |||
} | |||
} | |||
.legend-item:nth-child(1):before { | |||
background-color: #12f7f1; | |||
} | |||
.legend-item:nth-child(2):before { | |||
background-color: #58adfa; | |||
} | |||
} | |||
</style> |
@@ -0,0 +1,195 @@ | |||
<!-- | |||
filename: ChipRateItem.vue | |||
author: liubin | |||
date: 2024-04-29 14:25:18 | |||
description: | |||
--> | |||
<template> | |||
<div class="chip-rate-item"> | |||
<div class="cities"> | |||
<CopilotButtons :options="cities" @update:active="handleCityUpdate" /> | |||
</div> | |||
<div class="chart" ref="chart"></div> | |||
<div class="legend" v-if="period == '月' || period == '年'"> | |||
<div class="legend-item" v-for="lgd in legend" :key="lgd.label"> | |||
<span class="legend-item__value">{{ lgd.value }}</span> | |||
<span class="legend-item__label">{{ lgd.label }}</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/chipOptions.js"; | |||
import { mapGetters } from "vuex"; | |||
export default { | |||
name: "ChipRateItem", | |||
components: { CopilotButtons }, | |||
mixins: [chartMixin, fullscreenMixin], | |||
props: { | |||
cities: { | |||
type: Array, | |||
default: () => [], | |||
}, | |||
color: { | |||
type: Number, | |||
default: 1, | |||
}, | |||
period: { | |||
type: String, | |||
default: "日", | |||
}, | |||
}, | |||
data() { | |||
return { | |||
factoryId: 0, | |||
count: 1, | |||
}; | |||
}, | |||
computed: { | |||
chipRate() { | |||
return this.$store.getters.copilot.efficiency.chipRate; | |||
}, | |||
valueTuple() { | |||
const getter = this.chipRate; | |||
console.log(getter) | |||
if (this.period === "日" || this.period === "周") { | |||
return [ | |||
getter.previous[this.factoryId], | |||
getter.current[this.factoryId], | |||
0, | |||
]; | |||
} | |||
// [100, 200, 200] | |||
return [ | |||
getter.previous[this.factoryId], | |||
getter.current[this.factoryId], | |||
getter.target[this.factoryId], | |||
]; | |||
}, | |||
options() { | |||
const single = this.period === "日" || this.period === "周"; | |||
const year = new Date().getFullYear(); | |||
const month = new Date().getMonth() + 1; | |||
const vt = this.valueTuple; | |||
let titleValue = single | |||
? (vt[1] != null && `${vt[1] * 100}%`) || "0%" | |||
: vt[0] != null && vt[2] != null && vt[2] !== 0 | |||
? `${((vt[1] / vt[2]) * 100).toFixed(0)}%` | |||
: "0%", | |||
subtitle = { | |||
日: "本日良率", | |||
周: "本周良率", | |||
月: `${month}月良率`, | |||
年: `${year}良率`, | |||
}[this.period]; | |||
const t = getOptions({ | |||
single, | |||
color: this.color == 1 ? "#4CF0E8" : "#1065ff", | |||
titleValue, | |||
subtitle, | |||
previousSum: vt[0], | |||
currentSum: vt[1], | |||
targetSum: vt[2], | |||
}); | |||
return t; | |||
}, | |||
legend() { | |||
const year = new Date().getFullYear(); | |||
const month = new Date().getMonth() + 1; | |||
return [ | |||
{ | |||
label: | |||
this.period == "月" | |||
? `${year - 1}年${month}月良率` | |||
: `${year - 1}年良率`, | |||
value: (this.valueTuple[0] * 100).toFixed(0) + "%", | |||
}, | |||
{ | |||
label: this.period == "月" ? `${month}月良率` : `${year}年良率`, | |||
value: (this.valueTuple[1] * 100).toFixed(0) + "%", | |||
}, | |||
]; | |||
}, | |||
}, | |||
mounted() { | |||
this.initOptions(this.options); | |||
}, | |||
watch: { | |||
period() { | |||
this.initOptions(this.options); | |||
}, | |||
factoryId() { | |||
this.initOptions(this.options); | |||
}, | |||
chipRate() { | |||
this.initOptions(this.options); | |||
}, | |||
}, | |||
methods: { | |||
handleCityUpdate(id) { | |||
this.factoryId = id; | |||
}, | |||
fullscreenCallback(isFullscreen) {}, | |||
}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.chip-rate-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 |
@@ -0,0 +1,66 @@ | |||
<!-- | |||
filename: CityName.vue | |||
author: liubin | |||
date: 2024-04-10 08:59:28 | |||
description: | |||
--> | |||
<template> | |||
<div class="city-name"> | |||
<img :src="Icon" alt="city icon" /> | |||
<span>{{ value }}</span> | |||
</div> | |||
</template> | |||
<script> | |||
import Icon from "@/views/copilot/assets/icon.png"; | |||
export default { | |||
name: "CityName", | |||
props: { | |||
value: { | |||
type: String, | |||
default: "", | |||
}, | |||
}, | |||
data() { | |||
return { Icon }; | |||
}, | |||
}; | |||
</script> | |||
<style scoped> | |||
.city-name { | |||
min-width: 80px; | |||
margin: auto; | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
justify-content: center; | |||
padding: 0 8px; | |||
position: relative; | |||
} | |||
.city-name::after { | |||
content: ""; | |||
position: absolute; | |||
top: 50%; | |||
right: 0; | |||
width: 2px; | |||
background: linear-gradient(to top, transparent, #0b5be1ee, transparent); | |||
height: 100%; | |||
transform: translateY(-50%); | |||
} | |||
img { | |||
/* width: 32px; */ | |||
width: 1.543vw; | |||
} | |||
span { | |||
/* font-size: 12px; */ | |||
font-size: 0.77vw; | |||
letter-spacing: 2px; | |||
text-align: center; | |||
} | |||
</style> |
@@ -0,0 +1,113 @@ | |||
<!-- | |||
filename: ProgressBar.vue | |||
author: liubin | |||
date: 2024-04-29 09:18:30 | |||
description: | |||
--> | |||
<template> | |||
<div class="progress-bar" :data-title="title" :data-rate="dataRate"> | |||
<div | |||
class="progress-bar__rate" | |||
:style="{ width: dataRate == '-' ? 0 : dataRate }" | |||
></div> | |||
</div> | |||
</template> | |||
<script> | |||
export default { | |||
name: "ProgressBar", | |||
components: {}, | |||
props: { | |||
value: { | |||
type: Number, | |||
default: 0, | |||
}, | |||
total: { | |||
type: Number, | |||
default: 0, | |||
}, | |||
title: { | |||
type: String, | |||
default: "", | |||
}, | |||
}, | |||
data() { | |||
return {}; | |||
}, | |||
computed: { | |||
dataRate() { | |||
return this.total == 0 | |||
? "-" | |||
: `${(parseFloat(this.value / this.total) * 100).toFixed(0)}%`; | |||
}, | |||
}, | |||
methods: {}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.progress-bar { | |||
height: 10px; | |||
background-color: #002f6b; | |||
border-radius: 4px; | |||
margin-bottom: 12px; | |||
position: relative; | |||
&:before { | |||
content: attr(data-title); | |||
display: inline-block; | |||
color: #fff; | |||
position: absolute; | |||
bottom: -200%; | |||
font-size: 12px; | |||
} | |||
&:after { | |||
content: attr(data-rate); | |||
display: inline-block; | |||
color: #fff; | |||
position: absolute; | |||
bottom: -200%; | |||
right: 0; | |||
font-size: 12px; | |||
} | |||
&:first-child { | |||
&:after { | |||
color: #11eae3; | |||
} | |||
} | |||
&:nth-child(2) { | |||
&:after { | |||
color: #0e65fd; | |||
} | |||
} | |||
.progress-bar__rate { | |||
position: absolute; | |||
display: inline-block; | |||
height: 100%; | |||
width: 0; | |||
border-radius: 4px; | |||
} | |||
&:first-child { | |||
.progress-bar__rate { | |||
background: linear-gradient( | |||
to right, | |||
#004c5e11 10%, | |||
#004c5e, | |||
#0ac0c0, | |||
#11eae3 | |||
); | |||
} | |||
} | |||
&:nth-child(2) { | |||
.progress-bar__rate { | |||
background: linear-gradient(to right, #0048a811, #0048a8, #0e65fd); | |||
} | |||
} | |||
} | |||
</style> |
@@ -0,0 +1,60 @@ | |||
<!-- | |||
filename: StdRateItem.vue | |||
author: liubin | |||
date: 2024-04-29 08:59:33 | |||
description: | |||
--> | |||
<template> | |||
<div class="std-rate-item"> | |||
<CityName :value="city.name" /> | |||
<div class="std-rate-item__value"> | |||
<ProgressBar title="24年目标" :total="city.target" :value="city.target" /> | |||
<ProgressBar | |||
title="24年累计" | |||
:total="city.target" | |||
:value="city.thisYear" | |||
/> | |||
</div> | |||
</div> | |||
</template> | |||
<script> | |||
import CityName from "./CityName.vue"; | |||
import ProgressBar from "./ProgressBar.vue"; | |||
export default { | |||
name: "StdRateItem", | |||
components: { CityName, ProgressBar }, | |||
props: { | |||
city: { | |||
type: Object, | |||
required: true, | |||
}, | |||
}, | |||
data() { | |||
return {}; | |||
}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.std-rate-item { | |||
box-shadow: inset 0 0 12px 2px #fff3; | |||
border-radius: 4px; | |||
display: flex; | |||
align-items: center; | |||
gap: 8px; | |||
padding: 12px; | |||
} | |||
.std-rate-item__value { | |||
flex: 1; | |||
margin: 6px; | |||
display: flex; | |||
gap: 12px; | |||
height: 60px; | |||
flex-direction: column; | |||
justify-content: center; | |||
} | |||
</style> |
@@ -1,7 +1,7 @@ | |||
<!-- | |||
* @Author: zhp | |||
* @Date: 2024-05-07 10:04:53 | |||
* @LastEditTime: 2024-05-07 10:20:17 | |||
* @LastEditTime: 2024-05-07 10:25:55 | |||
* @LastEditors: zhp | |||
* @Description: | |||
--> | |||
@@ -9,21 +9,36 @@ | |||
<template> | |||
<div class="efficiency-copilot"> | |||
<Container title="芯片良率" icon="chip2"> | |||
<std-output :period="period" /> | |||
<ChipRate :period="period" /> | |||
</Container> | |||
<Container title="标准组件良率" icon="std"> | |||
<StdRate :period="period" /> | |||
</Container> | |||
<Container title="芯片OEE" icon="chip"> | |||
<ChipOee :period="period" /> | |||
</Container> | |||
<Container title="转化效率" icon="cube"> | |||
<TransformRate :period="period" /> | |||
</Container> | |||
<Container title="标准组件良率" icon="std"></Container> | |||
<Container title="芯片OEE" icon="chip"></Container> | |||
<Container title="转化效率" icon="cube"></Container> | |||
</div> | |||
</template> | |||
<script> | |||
import Container from "@/views/copilot/components/Container.vue"; | |||
import StdOutput from "./components/StdOutput.vue"; | |||
import ChipOeeVue from "./components/ChipOee.vue"; | |||
import ChipRateVue from "./components/ChipRate.vue"; | |||
import StdRateVue from "./components/StdRate.vue"; | |||
import TransformRateVue from "./components/TransformRate.vue"; | |||
export default { | |||
name: "EfficiencyCopilot", | |||
components: { Container, StdOutput }, | |||
components: { | |||
Container, | |||
ChipOee: ChipOeeVue, | |||
ChipRate: ChipRateVue, | |||
StdRate: StdRateVue, | |||
TransformRate: TransformRateVue, | |||
}, | |||
props: { | |||
period: { | |||
type: String, | |||
@@ -44,7 +59,10 @@ export default { | |||
methods: { | |||
fetchData(period = "日") { | |||
console.log(`效率驾驶舱,获取${period}数据`); | |||
this.$store.dispatch("copilot/initCopilot", { period, source: "efficiency" }); | |||
this.$store.dispatch("copilot/initCopilot", { | |||
period, | |||
source: "efficiency", | |||
}); | |||
}, | |||
}, | |||
}; | |||
@@ -0,0 +1,163 @@ | |||
export default function ({ | |||
single = false, | |||
color, | |||
titleValue, | |||
subtitle, | |||
previousSum, | |||
currentSum, | |||
targetSum, | |||
}) { | |||
return { | |||
grid: { | |||
left: 0, | |||
right: 0, | |||
bottom: 0, | |||
top: 0, | |||
containLabel: true, | |||
}, | |||
tooltip: { | |||
// formatter(params) { | |||
// return `${params.name}: ${(params.value * 100).toFixed(0)}%`; | |||
// } | |||
}, | |||
title: { | |||
text: titleValue, | |||
left: "49%", | |||
top: "39%", | |||
textAlign: "center", | |||
textStyle: { | |||
fontWeight: 600, | |||
fontSize: 32, | |||
color: "#fffd", | |||
}, | |||
subtext: `\u2002${subtitle}\u2002`, | |||
subtextStyle: { | |||
fontSize: 14, | |||
fontWeight: 100, | |||
color: "#fffd", | |||
align: "right", | |||
}, | |||
}, | |||
series: [ | |||
// 背景 series | |||
{ | |||
type: "pie", | |||
name: "当前目标", | |||
radius: ["70%", "85%"], | |||
center: ["50%", "52%"], | |||
emptyCircleStyle: { | |||
color: "#040c5f45", | |||
}, | |||
}, | |||
// 数据 series | |||
{ | |||
type: "pie", | |||
radius: ["70%", "85%"], | |||
center: ["50%", "52%"], | |||
avoidLabelOvervlap: false, | |||
label: { | |||
show: false, | |||
}, | |||
labelLine: { | |||
show: false, | |||
}, | |||
data: [ | |||
{ | |||
value: currentSum, | |||
name: "当前良率", | |||
selected: false, | |||
itemStyle: { | |||
borderJoin: "round", | |||
borderCap: "round", | |||
borderWidth: 12, | |||
borderRadius: "50%", | |||
color: { | |||
type: "linear", | |||
x: 1, | |||
y: 0, | |||
x2: 0, | |||
y2: 1, | |||
colorStops: single | |||
? [ | |||
{ offset: 0, color: `${color}11` }, | |||
{ offset: 1, color: `${color}` }, | |||
] | |||
: [ | |||
{ offset: 0, color: "#4CF0E811" }, | |||
{ offset: 1, color: "#4CF0E8" }, | |||
], | |||
}, | |||
}, | |||
}, | |||
{ | |||
value: | |||
targetSum > currentSum | |||
? targetSum - currentSum | |||
: targetSum == 0 | |||
? currentSum == 0 | |||
? 1 | |||
: 0 | |||
: targetSum, | |||
name: "未达成", | |||
itemStyle: { color: "transparent" }, | |||
label: { show: false }, | |||
}, | |||
], | |||
}, | |||
// 数据 series2 - 2023累计 | |||
single | |||
? null | |||
: { | |||
type: "pie", | |||
radius: ["55%", "70%"], | |||
center: ["50%", "52%"], | |||
avoidLabelOvervlap: false, | |||
label: { | |||
show: false, | |||
}, | |||
labelLine: { | |||
show: false, | |||
}, | |||
data: [ | |||
{ | |||
value: previousSum, | |||
name: "上期良率", | |||
selected: false, | |||
itemStyle: { | |||
borderJoin: "round", | |||
borderCap: "round", | |||
borderWidth: 12, | |||
borderRadius: "50%", | |||
color: { | |||
type: "linear", | |||
x: 1, | |||
y: 0, | |||
x2: 0, | |||
y2: 1, | |||
colorStops: [ | |||
{ offset: 0, color: "#1065ff66" }, | |||
{ offset: 1, color: "#1065ff" }, | |||
], | |||
}, | |||
}, | |||
}, | |||
{ | |||
value: | |||
targetSum > previousSum | |||
? targetSum - previousSum | |||
: previousSum == 0 | |||
? 1 | |||
: 0, | |||
name: "-", | |||
formatter: { | |||
show: false | |||
}, | |||
itemStyle: { color: "transparent" }, | |||
label: { show: false }, | |||
}, | |||
], | |||
}, | |||
], | |||
}; | |||
} |
@@ -0,0 +1,128 @@ | |||
<!-- | |||
filename: ElecCost.vue | |||
author: liubin | |||
date: 2024-04-29 16:37:01 | |||
description: 电能耗 | |||
--> | |||
<template> | |||
<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: { | |||
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); | |||
}, | |||
}, | |||
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 { | |||
flex: 1; | |||
} | |||
</style> |
@@ -0,0 +1,115 @@ | |||
<!-- | |||
filename: NatGas.vue | |||
author: liubin | |||
date: 2024-04-29 16:36:27 | |||
description: 天然气能耗 | |||
--> | |||
<template> | |||
<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: "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); | |||
}, | |||
}, | |||
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 { | |||
flex: 1; | |||
} | |||
</style> |
@@ -0,0 +1,63 @@ | |||
<!-- | |||
filename: StockMonitor.vue | |||
author: liubin | |||
date: 2024-04-29 16:35:40 | |||
description: 仓库监控·当前 | |||
--> | |||
<template> | |||
<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: { MonitorItem: MonitorItemVue }, | |||
props: {}, | |||
data() { | |||
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: {}, | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.stock-monitor { | |||
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> |
@@ -0,0 +1,128 @@ | |||
<!-- | |||
filename: WaterCost.vue | |||
author: liubin | |||
date: 2024-04-29 16:37:34 | |||
description: 水能耗 | |||
--> | |||
<template> | |||
<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: { | |||
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); | |||
}, | |||
}, | |||
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 { | |||
flex: 1; | |||
} | |||
</style> |
@@ -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 |
@@ -2,24 +2,81 @@ | |||
filename: index.vue | |||
author: liubin | |||
date: 2024-04-16 14:40:15 | |||
description: 能源驾驶舱 | |||
description: 综合驾驶舱 | |||
--> | |||
<template> | |||
<div class="energy-copilot">能源驾驶舱</div> | |||
<div class="energy-copilot"> | |||
<Container title="仓库监控·当前" icon="chip2"> | |||
<StockMonitorVue :period="period" /> | |||
</Container> | |||
<Container title="天然气能耗" icon="std"> | |||
<NatGasVue :period="period" /> | |||
</Container> | |||
<Container title="电能耗" icon="chip"> | |||
<ElecCostVue :period="period" /> | |||
</Container> | |||
<Container title="水能耗" icon="cube"> | |||
<WaterCostVue :period="period" /> | |||
</Container> | |||
</div> | |||
</template> | |||
<script> | |||
import Container from "@/views/copilot/components/Container.vue"; | |||
import StockMonitorVue from "./components/StockMonitor.vue"; | |||
import ElecCostVue from "./components/ElecCost.vue"; | |||
import NatGasVue from "./components/NatGas.vue"; | |||
import WaterCostVue from "./components/WaterCost.vue"; | |||
export default { | |||
name: "EnergyCopilot", | |||
components: {}, | |||
props: {}, | |||
components: { | |||
Container, | |||
StockMonitorVue, | |||
ElecCostVue, | |||
NatGasVue, | |||
WaterCostVue, | |||
}, | |||
props: { | |||
period: { | |||
type: String, | |||
default: "日", | |||
}, | |||
}, | |||
data() { | |||
return {}; | |||
}, | |||
computed: {}, | |||
methods: {}, | |||
watch: { | |||
period: { | |||
handler(val) { | |||
val && this.fetchData(val); | |||
}, | |||
immediate: true, | |||
}, | |||
}, | |||
methods: { | |||
fetchData(period = "日") { | |||
console.log(`效率驾驶舱,获取${period}数据`); | |||
this.$store.dispatch("copilot/initCopilot", { | |||
period, | |||
source: "comprehensive", | |||
}); | |||
}, | |||
}, | |||
}; | |||
</script> | |||
<style scoped></style> | |||
<style scoped> | |||
.energy-copilot { | |||
flex: 1; | |||
display: grid; | |||
gap: 16px; | |||
grid-template-columns: 1fr 1fr; | |||
grid-template-rows: 1fr 1fr; | |||
} | |||
.energy-copilot > div { | |||
height: 100%; | |||
} | |||
</style> |
@@ -0,0 +1,156 @@ | |||
export default function ({ | |||
single = false, | |||
color, | |||
titleValue, | |||
subtitle, | |||
previousSum, | |||
currentSum, | |||
targetSum, | |||
}) { | |||
return { | |||
grid: { | |||
left: 0, | |||
right: 0, | |||
bottom: 0, | |||
top: 0, | |||
containLabel: true, | |||
}, | |||
tooltip: {}, | |||
title: { | |||
text: titleValue, | |||
left: "49%", | |||
top: "39%", | |||
textAlign: "center", | |||
textStyle: { | |||
fontWeight: 600, | |||
fontSize: 32, | |||
color: "#fffd", | |||
}, | |||
subtext: `\u2002${subtitle}\u2002`, | |||
subtextStyle: { | |||
fontSize: 14, | |||
fontWeight: 100, | |||
color: "#fffd", | |||
align: "right", | |||
}, | |||
}, | |||
series: [ | |||
// 背景 series | |||
{ | |||
type: "pie", | |||
name: "当前目标", | |||
radius: ["70%", "85%"], | |||
center: ["50%", "52%"], | |||
emptyCircleStyle: { | |||
color: "#040c5f45", | |||
}, | |||
}, | |||
// 数据 series | |||
{ | |||
type: "pie", | |||
radius: ["70%", "85%"], | |||
center: ["50%", "52%"], | |||
avoidLabelOvervlap: false, | |||
label: { | |||
show: false, | |||
}, | |||
labelLine: { | |||
show: false, | |||
}, | |||
data: [ | |||
{ | |||
value: currentSum, | |||
name: "当前累计产出", | |||
selected: false, | |||
itemStyle: { | |||
borderJoin: "round", | |||
borderCap: "round", | |||
borderWidth: 12, | |||
borderRadius: "50%", | |||
// color: { | |||
// type: "linear", | |||
// x: 1, | |||
// y: 0, | |||
// x2: 0, | |||
// y2: 1, | |||
// colorStops: single | |||
// ? [ | |||
// { offset: 0, color: `${color}11` }, | |||
// { offset: 1, color: `${color}` }, | |||
// ] | |||
// : [ | |||
// { offset: 0, color: "#4CF0E811" }, | |||
// { offset: 1, color: "#4CF0E8" }, | |||
// ], | |||
// }, | |||
}, | |||
}, | |||
{ | |||
value: | |||
targetSum > currentSum | |||
? targetSum - currentSum | |||
: targetSum == 0 | |||
? currentSum == 0 | |||
? 1 | |||
: 0 | |||
: 0, | |||
name: "未达成累计", | |||
itemStyle: { color: "transparent" }, | |||
label: { show: false }, | |||
}, | |||
], | |||
}, | |||
// 数据 series2 - 2023累计 | |||
single | |||
? null | |||
: { | |||
type: "pie", | |||
radius: ["55%", "70%"], | |||
center: ["50%", "52%"], | |||
avoidLabelOvervlap: false, | |||
label: { | |||
show: false, | |||
}, | |||
labelLine: { | |||
show: false, | |||
}, | |||
data: [ | |||
{ | |||
value: previousSum, | |||
name: "上期累计产出", | |||
selected: false, | |||
itemStyle: { | |||
borderJoin: "round", | |||
borderCap: "round", | |||
borderWidth: 12, | |||
borderRadius: "50%", | |||
// color: { | |||
// type: "linear", | |||
// x: 1, | |||
// y: 0, | |||
// x2: 0, | |||
// y2: 1, | |||
// colorStops: [ | |||
// { offset: 0, color: "#1065ff66" }, | |||
// { offset: 1, color: "#1065ff" }, | |||
// ], | |||
// }, | |||
}, | |||
}, | |||
{ | |||
value: | |||
targetSum > previousSum | |||
? targetSum - previousSum | |||
: previousSum == 0 | |||
? 1 | |||
: 0, | |||
name: "-", | |||
itemStyle: { color: "transparent" }, | |||
label: { show: false }, | |||
}, | |||
], | |||
}, | |||
], | |||
}; | |||
} |
@@ -16,7 +16,7 @@ | |||
</template> | |||
<script> | |||
import BarChartBase from "./sub/bar/BarChartBase.vue"; | |||
import BarChartBase from "@/views/copilot/components/BarChartBase.vue"; | |||
export default { | |||
name: "ChipInvest", | |||
@@ -16,7 +16,7 @@ | |||
</template> | |||
<script> | |||
import BarChartBase from "./sub/bar/BarChartBase.vue"; | |||
import BarChartBase from "@/views/copilot/components/BarChartBase.vue"; | |||
export default { | |||
name: "FtoInvest", | |||
@@ -13,7 +13,7 @@ | |||
</template> | |||
<script> | |||
import Icon from "../../../assets/icon.png"; | |||
import Icon from "@/views/copilot/assets/icon.png"; | |||
export default { | |||
name: "CityName", | |||