This commit is contained in:
liushuai
2019-07-09 17:20:20 +08:00
parent 80a0f8664d
commit 0ca656cc1c
3 changed files with 38 additions and 11 deletions

View File

@@ -198,12 +198,36 @@ export default {
}).then(() => {
this.drawLine()
})
getData3(this.MachineValue1, this.date1, this.date2).then(response => {
this.table1 = response.data
console.log(this.table1)
}).then(() => {
this.drawLine3()
})
if (this.date1 === null || this.date2 === null) {
this.$message.warning('请选择开始时间或结束时间')
} else {
const endYear = parseInt(this.date2.split('-')[0])
const startYear = parseInt(this.date1.split('-')[0])
const endMonth = parseInt(this.date2.split('-')[1])
const startMonth = parseInt(this.date1.split('-')[1])
const endDate = parseInt(this.date2.split('-')[2])
const startDate = parseInt(this.date1.split('-')[2])
let diff
if ((endMonth - startMonth) === 0) {
diff = endDate - startDate
}
if ((endMonth - startMonth) === 1) {
diff = endDate - startDate + 10
}
if ((endMonth - startMonth) > 1 || (endYear - startYear) !== 0) {
diff = 999
}
if (diff > 6) {
this.$message.warning('选择时间区间不得超过6天')
} else {
getData3(this.MachineValue1, this.date1, this.date2).then(response => {
this.table1 = response.data
console.log(this.table1)
}).then(() => {
this.drawLine3()
})
}
}
},
// 绘制图形
drawLine() {
@@ -388,18 +412,19 @@ export default {
return params.value[1].substr(11, 5) + '~' + params.value[2].substr(11, 5)
} // 数据的值
},
legend: { // 图例
left: 'left'
// selectedMode: false, // 图例可点击
legend: {
orient: 'vertical',
x: 'left',
data: ['运行', '停机', '等待']
},
dataZoom: [{
type: 'inside',
start: 0,
end: 50
end: 100
}, { // X轴可调
xAxisIndex: 0,
start: 0,
end: 50,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {