fix:车间看板本月各工段生产产品数

This commit is contained in:
shijing 2025-07-22 13:53:24 +08:00
parent a112ba552a
commit a8a0774cc0
3 changed files with 151 additions and 149 deletions

View File

@ -10,9 +10,9 @@
<div class="leftBlock">
<div style="height: 55vh;position: relative;">
<dv-border-box-1>
<div class="chartBlockTitle">车间各工段生产产品数</div>
<div class="echartsWrap" style="width: 50vh;overflow: hidden;">
<scEcharts :option="barOption" style="height: 70.5vh;width: 90%;left: 5%;"/>
<div class="chartBlockTitle">本月各工段生产产品数</div>
<div class="echartsWrap">
<scEcharts id="barCharts" :option="barOption" style="height: 70.5vh;width: 96%;left: 2%;position: absolute;top: 0px;"/>
</div>
<!-- <dv-capsule-chart :config="config_left1" class="leftChartBlock1"/> -->
</dv-border-box-1>
@ -55,7 +55,7 @@
</el-row>
<div style="height: 38vh;">
<dv-border-box-1>
<div class="chartBlockTitle">车间工段任务展示</div>
<div class="chartBlockTitle">车间物料展示</div>
<dv-scroll-board :config="config_middle_top" class="middleTableBlock1"/>
</dv-border-box-1>
</div>
@ -344,50 +344,46 @@ export default {
show:false
},
},
yAxis: [
{
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: "#fff"
},
splitLine: {
show:false
},
type: 'category',
inverse: true, //
data: []
}
],
series: [
{
name: '柱状图',
type: 'bar',
data: [],
barCategoryGap: 50,
barWidth: 10,
itemStyle: {
normal: {
barBorderRadius: 5,
color: function (params) {
return myColor[params.dataIndex];
}
},
label: {
normal: {
show: true,
// position: "outside",
color: "#fff",
formatter: "{a}"
}
yAxis: {
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: "#fff"
},
splitLine: {
show:false
},
type: 'category',
inverse: true, //
data: []
},
series:{
name: '柱状图',
type: 'bar',
data: [],
barCategoryGap: 50,
barWidth: 10,
itemStyle: {
normal: {
barBorderRadius: 5,
color: function (params) {
return myColor[params.dataIndex];
}
},
}
]
label: {
normal: {
show: true,
position: "outside",
color: "#fff",
formatter: "{a}"
}
}
},
}
},
tableHeight: 100,
speed: 2000,
@ -426,7 +422,7 @@ export default {
headerBGC: 'rgba(47,102,107,.34)',
oddRowBGC: 'rgba(0,0,0,0)',
evenRowBGC: 'rgba(0,0,0,0)',
header: ['任务编号', '产出产品', '任务量', '合格数'],
header: ['批次号','物料名称', '当前工序', '当前状态', '当前数量'],
data: []
},
config_middle_bottom:{
@ -448,12 +444,13 @@ export default {
currentTime: "",
currentDay: "",
today: "",
end_time:'',
start_time:'',
end_date:'',
start_date:'',
deptName1: "毛坯加工班组",
deptName2: "辅助班组",
deptName3: "精雕机班组",
deptName4: "成品精加工班组",
setIntervalChart : null,
};
},
mounted() {
@ -462,7 +459,16 @@ export default {
this.dayInterval = setInterval(() => {
this.showTime();
}, 1000);
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
month = month < 10 ? "0" + month : month;
let days = new Date(year, month, 0).getDate();
that.start_date = year + "-" + month + "-01";
that.end_date = year + "-" + month + "-" + days;
that.materialAll();
that.barOption.yAxis.data=[];
that.barOption.series.data=[];
that.getMgroups(that.deptName1);
that.getMgroups(that.deptName2);
that.getMgroups(that.deptName3);
@ -477,11 +483,23 @@ export default {
that.getEveryoneCount(that.deptName2);
that.getEveryoneCount(that.deptName3);
that.getEveryoneCount(that.deptName4);
//
that.getMtask1(that.deptName1);
that.getMtask1(that.deptName2);
that.getMtask1(that.deptName3);
that.getMtask1(that.deptName4);
if(that.setIntervalChart !== null){
clearInterval(that.setIntervalChart);
that.setIntervalChart = null;
}
that.setIntervalChart = setInterval(() => {
let top = document.getElementById("barCharts").style.top;
top = top.substring(0,top.length-2);
let topNumber = Number(top);
let newTop = 0;
if(topNumber <= -20){
newTop = 0;
}else{
newTop =Number(top)-2.5;
}
document.getElementById("barCharts").style.top = newTop + 'vh';
},2000)
},
methods: {
getMondayOfCurrentWeek() {
@ -526,55 +544,48 @@ export default {
if(res.length > 0){
res.forEach((item)=>{
that.mgroupsId += item.id + ',';
that.barOption.yAxis.data.push(item.name);
that.barOption.series.data.push(0);
//
that.getInms(item);
that.getmgroupMaterial(item.name);
//
// that.config_left1.data.push({name:item.name,value:0});
that.barOption.yAxis[0].data.push(item.name);
that.barOption.series[0].data.push(0);
})
}
});
},
//
getMtask1(deptName) {
//
getInms(item){
let that = this;
let params = {
state: 20,mgroup__belong_dept__name: deptName,page:0,
query: " { id, material_out_name, number, count, count_ok }"
};
that.config_middle_top.data = [];
that.$API.pm.mtask.list.req(params).then((res) => {
let params = { tag: 'done',page:0,mgroup: item.id };
that.$API.wpm.wmaterial.list.req(params).then((res) => {
if(res.length>0){
res.forEach((item) => {
res.forEach((item)=>{
let arr = [];
arr[0] = item.number;
arr[1] = item.material_out_name;
arr[2] = item.count;
arr[3] = item.count_ok;
arr[0] = item.batch;
arr[1] = item.material_.name;
arr[2] = item.material_.process_name;
arr[3] = item.state==10?'合格品':'不合格品';
arr[4] = item.count;
that.config_middle_top.data.push(arr);
})
}
});
})
},
//
getmgroupMaterial(deptName) {
getmgroupMaterial(mgroupName) {
let that = this;
let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let params = {
// query: {start_date:date,end_date:date,mgroup_name:item.name},
query: {start_date:date,end_date:date,dept_name:deptName},
query: {start_date:that.start_date,end_date:that.end_date,mgroup_name:mgroupName}
};
this.$API.bi.dataset.exec.req("mlog_okrate", params).then((res) => {
if(res.data2.ds0.length>0){
let data = res.data2.ds0;
data.forEach((item) => {
that.config_left1.data.forEach((obj,index2) => {
if (item.name == obj.工段){
that.config_left1.data[index2].value = item.合格数;
}
})
let index2 = that.barOption.yAxis.data.indexOf(item.工段);
that.barOption.series.data[index2] = item.合格数;
})
}
console.log(that.barOption);
});
},
//
@ -665,6 +676,9 @@ export default {
});
},
},
beforeUnmount() {
clearInterval(this.setIntervalChart);
}
};
</script>
<style scoped>
@ -761,4 +775,16 @@ export default {
font-weight: 600;
border-bottom: 1px solid rgb(83 198 243);
}
.echartsWrap{
height: 49vh;
overflow: hidden;
position: relative;
}
#barCharts{
height: 70.5vh;
width: 96%;
left: 2%;
position: absolute;
top: 0px;
}
</style>

View File

@ -74,7 +74,7 @@
</el-row>
<div style="height: 34vh;position: relative;">
<dv-border-box-1>
<div class="chartBlockTitle">车间各工段生产产品数</div>
<div class="chartBlockTitle">本月各工段生产产品数</div>
<dv-capsule-chart :config="config_left1" class="leftChartBlock1"/>
</dv-border-box-1>
</div>
@ -392,7 +392,7 @@ export default {
headerBGC: 'rgba(47,102,107,.34)',
oddRowBGC: 'rgba(0,0,0,0)',
evenRowBGC: 'rgba(0,0,0,0)',
header:['批次号','物料名称', '当前工序', '状态', '数量'],
header:['批次号','物料名称', '当前工序', '当前状态', '当前数量'],
data: []
},
config_middle_bottom:{
@ -425,20 +425,15 @@ export default {
this.dayInterval = setInterval(() => {
this.showTime();
}, 1000);
that.$API.system.dept.list.req({name:that.deptName,page:0}).then((res) => {
if(res.length > 0){
that.deptId = res[0].id;
that.getMgroups();
//
that.getEquipment();
//
that.getEveryoneCount();
//
that.getInms();
}
})
that.getMgroups();
//
that.getEquipment();
//
that.getEveryoneCount();
//
that.materialAll();
//
that.getmgroupMaterial();
},
methods: {
getMondayOfCurrentWeek() {
@ -482,13 +477,12 @@ export default {
that.$API.mtm.mgroup.list.req({belong_dept__name:that.deptName,page:0}).then((res) => {
if(res.length > 0){
res.forEach((item)=>{
that.mgroupsId += item.id + ',';
let obj = {};
that.mgroupsId += item.id + ',';
let obj = {};
obj.name = item.name;
obj.value = 0;
that.config_left1.data.push(obj);
that.getmgroupMaterial();
that.getInms(item);
that.getInms(item);
})
}
});
@ -514,10 +508,16 @@ export default {
//
getmgroupMaterial() {
let that = this;
let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
month = month < 10 ? "0" + month : month;
let days = new Date(year, month, 0).getDate();
let start_date = year + "-" + month + "-01";
let end_date = year + "-" + month + "-" + days;
// let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let params = {
// query: {start_date:date,end_date:date,mgroup_name:item.name},
query: {start_date:date,end_date:date,dept_name:that.deptName},
query: {start_date:start_date,end_date:end_date,dept_name:that.deptName},
};
this.$API.bi.dataset.exec.req("mlog_okrate", params).then((res) => {
if(res.data2.ds0.length>0){
@ -536,8 +536,8 @@ export default {
getEquipment() {
let that = this;
let params = {
page: 0, belong_dept:that.deptId,
// query: " { id, name, number, model, state ,mgroup_name }"
page: 0, belong_dept__name:that.deptName,
query: " { id, name, number, model, state ,mgroup_name,running_state }"
};
that.config_middle_bottom.data = [];
that.$API.em.equipment.list.req(params).then((res) => {
@ -563,7 +563,6 @@ export default {
let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let params = {
query: {start_date:date,end_date:date,dept_name:that.deptName},
// query: {start_date:'2025-05-04',end_date:'2025-05-04',dept_name:that.deptName},
};
this.$API.bi.dataset.exec.req("performance", params).then((res) => {
if(res.data2.ds0.length>0){
@ -619,28 +618,6 @@ export default {
}
});
},
//
getMtask1() {
let that = this;
let params = {
state: 20,mgroup__belong_dept: that.deptId,page:0,
query: " { id, material_out_name, number, count, count_ok }"
};
that.config_middle_top.data = [];
that.$API.pm.mtask.list.req(params).then((res) => {
if(res.length>0){
res.forEach((item) => {
let arr = [];
arr[0] = item.number;
arr[1] = item.material_out_name;
arr[2] = item.count;
arr[3] = item.count_ok;
// arr[4] = item.count_ok/item.count*100+'%';
that.config_middle_top.data.push(arr);
})
}
});
},
},
};
</script>

View File

@ -74,7 +74,7 @@
</el-row>
<div style="height: 34vh;position: relative;">
<dv-border-box-1>
<div class="chartBlockTitle">车间各工段生产产品数</div>
<div class="chartBlockTitle">本月各工段生产产品数</div>
<dv-capsule-chart :config="config_left1" class="leftChartBlock1"/>
</dv-border-box-1>
</div>
@ -392,7 +392,7 @@ export default {
headerBGC: 'rgba(47,102,107,.34)',
oddRowBGC: 'rgba(0,0,0,0)',
evenRowBGC: 'rgba(0,0,0,0)',
header:['批次号','物料名称', '当前工序', '状态', '数量'],
header:['批次号','物料名称', '当前工序', '当前状态', '当前数量'],
data: []
},
config_middle_bottom:{
@ -425,18 +425,11 @@ export default {
this.dayInterval = setInterval(() => {
this.showTime();
}, 1000);
that.$API.system.dept.list.req({name:that.deptName,page:0}).then((res) => {
if(res.length > 0){
that.deptId = res[0].id;
that.getMgroups();
//
that.getEquipment();
//
that.getEveryoneCount();
//
that.getInms();
}
})
that.getMgroups();
//
that.getEquipment();
//
that.getEveryoneCount();
//
that.materialAll();
},
@ -515,10 +508,16 @@ export default {
//
getmgroupMaterial() {
let that = this;
let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
month = month < 10 ? "0" + month : month;
let days = new Date(year, month, 0).getDate();
let start_date = year + "-" + month + "-01";
let end_date = year + "-" + month + "-" + days;
// let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let params = {
// query: {start_date:date,end_date:date,mgroup_name:item.name},
query: {start_date:date,end_date:date,dept_name:that.deptName},
query: {start_date:start_date,end_date:end_date,dept_name:that.deptName},
};
this.$API.bi.dataset.exec.req("mlog_okrate", params).then((res) => {
if(res.data2.ds0.length>0){
@ -537,8 +536,8 @@ export default {
getEquipment() {
let that = this;
let params = {
page: 0, belong_dept:that.deptId,
// query: " { id, name, number, model, state ,mgroup_name }"
page: 0, belong_dept__name:that.deptName,
query: " { id, name, number, model, state ,mgroup_name,running_state }"
};
that.config_middle_bottom.data = [];
that.$API.em.equipment.list.req(params).then((res) => {
@ -563,8 +562,8 @@ export default {
that.config_right_top.data = [];
let date = that.$TOOL.dateFormat(new Date(), "yyyy-MM-dd");
let params = {
// query: {start_date:date,end_date:date,dept_name:that.deptName},
query: {start_date:'2025-05-04',end_date:'2025-05-04',dept_name:that.deptName},
query: {start_date:date,end_date:date,dept_name:that.deptName},
// query: {start_date:'2025-05-04',end_date:'2025-05-04',dept_name:that.deptName},
};
this.$API.bi.dataset.exec.req("performance", params).then((res) => {
if(res.data2.ds0.length>0){