From 4a40f20612fc2a3147cf5759c74b140e49e9fc57 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 12 Nov 2024 15:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8D=87=E7=BA=A72?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kanban/dailyoutput/echarts3dbar2.vue | 8 +- src/views/kanban/dailyoutput/index.vue | 256 +++++++++++++++++- 2 files changed, 256 insertions(+), 8 deletions(-) diff --git a/src/views/kanban/dailyoutput/echarts3dbar2.vue b/src/views/kanban/dailyoutput/echarts3dbar2.vue index 72eec6e..0370470 100644 --- a/src/views/kanban/dailyoutput/echarts3dbar2.vue +++ b/src/views/kanban/dailyoutput/echarts3dbar2.vue @@ -23,7 +23,7 @@ export default { }; }, watch: { - xAxisdata1: function (newVal, oldVal) { + xAxis1data: function (newVal, oldVal) { this.initChart(); }, colorlist: function (newVal, oldVal) {}, @@ -192,7 +192,7 @@ export default { ], series: [ { - name: "理论数量", + //name: "理论数量", type: "bar", barWidth: "12px", itemStyle: { @@ -213,7 +213,7 @@ export default { data: this.series1data1, }, { - name: "实际产量", + //name: "实际产量", type: "bar", barWidth: "12px", itemStyle: { @@ -234,7 +234,7 @@ export default { data: this.series1data2, }, { - name: "达成率", + //name: "达成率", type: "line", yAxisIndex: 1, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用 smooth: false, //平滑曲线显示 diff --git a/src/views/kanban/dailyoutput/index.vue b/src/views/kanban/dailyoutput/index.vue index d6399b5..d75197b 100644 --- a/src/views/kanban/dailyoutput/index.vue +++ b/src/views/kanban/dailyoutput/index.vue @@ -463,6 +463,95 @@ export default { _this.yAxis1seriesMAX1 = MAX2; } _this.yAxis1seriesMAX2 = Math.max(..._this.series1data3); + let numberlist = []; + let dataoption = []; + let totalArr = []; + let barWidth1 = 20; + let barWidth2 = 30; + _this.optionDatalist1 = []; + if (response.data.totalNum.length > 0) { + _this.number1 = response.data.totalNum[0].totalNum; + } + if (response.data.everyNum.length > 0) { + response.data.everyNum.forEach((item) => { + let a = {}; + a.name = item.equName; + a.value = item.totalNum; + a.code = item.equCode; + _this.optionDatalist1.push(a); + dataoption.push(a); + numberlist.push(item.totalNum); + }); + + dataoption.sort((a, b) => { + return a.value - b.value; + }); + let max = Math.max(...numberlist); + max = max + 100; + dataoption.forEach((item) => { + totalArr.push(max); + }); + if (dataoption.length > 10) { + barWidth1 = ""; + barWidth2 = ""; + } + option1 = { + yAxis: [ + { + data: dataoption, + }, + ], + series: [ + { + data: dataoption, + itemStyle: { + normal: { + color: function (params) { + var index_num = params.value; + + for (var i = 0; i < dataoption.length; i++) { + //判断数据是否大于1 + if (index_num > 1131) { + //var colorList = ['#ff7f50', '#87cefa', '#da70d6', '#32cd32', '#6495ed', '#ff69b4', '#ba55d3', '#cd5c5c', '#ffa500', '#40e0d0']; + //return colorList[params.dataIndex]; + return new echarts.graphic.LinearGradient( + 0, + 0, + 1, + 0, + [ + { offset: 0, color: "#FFB742" }, + { offset: 1, color: "#FFB742" }, + ] + ); + } else { + //var colorList = ['blue']; + //return colorList[params.dataIndex]; + return new echarts.graphic.LinearGradient( + 0, + 0, + 1, + 0, + [ + { offset: 0, color: "#005954" }, + { offset: 1, color: "#66E1DF" }, + ] + ); + } + } + }, + }, + }, + barWidth: barWidth1, + }, + { + data: totalArr, + barWidth: barWidth2, + }, + ], + }; + myChart1.setOption(option1); + } } } }); @@ -576,9 +665,6 @@ export default { }).then((response) => { if (response) { if (response.data) { - let numberlist = []; - let dataoption = []; - let totalArr = []; _this.xAxis2data = response.data.dayNames; _this.series2data1 = response.data.plans; _this.series2data2 = response.data.acts; @@ -593,6 +679,86 @@ export default { _this.yAxis2seriesMAX1 = MAX2; } _this.yAxis2seriesMAX2 = Math.max(..._this.series2data3); + let numberlist = []; + let dataoption = []; + let totalArr = []; + _this.optionDatalist2 = []; + if (response.data.totalNum.length > 0) { + _this.number2 = response.data.totalNum[0].totalNum; + } + if (response.data.everyNum.length > 0) { + response.data.everyNum.forEach((item) => { + let a = {}; + a.name = item.equName; + a.value = item.totalNum; + a.code = item.equCode; + _this.optionDatalist2.push(a); + dataoption.push(a); + numberlist.push(item.totalNum); + }); + dataoption.sort((a, b) => { + return a.value - b.value; + }); + let max = Math.max(...numberlist); + max = max + 100; + dataoption.forEach((item) => { + totalArr.push(max); + }); + option2 = { + yAxis: [ + { + data: dataoption, + }, + ], + series: [ + { + data: dataoption, + itemStyle: { + normal: { + color: function (params) { + var index_num = params.value; + + for (var i = 0; i < dataoption.length; i++) { + //判断数据是否大于1 + if (index_num > 1131) { + //var colorList = ['#ff7f50', '#87cefa', '#da70d6', '#32cd32', '#6495ed', '#ff69b4', '#ba55d3', '#cd5c5c', '#ffa500', '#40e0d0']; + //return colorList[params.dataIndex]; + return new echarts.graphic.LinearGradient( + 0, + 0, + 1, + 0, + [ + { offset: 0, color: "#FFB742" }, + { offset: 1, color: "#FFB742" }, + ] + ); + } else { + //var colorList = ['blue']; + //return colorList[params.dataIndex]; + return new echarts.graphic.LinearGradient( + 0, + 0, + 1, + 0, + [ + { offset: 0, color: "#005954" }, + { offset: 1, color: "#66E1DF" }, + ] + ); + } + } + }, + }, + }, + }, + { + data: totalArr, + }, + ], + }; + myChart2.setOption(option2); + } } } }); @@ -720,7 +886,89 @@ export default { _this.yAxis3seriesMAX1 = MAX2; } _this.yAxis3seriesMAX2 = Math.max(..._this.series3data3); + let numberlist = []; + let dataoption = []; + let totalArr = []; + _this.optionDatalist3 = []; + + if (response.data.totalNum.length > 0) { + _this.number3 = response.data.totalNum[0].totalNum; + } + if (response.data.everyNum.length > 0) { + response.data.everyNum.forEach((item) => { + let a = {}; + a.name = item.equName; + a.value = item.totalNum; + a.code = item.equCode; + _this.optionDatalist3.push(a); + dataoption.push(a); + numberlist.push(item.totalNum); + }); + dataoption.sort((a, b) => { + return a.value - b.value; + }); + let max = Math.max(...numberlist); + max = max + 100; + dataoption.forEach((item) => { + totalArr.push(max); + }); + option3 = { + yAxis: [ + { + data: dataoption, + }, + ], + series: [ + { + data: dataoption, + itemStyle: { + normal: { + color: function (params) { + var index_num = params.value; + + for (var i = 0; i < dataoption.length; i++) { + //判断数据是否大于1 + if (index_num > 1131) { + //var colorList = ['#ff7f50', '#87cefa', '#da70d6', '#32cd32', '#6495ed', '#ff69b4', '#ba55d3', '#cd5c5c', '#ffa500', '#40e0d0']; + //return colorList[params.dataIndex]; + return new echarts.graphic.LinearGradient( + 0, + 0, + 1, + 0, + [ + { offset: 0, color: "#FFB742" }, + { offset: 1, color: "#FFB742" }, + ] + ); + } else { + //var colorList = ['blue']; + //return colorList[params.dataIndex]; + return new echarts.graphic.LinearGradient( + 0, + 0, + 1, + 0, + [ + { offset: 0, color: "#005954" }, + { offset: 1, color: "#66E1DF" }, + ] + ); + } + } + }, + }, + }, + }, + { + data: totalArr, + }, + ], + }; + myChart3.setOption(option3); + } } + } }); var myChart4 = echarts.init(document.querySelector("#echart4")); @@ -825,7 +1073,7 @@ export default { ], }; myChart4.setOption(option4); - getWhiteBoardEquPro7Days({ + getMesBoardEquProductionToday({ factory: _this.selectxt, shiftId: _this.selectxtclasses, ymd: _this.datetime,