瀏覽代碼

Merge pull request 'dy' (#28) from dy into test

Reviewed-on: http://git.picaiba.com/mt-fe-group/yudao-dev/pulls/28
pull/40/head
高天泽 1 年之前
父節點
當前提交
ff9e93d264
共有 4 個文件被更改,包括 134 次插入24 次删除
  1. +1
    -1
      .env.dev
  2. +25
    -22
      src/views/core/analysis/balanceAnalysis/index.vue
  3. +102
    -0
      src/views/core/analysis/balanceChart.vue
  4. +6
    -1
      src/views/core/monitoring/data/index.vue

+ 1
- 1
.env.dev 查看文件

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


+ 25
- 22
src/views/core/analysis/balanceAnalysis/index.vue 查看文件

@@ -2,7 +2,7 @@
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table v-loading="dataListLoading" :span-method="mergeColumnHandler" :table-props="tableProps" :table-data="tableData" />
<line-chart ref="lineChart" />
<balance-chart ref="lineChart" />
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
@@ -16,7 +16,7 @@
import { parseTime } from '../../mixins/code-filter';
import { getCT } from '@/api/core/analysis/index';
import { getProductionLinePage } from '@/api/core/base/productionLine';
import lineChart from '../LineChart'
import BalanceChart from '../balanceChart'
import { time } from 'echarts';
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';

@@ -43,7 +43,7 @@ import { time } from 'echarts';

export default {
components: {
lineChart,
BalanceChart
},
// mixins: [basicPage],
data() {
@@ -103,8 +103,8 @@ export default {
getArr() {
const params = {
page: 1,
limit: 500,
};
limit: 500
}
this.optionArrUrl.forEach((item, index) => {
item(params).then((response) => {
this.formConfig[index].selectOptions = response.data.list
@@ -126,7 +126,6 @@ export default {
}
}
})
console.log('打印数组长度', this.spanArr)
},
/** 合并table列的规则 */
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
@@ -145,6 +144,11 @@ export default {
// this.listQuery.lineId = '1672847052717821953'
// this.listQuery.startTime = '1693497600000';
// 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 => {
console.log(res)
let arr = [
@@ -162,23 +166,33 @@ export default {
let sectionArr= []
res.data.data.forEach((ele, index) => {
let tempData = []
ele.data.forEach(item => {
let eqData = []
let plData = []
ele.data.forEach((item, index) => {
item.children.forEach(params => {
if (params.dynamicName === '设备CT') {
tempData[item.dynamicName + '_eq'] = params.dynamicValue
eqData[index] = params.dynamicValue
} else {
tempData[item.dynamicName + '_pl'] = params.dynamicValue
plData[index] = params.dynamicValue
}
})
})
const equipment = {
name: ele.equName,
eqData: eqData,
plData: plData
}
tempData['equName'] = ele.equName
tempData['sectionName'] = ele.sectionName
this.tableData.push(tempData)
const { sectionName } = tempData
sectionArr.push(sectionName)
this.yData.push(equipment)
console.log('看看equ', this.yData)
})
this.setRowSpan(sectionArr)
console.log('工段名称列表', sectionArr)
res.data.nameData.forEach(item => {
this.timeList.push(item.name)
})
@@ -194,24 +208,13 @@ export default {
]
}
arr.push(subprop)
this.xData.push(times)
}
}
this.tableProps = arr

let xData = []
res.data.nameData.forEach(item => {
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)
console.log('表格横坐标', this.xData)
this.$refs.lineChart.initChart(this.xData, this.yData)
// this.total = response.data.total;
// this.dataListLoading = false;
});


+ 102
- 0
src/views/core/analysis/balanceChart.vue 查看文件

@@ -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>

+ 6
- 1
src/views/core/monitoring/data/index.vue 查看文件

@@ -1,7 +1,7 @@
<!--
* @Author: Do not edit
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-09-16 17:42:37
* @LastEditTime: 2023-09-20 10:55:23
* @LastEditors: DY
* @Description:
-->
@@ -157,6 +157,11 @@ export default {
};
},
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.getPdLineList()
},


Loading…
取消
儲存