From dbb2a464d215efcda6c0761b0574e9d9d6e9f24d Mon Sep 17 00:00:00 2001 From: liuying <1427574514@qq.com> Date: 周四, 17 10月 2024 15:35:19 +0800 Subject: [PATCH] 整改 --- yiqi_screen/src/components/ProductionStatistics.vue | 41 +++++++++++++------- yiqi_screen/src/components/ProductionCompletionTrend.vue | 31 ++++++++++++--- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/yiqi_screen/src/components/ProductionCompletionTrend.vue b/yiqi_screen/src/components/ProductionCompletionTrend.vue index 2d23cb8..8987f4f 100644 --- a/yiqi_screen/src/components/ProductionCompletionTrend.vue +++ b/yiqi_screen/src/components/ProductionCompletionTrend.vue @@ -19,16 +19,21 @@ }, watch:{ produceCompletionData(val){ - let xData=[],yData1=[],yData2=[]; + let xData=[],yData1=[],yData2=[],yData3=[]; val.forEach(item => { xData.push(item.month) - yData1.push(item.planCompletionNum) - yData2.push(item.planCompletionRate) + yData1.push(item.completionNum) //瀹為檯 + yData2.push(item.planCompletionRate) //planCompletionRate + yData3.push(item.planCompletionNum) //璁″垝 }); this.$set(this.option.xAxis,'data',xData) this.$set(this.option.series[0],'data',yData1) this.$set(this.option.series[1],'data',yData2) - this.myChart.setOption(this.option); + this.$set(this.option.series[2],'data',yData3) + this.$nextTick(() => { + this.myChart.setOption(this.option); + }); + } }, mounted() { @@ -37,8 +42,12 @@ tooltip: { trigger: "axis", formatter: - '{b0}鏈�<br /><a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#13e5f2,#01afba);border-radius:50%"></a> {a0}: {c0}<br /><a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#fff,#eee);border-radius:50%"></a> {a1}: {c1}%', + '{b0}鏈�<br />' + + '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#13e5f2,#01afba);border-radius:50%"></a> {a0}: {c0}<br />' + + '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#ffc107,#fd7e14);border-radius:50%"></a> {a2}: {c2}<br />'+ + '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#fff,#eee);border-radius:50%"></a> {a1}: {c1}%<br />', // 娣诲姞鐢熶骇璁″垝鏁版彁绀� backgroundColor: "rgba(0,0,0,0.7)", + textStyle: { color: "#fff", }, @@ -69,7 +78,6 @@ yAxis: [ { type: "value", - // name: "鎶ヨ娆℃暟", position:'left', axisLine: { show: true, @@ -154,6 +162,17 @@ width:3 } }, + { + name: "鐢熶骇璁″垝鏁�", // 娣诲姞鐢熶骇璁″垝鏁� + type: "line", + data: [], // 鏍规嵁闇�瑕佸~鍏呮鏁扮粍 + showSymbol: false, + yAxisIndex: 0, // 涓庣浉搴旂殑 y 杞村叧鑱� + color: 'rgba(255,205,86,0.85)', // 鑷畾涔夐鑹� + lineStyle: { + width: 3 + } + } ], // animation: true, // dataZoom: [ diff --git a/yiqi_screen/src/components/ProductionStatistics.vue b/yiqi_screen/src/components/ProductionStatistics.vue index 5a50aa1..65d8a59 100644 --- a/yiqi_screen/src/components/ProductionStatistics.vue +++ b/yiqi_screen/src/components/ProductionStatistics.vue @@ -22,22 +22,33 @@ }, watch: { produceStatisData(val) { - this.$set(this.option.series[1], "data", [ - { value: val.currentMonthProduceNum }, - { value: val.currentMonthPlanNum - val.currentMonthProduceNum }, - ]); - // 褰撳墠鐝粍瀹為檯鐢熶骇鏁伴噺 currentShiftProduceNum - // 褰撳墠鐝粍璁″垝鐢熶骇鏁伴噺 currentShiftPlanNum - this.$set(this.option.series[0], "data", [ - - // { value: 1 }, //瀹為檯鐢熶骇鏁伴噺 1/ (9+1) = 10% - // { value: 9 }, + // 褰撳墠鐝粍瀹為檯鐢熶骇鏁伴噺 currentShiftProduceNum + // 褰撳墠鐝粍璁″垝鐢熶骇鏁伴噺 currentShiftPlanNum + var num1 = val.currentShiftProduceNum; //瀹為檯鐢熶骇鏁伴噺 + var num2 = val.currentShiftPlanNum - val.currentShiftProduceNum; //璁″垝鐢熶骇鏁伴噺 + if(val.currentShiftPlanNum == 0){ //鍒嗘瘝涓�0 鏄剧ず0% + num1 = 0 + num2 = 10 + } + this.$set(this.option.series[0], "data", [ + // { value: 1 }, //瀹為檯鐢熶骇鏁伴噺 1/ (9+1) = 10% + // { value: 9 }, + { value: num1 }, //瀹為檯鐢熶骇鏁伴噺 + { value: num2 }, + ]); + var num3 = val.currentMonthProduceNum; + var num4 = val.currentMonthPlanNum - val.currentMonthProduceNum; + if(val.currentMonthPlanNum == 0 ){ //鍒嗘瘝涓�0 鏄剧ず0% + num3 = 0 + num4 = 10 + } + this.$set(this.option.series[1], "data", [ + { value: num3 }, + { value: num4 }, + ]); - { value: val.currentShiftProduceNum }, - { value: val.currentShiftPlanNum - val.currentShiftProduceNum }, - ]); - this.myChart.setOption(this.option); - this.hignLightPie(); + this.myChart.setOption(this.option); + this.hignLightPie(); }, }, mounted() { -- Gitblit v1.9.3