数据大屏数据同步

This commit is contained in:
shijing 2023-12-25 17:30:11 +08:00
parent b11e2aaeb4
commit 8c835fe715
1 changed files with 106 additions and 42 deletions

View File

@ -83,6 +83,10 @@
<div class="blockTitle">
<div class="blockTitleIcon"></div>
<div>本周不合格占比</div>
<el-radio-group v-model="deptName" @change="deptNameChange">
<el-radio label="7车间">7车间</el-radio>
<el-radio label="10车间">10车间</el-radio>
</el-radio-group>
</div>
<div id="pie"
style="width:100%;height:92%;background:rgba(9,31,43,.5);border-radius: 20px;margin-top: 5px;">
@ -178,7 +182,6 @@
</div>
<CircleClose class="circleClose" @click="circleClose" />
</div>
</div>
</el-container>
</template>
@ -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() {