From 889d80d88abd7b4a60846678624f4b976c15f820 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 13 六月 2025 09:07:36 +0800
Subject: [PATCH] 1.新增判断:当不良数量为零时,合格数量不能为零

---
 src/utils/myEcharts.js |  173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 171 insertions(+), 2 deletions(-)

diff --git a/src/utils/myEcharts.js b/src/utils/myEcharts.js
index 3fb285e..aed1df6 100644
--- a/src/utils/myEcharts.js
+++ b/src/utils/myEcharts.js
@@ -2119,12 +2119,12 @@
   return option
 }
 
-export function all02(data) {
+export function all02(data, title) {
   return {
     backgroundColor: 'transparent',
     // tooltip: {},
     title: {
-      text: '姣忔湀璁㈠崟鏁伴噺/鍑哄簱鏁伴噺',
+      text: title,
       left: '50%',
       top: '0%',
       textAlign: 'center',
@@ -3243,3 +3243,172 @@
   }
   return option
 }
+
+export function bar3(data) {
+  const option = {
+    backgroundColor: 'transparent',
+    grid: {
+      left: '1%',
+      right: '4%',
+      bottom: '6%',
+      top: '20%',
+      containLabel: true
+    },
+    legend: { // 鍥句緥缁勪欢锛岄鑹插拰鍚嶅瓧
+      left: 'center',
+      top: 10,
+      itemGap: 16,
+      itemWidth: 18,
+      itemHeight: 10,
+      data: [{
+        name: '浠诲姟鏁�'
+      },
+      {
+        name: '瀹屽伐鏁�'
+      }],
+      textStyle: {
+        color: colorX,
+        fontStyle: 'normal',
+        fontFamily: '寰蒋闆呴粦',
+        fontSize: 16
+      }
+    },
+    xAxis: [
+      {
+        type: 'category',
+        // data: data.map(i => i.step_code),
+        data: data.map(i => i.stepname),
+        boundaryGap: true,
+        axisLabel: {
+          interval: 0,
+          formatter: '{value}',
+          fontSize: 16,
+          margin: 20,
+          textStyle: {
+            color: colorX
+          }
+        },
+        axisLine: {
+          lineStyle: {
+            color: '#032c58'
+          }
+        },
+        splitLine: {
+          show: false,
+          lineStyle: {
+            color: '#032c58'
+          }
+        },
+        axisTick: {
+          show: false
+        }
+      }
+    ],
+    yAxis: [
+      {
+        // max: Math.max(...data.map(i => i.plan_qty)) * 1.2,
+        boundaryGap: false,
+        splitNumber: 4,
+        type: 'value',
+        axisLabel: {
+          textStyle: {
+            fontSize: 18,
+            color: colorX
+          }
+        },
+        // name: '鍗�',
+        // nameTextStyle: {
+        //   color: colorY,
+        //   fontSize: 14,
+        //   lineHeight: 20
+        // },
+        splitLine: {
+          show: true,
+          lineStyle: {
+            color: '#032c58'
+          }
+        },
+        axisLine: {
+          show: true,
+          lineStyle: {
+            color: '#032c58'
+          }
+        },
+        axisTick: {
+          show: true
+        }
+      }
+    ],
+    series: [
+      {
+        name: '浠诲姟鏁�',
+        type: 'bar',
+        data: data.map(i => i.plan_qty),
+        barWidth: 20,
+        barGap: 0, // 鏌遍棿璺濈
+        label: { // 鍥惧舰涓婄殑鏂囨湰鏍囩
+          normal: {
+            show: true,
+            position: 'top',
+            textStyle: {
+              color: colorX,
+              fontStyle: 'normal',
+              fontFamily: '寰蒋闆呴粦',
+              fontSize: 16
+            }
+          }
+        },
+        itemStyle: { // 鍥惧舰鏍峰紡
+          normal: {
+            barBorderRadius: [5, 5, 0, 0],
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+              offset: 1, color: 'rgba(127, 128, 225, 0.7)'
+            }, {
+              offset: 0.9, color: 'rgba(72, 73, 181, 0.7)'
+            }, {
+              offset: 0.31, color: 'rgba(0, 208, 208, 0.7)'
+            }, {
+              offset: 0.15, color: 'rgba(0, 208, 208, 0.7)'
+            }, {
+              offset: 0, color: 'rgba(104, 253, 255, 0.7)'
+            }], false)
+          }
+        }
+      },
+      {
+        name: '瀹屽伐鏁�',
+        type: 'bar',
+        data: data.map(i => i.good_qty),
+        barWidth: 20,
+        barGap: 1, // 鏌遍棿璺濈
+        label: { // 鍥惧舰涓婄殑鏂囨湰鏍囩
+          normal: {
+            show: true,
+            position: 'top',
+            textStyle: {
+              color: colorX,
+              fontStyle: 'normal',
+              fontFamily: '寰蒋闆呴粦',
+              fontSize: 16
+            }
+          }
+        },
+        itemStyle: { // 鍥惧舰鏍峰紡
+          normal: {
+            barBorderRadius: [5, 5, 0, 0],
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+              offset: 1, color: 'rgba(127, 128, 225, 0.7)'
+            }, {
+              offset: 0.9, color: 'rgba(72, 73, 181, 0.7)'
+            }, {
+              offset: 0.25, color: 'rgba(226, 99, 74, 0.7)'
+            }, {
+              offset: 0, color: 'rgba(253, 200, 106, 0.7)'
+            }], false)
+          }
+        }
+      }
+    ]
+  }
+  return option
+}

--
Gitblit v1.9.3