Commit 8338b99d authored by 车宾's avatar 车宾

fea(化验室槽液检测参数趋势图):功能联调

parent 4522ffca
...@@ -25,9 +25,9 @@ export default { ...@@ -25,9 +25,9 @@ export default {
}, },
{ {
path: 'trendchartOfTankParameters', path: 'trendchartOfTankParameters',
component: () => import('@/views/Laboratory/Pretreatment/trendchartOfTankParameters'), component: () => import('@/views/Laboratory/trendchartOfTankParameters/list'),
name: 'TrendchartOfTankParameters', name: 'TrendchartOfTankParameters',
meta: { title: 'TrendchartOfTankParameters', icon: 'template', noCache: false, mark: '/laboratory/pretreatment/trendchartOfTankParameters' } meta: { title: 'TrendchartOfTankParameters', icon: 'template', noCache: false, mark: '/laboratory/trendchartOfTankParameters/list' }
} }
] ]
} }
<template> <template>
<div class="chart-pack"> <div class="chart-pack">
<div :id="sendData.id" class="chart"> <div :id="propsId" class="chart">
</div> </div>
</div> </div>
</template> </template>
...@@ -10,27 +10,38 @@ import Echarts from 'echarts' ...@@ -10,27 +10,38 @@ import Echarts from 'echarts'
export default { export default {
props: { props: {
sendData: { sendData: {
type: Object, type: Array,
default: () => { default: () => {
return {} return []
}
} }
}, },
data () { timesArrList: {
return { type: Array,
sampleCharts: '' default: () => {
return []
} }
}, },
watch: { propsId: {
sendData: { type: Number,
handler (newVal, oldVal) { default: () => {
this.renderEcharts(); return null
}
}
}, },
deep: true data () {
return {
// 图表Y轴数据
chartsYdata:[],
// 下限值
rangeLower: null,
// 上限值
rangeUpper: null,
// Y轴名字
nameY: null
} }
}, },
mounted () { mounted () {
if (this.sendData.hasOwnProperty('id')) { if (this.sendData.length > 0 && this.propsId !== null) {
this.$nextTick(() => { this.$nextTick(() => {
this.renderEcharts(); this.renderEcharts();
}) })
...@@ -38,17 +49,20 @@ export default { ...@@ -38,17 +49,20 @@ export default {
}, },
methods: { methods: {
renderEcharts () { renderEcharts () {
let domItem = document.getElementById(`${this.sendData.id}`); // 数据解析
this.sampleCharts = Echarts.init(domItem); for (let item of this.sendData) {
let data = this.sendData.value; this.chartsYdata.push(item.checkResult)
let top = this.sendData.top; this.rangeLower = item.rangeLower
let down = this.sendData.down; this.rangeUpper = item.rangeUpper
// this.sampleCharts.clear(); this.nameY = item.name
// echarts.dispose(domItem) };
// let echart = echarts.init(domItem) let domItem = document.getElementById(`${this.propsId}`);
// 清空div中的内容和结构
domItem.innerHTML = '';
let sampleCharts = Echarts.init(domItem);
var charts = { var charts = {
// unit: '户数', // unit: '户数',
names: ['进给轴倍率', '主轴负载'] // names: ['进给轴倍率', '主轴负载']
// lineX:new Date(this.createTime).getTime(), // lineX:new Date(this.createTime).getTime(),
}; };
let opt = { let opt = {
...@@ -65,7 +79,7 @@ export default { ...@@ -65,7 +79,7 @@ export default {
// name: '日期', // name: '日期',
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], data: this.timesArrList,
nameTextStyle: { nameTextStyle: {
// fontWeight: 'bold', // fontWeight: 'bold',
fontSize: 18, fontSize: 18,
...@@ -73,8 +87,8 @@ export default { ...@@ -73,8 +87,8 @@ export default {
} }
}, },
yAxis: { yAxis: {
name: this.nameY,
type: 'value', type: 'value',
name: this.sendData.argumentName,
nameTextStyle: { nameTextStyle: {
// fontWeight: 'bold', // fontWeight: 'bold',
fontSize: 16, fontSize: 16,
...@@ -83,13 +97,13 @@ export default { ...@@ -83,13 +97,13 @@ export default {
}, },
series: [ series: [
{ {
name: '邮件营销', name: this.nameY,
type: 'line', type: 'line',
lineStyle: { lineStyle: {
color: '#8cd2ff' color: '#8cd2ff'
}, },
stack: '总量', stack: '总量',
data: data, data: this.chartsYdata,
markLine: { markLine: {
label: { label: {
show: true, show: true,
...@@ -107,17 +121,17 @@ export default { ...@@ -107,17 +121,17 @@ export default {
silent: true, silent: true,
data: [ data: [
{ {
yAxis: top yAxis: this.rangeUpper
}, },
{ {
yAxis: down yAxis: this.rangeLower
} }
] ]
} }
} }
] ]
}; };
this.sampleCharts.setOption(opt); sampleCharts.setOption(opt, true);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment