基础,物料,设备

This commit is contained in:
helloDy
2023-11-07 15:53:01 +08:00
parent 1d38a560ec
commit fcb1885bf7
21 changed files with 827 additions and 588 deletions

View File

@@ -19,7 +19,7 @@
// import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
import { getProductionLinePage } from '@/api/core/base/productionLine';
// import { getProductionLinePage } from '@/api/core/base/productionLine';
import lineChart from '../LineChart'
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
@@ -58,21 +58,20 @@ export default {
dataListLoading:false,
tableData: [],
listQuery: {
lineIds: [],
time: ''
// lineIds: [],
recordTime: []
},
dateLabelList: [],
optionArrUrl: [getProductionLinePage ],
formConfig: [
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'lineIds',
defaultSelect: '',
multiple:true,
filterable: true,
},
// {
// type: 'select',
// label: '产线',
// selectOptions: [],
// param: 'lineIds',
// defaultSelect: '',
// multiple:true,
// filterable: true,
// },
{
type: 'datePicker',
label: '时间',
@@ -94,22 +93,22 @@ export default {
};
},
created() {
this.getArr();
// this.getArr();
},
methods: {
getArr() {
const params = {
page: 1,
limit: 500,
};
this.optionArrUrl.forEach((item, index) => {
item(params).then((response) => {
this.formConfig[index].selectOptions = response.data.list
// this.formConfig[0].defaultSelect = response.data.list[0].id
this.$set(this.formConfig[0], 'defaultSelect', response.data.list[0].id)
});
});
},
// getArr() {
// const params = {
// page: 1,
// limit: 500,
// };
// this.optionArrUrl.forEach((item, index) => {
// item(params).then((response) => {
// this.formConfig[index].selectOptions = response.data.list
// // this.formConfig[0].defaultSelect = response.data.list[0].id
// this.$set(this.formConfig[0], 'defaultSelect', response.data.list[0].id)
// });
// });
// },
getData() {
// this.listQuery.lineIds = ['1672847052717821953']
// this.listQuery.productId = val.productId;
@@ -230,12 +229,26 @@ export default {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.lineIds = val.lineIds ? val.lineIds :undefined
// this.listQuery.productId = val.productId;
this.listQuery.time = val.time ? new Date(val.time).getTime() : undefined
// this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 10;
// this.listQuery.recordTime = val.time ? new Date(val.time).getTime() : undefined
if (val.time) {
const tempTtime = new Date(val.time)
let day = 0
switch (tempTtime.getMonth() + 1) {
case 1, 3, 5, 7, 8, 10, 12:
day = 31;
break;
case 2:
day = 28;
break;
case 4, 6, 9, 11:
day = 30;
break;
}
console.log(parseTime(new Date(tempTtime.getFullYear(), 11, 31, 23, 59, 59)))
this.listQuery.recordTime = [
val.time,
parseTime(new Date(tempTtime.getFullYear(), tempTtime.getMonth(), day, 23, 59, 59))
]
this.getData()
} else {
this.$message({

View File

@@ -2,7 +2,7 @@
filename: index.vue
author: liubin
date: 2023-08-04 14:44:58
description: 设备24小时生产记录
description: 24小时产线生产数据
-->
<template>
<div class="app-container">
@@ -24,6 +24,7 @@
<script>
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
import { parseTime } from '../../mixins/code-filter';
export default {
name: 'productionLineData24',
@@ -54,28 +55,32 @@ export default {
},
methods: {
/** 构建tableProps - 依据第一个元素所提供的信息 */
buildProps(plData) {
plData.forEach(item => {
this.timeList.push(item.name)
})
const timeArray = Array.from(new Set(this.timeList))
console.log('nihc', timeArray)
for (const times of timeArray) {
if (times !== '投入数量' && times !== '产出数量' && times !== '报废数量' && times !== '产出面积') {
const subprop = {
label: times.slice(0, 10) + ' ' + times.slice(11),
align: 'center',
children: [
{ prop: times + '_in', label: '投入数量' },
{ prop: times + '_out', label: '产出数量' },
{ prop: times + '_junk', label: '报废数量' },
{ prop: times + '_area', label: '产出面积' }
]
}
this.arr.push(subprop)
buildProps() {
// 获取当前时间
var currentTime = new Date();
let timeArr = []
// 添加24小时内的整点时间--时间戳格式
for (let i = 0; i < 24; i ++) {
timeArr.unshift(new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate(), currentTime.getHours() - i, 0, 0).getTime())
}
console.log("24小时内的开始时间" + timeArr, timeArr.length);
for(const times of timeArr) {
const subprop = {
label: parseTime(times),
align: 'center',
children: [
{ prop: times + '_up', label: '上片数据' },
{ prop: times + '_down', label: '下片数据' },
{ prop: times + '_good', label: '良品面积' },
{ prop: times + '_bad', label: '报废数据' },
{ prop: times + '_percent', label: '报废比例(%)' }
]
}
this.arr.push(subprop)
}
this.tableProps = this.arr
console.log('111', this.tableProps)
},
setRowSpan(arr) {
let count = 0
@@ -101,20 +106,11 @@ export default {
console.log('打印看下数据list', list)
list.forEach((ele, index) => {
let tempData = []
ele.data.forEach(item => {
item.children.forEach(params => {
if (params.dynamicName === '投入数量') {
tempData[item.dynamicName + '_in'] = params.dynamicValue
} else if (params.dynamicName === '产出数量') {
tempData[item.dynamicName + '_out'] = params.dynamicValue
} else if (params.dynamicName === '报废数量') {
tempData[item.dynamicName + '_junk'] = params.dynamicValue
} else {
tempData[item.dynamicName + '_area'] = params.dynamicValue
}
})
})
tempData['proLineName'] = ele.proLineName
tempData[ele.recordTime + '_up'] = ele.inputNum
tempData[ele.recordTime + '_down'] = ele.outputNum
tempData[ele.recordTime + '_up'] = ele.inputNum
tempData['proLineName'] = ele.lineName
tempData['workOrderName'] = ele.workOrderName
tempData['spec'] = ele.spec
this.tableData.push(tempData)
console.log('看看数据', this.tableData, tempData)
@@ -151,17 +147,23 @@ export default {
prop: 'proLineName',
label: '生产线',
fixed: 'left',
showOverflowTooltip: true
'show-overflow-tooltip': true
},
{
prop: 'workOrderName',
label: '当前工单',
fixed: 'left',
'show-overflow-tooltip': true
},
{
prop: 'spec',
label: '产品规格',
fixed: 'left',
showOverflowTooltip: true
'show-overflow-tooltip': true
}
]
this.buildProps(res.data.nameData);
this.buildData(res.data.data);
this.buildProps();
this.buildData(res.data);
})
// // const data = this.res.data;