Compare commits

...

3 Commits

Author SHA1 Message Date
ff9e93d264 Merge pull request 'dy' (#28) from dy into test
Reviewed-on: #28
2023-09-20 14:28:21 +08:00
helloDy
ee0affc78f Merge branch 'test' into dy 2023-09-20 13:58:36 +08:00
helloDy
dfec94be17 表格 2023-09-20 13:58:14 +08:00
4 changed files with 134 additions and 24 deletions

View File

@ -1,7 +1,7 @@
### ###
# @Author: Do not edit # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-09-16 09:41:07 # @LastEditTime: 2023-09-18 10:44:07
# @LastEditors: DY # @LastEditors: DY
# @Description: # @Description:
### ###

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table v-loading="dataListLoading" :span-method="mergeColumnHandler" :table-props="tableProps" :table-data="tableData" /> <base-table v-loading="dataListLoading" :span-method="mergeColumnHandler" :table-props="tableProps" :table-data="tableData" />
<line-chart ref="lineChart" /> <balance-chart ref="lineChart" />
<!-- <pagination <!-- <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
@ -16,7 +16,7 @@
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { getCT } from '@/api/core/analysis/index'; import { getCT } from '@/api/core/analysis/index';
import { getProductionLinePage } from '@/api/core/base/productionLine'; import { getProductionLinePage } from '@/api/core/base/productionLine';
import lineChart from '../LineChart' import BalanceChart from '../balanceChart'
import { time } from 'echarts'; import { time } from 'echarts';
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection'; // import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
@ -43,7 +43,7 @@ import { time } from 'echarts';
export default { export default {
components: { components: {
lineChart, BalanceChart
}, },
// mixins: [basicPage], // mixins: [basicPage],
data() { data() {
@ -103,8 +103,8 @@ export default {
getArr() { getArr() {
const params = { const params = {
page: 1, page: 1,
limit: 500, limit: 500
}; }
this.optionArrUrl.forEach((item, index) => { this.optionArrUrl.forEach((item, index) => {
item(params).then((response) => { item(params).then((response) => {
this.formConfig[index].selectOptions = response.data.list this.formConfig[index].selectOptions = response.data.list
@ -126,7 +126,6 @@ export default {
} }
} }
}) })
console.log('打印数组长度', this.spanArr)
}, },
/** 合并table列的规则 */ /** 合并table列的规则 */
mergeColumnHandler({ row, column, rowIndex, columnIndex }) { mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
@ -145,6 +144,11 @@ export default {
// this.listQuery.lineId = '1672847052717821953' // this.listQuery.lineId = '1672847052717821953'
// this.listQuery.startTime = '1693497600000'; // this.listQuery.startTime = '1693497600000';
// this.listQuery.endTime = '1693843200000'; // this.listQuery.endTime = '1693843200000';
this.tableData.splice(0)
this.xData.splice(0)
this.yData.splice(0)
this.tableProps.splice(0)
this.spanArr.splice(0)
this.urlOptions.getDataListURL(this.listQuery).then(res => { this.urlOptions.getDataListURL(this.listQuery).then(res => {
console.log(res) console.log(res)
let arr = [ let arr = [
@ -162,23 +166,33 @@ export default {
let sectionArr= [] let sectionArr= []
res.data.data.forEach((ele, index) => { res.data.data.forEach((ele, index) => {
let tempData = [] let tempData = []
ele.data.forEach(item => { let eqData = []
let plData = []
ele.data.forEach((item, index) => {
item.children.forEach(params => { item.children.forEach(params => {
if (params.dynamicName === '设备CT') { if (params.dynamicName === '设备CT') {
tempData[item.dynamicName + '_eq'] = params.dynamicValue tempData[item.dynamicName + '_eq'] = params.dynamicValue
eqData[index] = params.dynamicValue
} else { } else {
tempData[item.dynamicName + '_pl'] = params.dynamicValue tempData[item.dynamicName + '_pl'] = params.dynamicValue
plData[index] = params.dynamicValue
} }
}) })
}) })
const equipment = {
name: ele.equName,
eqData: eqData,
plData: plData
}
tempData['equName'] = ele.equName tempData['equName'] = ele.equName
tempData['sectionName'] = ele.sectionName tempData['sectionName'] = ele.sectionName
this.tableData.push(tempData) this.tableData.push(tempData)
const { sectionName } = tempData const { sectionName } = tempData
sectionArr.push(sectionName) sectionArr.push(sectionName)
this.yData.push(equipment)
console.log('看看equ', this.yData)
}) })
this.setRowSpan(sectionArr) this.setRowSpan(sectionArr)
console.log('工段名称列表', sectionArr)
res.data.nameData.forEach(item => { res.data.nameData.forEach(item => {
this.timeList.push(item.name) this.timeList.push(item.name)
}) })
@ -194,24 +208,13 @@ export default {
] ]
} }
arr.push(subprop) arr.push(subprop)
this.xData.push(times)
} }
} }
this.tableProps = arr this.tableProps = arr
let xData = [] console.log('表格横坐标', this.xData)
res.data.nameData.forEach(item => { this.$refs.lineChart.initChart(this.xData, this.yData)
xData.push(item.name)
// arr[2].children.push(props)
})
let yData = []
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, yData)
// this.total = response.data.total; // this.total = response.data.total;
// this.dataListLoading = false; // this.dataListLoading = false;
}); });

View File

@ -0,0 +1,102 @@
<!--
* @Author: zhp
* @Date: 2023-09-13 09:02:25
* @LastEditTime: 2023-09-20 09:29:40
* @LastEditors: DY
* @Description:
-->
<template>
<div>
<div style="margin: 20px">
<el-button v-for="(item, index) in dataArray" :key="index" @click="changeChart(index)">{{ item.name }}</el-button>
</div>
<div ref="chartDiv" :class="className" :style="{height:height,width:width}" />
</div>
</template>
<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
// import resize from './mixins/resize'
export default {
// mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '350px'
},
// autoResize: {
// type: Boolean,
// default: true
// }
},
data() {
return {
chart: null,
dataArray: [],
xDatas: []
}
},
mounted() {
},
methods: {
changeChart(index) {
this.setOptions(this.xDatas, this.dataArray[index])
},
initChart(xData, yData, lineName) {
this.dataArray = yData
this.xDatas = xData
console.log(xData,yData);
console.log('zale', yData[0].eqData)
this.chart = echarts.init(this.$refs.chartDiv, 'macarons')
this.setOptions(xData, yData[0], lineName)
},
setOptions(xData, dataList, lineName) {
// let seriesData = []
// lineName.forEach((item,index) => {
// seriesData.push({
// name: item,
// data: yData[index],
// type: 'line',
// })
// })
this.chart.setOption({
xAxis: {
type: 'category',
data: xData
},
tooltip: {
trigger: 'axis'
},
legend: {
data:lineName
},
yAxis: {
type: 'value'
},
series: [
{
name: '设备CT',
data: dataList.eqData,
type: 'line',
},
{
name: '产线CT',
data: dataList.plData,
type: 'line',
}
]
})
}
}
}
</script>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-09-16 17:42:37 * @LastEditTime: 2023-09-20 10:55:23
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -157,6 +157,11 @@ export default {
}; };
}, },
created() { created() {
if (this.$route.params.startTime) {
this.formConfig[1].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime]
}
// const time = new Date()
// this.formConfig[1].defaultSelect = [time, time]
this.getDataList() this.getDataList()
this.getPdLineList() this.getPdLineList()
}, },