fix: 大屏getDeptDetail错误

This commit is contained in:
caoqianming 2023-12-27 18:32:16 +08:00
parent 417a583c7a
commit 0e06b13501
1 changed files with 245 additions and 244 deletions

View File

@ -51,7 +51,7 @@
<div class="totalNumWrap totalNum_orange"> <div class="totalNumWrap totalNum_orange">
<img class="" src="img/number_bg_orange.png"> <img class="" src="img/number_bg_orange.png">
<span class="totalNumText">AVG合格数</span> <span class="totalNumText">AVG合格数</span>
<div class="totalNumber">{{countOk_AVG}}</div> <div class="totalNumber">{{ countOk_AVG }}</div>
</div> </div>
<div class="totalNumWrap totalNumWrap_green"> <div class="totalNumWrap totalNumWrap_green">
<img src="img/number_bg_green.png"> <img src="img/number_bg_green.png">
@ -61,7 +61,7 @@
<div class="totalNumWrap totalNum_blue"> <div class="totalNumWrap totalNum_blue">
<img src="img/number_bg_blue.png"> <img src="img/number_bg_blue.png">
<span class="totalNumText">预制管合格数</span> <span class="totalNumText">预制管合格数</span>
<div class="totalNumber">{{countOk_dept10}}</div> <div class="totalNumber">{{ countOk_dept10 }}</div>
</div> </div>
</div> </div>
@ -135,11 +135,11 @@
<p> <span class="numberFont">390</span><span class="numberUnit"></span></p> <p> <span class="numberFont">390</span><span class="numberUnit"></span></p>
</div> </div>
<div class="countWrap"> <div class="countWrap">
<div v-if="currentObj.deptName=='10车间'||currentObj.deptName=='6车间'"> <div v-if="currentObj.deptName == '10车间' || currentObj.deptName == '6车间'">
<p>光纤预制管</p> <p>光纤预制管</p>
<p> <span class="numberFont">390{{ currentObj.生产数 }}</span><span class="numberUnit"></span></p> <p> <span class="numberFont">390{{ currentObj.生产数 }}</span><span class="numberUnit"></span></p>
</div> </div>
<div v-if="currentObj.deptName=='7车间'||currentObj.deptName=='6车间'"> <div v-if="currentObj.deptName == '7车间' || currentObj.deptName == '6车间'">
<p>光纤预制棒</p> <p>光纤预制棒</p>
<p> <span class="numberFont">390{{ currentObj.生产数 }}</span><span class="numberUnit"></span></p> <p> <span class="numberFont">390{{ currentObj.生产数 }}</span><span class="numberUnit"></span></p>
</div> </div>
@ -197,7 +197,7 @@ import 'animate.css';
export default { export default {
data() { data() {
return { return {
dept7Data:[ dept7Data: [
{ value: 0, name: '炸纹' }, { value: 0, name: '炸纹' },
{ value: 0, name: '条纹' }, { value: 0, name: '条纹' },
{ value: 0, name: '气泡' }, { value: 0, name: '气泡' },
@ -205,7 +205,7 @@ export default {
{ value: 0, name: '其他' }, { value: 0, name: '其他' },
{ value: 0, name: '合格' }, { value: 0, name: '合格' },
], ],
dept10Data:[ dept10Data: [
{ value: 0, name: '椭圆弯曲' }, { value: 0, name: '椭圆弯曲' },
{ value: 0, name: '大小头' }, { value: 0, name: '大小头' },
{ value: 0, name: '偏壁' }, { value: 0, name: '偏壁' },
@ -260,24 +260,24 @@ export default {
currentObj: { currentObj: {
deptName: '' deptName: ''
}, },
deptName:'10车间', deptName: '10车间',
heightTimer: null, heightTimer: null,
countOk_AVG:0, countOk_AVG: 0,
countOk_dept7:0, countOk_dept7: 0,
countOk_dept10:0, countOk_dept10: 0,
blockTableHeight:0, blockTableHeight: 0,
weekDateList:[], weekDateList: [],
// //
saleOutdept6:[0,0,0,0,0,0,0], saleOutdept6: [0, 0, 0, 0, 0, 0, 0],
saleOutAVG:[0,0,0,0,0,0,0], saleOutAVG: [0, 0, 0, 0, 0, 0, 0],
// //
countOkAVG:[0,0,0,0,0,0,0], countOkAVG: [0, 0, 0, 0, 0, 0, 0],
countOkDept7:[0,0,0,0,0,0,0], countOkDept7: [0, 0, 0, 0, 0, 0, 0],
countOkDept10:[0,0,0,0,0,0,0], countOkDept10: [0, 0, 0, 0, 0, 0, 0],
// //
countRateDept7:[0,0,0,0,0,0,0], countRateDept7: [0, 0, 0, 0, 0, 0, 0],
countRateDept10:[0,0,0,0,0,0,0], countRateDept10: [0, 0, 0, 0, 0, 0, 0],
pieoption : { pieoption: {
color: ['rgb(3,195,198)', 'rgb(155,248,249)', 'rgb(110,181,249)', 'rgb(205,248,248)', 'rgb(248,189,118)'], color: ['rgb(3,195,198)', 'rgb(155,248,249)', 'rgb(110,181,249)', 'rgb(205,248,248)', 'rgb(248,189,118)'],
legend: { legend: {
bottom: 1, bottom: 1,
@ -324,7 +324,7 @@ export default {
dx: 0 dx: 0
} }
}, },
data:[] data: []
} }
} }
} }
@ -346,10 +346,10 @@ export default {
that.showTime(); that.showTime();
}, 1000); }, 1000);
that.notokTimer = setInterval(() => { that.notokTimer = setInterval(() => {
if(that.deptName=='10车间'){ if (that.deptName == '10车间') {
that.deptName='7车间' that.deptName = '7车间'
}else{ } else {
that.deptName='10车间' that.deptName = '10车间'
} }
that.deptNameChange(that.deptName); that.deptNameChange(that.deptName);
}, 5000); }, 5000);
@ -367,8 +367,8 @@ export default {
let first = new Date(new Date(cDate.getTime() - (weekFirst * ondDayTime)));// let first = new Date(new Date(cDate.getTime() - (weekFirst * ondDayTime)));//
let last = new Date(new Date(cDate.getTime() + (weekLast * ondDayTime)));// let last = new Date(new Date(cDate.getTime() + (weekLast * ondDayTime)));//
let dateArr = []; let dateArr = [];
for(let i=0;i<7;i++){ for (let i = 0; i < 7; i++) {
let itemDate = new Date(first.getTime()-i*ondDayTime); let itemDate = new Date(first.getTime() - i * ondDayTime);
let item = itemDate.getFullYear() + '-' + (itemDate.getMonth() + 1) + '-' + itemDate.getDate(); let item = itemDate.getFullYear() + '-' + (itemDate.getMonth() + 1) + '-' + itemDate.getDate();
dateArr.push(item); dateArr.push(item);
} }
@ -385,14 +385,14 @@ export default {
getsaleOut() { getsaleOut() {
let that = this; let that = this;
let obj = { 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) => { that.$API.bi.dataset.exec.req('saleOutDay', obj).then((res6) => {
let list = res6.data2.ds0; let list = res6.data2.ds0;
let saleOutdept6 = [0,0,0,0,0,0,0];// let saleOutdept6 = [0, 0, 0, 0, 0, 0, 0];//
if(list.length>0){ if (list.length > 0) {
list.forEach(item => { list.forEach(item => {
let date = item.+'-'+item.+'-'+item.; let date = item. + '-' + item. + '-' + item.;
let index = this.weekDateList.indexOf(date); let index = this.weekDateList.indexOf(date);
saleOutdept6[index] = item.交付数; saleOutdept6[index] = item.交付数;
}); });
@ -402,14 +402,14 @@ export default {
}); });
}, },
//AVG$ //AVG$
getAVGDayData(){ getAVGDayData() {
let that = this; 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=>{ 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 list = res;
let count_ok = 0,saleOutAVG = [0,0,0,0,0,0,0],countOkAVG= [0,0,0,0,0,0,0]; let count_ok = 0, saleOutAVG = [0, 0, 0, 0, 0, 0, 0], countOkAVG = [0, 0, 0, 0, 0, 0, 0];
if(list.length>0){ if (list.length > 0) {
list.forEach(item=>{ list.forEach(item => {
count_ok=count_ok+item.count_ok; count_ok = count_ok + item.count_ok;
let index = this.weekDateList.indexOf(item.handle_date); let index = this.weekDateList.indexOf(item.handle_date);
saleOutAVG[index] = item.count_delivered; saleOutAVG[index] = item.count_delivered;
countOkAVG[index] = item.count_ok; countOkAVG[index] = item.count_ok;
@ -482,7 +482,7 @@ export default {
bottom: '5%', bottom: '5%',
containLabel: true containLabel: true
}, },
xAxis:{ xAxis: {
type: 'category', type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
nameTextStyle: { nameTextStyle: {
@ -492,7 +492,7 @@ export default {
color: '#ffffff' color: '#ffffff'
}, },
}, },
yAxis:{ yAxis: {
name: "", name: "",
type: 'value', type: 'value',
nameTextStyle: { nameTextStyle: {
@ -575,54 +575,54 @@ export default {
}) })
}, },
//7&& //7&&
getCountDept7(){ getCountDept7() {
let that = this; let that = this;
let obj = { 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) => { that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => {
let list = res.data2.ds0; let list = res.data2.ds0;
let countOkDept7 = [0,0,0,0,0,0,0],countRateDept7 = [0,0,0,0,0,0,0]; 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; let value0 = 0, value1 = 0, value2 = 0, value3 = 0, value4 = 0, value5 = 0, countOk_dept7 = 0;
if(list.length>0){ if (list.length > 0) {
list.forEach(item => { list.forEach(item => {
let date = item.+'-'+item.+'-'+item.; let date = item. + '-' + item. + '-' + item.;
let index = this.weekDateList.indexOf(date); let index = this.weekDateList.indexOf(date);
countOkDept7[index] = item.合格数; countOkDept7[index] = item.合格数;
countRateDept7[index] = Math.round(item.合格率); countRateDept7[index] = Math.round(item.合格率);
countOk_dept7 = countOk_dept7+item.合格数; countOk_dept7 = countOk_dept7 + item.合格数;
that.dept7Data[0].value= that.dept7Data[0].value+item.炸纹; that.dept7Data[0].value = that.dept7Data[0].value + item.炸纹;
that.dept7Data[1].value= that.dept7Data[1].value+item.条纹; that.dept7Data[1].value = that.dept7Data[1].value + item.条纹;
that.dept7Data[2].value= that.dept7Data[2].value+item.气泡; that.dept7Data[2].value = that.dept7Data[2].value + item.气泡;
that.dept7Data[3].value= that.dept7Data[3].value+item.弯曲; that.dept7Data[3].value = that.dept7Data[3].value + item.弯曲;
that.dept7Data[4].value= that.dept7Data[4].value+item.其他; that.dept7Data[4].value = that.dept7Data[4].value + item.其他;
that.dept7Data[5].value= that.dept7Data[5].value+item.合格数; that.dept7Data[5].value = that.dept7Data[5].value + item.合格数;
}); });
} }
that.countOkDept7 = countOkDept7; that.countOkDept7 = countOkDept7;
that.deptData =that.dept7Data; that.deptData = that.dept7Data;
that.countRateDept7 = countRateDept7; that.countRateDept7 = countRateDept7;
that.countOk_dept7 = countOk_dept7; that.countOk_dept7 = countOk_dept7;
that.getCountDept10(); that.getCountDept10();
}); });
}, },
//10&& //10&&
getCountDept10(){ getCountDept10() {
let that = this; let that = this;
let obj = { 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) => { that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => {
let list = res.data2.ds0; let list = res.data2.ds0;
let countOkDept10 = [0,0,0,0,0,0,0],countRateDept10 = [0,0,0,0,0,0,0]; 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; let value0 = 0, value1 = 0, value2 = 0, value3 = 0, value4 = 0, value5 = 0, countOk_dept10 = 0;
if(list.length>0){ if (list.length > 0) {
list.forEach(item => { list.forEach(item => {
let date = item.+'-'+item.+'-'+item.; let date = item. + '-' + item. + '-' + item.;
let index = this.weekDateList.indexOf(date); let index = this.weekDateList.indexOf(date);
countOkDept10[index] = item.合格数; countOkDept10[index] = item.合格数;
countRateDept10[index] = Math.round(item.合格率); countRateDept10[index] = Math.round(item.合格率);
countOk_dept10 = countOk_dept10+item.合格数; countOk_dept10 = countOk_dept10 + item.合格数;
}); });
} }
that.countOkDept10 = countOkDept10; that.countOkDept10 = countOkDept10;
@ -632,19 +632,19 @@ export default {
}); });
}, },
// //
getPlanRate(){ getPlanRate() {
let that = this; let that = this;
let obj = { 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 list = res.data2.ds0;
let PlanRate = [0,0,0,0,0,0,0]; let PlanRate = [0, 0, 0, 0, 0, 0, 0];
if(list.length>0){ if (list.length > 0) {
list.forEach(item => { list.forEach(item => {
let date = item.+'-'+item.+'-'+item.; let date = item. + '-' + item. + '-' + item.;
let index = this.weekDateList.indexOf(date); 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, barWidth: 15,
data:PlanRate, data: PlanRate,
itemStyle: { itemStyle: {
borderRadius: [5, 5, 0, 0], borderRadius: [5, 5, 0, 0],
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@ -774,38 +774,38 @@ export default {
line3Chart.setOption(line3option); line3Chart.setOption(line3option);
}) })
}, },
deptNameChange(deptName){ deptNameChange(deptName) {
let that = this; let that = this;
let obj = { 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) => { that.$API.bi.dataset.exec.req('lineDay', obj).then((res) => {
let list = res.data2.ds0; let list = res.data2.ds0;
let deptData = []; let deptData = [];
if(list.length>0){ if (list.length > 0) {
list.forEach(item => { list.forEach(item => {
if(that.deptName == '7车间'){ if (that.deptName == '7车间') {
that.dept7Data[0].value= that.dept7Data[0].value+item.炸纹; that.dept7Data[0].value = that.dept7Data[0].value + item.炸纹;
that.dept7Data[1].value= that.dept7Data[1].value+item.条纹; that.dept7Data[1].value = that.dept7Data[1].value + item.条纹;
that.dept7Data[2].value= that.dept7Data[2].value+item.气泡; that.dept7Data[2].value = that.dept7Data[2].value + item.气泡;
that.dept7Data[3].value= that.dept7Data[3].value+item.弯曲; that.dept7Data[3].value = that.dept7Data[3].value + item.弯曲;
that.dept7Data[4].value= that.dept7Data[4].value+item.其他; that.dept7Data[4].value = that.dept7Data[4].value + item.其他;
that.dept7Data[5].value= that.dept7Data[5].value+item.合格数; that.dept7Data[5].value = that.dept7Data[5].value + item.合格数;
deptData = that.dept7Data; deptData = that.dept7Data;
}else{ } else {
that.dept10Data[0].value= that.dept10Data[0].value+item.弯曲; that.dept10Data[0].value = that.dept10Data[0].value + item.弯曲;
that.dept10Data[1].value= that.dept10Data[1].value+item.大小头; that.dept10Data[1].value = that.dept10Data[1].value + item.大小头;
that.dept10Data[2].value= that.dept10Data[2].value+item.偏壁; that.dept10Data[2].value = that.dept10Data[2].value + item.偏壁;
that.dept10Data[3].value= that.dept10Data[3].value+item.结石; that.dept10Data[3].value = that.dept10Data[3].value + item.结石;
that.dept10Data[4].value= that.dept10Data[4].value+item.气线; that.dept10Data[4].value = that.dept10Data[4].value + item.气线;
that.dept10Data[5].value= that.dept10Data[5].value+item.合格数; that.dept10Data[5].value = that.dept10Data[5].value + item.合格数;
deptData = that.dept10Data; deptData = that.dept10Data;
} }
}); });
}else{ } else {
if(that.deptName == '7车间'){ if (that.deptName == '7车间') {
deptData = that.dept7Data; deptData = that.dept7Data;
}else{ } else {
deptData = that.dept10Data; deptData = that.dept10Data;
} }
} }
@ -824,14 +824,14 @@ export default {
let that = this; let that = this;
this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => { this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => {
let data = []; let data = [];
if(res.length>0){ if (res.length > 0) {
res.forEach(item => { res.forEach(item => {
let arr = []; let arr = [];
let colorText=''; let colorText = '';
if(item.count_safe!==null&&item.count_safe<item.count){ if (item.count_safe !== null && item.count_safe < item.count) {
colorText='<span style="color:red;">'+item.count+'</span>' colorText = '<span style="color:red;">' + item.count + '</span>'
}else{ } else {
colorText='<span style="color:green;">'+item.count+'</span>' colorText = '<span style="color:green;">' + item.count + '</span>'
} }
arr[0] = item.full_name; arr[0] = item.full_name;
arr[1] = item.specification;// arr[1] = item.specification;//
@ -841,7 +841,7 @@ export default {
}); });
} }
that.taskBoard.data = data; that.taskBoard.data = data;
console.log('getMaterialList',data) console.log('getMaterialList', data)
}) })
}, },
showTime() { showTime() {
@ -1142,27 +1142,28 @@ export default {
}); });
}, },
getDeptDetail(name) { getDeptDetail(name) {
let that = this;
if (this.currentObj.deptName == name && this.clickVisible) { if (this.currentObj.deptName == name && this.clickVisible) {
this.dialogData.deptName = name; this.dialogData.deptName = name;
} else { } else {
this.infoVisibel = true; this.infoVisibel = true;
this.dialogData.deptName = name; this.dialogData.deptName = name;
} }
let obj ={ let obj = {
query: {start_date:this.start_date,end_date:this.end_date,dept_name: name}, query: { start_date: this.start_date, end_date: this.end_date, dept_name: name },
}; };
that.$API.bi.dataset.exec.req('lineDay', obj).then((res1) => { that.$API.bi.dataset.exec.req('lineDay', obj).then((res1) => {
console.log('生产车间按日统计:',res1); console.log('生产车间按日统计:', res1);
let list1 = res1.data2.ds0; let list1 = res1.data2.ds0;
if(name=='6车间'){ if (name == '6车间') {
that.currentObj = list1[0]; that.currentObj = list1[0];
that.currentObj.rate = list1[0] that.currentObj.rate = list1[0]
}else if(name=='7车间'||name=='10车间'){ } else if (name == '7车间' || name == '10车间') {
that.currentObj = list1[0]; that.currentObj = list1[0];
}else if(name=='8车间'){ } else if (name == '8车间') {
} }
let seriesData1 = [],xAxisData1=[]; let seriesData1 = [], xAxisData1 = [];
debugger; debugger;
}); });
@ -1247,7 +1248,7 @@ export default {
bottom: '5%', bottom: '5%',
containLabel: true containLabel: true
}, },
xAxis:{ xAxis: {
type: 'category', type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
nameTextStyle: { nameTextStyle: {
@ -1335,7 +1336,7 @@ export default {
} }
]) ])
}, },
data:that.countOkAVG data: that.countOkAVG
} }
] ]
}; };
@ -1394,7 +1395,7 @@ export default {
bottom: '5%', bottom: '5%',
containLabel: true containLabel: true
}, },
xAxis:{ xAxis: {
type: 'category', type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
nameTextStyle: { nameTextStyle: {
@ -1572,7 +1573,7 @@ export default {
dx: 0 dx: 0
} }
}, },
data:that.deptData data: that.deptData
} }
}; };
that.pieoption = pieoption; that.pieoption = pieoption;