Compare commits

..

4 Commits

Author SHA1 Message Date
DESKTOP-FUDKNA8\znjsz
bc3a68a9a7 update 芯片OEE和转化效率 2024-04-29 16:06:59 +08:00
DESKTOP-FUDKNA8\znjsz
e066a7c4c7 update 芯片良率 2024-04-29 16:00:07 +08:00
DESKTOP-FUDKNA8\znjsz
b6820fd61f update 标准组件良率 2024-04-29 14:18:52 +08:00
DESKTOP-FUDKNA8\znjsz
5ed4eed5de update efficiency 2024-04-29 13:26:38 +08:00
14 changed files with 1145 additions and 8 deletions

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,257 @@
<!--
filename: BarChartBase.vue
author: liubin
date: 2024-04-10 08:59:28
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 "./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>

View File

@ -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/components/BarChartBase.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.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>

View File

@ -0,0 +1,47 @@
<!--
filename: ChipRate.vue
author: liubin
date: 2024-04-29 08:50:54
description: 芯片良率
-->
<template>
<div class="chip-rate">
<ChipRateItem :cities="['成都', '邯郸', '株洲', '瑞昌']" :color="1" />
<ChipRateItem :cities="['佳木斯', '凯盛光伏', '蚌埠兴科']" :color="2" />
</div>
</template>
<script>
import ChipRateItemVue from "./sub/chip/ChipRateItem.vue";
export default {
name: "ChipRate",
components: { ChipRateItem: ChipRateItemVue },
props: {},
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>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,139 @@
<!--
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="1">
<div class="legend-item">
<span class="legend-item__value">20%</span>
<span class="legend-item__label">2023年累计</span>
</div>
<div class="legend-item">
<span class="legend-item__value">20%</span>
<span class="legend-item__label">2024年累计</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";
export default {
name: "ChipRateItem",
components: { CopilotButtons },
mixins: [chartMixin, fullscreenMixin],
props: {
cities: {
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">
.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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -7,18 +7,37 @@
<template> <template>
<div class="efficiency-copilot"> <div class="efficiency-copilot">
<Container title="芯片良率" icon="chip2"></Container> <Container title="芯片良率" icon="chip2">
<Container title="标准组件良率" icon="std"></Container> <ChipRate />
<Container title="芯片OEE" icon="chip"></Container> </Container>
<Container title="转化效率" icon="cube"></Container> <Container title="标准组件良率" icon="std">
<StdRate />
</Container>
<Container title="芯片OEE" icon="chip">
<ChipOee :period="period" />
</Container>
<Container title="转化效率" icon="cube">
<TransformRate :period="period" />
</Container>
</div> </div>
</template> </template>
<script> <script>
import Container from "@/views/copilot/components/Container.vue"; import Container from "@/views/copilot/components/Container.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 { export default {
name: "EfficiencyCopilot", name: "EfficiencyCopilot",
components: { Container }, components: {
Container,
ChipOee: ChipOeeVue,
ChipRate: ChipRateVue,
StdRate: StdRateVue,
TransformRate: TransformRateVue,
},
props: { props: {
period: { period: {
type: String, type: String,
@ -39,7 +58,10 @@ export default {
methods: { methods: {
fetchData(period = "日") { fetchData(period = "日") {
console.log(`效率驾驶舱,获取${period}数据`); console.log(`效率驾驶舱,获取${period}数据`);
this.$store.dispatch("copilot/initCopilot", { period, source: "efficiency" }); this.$store.dispatch("copilot/initCopilot", {
period,
source: "efficiency",
});
}, },
}, },
}; };

View File

@ -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 },
},
],
},
],
};
}

View File

@ -16,7 +16,7 @@
</template> </template>
<script> <script>
import BarChartBase from "./sub/bar/BarChartBase.vue"; import BarChartBase from "@/views/copilot/components/BarChartBase.vue";
export default { export default {
name: "FtoInvest", name: "FtoInvest",

View File

@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import Icon from "../../../assets/icon.png"; import Icon from "@/views/copilot/assets/icon.png";
export default { export default {
name: "CityName", name: "CityName",