|
@@ -1,17 +1,17 @@
|
|
|
<template>
|
|
|
<div class="screen-common-component">
|
|
|
- <ScreenComHeader :module-id="moduleId" align="start" title="产品生产情况" />
|
|
|
+ <ScreenComHeader :module-id="moduleId" align="start" title="生产量情况" />
|
|
|
<div class="container">
|
|
|
<div ref="chartRef" class="charts-container"></div>
|
|
|
<div class="describe-container">
|
|
|
<div>
|
|
|
<span class="typeText">生产目标</span>
|
|
|
- <span class="valueText">70</span>
|
|
|
+ <span class="valueText">{{ progressOption.orderNum }}</span>
|
|
|
<span class="unitText">件</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
<span class="typeText">实际生产量</span>
|
|
|
- <span class="valueText">80</span>
|
|
|
+ <span class="valueText">{{ progressOption.comNum }}</span>
|
|
|
<span class="unitText">件</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -29,75 +29,92 @@
|
|
|
<script lang="ts" setup>
|
|
|
import ScreenComHeader from "@/views/screens/configs/screenComHeader.vue";
|
|
|
import * as echarts from "echarts";
|
|
|
+import { productionQuantity } from "@/api/screens";
|
|
|
|
|
|
const chartRef = ref(null);
|
|
|
|
|
|
-const option = {
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: "gauge",
|
|
|
- progress: {
|
|
|
- show: true,
|
|
|
- width: 12,
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
+const generateOption = (c: string, o: string) => {
|
|
|
+ const option = {
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: "gauge",
|
|
|
+ progress: {
|
|
|
+ show: true,
|
|
|
width: 12,
|
|
|
},
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- distance: 2,
|
|
|
- length: 4,
|
|
|
- lineStyle: {
|
|
|
- width: 2,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ width: 12,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ distance: 2,
|
|
|
+ length: 4,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: "#999",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ distance: 12,
|
|
|
color: "#999",
|
|
|
+ fontSize: 14,
|
|
|
},
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- distance: 12,
|
|
|
- color: "#999",
|
|
|
- fontSize: 14,
|
|
|
- },
|
|
|
- anchor: {
|
|
|
- show: true,
|
|
|
- showAbove: true,
|
|
|
- size: 16,
|
|
|
- itemStyle: {
|
|
|
- borderWidth: 10,
|
|
|
+ anchor: {
|
|
|
+ show: true,
|
|
|
+ showAbove: true,
|
|
|
+ size: 16,
|
|
|
+ itemStyle: {
|
|
|
+ borderWidth: 10,
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- title: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- detail: {
|
|
|
- valueAnimation: true,
|
|
|
- fontSize: 16,
|
|
|
- offsetCenter: [0, "70%"],
|
|
|
- formatter: "{value}%",
|
|
|
- textStyle: {
|
|
|
- color: "#fff",
|
|
|
+ title: {
|
|
|
+ show: false,
|
|
|
},
|
|
|
- },
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: 70,
|
|
|
+ detail: {
|
|
|
+ valueAnimation: true,
|
|
|
+ fontSize: 16,
|
|
|
+ offsetCenter: [0, "70%"],
|
|
|
+ formatter: "{value}%",
|
|
|
+ textStyle: {
|
|
|
+ color: "#fff",
|
|
|
+ },
|
|
|
},
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: Number((Number(c) / Number(o)) * 100).toFixed(0),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ return option;
|
|
|
};
|
|
|
|
|
|
const progressOption = ref({
|
|
|
value: 66,
|
|
|
localGradient: true,
|
|
|
+ orderNum: 0,
|
|
|
+ comNum: 0,
|
|
|
});
|
|
|
|
|
|
-onMounted(() => {
|
|
|
+onMounted(async () => {
|
|
|
const chart = echarts.init(chartRef.value);
|
|
|
- chart.setOption(option);
|
|
|
+
|
|
|
+ let res: any = await productionQuantity();
|
|
|
+ let { data } = res;
|
|
|
+
|
|
|
+ progressOption.value = {
|
|
|
+ value: Number(data.rate) * 100,
|
|
|
+ localGradient: true,
|
|
|
+ orderNum: Number(data.orderNum),
|
|
|
+ comNum: Number(data.completeNum),
|
|
|
+ };
|
|
|
+
|
|
|
+ chart.setOption(generateOption(data.completeNum, data.orderNum));
|
|
|
});
|
|
|
|
|
|
const props = defineProps({
|