生产分析
This commit is contained in:
@@ -1,114 +1,95 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick" />
|
||||
<base-table
|
||||
v-loading="dataListLoading"
|
||||
:table-props="tableProps"
|
||||
:page="listQuery.pageNo"
|
||||
:limit="listQuery.pageSize"
|
||||
:table-data="tableData" />
|
||||
<pagination
|
||||
<div class="app-container">
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<base-table v-loading="dataListLoading" :table-props="tableProps" :table-data="tableData" />
|
||||
<line-chart ref="lineChart" />
|
||||
<!-- <pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList" />
|
||||
</div>
|
||||
@pagination="getDataList" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
// import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import { getLineBindProductLogPage } from '@/api/core/base/lineBindProductLog';
|
||||
import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
|
||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||
import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
|
||||
import lineChart from '../LineChart'
|
||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'productionLineName',
|
||||
label: '产线',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '',
|
||||
label: '合计',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '',
|
||||
label: '进片数量/片',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '',
|
||||
label: '出片数量/片',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '',
|
||||
label: '损耗数量/片',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '',
|
||||
label: '损耗面积/m²',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '',
|
||||
label: '损耗比例/%',
|
||||
align: 'center',
|
||||
}
|
||||
];
|
||||
// const tableProps = [
|
||||
// // {
|
||||
// // prop: 'lineName',
|
||||
// // label: '产线',
|
||||
// // align: 'center',
|
||||
// // },
|
||||
// // {
|
||||
// // prop: 'sum',
|
||||
// // label: '合计',
|
||||
// // align: 'center',
|
||||
// // },
|
||||
// // {
|
||||
// // prop: 'dynamicValue',
|
||||
// // label: 'dynamicName',
|
||||
// // align: 'center',
|
||||
// // children:[
|
||||
|
||||
// // ]
|
||||
// // }
|
||||
// ];
|
||||
|
||||
export default {
|
||||
mixins: [basicPage],
|
||||
components: {
|
||||
lineChart,
|
||||
},
|
||||
// mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getLineBindProductLogPage,
|
||||
getDataListURL: getYieldAnalysisPageData,
|
||||
},
|
||||
tableProps,
|
||||
tableData: [],
|
||||
optionArrUrl: [getProductionLinePage, getWorkshopSectionPage],
|
||||
tableProps:[],
|
||||
dataListLoading:false,
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
lineIds: [],
|
||||
time: ''
|
||||
},
|
||||
xData: [],
|
||||
yData:[],
|
||||
optionArrUrl: [getProductionLinePage ],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
selectOptions: [],
|
||||
param: 'productionLineId',
|
||||
defaultSelect: '',
|
||||
param: 'lineIds',
|
||||
defaultSelect: '',
|
||||
multiple:true,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间',
|
||||
dateType: 'daterange',
|
||||
dateType: 'datetime',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'createTime',
|
||||
param: 'time',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '搜索',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '导出',
|
||||
name: 'export',
|
||||
},
|
||||
}
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
},
|
||||
created() {
|
||||
this.getArr();
|
||||
},
|
||||
@@ -120,19 +101,109 @@ export default {
|
||||
};
|
||||
this.optionArrUrl.forEach((item, index) => {
|
||||
item(params).then((response) => {
|
||||
this.formConfig[index].selectOptions = response.data.list;
|
||||
this.formConfig[index].selectOptions = response.data.list
|
||||
});
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
},
|
||||
getData() {
|
||||
// this.listQuery.lineIds = ['1672847052717821953']
|
||||
// this.listQuery.productId = val.productId;
|
||||
// this.listQuery.time = '1694486098000';
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(res => {
|
||||
let arr = [
|
||||
{
|
||||
prop: 'lineName',
|
||||
label: '产线',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'sum',
|
||||
label: '合计',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: res.data.nameData[0].name,
|
||||
label: res.data.nameData[0].name,
|
||||
align: 'center',
|
||||
children:[
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
console.log(res.data.nameData.slice(1))
|
||||
res.data.nameData.slice(1).forEach(item => {
|
||||
const props = {
|
||||
'prop': item.name,
|
||||
'label': item.name,
|
||||
'align': 'center'
|
||||
}
|
||||
arr[2].children.push(props)
|
||||
})
|
||||
let tableDataArr =[]
|
||||
res.data.data.forEach(item => {
|
||||
let obj = {}
|
||||
obj.lineName= item.lineName,
|
||||
obj.sum= item.sum,
|
||||
item.data.forEach((ele, index) => {
|
||||
// console.log(ele)
|
||||
ele.children.forEach((e) => {
|
||||
console.log(e.dynamicName)
|
||||
obj['' + e.dynamicName + ''] = e.dynamicValue
|
||||
console.log(obj['' + e.dynamicName + '']);
|
||||
})
|
||||
})
|
||||
tableDataArr.push(obj)
|
||||
});
|
||||
this.tableData = tableDataArr
|
||||
console.log(this.tableData)
|
||||
console.log(arr)
|
||||
this.tableProps = arr
|
||||
let xData = []
|
||||
|
||||
res.data.nameData.slice(1).forEach(item => {
|
||||
xData.push(item.name)
|
||||
// arr[2].children.push(props)
|
||||
})
|
||||
let yAllData = []
|
||||
let lineName = []
|
||||
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)
|
||||
// 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(xData, yAllData, lineName)
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
// console.log(val)
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.productionLineId = val.productionLineId;
|
||||
this.listQuery.productId = val.productId;
|
||||
this.listQuery.createTime = val.createTime;
|
||||
this.getDataList();
|
||||
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.getData()
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
|
||||
Reference in New Issue
Block a user