更新汝阳bug
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<div v-if="tableData.length">
|
||||
<base-table v-loading="dataListLoading" :table-props="tableProps" :table-data="tableData" />
|
||||
<SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" />
|
||||
<line-chart ref="lineChart" />
|
||||
</div>
|
||||
<div v-else class="no-data-bg"></div>
|
||||
<!-- <pagination
|
||||
<div class="app-container">
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick" />
|
||||
<div v-if="tableData.length">
|
||||
<base-table
|
||||
v-loading="dataListLoading"
|
||||
:table-props="tableProps"
|
||||
:max-height="tableH"
|
||||
:table-data="tableData" />
|
||||
<SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" />
|
||||
<line-chart ref="lineChart" />
|
||||
</div>
|
||||
<div v-else class="no-data-bg"></div>
|
||||
<!-- <pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList" /> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -20,7 +27,8 @@
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
|
||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||
import lineChart from '../LineChart'
|
||||
import lineChart from '../LineChart';
|
||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
|
||||
|
||||
// const tableProps = [
|
||||
@@ -45,51 +53,52 @@ import lineChart from '../LineChart'
|
||||
// ];
|
||||
|
||||
export default {
|
||||
components: {
|
||||
lineChart,
|
||||
},
|
||||
// mixins: [basicPage],
|
||||
components: {
|
||||
lineChart,
|
||||
},
|
||||
mixins: [tableHeightMixin],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getYieldAnalysisPageData,
|
||||
getDataListURL: getYieldAnalysisPageData,
|
||||
},
|
||||
tableProps:[],
|
||||
dataListLoading:false,
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
lineIds: [],
|
||||
time: ''
|
||||
},
|
||||
dateLabelList: [],
|
||||
optionArrUrl: [getProductionLinePage ],
|
||||
tableProps: [],
|
||||
dataListLoading: false,
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
lineIds: [],
|
||||
time: '',
|
||||
},
|
||||
dateLabelList: [],
|
||||
optionArrUrl: [getProductionLinePage],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
selectOptions: [],
|
||||
param: 'lineIds',
|
||||
defaultSelect: '',
|
||||
multiple:true,
|
||||
param: 'lineIds',
|
||||
defaultSelect: [],
|
||||
multiple: true,
|
||||
filterable: true,
|
||||
width: 400,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间',
|
||||
dateType: 'month',
|
||||
format: 'yyyy-MM-dd',
|
||||
format: 'yyyy-MM',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'time',
|
||||
param: 'time',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
@@ -104,145 +113,147 @@ export default {
|
||||
};
|
||||
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)
|
||||
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;
|
||||
// this.listQuery.time = '1694486098000';
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(res => {
|
||||
let arr = [
|
||||
{
|
||||
prop: 'lineName',
|
||||
label: '产线',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'sum',
|
||||
label: '合计',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: res.data ? res.data.nameData[0].name : undefined,
|
||||
label: res.data ? res.data.nameData[0].name : undefined,
|
||||
align: 'center',
|
||||
children:[
|
||||
},
|
||||
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: '产线',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
prop: 'sum',
|
||||
label: '合计[片]',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
prop: res.data ? res.data.nameData[0].name : undefined,
|
||||
label: res.data ? res.data.nameData[0].name : undefined,
|
||||
align: 'center',
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
// console.log(res.data.nameData.slice(1))
|
||||
let xData = [];
|
||||
let yAllData = [];
|
||||
let lineName = [];
|
||||
if (res.data) {
|
||||
let tempDateList = [];
|
||||
res.data.nameData.forEach((date) => {
|
||||
tempDateList.push(date.name);
|
||||
});
|
||||
this.dateLabelList = Array.from(new Set(tempDateList));
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
// console.log(res.data.nameData.slice(1))
|
||||
let xData = []
|
||||
let yAllData = []
|
||||
let lineName = []
|
||||
if (res.data) {
|
||||
let tempDateList = []
|
||||
res.data.nameData.forEach(date => {
|
||||
tempDateList.push(date.name)
|
||||
})
|
||||
this.dateLabelList = Array.from(new Set(tempDateList))
|
||||
this.dateLabelList.forEach((item) => {
|
||||
if (item.indexOf('年') === -1) {
|
||||
// 构造表头
|
||||
const props = {
|
||||
prop: item,
|
||||
label: item,
|
||||
};
|
||||
arr[2].children.push(props);
|
||||
|
||||
this.dateLabelList.forEach(item => {
|
||||
if (item.indexOf('年') === -1) {
|
||||
// 构造表头
|
||||
const props = {
|
||||
'prop': item,
|
||||
'label': item
|
||||
}
|
||||
arr[2].children.push(props)
|
||||
// 构造echarts横坐标
|
||||
xData.push(item);
|
||||
}
|
||||
});
|
||||
// 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;
|
||||
this.tableProps = arr;
|
||||
|
||||
// 构造echarts横坐标
|
||||
xData.push(item)
|
||||
}
|
||||
})
|
||||
// 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
|
||||
this.tableProps = arr
|
||||
|
||||
// let tempList = []
|
||||
// res.data.nameData.slice(1).forEach(item => {
|
||||
// tempList.push(item.name)
|
||||
// // arr[2].children.push(props)
|
||||
// })
|
||||
// xData = Array.from(new Set(tempList))
|
||||
|
||||
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(xData, yAllData, lineName)
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
// let tempList = []
|
||||
// res.data.nameData.slice(1).forEach(item => {
|
||||
// tempList.push(item.name)
|
||||
// // arr[2].children.push(props)
|
||||
// })
|
||||
// xData = Array.from(new Set(tempList))
|
||||
|
||||
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.$nextTick(() => {
|
||||
this.$refs.lineChart.initChart(xData, yAllData, lineName);
|
||||
});
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
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
|
||||
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;
|
||||
if (val.time) {
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message({
|
||||
message: '请选择时间',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
// this.listQuery.pageSize = 10;
|
||||
if (val.time) {
|
||||
this.getData();
|
||||
} else {
|
||||
this.$message({
|
||||
message: '请选择时间',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
|
||||
Reference in New Issue
Block a user