diff --git a/src/views/bigScreen/index_photon.vue b/src/views/bigScreen/index_photon.vue index ebefa18a..46555252 100644 --- a/src/views/bigScreen/index_photon.vue +++ b/src/views/bigScreen/index_photon.vue @@ -51,7 +51,7 @@
AVG合格数 -
{{countOk_AVG}}
+
{{ countOk_AVG }}
@@ -61,7 +61,7 @@
预制管合格数 -
{{countOk_dept10}}
+
{{ countOk_dept10 }}
@@ -84,9 +84,9 @@
本周不合格占比
- 7车间 - 10车间 - + 7车间 + 10车间 +
@@ -135,11 +135,11 @@

390

-
+

光纤预制管

390{{ currentObj.生产数 }}

-
+

光纤预制棒

390{{ currentObj.生产数 }}

@@ -197,7 +197,7 @@ import 'animate.css'; export default { data() { return { - dept7Data:[ + dept7Data: [ { value: 0, name: '炸纹' }, { value: 0, name: '条纹' }, { value: 0, name: '气泡' }, @@ -205,7 +205,7 @@ export default { { value: 0, name: '其他' }, { value: 0, name: '合格' }, ], - dept10Data:[ + dept10Data: [ { value: 0, name: '椭圆弯曲' }, { value: 0, name: '大小头' }, { value: 0, name: '偏壁' }, @@ -260,24 +260,24 @@ export default { currentObj: { deptName: '' }, - deptName:'10车间', + deptName: '10车间', heightTimer: null, - countOk_AVG:0, - countOk_dept7:0, - countOk_dept10:0, - blockTableHeight:0, - weekDateList:[], + countOk_AVG: 0, + countOk_dept7: 0, + countOk_dept10: 0, + blockTableHeight: 0, + weekDateList: [], //表一数据 - saleOutdept6:[0,0,0,0,0,0,0], - saleOutAVG:[0,0,0,0,0,0,0], + saleOutdept6: [0, 0, 0, 0, 0, 0, 0], + saleOutAVG: [0, 0, 0, 0, 0, 0, 0], //表二数据 - countOkAVG:[0,0,0,0,0,0,0], - countOkDept7:[0,0,0,0,0,0,0], - countOkDept10:[0,0,0,0,0,0,0], + countOkAVG: [0, 0, 0, 0, 0, 0, 0], + countOkDept7: [0, 0, 0, 0, 0, 0, 0], + countOkDept10: [0, 0, 0, 0, 0, 0, 0], //表三数据 - countRateDept7:[0,0,0,0,0,0,0], - countRateDept10:[0,0,0,0,0,0,0], - pieoption : { + 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, @@ -295,37 +295,37 @@ export default { show: true, }, series: { - name: '不合格占比', - type: 'pie', - radius: [30, 60], - center: ['50%', '45%'], - // roseType: 'area', - itemStyle: { - borderRadius: 2 + name: '不合格占比', + type: 'pie', + radius: [30, 60], + center: ['50%', '45%'], + // roseType: 'area', + itemStyle: { + borderRadius: 2 + }, + label: { + minMargin: 10, + edgeDistance: 10, + fontSize: '12px' + }, + labelLine: { + lineStyle: { }, - 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:[] - } + 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: [] + } } } }, @@ -346,14 +346,14 @@ export default { that.showTime(); }, 1000); that.notokTimer = setInterval(() => { - if(that.deptName=='10车间'){ - that.deptName='7车间' - }else{ - that.deptName='10车间' + if (that.deptName == '10车间') { + that.deptName = '7车间' + } else { + that.deptName = '10车间' } that.deptNameChange(that.deptName); }, 5000); - + that.initChart(); }) //一天的毫秒数 @@ -367,8 +367,8 @@ export default { let first = new Date(new Date(cDate.getTime() - (weekFirst * ondDayTime)));//本周周一 let last = new Date(new Date(cDate.getTime() + (weekLast * ondDayTime)));//本周周日 let dateArr = []; - for(let i=0;i<7;i++){ - let itemDate = new Date(first.getTime()-i*ondDayTime); + for (let i = 0; i < 7; i++) { + let itemDate = new Date(first.getTime() - i * ondDayTime); let item = itemDate.getFullYear() + '-' + (itemDate.getMonth() + 1) + '-' + itemDate.getDate(); dateArr.push(item); } @@ -385,41 +385,41 @@ export default { getsaleOut() { let that = this; let obj = { - query: { start_date: that.start_date, end_date: that.end_date}, + query: { start_date: that.start_date, end_date: that.end_date }, }; that.$API.bi.dataset.exec.req('saleOutDay', obj).then((res6) => { - let list = res6.data2.ds0; - let saleOutdept6 = [0,0,0,0,0,0,0];//棒管交付数 - if(list.length>0){ + let list = res6.data2.ds0; + let saleOutdept6 = [0, 0, 0, 0, 0, 0, 0];//棒管交付数 + if (list.length > 0) { list.forEach(item => { - let date = item.年+'-'+item.月+'-'+item.日; + let date = item.年 + '-' + item.月 + '-' + item.日; let index = this.weekDateList.indexOf(date); saleOutdept6[index] = item.交付数; }); - } + } that.saleOutdept6 = saleOutdept6; that.getAVGDayData(); }); }, //获取AVG的交付数$合格数 - getAVGDayData(){ - let that = this; - this.$API.wpm.otherlog.list.req({product:'AVG',page:0,handle_date__gte: that.start_date,handle_date__lte: that.end_date}).then(res=>{ - let list = res; - let count_ok = 0,saleOutAVG = [0,0,0,0,0,0,0],countOkAVG= [0,0,0,0,0,0,0]; - if(list.length>0){ - list.forEach(item=>{ - count_ok=count_ok+item.count_ok; + getAVGDayData() { + let that = this; + this.$API.wpm.otherlog.list.req({ product: 'AVG', page: 0, handle_date__gte: that.start_date, handle_date__lte: that.end_date }).then(res => { + let list = res; + let count_ok = 0, saleOutAVG = [0, 0, 0, 0, 0, 0, 0], countOkAVG = [0, 0, 0, 0, 0, 0, 0]; + if (list.length > 0) { + list.forEach(item => { + count_ok = count_ok + item.count_ok; let index = this.weekDateList.indexOf(item.handle_date); saleOutAVG[index] = item.count_delivered; countOkAVG[index] = item.count_ok; - }) - that.saleOutAVG = saleOutAVG; - that.countOkAVG = countOkAVG; - that.countOk_AVG = count_ok; - } + }) + that.saleOutAVG = saleOutAVG; + that.countOkAVG = countOkAVG; + that.countOk_AVG = count_ok; + } that.getCountDept7(); - //左1---本周交付数 + //左1---本周交付数 let chartDom = document.getElementById('line1'); chartDom.style.height = this.blockHeight; let myChart = echarts.init(chartDom); @@ -482,7 +482,7 @@ export default { bottom: '5%', containLabel: true }, - xAxis:{ + xAxis: { type: 'category', data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], nameTextStyle: { @@ -492,7 +492,7 @@ export default { color: '#ffffff' }, }, - yAxis:{ + yAxis: { name: "", type: 'value', nameTextStyle: { @@ -572,59 +572,59 @@ export default { ] }; myChart.setOption(option); - }) - }, - //7车间合格数&&合格率 - getCountDept7(){ + }) + }, + //7车间合格数&&合格率 + getCountDept7() { let that = this; let obj = { - query: { start_date: that.start_date, end_date: that.end_date,dept_name: "7车间"}, + query: { start_date: that.start_date, end_date: that.end_date, dept_name: "7车间" }, }; that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => { - let list = res.data2.ds0; - let countOkDept7 = [0,0,0,0,0,0,0],countRateDept7 = [0,0,0,0,0,0,0]; - let value0=0,value1=0,value2=0,value3=0,value4=0,value5=0,countOk_dept7=0; - if(list.length>0){ + let list = res.data2.ds0; + let countOkDept7 = [0, 0, 0, 0, 0, 0, 0], countRateDept7 = [0, 0, 0, 0, 0, 0, 0]; + let value0 = 0, value1 = 0, value2 = 0, value3 = 0, value4 = 0, value5 = 0, countOk_dept7 = 0; + if (list.length > 0) { list.forEach(item => { - let date = item.年+'-'+item.月+'-'+item.日; + let date = item.年 + '-' + item.月 + '-' + item.日; let index = this.weekDateList.indexOf(date); countOkDept7[index] = item.合格数; countRateDept7[index] = Math.round(item.合格率); - countOk_dept7 = countOk_dept7+item.合格数; - 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.合格数; + countOk_dept7 = countOk_dept7 + item.合格数; + 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.合格数; }); - } + } that.countOkDept7 = countOkDept7; - that.deptData =that.dept7Data; + that.deptData = that.dept7Data; that.countRateDept7 = countRateDept7; that.countOk_dept7 = countOk_dept7; that.getCountDept10(); }); }, //10车间合格数&&合格率 - getCountDept10(){ + getCountDept10() { let that = this; let obj = { - query: { start_date: that.start_date, end_date: that.end_date,dept_name: "10车间"}, + query: { start_date: that.start_date, end_date: that.end_date, dept_name: "10车间" }, }; that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => { - let list = res.data2.ds0; - let countOkDept10 = [0,0,0,0,0,0,0],countRateDept10 = [0,0,0,0,0,0,0]; - let value0=0,value1=0,value2=0,value3=0,value4=0,value5=0,countOk_dept10=0; - if(list.length>0){ + let list = res.data2.ds0; + let countOkDept10 = [0, 0, 0, 0, 0, 0, 0], countRateDept10 = [0, 0, 0, 0, 0, 0, 0]; + let value0 = 0, value1 = 0, value2 = 0, value3 = 0, value4 = 0, value5 = 0, countOk_dept10 = 0; + if (list.length > 0) { list.forEach(item => { - let date = item.年+'-'+item.月+'-'+item.日; + let date = item.年 + '-' + item.月 + '-' + item.日; let index = this.weekDateList.indexOf(date); countOkDept10[index] = item.合格数; countRateDept10[index] = Math.round(item.合格率); - countOk_dept10 = countOk_dept10+item.合格数; - }); - } + countOk_dept10 = countOk_dept10 + item.合格数; + }); + } that.countOkDept10 = countOkDept10; that.countRateDept10 = countRateDept10; that.countOk_dept10 = countOk_dept10; @@ -632,19 +632,19 @@ export default { }); }, //本周计划完成度 - getPlanRate(){ + getPlanRate() { let that = this; let obj = { - query: { start_date: that.start_date, end_date: that.end_date,dept_name: that.deptName}, + 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) => { + that.$API.bi.dataset.exec.req('productStatistic', obj).then((res) => { let list = res.data2.ds0; - let PlanRate = [0,0,0,0,0,0,0]; - if(list.length>0){ + let PlanRate = [0, 0, 0, 0, 0, 0, 0]; + if (list.length > 0) { list.forEach(item => { - let date = item.年+'-'+item.月+'-'+item.日; + let date = item.年 + '-' + item.月 + '-' + item.日; let index = this.weekDateList.indexOf(date); - PlanRate[index] = Math.round((item.合格数/item.任务数)*100) ; + PlanRate[index] = Math.round((item.合格数 / item.任务数) * 100); }); } //柱状图折线 @@ -734,7 +734,7 @@ export default { } }, barWidth: 15, - data:PlanRate, + data: PlanRate, itemStyle: { borderRadius: [5, 5, 0, 0], color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ @@ -774,45 +774,45 @@ export default { line3Chart.setOption(line3option); }) }, - deptNameChange(deptName){ + deptNameChange(deptName) { let that = this; let obj = { - query: { start_date: that.start_date, end_date: that.end_date,dept_name: deptName}, + 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; + let list = res.data2.ds0; let deptData = []; - if(list.length>0){ + if (list.length > 0) { 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.合格数; + 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.合格数; + } 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; } - }); - }else{ - if(that.deptName == '7车间'){ + }); + } else { + if (that.deptName == '7车间') { deptData = that.dept7Data; - }else{ + } else { deptData = that.dept10Data; } } console.log(deptData) that.deptData = deptData; that.pieoption.series.data = deptData; - let pieoption = that.pieoption; + let pieoption = that.pieoption; let pieDom = document.getElementById('pie'); let pieChart = echarts.init(pieDom); pieChart.clear(); @@ -822,16 +822,16 @@ export default { //库存情况 getMaterialList() { let that = this; - this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => { - let data = []; - if(res.length>0){ + this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => { + let data = []; + if (res.length > 0) { res.forEach(item => { let arr = []; - let colorText=''; - if(item.count_safe!==null&&item.count_safe' - }else{ - colorText=''+item.count+'' + let colorText = ''; + if (item.count_safe !== null && item.count_safe < item.count) { + colorText = '' + item.count + '' + } else { + colorText = '' + item.count + '' } arr[0] = item.full_name; arr[1] = item.specification;//规格 @@ -841,9 +841,9 @@ export default { }); } that.taskBoard.data = data; - console.log('getMaterialList',data) - }) - }, + console.log('getMaterialList', data) + }) + }, showTime() { this.currentTime = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss'); this.currentWeek = this.$TOOL.dateFormat(new Date(), 'week'); @@ -1142,28 +1142,29 @@ export default { }); }, getDeptDetail(name) { + let that = this; if (this.currentObj.deptName == name && this.clickVisible) { this.dialogData.deptName = name; } else { this.infoVisibel = true; this.dialogData.deptName = name; } - let obj ={ - query: {start_date:this.start_date,end_date:this.end_date,dept_name: name}, + let obj = { + query: { start_date: this.start_date, end_date: this.end_date, dept_name: name }, }; that.$API.bi.dataset.exec.req('lineDay', obj).then((res1) => { - console.log('生产车间按日统计:',res1); + console.log('生产车间按日统计:', res1); let list1 = res1.data2.ds0; - if(name=='6车间'){ + if (name == '6车间') { that.currentObj = list1[0]; that.currentObj.rate = list1[0] - }else if(name=='7车间'||name=='10车间'){ + } else if (name == '7车间' || name == '10车间') { that.currentObj = list1[0]; - }else if(name=='8车间'){ + } else if (name == '8车间') { } - let seriesData1 = [],xAxisData1=[]; - + let seriesData1 = [], xAxisData1 = []; + debugger; }); }, @@ -1247,7 +1248,7 @@ export default { bottom: '5%', containLabel: true }, - xAxis:{ + xAxis: { type: 'category', data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], nameTextStyle: { @@ -1257,19 +1258,19 @@ export default { color: '#ffffff' }, }, - yAxis: { - name: "", - type: 'value', - nameTextStyle: { - color: '#ffffff' - }, - axisLabel: { - color: '#ffffff' - }, - splitLine: { - show: false - }, + yAxis: { + name: "", + type: 'value', + nameTextStyle: { + color: '#ffffff' }, + axisLabel: { + color: '#ffffff' + }, + splitLine: { + show: false + }, + }, series: [ { name: '预制棒', @@ -1335,7 +1336,7 @@ export default { } ]) }, - data:that.countOkAVG + data: that.countOkAVG } ] }; @@ -1394,7 +1395,7 @@ export default { bottom: '5%', containLabel: true }, - xAxis:{ + xAxis: { type: 'category', data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], nameTextStyle: { @@ -1432,14 +1433,14 @@ export default { itemStyle: { // 设置symbol的颜色 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: 'orange' - }, - { - offset: 1, - color: 'yellow' - }]) + { + offset: 0, + color: 'orange' + }, + { + offset: 1, + color: 'yellow' + }]) }, smooth: 0.5, // 设置折线弧度 data: that.countRateDept7, @@ -1468,14 +1469,14 @@ export default { itemStyle: { // 设置symbol的颜色 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: 'rgb(1,235,239)' - }, - { - offset: 1, - color: 'rgb(5, 158, 163)' - }]) + { + offset: 0, + color: 'rgb(1,235,239)' + }, + { + offset: 1, + color: 'rgb(5, 158, 163)' + }]) }, smooth: 0.5, // 设置折线弧度 data: that.countRateDept10, @@ -1520,60 +1521,60 @@ export default { show: true, }, series: { - name: '不合格占比', - type: 'pie', - radius: [30, 60], - center: ['50%', '45%'], - // roseType: 'area', - itemStyle: { - borderRadius: 2 - }, - // label: { - // fontSize: 12, - // alignTo: 'edge', - // formatter: '{b}\n', - // edgeDistance: 10, - // lineHeight: 20, - // rich: { - // title: { - // fontSize: 12, - // color: '#999', - // lineHeight: 50, - // }, - // } - // }, - // 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 - // }; - // }, + name: '不合格占比', + type: 'pie', + radius: [30, 60], + center: ['50%', '45%'], + // roseType: 'area', + itemStyle: { + borderRadius: 2 + }, + // label: { + // fontSize: 12, + // alignTo: 'edge', + // formatter: '{b}\n', + // edgeDistance: 10, + // lineHeight: 20, + // rich: { + // title: { + // fontSize: 12, + // color: '#999', + // lineHeight: 50, + // }, + // } + // }, + // 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 + // }; + // }, - label: { - minMargin: 10, - edgeDistance: 10, - fontSize: '12px' + label: { + minMargin: 10, + edgeDistance: 10, + fontSize: '12px' + }, + labelLine: { + lineStyle: { }, - labelLine: { - lineStyle: { - }, - length: 2, - length2: 5 - }, - labelLayout: function (params) { - var isLeft = params.labelRect.x < pieChart.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:that.deptData - } + length: 2, + length2: 5 + }, + labelLayout: function (params) { + var isLeft = params.labelRect.x < pieChart.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: that.deptData + } }; that.pieoption = pieoption; pieChart.setOption(pieoption);