From e8ae54f70675b109f70ee6bffd91a1c5155f5829 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 22 Dec 2023 17:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E9=97=B4=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bigScreen/index_10dept.vue | 139 +++++--- src/views/bigScreen/index_6dept.vue | 156 ++++++--- src/views/bigScreen/index_7dept.vue | 499 +++++++++++++++++---------- 3 files changed, 522 insertions(+), 272 deletions(-) diff --git a/src/views/bigScreen/index_10dept.vue b/src/views/bigScreen/index_10dept.vue index 80240277..190bdad2 100644 --- a/src/views/bigScreen/index_10dept.vue +++ b/src/views/bigScreen/index_10dept.vue @@ -8,15 +8,19 @@ - +
今日任务
-
- ZB2 - 130 +
+
+ {{item.material_out_name}} + + {{item.count}} + +
@@ -135,40 +139,35 @@ export default { right: 0, data: [{ backgroundColor: 'rgb(1,235,239)', - name: '棒', + name: '生产数', itemStyle: { // color:'rgb(1,235,239)', color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgb(1,235,239)' + color: 'rgb(250,205,0)' }, { offset: 1, - color: 'rgb(5, 158, 163)' + color: 'rgb(254,129,0)' }]) }, textStyle: { color: '#fff' } - }, { - name: '管', - textStyle: { - color: '#fff' - } }], - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: 'rgb(250,205,0)' - }, - { - offset: 1, - color: 'rgb(254,129,0)' - } - ]) - } + // itemStyle: { + // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + // { + // offset: 0, + // color: 'rgb(250,205,0)' + // }, + // { + // offset: 1, + // color: 'rgb(254,129,0)' + // } + // ]) + // } }, toolbox: { feature: { @@ -193,7 +192,7 @@ export default { }, }, yAxis: { - name: "生产数", + name: "", type: 'value', nameTextStyle: { color: '#ffffff' @@ -212,7 +211,7 @@ export default { }, series: [ { - name: '管', + name: '生产数', type: 'bar', stack: 'Ad', barWidth: 30, @@ -242,38 +241,31 @@ export default { ] }, chart3Option:{ - backgroundColor: '', - tooltip: { - trigger: 'item' + backgroundColor: '', + tooltip: { + trigger: 'item' + }, + legend: { + top:'bottom', + }, + series: { + name: '完成率', + type: 'pie', + radius: '50%', + itemStyle: { + borderRadius: 2 }, - legend: { - top:'bottom', - }, - series: { - name: '完成率', - type: 'pie', - radius: '50%', + center: ['50%', '45%'], + data: [], + emphasis: { itemStyle: { - borderRadius: 2 - }, - center: ['50%', '45%'], - data: [ - { value: 1, name: '椭圆弯曲' }, - { value: 3, name: '大小头' }, - { value: 0, name: '偏壁' }, - { value: 5, name: '结石' }, - { value: 5, name: '气线' }, - { value: 200, name: '合格' }, - ], - emphasis: { - itemStyle: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)' - } + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' } } - }, + } + }, containerHeight1:100, containerHeight2:100, table1Visible:false, @@ -284,6 +276,7 @@ export default { attendanceData:[], liData2: ['序号','产品名称', '型号', '计划开始时间', '计划结束时间','完成进度', '产量','状态'], processData: [], + todayMtask:[], speed: 2000, myScroll: null, iliHeight: 30, @@ -302,6 +295,7 @@ export default { }, currentTime:'', currentDay:'', + today:'', todayObjet:{}, yesterdayObjet:{}, @@ -438,11 +432,13 @@ export default { this.currentDay = day; this.start_date =year+'-'+month+'-01'; this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate(); + this.today = year+'-'+month+'-'+day; let yesterday = new Date(date.getTime()-24*60*60*1000); this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate(); this.getMtask(); this.getAttendance(); this.getProductLine(); + this.getTodayMtask(); }, methods: { showTime(){ @@ -503,6 +499,7 @@ export default { let obj ={}; obj.start_date__gte = this.start_date; obj.end_date__lte = this.end_date; + obj.belong_dept__name='10车间'; obj.page=0; that.$API.pm.utask.list.req(obj).then((res) => { console.log('任务进度:',res); @@ -558,6 +555,7 @@ export default { let chart1Option = deepCopy(this.basicOption) chart1Option.xAxis.data = xAxisData1; chart1Option.series[0].data = seriesData1; + chart1Option.yAxis.name='生产数'; let chart1 = this.setChart("chart1", chart1Option); let index1 = 0 this.chartInterval1 = setInterval(function () { @@ -588,13 +586,14 @@ export default { } if(list2.length>0){ list2.forEach(item2=>{ - let index2 = item.日-1; + let index2 = item2.日-1; seriesData2[index2] = item2.合格率; }) } console.log('xAxisData2',xAxisData2) let chart2Option = deepCopy(this.basicOption); chart2Option.xAxis.data = xAxisData2; + chart2Option.yAxis.name='合格率'; chart2Option.legend = { icon: "stack", right: 0, @@ -705,7 +704,7 @@ export default { let chart3 = this.setChart("chart3", that.chart3Option); let index3 = 0 this.chartInterval3 = setInterval(function () { - if (index3 < chart3Option.series[0].data.length) { + if (index3 < that.chart3Option.series[0].data.length) { chart3.dispatchAction({ type: 'downplay', seriesIndex: 0 }); chart3.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index3 }); chart3.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index3 }); @@ -718,6 +717,34 @@ export default { }); }, + //今日任务 + getUtask(){ + let that = this; + let obj = {}; + let date = that.currentYear+'-'+that.currentMonth+'-'+that.currentDay; + obj.start_date =date; + obj.end_date =date; + obj.page = 0; + obj.belong_dept__name = '10车间'; + that.$API.pm.utask.list.req(obj).then(res=>{ + let list = res; + + }) + }, + //今日任务 + getTodayMtask(){ + let that = this; + let obj ={}; + obj.start_date = this.today; + obj.end_date = this.today; + obj.belong_dept__name='10车间'; + obj.page=0; + that.$API.pm.mtask.list.req(obj).then((res) => { + that.todayMtask=res; + console.log('今日任务:',res); + }); + }, + //累计合计 } } diff --git a/src/views/bigScreen/index_6dept.vue b/src/views/bigScreen/index_6dept.vue index 535bef85..4fb96668 100644 --- a/src/views/bigScreen/index_6dept.vue +++ b/src/views/bigScreen/index_6dept.vue @@ -7,37 +7,21 @@ - - -
-
-
今日任务
-
-
-
- - -
-
ZB2
-
- 130
-
-
- -
-
ZJ2
-
- 130
-
-
-
+ +
+
+
今日任务
+
+
+
+
+ {{item.material_out_name}} + + {{item.count}} +
- +
@@ -49,7 +33,7 @@
@@ -64,7 +48,7 @@
@@ -320,6 +304,9 @@ export default { [{elType:'primary',value:"开凿"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"}, {elType:'primary',value:368},{elType:'primary',value:320},{elType:'progress',value:99},{elType:'primary',value:'60%'},{elType:'primary',value:'周欸'}], [{elType:'primary',value:"配管"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"}, {elType:'primary',value:368},{elType:'primary',value:330},{elType:'progress',value:99},{elType:'primary',value:'60%'},{elType:'primary',value:'吴思'}], ], + todayMtask:[], + saleOutData:[], + processData:[], time: null, start_date:'', end_date:'', @@ -327,6 +314,7 @@ export default { dayInterval:null, currentTime:'', currentDay:'', + } }, mounted() { @@ -338,13 +326,21 @@ export default { this.table2Visible = true; const ondDayTime = 86400000; - let cDate = new Date(); - let month = cDate.getMonth()+1; - let start_date = cDate.getFullYear()+'-'+month+'-01'; - let lastDay = new Date(cDate.getFullYear(), cDate.getMonth(), 0).getDate(); - let end_date = cDate.getFullYear()+'-'+month+'-'+lastDay; + let date = new Date(); + let year = date.getFullYear(); + let month = date.getMonth()+1; + let day = date.getDate(); + let days = new Date(year, month, 0).getDate(); + this.days = days; + let start_date = year+'-'+month+'-01'; + let lastDay = new Date(year, month, 0).getDate(); + let end_date = year+'-'+month+'-'+lastDay; this.start_date = start_date; this.end_date = end_date; + this.today = year+'-'+month+'-'+day; + let yesterday = new Date(date.getTime()-24*60*60*1000); + this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate(); + this.getsaleOut(); let chart1Option = deepCopy(this.basicOption) this.setChart("chart1", chart1Option); @@ -354,7 +350,10 @@ export default { chart2Option.series[0].type = 'line'; chart2Option.series[1].type = 'line'; this.setChart("chart2", chart2Option) - + this.getMioItem();//发货情况 + this.getTodayMtask();//今日任务 + //昨日工序进度 + this.getMtask(); //时间 this.showTime() this.dayInterval = setInterval(()=>{ @@ -381,21 +380,98 @@ export default { } catch (error) { } }, 500) }, + //今日任务 + getTodayMtask(){ + let that = this; + let obj ={}; + obj.start_date = this.today; + obj.end_date = this.today; + obj.belong_dept__name='6车间'; + obj.page=0; + that.$API.pm.mtask.list.req(obj).then((res) => { + that.todayMtask=res; + console.log('今日任务:',res); + }); + }, //发货情况 getMioItem(){ let that = this; let obj ={}; - that.$API.inm.mioitem.list.req(obj).then((res) => { + obj.mio__type = 'sale_out'; + obj.page=0; + that.$API.inm.mio.list.req(obj).then((res) => { console.log(res); - debugger; + let saleOutData = []; + res.forEach(item => { + let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {}; + obj1.elType = 'primary'; + obj1.value = item.inout_date; + obj2.elType = 'primary'; + obj2.value = item.inout_date; + obj3.elType = 'primary'; + obj3.value = item.inout_date; + obj4.elType = 'primary'; + obj4.value = item.inout_date; + arr.push(obj1); + arr.push(obj2); + arr.push(obj3); + arr.push(obj4); + saleOutData.push(arr); + }); + this.saleOutData = saleOutData; }); }, //昨日工序进展 getMtask(){ let that = this; let obj ={}; + obj.start_date = this.today; + obj.end_date = this.today; + obj.mgroup__belong_dept__name='6车间'; + obj.page=0; that.$API.pm.mtask.list.req(obj).then((res) => { console.log(res); + if(res.length>0){ + let processData = []; + res.forEach(item => { + let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {},obj5 = {},obj6 = {},obj7 = {},obj8 = {}; + obj1.elType = 'primary'; + obj1.value = item.mgroup_name;//工序 + obj2.elType = 'primary'; + obj2.value = item.material_out_.name; + obj3.elType = 'primary'; + obj3.value = item.material_out_.specification; + obj4.elType = 'primary'; + obj4.value = item.count; + obj5.elType = 'primary'; + obj5.value = item.count_ok; + obj6.elType = 'progress'; + let jindu = Math.floor((item.count_ok/item.count)*100); + obj6.value = jindu; + obj7.elType = 'primary'; + let rate = 0; + if(item.count_real!=0){ + rate = Math.floor((item.count_ok/item.count_real)*100); + }else{ + rate = 0; + } + obj7.value = rate; + obj8.elType = 'primary'; + obj8.value = item.submit_user; + arr.push(obj1); + arr.push(obj2); + arr.push(obj3); + arr.push(obj4); + arr.push(obj5); + arr.push(obj6); + arr.push(obj7); + arr.push(obj8); + processData.push(arr); + + }); + console.log('processData',processData) + this.processData = processData; + } debugger; }); }, @@ -419,6 +495,7 @@ export default { debugger; }); }, + }, } @@ -431,6 +508,7 @@ export default { .dashboard { background-image: url("/public/img/photon_bg.png"); color: #fff; + background-size:cover; font-family: "Microsoft Yahei" !important; } .header { diff --git a/src/views/bigScreen/index_7dept.vue b/src/views/bigScreen/index_7dept.vue index 8655e37f..d6f598b2 100644 --- a/src/views/bigScreen/index_7dept.vue +++ b/src/views/bigScreen/index_7dept.vue @@ -7,21 +7,21 @@ - - -
-
-
今日任务
-
-
-
- ZJ2 - 600 -
+
+
+
今日任务
+
+
+
+
+ {{item.material_out_name}} + + {{item.count}} +
- - + +
+
@@ -32,7 +32,7 @@
+ :rowData="processData" :titleData="liData1" :refValue="refValue1">
@@ -46,7 +46,7 @@
+ :rowData="lineData" :titleData="liData2" :refValue="refValue2">
@@ -97,6 +97,7 @@ export default { return { basicOption: { backgroundColor: '', + tooltip: { trigger: 'axis', axisPointer: { @@ -110,19 +111,19 @@ export default { icon: "stack", right: 0, data: [{ - backgroundColor: 'rgb(250,205,0)', - name: '合格率', + backgroundColor: 'rgb(1,235,239)', + name: '生产数', itemStyle: { + // color:'rgb(1,235,239)', color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgb(250,205,0)' + color: 'rgb(250,205,0)' }, { offset: 1, color: 'rgb(254,129,0)' - } - ]) + }]) }, textStyle: { color: '#fff' @@ -207,6 +208,39 @@ export default { data: [140, 232, 101, 264, 90, 340, 250,140, 232, 101, 264, 90, 340, 250,140, 232, 101, 264, 90, 340, 250,140, 232, 101, 264, 90, 340, 250, 340, 250] }] }, + chart3Option:{ + backgroundColor: '', + tooltip: { + trigger: 'item' + }, + legend: { + top:'bottom', + }, + series: { + name: '完成率', + type: 'pie', + radius: '50%', + itemStyle: { + borderRadius: 2 + }, + center: ['50%', '45%'], + data: [ + { value: 0, name: '炸纹' }, + { value: 0, name: '条纹' }, + { value: 0, name: '气泡' }, + { value: 0, name: '弯曲' }, + { value: 0, name: '其他' }, + { value: 0, name: '合格' }, + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + }, containerHeight1:100, containerHeight2:100, table1Visible:false, @@ -214,46 +248,20 @@ export default { refValue1:'moocBox1', refValue2:'moocBox2', liData1: ['序号', '型号', '完成进度', '产量', '状态'], - listData1test: [ - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:100},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:100},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:90},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:100},{elType:'primary',value:368},{elType:'tag',value:30}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}], - [{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}], - ], + processData:[], liData2: ['序号', '炉号','产品名称', '型号', '规格', '最近产量','锅数','设备状态'], - listData2test:[ - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - [{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}], - ], + lineData:[], + todayMtask:[], time: null, delay: 20, dayInterval:null, - stateOption:{ - 30:'生产中', - 40:'已完成' - }, + days:30, + today:'', start_date:'', end_date:'', currentTime:'', currentDay:'', + yesterday:'', chartInterval1: null, chartInterval2: null, chartInterval3: null, @@ -266,115 +274,24 @@ export default { //表格table2的显示 this.containerHeight2 = document.getElementById('scrollContainer2').clientHeight; this.table2Visible = true; - - let chart1Option = deepCopy(this.basicOption) - let chart1 = this.setChart("chart1", chart1Option); - let index1 = 0 - this.chartInterval1 = setInterval(function () { - if (index1 < chart1Option.series[0].data.length) { - chart1.dispatchAction({ type: 'downplay', seriesIndex: 0 }); - chart1.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index1 }); - chart1.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index1 }); - } else { - index1 = 0; - } - }, 3000); - let chart2Option = deepCopy(this.basicOption) - chart2Option.legend = { - icon: "stack", - right: 0, - data: [{ - backgroundColor: 'rgb(250,205,0)', - name: '合格率', - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: 'rgb(1,235,239)' - }, - { - offset: 1, - color: 'rgb(5, 158, 163)' - } - ]) - }, - textStyle: { - color: '#fff' - } - }], - }; - chart2Option.xAxis.data= ['1日','2日', '3日', '4日', '5日', '6日', '7日', '8日','9日','10日', '11日', '12日', '13日', '14日', '15日', '16日', '17日', '18日','19日','20日', '21日', '22日', '23日', '24日', '25日', '26日', '27日', '28日', '29日', '30日']; - chart2Option.yAxis[0].name = '合格率(%)'; - chart2Option.series[0].type = 'line'; - chart2Option.series[0].data = ['40','60','70','56','49','69','50','60','70','56','30','69','50','60','70','56','49','69','50','60','40','56','49','69','50','70','56','49','80','50']; - let chart2 = this.setChart("chart2", chart2Option) - let index2 = 0 - this.chartInterval2 = setInterval(function () { - if (index2 < chart2Option.series[0].data.length) { - chart2.dispatchAction({ type: 'downplay', seriesIndex: 0 }); - chart2.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index2 }); - chart2.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index2 }); - index2++; - } else { - index2 = 0; - } - }, 3000); - let chart3Option ={ - backgroundColor: '', - tooltip: { - trigger: 'item' - }, - legend: { - top:'bottom' - }, - series: [ - { - name: '完成率', - type: 'pie', - radius: '50%', - itemStyle: { - borderRadius: 2 - }, - center: ['50%', '45%'], - data: [ - { value: 1, name: '椭圆弯曲' }, - { value: 3, name: '大小头' }, - { value: 0, name: '偏壁' }, - { value: 5, name: '结石' }, - { value: 5, name: '气线' }, - { value: 200, name: '合格' }, - ], - emphasis: { - itemStyle: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)' - } - } - } - ] - }; - let chart3 = this.setChart("chart3", chart3Option); - let index3 = 0 - this.chartInterval3 = setInterval(function () { - if (index3 < chart3Option.series[0].data.length) { - chart3.dispatchAction({ type: 'downplay', seriesIndex: 0 }); - chart3.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index3 }); - chart3.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index3 }); - index3++; - } else { - index3 = 0; - } - }, 3000); - const ondDayTime = 86400000; - let cDate = new Date(); - let month = cDate.getMonth()+1; - let start_date = cDate.getFullYear()+'-'+month+'-01'; - let lastDay = new Date(cDate.getFullYear(), cDate.getMonth(), 0).getDate(); - let end_date = cDate.getFullYear()+'-'+month+'-'+lastDay; + let date = new Date(); + let year = date.getFullYear(); + let month = date.getMonth()+1; + let day = date.getDate(); + let days = new Date(year, month, 0).getDate(); + this.days = days; + let start_date = year+'-'+month+'-01'; + let lastDay = new Date(year, month, 0).getDate(); + let end_date = year+'-'+month+'-'+lastDay; this.start_date = start_date; this.end_date = end_date; + this.today = year+'-'+month+'-'+day; + let yesterday = new Date(date.getTime()-24*60*60*1000); + this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate(); this.getProductLine(); + this.getUtask(); + this.getTodayMtask(); + this.getLineData(); //时间 this.showTime() this.dayInterval = setInterval(()=>{ @@ -402,36 +319,263 @@ export default { }, 500) }, //任务进度 - getMtask(){ + getUtask(){ let that = this; let obj ={}; - that.$API.pm.mtask.list.req(obj).then((res) => { + obj.start_date__gte = this.start_date; + obj.end_date__lte = this.end_date; + obj.belong_dept__name='7车间'; + obj.page=0; + that.$API.pm.utask.list.req(obj).then((res) => { console.log('任务进度:',res); - debugger; + let processData = []; + res.forEach(item => { + let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {}; + obj1.elType = 'primary'; + obj1.value = item.material_.specification; + obj2.elType = 'progress'; + let process = Math.floor((item.count_ok/item.count)*100) + obj2.value = process; + obj3.elType = 'primary'; + obj3.value = item.count_ok; + obj4.elType = 'tag'; + obj4.value = item.state; + arr.push(obj1); + arr.push(obj2); + arr.push(obj3); + arr.push(obj4); + processData.push(arr); + }); + this.processData = processData; + }); + }, + //7车间生产按炉进度 + getLineData(){ + let that = this; + that.$API.bi.dataset.exec.req('linedept7', {}).then((res) => { + console.log('7车间生产线:',res); + let list = res.data2.ds0; + if(list.length>0){ + let lineData = []; + list.forEach(item => { + let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {},obj5 = {},obj6 = {},obj7 = {}; + obj1.elType = 'primary'; + obj1.value = item.equip_name;//炉号 + obj2.elType = 'primary'; + obj2.value = item.material_name; + obj3.elType = 'primary'; + obj3.value = item.material_specification; + obj4.elType = 'primary'; + obj4.value = item.material_model; + obj5.elType = 'primary'; + let process = item.count_real + obj5.value = process; + obj6.elType = 'primary'; + obj6.value = item.index; + obj7.elType = 'tag'; + obj7.value = item.equip_state; + arr.push(obj1); + arr.push(obj2); + arr.push(obj3); + arr.push(obj4); + arr.push(obj5); + arr.push(obj6); + arr.push(obj7); + lineData.push(arr); + }); + this.lineData = lineData; + } }); }, //生产线 getProductLine(){ let that = this; - let obj ={ - query: {start_date:this.start_date,end_date:this.end_date,dept_name: "7车间"}, - }; + //本月生产统计 let obj1 ={ - query: {start_date:this.start_date,end_date:this.end_date}, + query: {start_date:that.start_date,end_date:that.end_date}, }; - //7车间生产线 - that.$API.bi.dataset.exec.req('linedept7', obj).then((res1) => { - console.log('7车间生产线:',res1); + that.$API.bi.dataset.exec.req('stoveStatics', obj1).then((res1) => { + console.log('本月生产统计:',res1); + let list1 = res1.data2.ds0; + let seriesData1 = [],xAxisData1=[]; + if(list1.length>0){ + list1.forEach(item1=>{ + xAxisData1.push(item1.equip_name); + seriesData1.push(item1.count_real); + }) + } + let chart1Option = deepCopy(this.basicOption) + chart1Option.xAxis.data = xAxisData1; + chart1Option.series[0].data = seriesData1; + chart1Option.yAxis.name='生产数'; + let chart1 = this.setChart("chart1", chart1Option); + let index1 = 0 + this.chartInterval1 = setInterval(function () { + if (index1 < chart1Option.series[0].data.length) { + chart1.dispatchAction({ type: 'downplay', seriesIndex: 0 }); + chart1.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index1 }); + chart1.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index1 }); + index1++; + } else { + index1 = 0; + } + }, 3000); }); - //7车间生产按炉统计 - that.$API.bi.dataset.exec.req('stoveStatics', obj1).then((res2) => { - console.log('7车间生产按炉统计:',res2); - debugger; + //本月合格率统计 + let obj2 ={ + query: {start_date:that.start_date,end_date:that.end_date,dept_name: "7车间"}, + }; + that.$API.bi.dataset.exec.req('lineDay', obj2).then((res2) => { + console.log('本月合格率统计:',res2); + let list2 = res2.data2.ds0; + let seriesData2 = [],xAxisData2=[]; + for (let i = 0; i < that.days; i++) { + let day = i+1; + let text = day+'日'; + xAxisData2[i]=text; + } + if(list2.length>0){ + list2.forEach(item2=>{ + let index2 = item2.日-1; + seriesData2[index2] = item2.合格率; + }) + } + console.log('xAxisData2',xAxisData2) + let chart2Option = deepCopy(this.basicOption); + chart2Option.xAxis.data = xAxisData2; + chart2Option.yAxis.name='合格率'; + chart2Option.legend = { + icon: "stack", + right: 0, + data: [{ + backgroundColor: 'rgb(250,205,0)', + name: '合格率', + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: 'rgb(1,235,239)' + }, + { + offset: 1, + color: 'rgb(5, 158, 163)' + } + ]) + }, + textStyle: { + color: '#fff' + } + }], + }; + let series2=[{ + name: '合格率', + type: 'line', + smooth: true, + lineStyle: { + width: 1, color: 'rgb(1,235,239)' + }, + showSymbol: false, + areaStyle: { + opacity: 0.8, + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: 'rgb(1,235,239)' + }, + { + offset: 1, + color: 'rgb(5, 158, 163)' + } + ]) + }, + emphasis: { + focus: 'series' + }, + label: { + show: true, + position: 'top', + color:'#fff' + }, + itemStyle: { + borderRadius: [2, 2, 0, 0], + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: 'rgb(250,205,0)' + }, + { + offset: 1, + color: 'rgb(254,129,0)' + } + ]) + }, + data: seriesData2 + }]; + chart2Option.series=series2; + let chart2 = this.setChart("chart2", chart2Option); + let index2 = 0 + this.chartInterval2 = setInterval(function () { + if (index2 < chart2Option.series[0].data.length) { + chart2.dispatchAction({ type: 'downplay', seriesIndex: 0 }); + chart2.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index2 }); + chart2.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index2 }); + index2++; + } else { + index2 = 0; + } + }, 3000); }); - //生产车间按日统计 本月合格率统计&昨日合格统计 - that.$API.bi.dataset.exec.req('lineDay', obj).then((res3) => { - console.log('生产车间按日统计:',res3); - debugger; + + //车间生产昨日统计 12月1号 + let obj3 ={ + query: {start_date:that.yesterday,end_date:that.yesterday,dept_name: "7车间"}, + }; + that.$API.bi.dataset.exec.req('lineDay', obj3).then((res3) => { + console.log('车间生产昨日统计:',res3); + let seriesData3 = [ + { value: 0, name: '炸纹' }, + { value: 0, name: '条纹' }, + { value: 0, name: '气泡' }, + { value: 0, name: '弯曲' }, + { value: 0, name: '其他' }, + { value: 0, name: '合格' }, + ] + if(res3.data2.ds0.length>0){ + let item3 = res3.data2.ds0[0]; + that.yesterdayObjet = item + seriesData3[0].value=item3.炸纹; + seriesData3[1].value=item3.条纹; + seriesData3[2].value=item3.气泡; + seriesData3[3].value=item3.弯曲; + seriesData3[4].value=item3.其他; + seriesData3[5].value=item3.合格数; + } + that.chart3Option.series.data = seriesData3; + let chart3 = this.setChart("chart3", that.chart3Option); + let index3 = 0 + this.chartInterval3 = setInterval(function () { + if (index3 < that.chart3Option.series.data.length) { + chart3.dispatchAction({ type: 'downplay', seriesIndex: 0 }); + chart3.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index3 }); + chart3.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index3 }); + index3++; + } else { + index3 = 0; + } + }, 3000); + }); + }, + //今日任务 + getTodayMtask(){ + let that = this; + let obj ={}; + obj.start_date = this.today; + obj.end_date = this.today; + obj.belong_dept__name='7车间'; + obj.page=0; + that.$API.pm.mtask.list.req(obj).then((res) => { + that.todayMtask=res; + console.log('今日任务:',res); }); }, }, @@ -447,6 +591,7 @@ export default { background-image: url("/public/img/photon_bg.png"); color: #fff; font-family: "Microsoft Yahei" !important; + background-size: cover; } .header { background: url("/public/img/photon_header.png");