This commit is contained in:
helloDy
2023-11-15 14:30:28 +08:00
rodzic e6158cd59b
commit 952490f0d4
12 zmienionych plików z 230 dodań i 120 usunięć

Wyświetl plik

@@ -150,48 +150,37 @@ export default {
getData() {
this.urlOptions.getDataListURL(this.listQuery).then(res => {
//构造数据
if (res.data) {
this.tableData = []
if (Object.values(res.data.coreProductionLineMonthVOS).length > 0) {
this.setHeader()
res.data.forEach(item => {
console.log('111', item.recordTime, moment(item.recordTime).format('DD'))
this.tableData.push({
proName: item.proName,
specifications: item.specifications
let yAllData = [], proNameList = []
Object.values(res.data.coreProductionLineMonthVOS).forEach(pro => {
// 一条产品的数据
let yData = []
const tempData = {
proName: pro[0].proName,
specifications: pro[0].specifications,
sum: 0
}
proNameList.push(pro[0].proName)
pro.forEach(item => {
// 产品下的各时间点的数据
// 截取日
const day = parseTime(item.recordTime).slice(8, 10) < 10 ? parseTime(item.recordTime).slice(9, 10) : parseTime(item.recordTime).slice(8, 10)
// console.log('!1', day < 10)
tempData['value' + day] = item.countSum
tempData.sum += item.countSum
yData[day] = item.countSum
// yData.push(item.countSum)
})
this.tableData.push(tempData)
yAllData.push(yData)
})
this.$nextTick(() => {
this.$refs.lineChart.initChart(this.xData, yAllData, proNameList)
})
}
console.log('饿', this.tableData)
// res.data.data.forEach(item => {
// let yData = []
// lineName.push(item.lineName)
// // let obj = {}
// // obj.lineName = item.lineName,
// // obj.sum = item.sum,
// item.data.forEach((ele, index) => {
// // console.log(ele)
// ele.children.forEach((e) => {
// // let yData = []
// yData.push(e.dynamicValue)
// })
// })
// yAllData.push(yData)
// });
// console.log(lineName)
// } else {
// this.tableProps = arr
// this.tableData = []
// xData = []
// yAllData = []
// lineName = []
// }
// res.data.data[0].data[0].children.forEach((item, index) => {
// // console.log(item)
// yData.push(item.dynamicValue)
// // let data = 'data' + Number(index+1)
// // obj['' + item.dynamicName + ''] = item.dynamicValue
// })
// console.log(this.yData)
// this.$refs.lineChart.initChart(this.xData, yAllData, lineName)
// this.total = response.data.total;
// this.dataListLoading = false;
});

Wyświetl plik

@@ -25,7 +25,7 @@
<script>
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
import { parseTime } from '../../mixins/code-filter';
import { Loading } from 'element-ui';
import { getSchedulingMonitoringRecord } from '@/api/monitoring/teamProduction'
export default {
name: 'productionLineData24',
@@ -48,6 +48,8 @@ export default {
tableData: [],
tableProps: [],
spanInfo: {},
monitorList: [],
ResData: []
};
},
computed: {},
@@ -56,7 +58,7 @@ export default {
},
methods: {
/** 构建tableProps - 依据第一个元素所提供的信息 */
buildProps() {
async buildProps() {
// 获取当前时间
var currentTime = new Date();
let timeArr = []
@@ -65,7 +67,6 @@ export default {
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),
@@ -73,7 +74,7 @@ export default {
children: [
{ prop: times + '_up', label: '上片数据' },
{ prop: times + '_down', label: '下片数据' },
{ prop: times + '_good', label: '良品面积' },
{ prop: times + '_area', label: '良品面积' },
{ prop: times + '_bad', label: '报废数据' },
{ prop: times + '_percent', label: '报废比例(%)' }
]
@@ -81,7 +82,13 @@ export default {
this.arr.push(subprop)
}
this.tableProps = this.arr
console.log('111', this.tableProps)
const paramsTime = [parseTime(timeArr[0]), parseTime(timeArr[23])]
await getSchedulingMonitoringRecord({checkTime: paramsTime}).then(res =>{
// 报废数据
this.monitorList = res.data.data
console.log('报废', this.monitorList)
this.buildData(this.ResData);
})
},
setRowSpan(arr) {
let count = 0
@@ -98,28 +105,47 @@ export default {
}
}
})
console.log('打印数组长度', this.spanArr)
},
/** 把 list 里的数据转换成 tableProps 对应的格式 */
convertList(list) {
let sectionArr= []
console.log('打印看下数据list', list)
list.forEach((ele, index) => {
let tempData = {}
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.specifications
this.tableData.push(tempData)
console.log('看看数据', this.tableData, tempData)
const { proLineName } = tempData
sectionArr.push(proLineName)
// let sectionArr= []
let temp = Object.values(list.datamap)
console.log('111', temp)
temp.forEach(item => {
// 每条产线下的数据list
console.log('22', item)
let lineData = {}
lineData['proLineName'] = item[0].lineName
let works = [], specs = []
item.forEach(it => {
works.push(it.workOrderName)
specs.push(it.specifications)
lineData[it.recordTime + '_up'] = it.inputNum
lineData[it.recordTime + '_down'] = it.outputNum
lineData[it.recordTime + '_area'] = it.area
})
console.log('你好', this.monitorList)
this.monitorList.forEach(m => {
console.log('455', m)
if (m.lineName === lineData.proLineName) {
m.data.forEach(bad => {
// 转成时间戳
// console.log('233', Date.parse(bad.dynamicName))
const stamp = Date.parse(bad.dynamicName)
lineData[stamp + '_bad'] = bad.dynamicValue
lineData[stamp + '_percent'] = (lineData[stamp + '_bad'] / lineData[stamp + '_down'] * 100).toFixed(2) + '%'
})
}
})
lineData['workOrderName'] = works.join(',')
lineData['spec'] = specs.join(',')
this.tableData.push(lineData)
})
this.setRowSpan(sectionArr)
console.log('工段名称列表', sectionArr)
console.log('打印', this.tableData)
// this.setRowSpan(sectionArr)
// console.log('工段名称列表', sectionArr)
},
buildData(data) {
@@ -141,8 +167,9 @@ export default {
},
async getList() {
this.urlOptions.getDataListURL().then(res => {
await this.urlOptions.getDataListURL().then(res => {
console.log('看看数据', res)
this.ResData = res.data
this.arr = [
{
prop: 'proLineName',
@@ -164,7 +191,6 @@ export default {
}
]
this.buildProps();
this.buildData(res.data);
})
// // const data = this.res.data;