From 8c835fe715fbf71d5c3e7e97af29a394f0aaf00b Mon Sep 17 00:00:00 2001 From: shijing Date: Mon, 25 Dec 2023 17:30:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bigScreen/index_photon.vue | 148 +++++++++++++++++++-------- 1 file changed, 106 insertions(+), 42 deletions(-) diff --git a/src/views/bigScreen/index_photon.vue b/src/views/bigScreen/index_photon.vue index 0d59fe2b..45851269 100644 --- a/src/views/bigScreen/index_photon.vue +++ b/src/views/bigScreen/index_photon.vue @@ -83,6 +83,10 @@
本周不合格占比
+ + 7车间 + 10车间 +
@@ -178,7 +182,6 @@
- @@ -194,32 +197,6 @@ import 'animate.css'; export default { data() { return { - chartPieOption:{ - backgroundColor: '', - tooltip: { - trigger: 'item' - }, - legend: { - top:'bottom', - }, - series: { - name: '完成率', - type: 'pie', - radius: '50%', - itemStyle: { - borderRadius: 2 - }, - center: ['50%', '45%'], - data: [], - emphasis: { - itemStyle: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)' - } - } - } - }, dept7Data:[ { value: 0, name: '炸纹' }, { value: 0, name: '条纹' }, @@ -283,7 +260,7 @@ export default { currentObj: { deptName: '' }, - deprName:'10车间', + deptName:'10车间', heightTimer: null, countOk_AVG:0, countOk_dept7:0, @@ -300,6 +277,56 @@ export default { //表三数据 countRateDept7:[0,0,0,0,0,0,0], countRateDept10:[0,0,0,0,0,0,0], + pieoption : { + color: ['rgb(3,195,198)', 'rgb(155,248,249)', 'rgb(110,181,249)', 'rgb(205,248,248)', 'rgb(248,189,118)'], + legend: { + bottom: 1, + textStyle: { + color: '#fff' + } + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + toolbox: { + show: true, + }, + series: { + name: '不合格占比', + type: 'pie', + radius: [30, 60], + center: ['50%', '45%'], + // roseType: 'area', + itemStyle: { + borderRadius: 2 + }, + label: { + minMargin: 10, + edgeDistance: 10, + fontSize: '12px' + }, + labelLine: { + lineStyle: { + }, + length: 2, + length2: 5 + }, + labelLayout: function (params) { + var isLeft = params.labelRect.x < myChart.getWidth() / 2 + var points = params.labelLinePoints; + points[2][0] = isLeft ? params.labelRect.x : params.labelRect.x + params.labelRect.width + return { + labelLinePoints: points, + dy: -10, + dx: 0 + } + }, + data:[] + } + } } }, mounted() { @@ -312,12 +339,23 @@ export default { document.getElementById('scrollTable').style.height = height1 + 'px' this.showTime(); this.$nextTick(() => { - that.initChart(); + that.getsaleOut(); that.initDomStyle(); that.initFactory(); that.timerTime = setInterval(() => { that.showTime(); }, 1000); + that.notokTimer = setInterval(() => { + if(that.deptName=='10车间'){ + that.deptName='7车间' + }else{ + that.deptName='10车间' + } + + that.deptNameChange(that.deptName); + }, 5000); + + that.initChart(); }) //一天的毫秒数 const ondDayTime = 86400000 @@ -340,7 +378,6 @@ export default { this.end_date = last.getFullYear() + '-' + (last.getMonth() + 1) + '-' + last.getDate(); this.getsaleOut(); this.getPlanRate(); - this.getAVGDayData(); this.getMaterialList(); }, methods: { @@ -360,7 +397,7 @@ export default { saleOutdept6[index] = item.交付数; }); } - that.saleOutAVG = saleOutAVG; + that.saleOutdept6 = saleOutdept6; that.getAVGDayData(); }); }, @@ -586,13 +623,7 @@ export default { countOkDept10[index] = item.合格数; countRateDept10[index] = item.合格率; countOk_dept10 = countOk_dept10+item.合格数; - that.dept10Data[0].value= that.dept10Data[0].value+item.弯曲; - that.dept10Data[1].value= that.dept10Data[1].value+item.大小头; - that.dept10Data[2].value= that.dept10Data[2].value+item.偏壁; - that.dept10Data[3].value= that.dept10Data[3].value+item.结石; - that.dept10Data[4].value= that.dept10Data[4].value+item.气线; - that.dept10Data[5].value= that.dept10Data[5].value+item.合格数; - }); + }); } that.countOkDept10 = countOkDept10; that.countRateDept10 = countRateDept10; @@ -604,7 +635,7 @@ export default { getPlanRate(){ let that = this; let obj = { - query: { start_date: that.start_date, end_date: that.end_date,dept_name: that.deprName}, + query: { start_date: that.start_date, end_date: that.end_date,dept_name: that.deptName}, }; that.$API.bi.dataset.exec.req('productStatistic', obj).then((res) => { let list = res.data2.ds0; @@ -743,6 +774,40 @@ export default { line3Chart.setOption(line3option); }) }, + deptNameChange(deptName){ + let that = this; + let obj = { + query: { start_date: that.start_date, end_date: that.end_date,dept_name: deptName}, + }; + that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => { + let list = res.data2.ds0; + if(list.length>0){ + let deptData = []; + list.forEach(item => { + if(that.deptName == '7车间'){ + that.dept7Data[0].value= that.dept7Data[0].value+item.炸纹; + that.dept7Data[1].value= that.dept7Data[1].value+item.条纹; + that.dept7Data[2].value= that.dept7Data[2].value+item.气泡; + that.dept7Data[3].value= that.dept7Data[3].value+item.弯曲; + that.dept7Data[4].value= that.dept7Data[4].value+item.其他; + that.dept7Data[5].value= that.dept7Data[5].value+item.合格数; + deptData = that.dept7Data; + }else{ + that.dept10Data[0].value= that.dept10Data[0].value+item.弯曲; + that.dept10Data[1].value= that.dept10Data[1].value+item.大小头; + that.dept10Data[2].value= that.dept10Data[2].value+item.偏壁; + that.dept10Data[3].value= that.dept10Data[3].value+item.结石; + that.dept10Data[4].value= that.dept10Data[4].value+item.气线; + that.dept10Data[5].value= that.dept10Data[5].value+item.合格数; + deptData = that.dept10Data; + } + }); + } + let pieoption = that.pieoption; + pieoption.series.data = deptData; + pieChart.setOption(pieoption); + }); + }, //库存情况 getMaterialList() { let that = this; @@ -1425,8 +1490,7 @@ export default { toolbox: { show: true, }, - series: [ - { + series: { name: '不合格占比', type: 'pie', radius: [30, 60], @@ -1481,8 +1545,8 @@ export default { }, data:that.dept7Data } - ] }; + that.pieoption = pieoption; pieChart.setOption(pieoption); }, circleClose() {