From 0ca656cc1cbcc8c3005c1347d49c097f3d15a26f Mon Sep 17 00:00:00 2001 From: liushuai Date: Tue, 9 Jul 2019 17:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/icons/svg/EquipmentConditionAnalysis.svg | 1 + src/icons/svg/PartsNumberMaintenance.svg | 1 + .../EquipmentConditionAnalysis/index.vue | 47 ++++++++++++++----- 3 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 src/icons/svg/EquipmentConditionAnalysis.svg create mode 100644 src/icons/svg/PartsNumberMaintenance.svg diff --git a/src/icons/svg/EquipmentConditionAnalysis.svg b/src/icons/svg/EquipmentConditionAnalysis.svg new file mode 100644 index 00000000..b98ad029 --- /dev/null +++ b/src/icons/svg/EquipmentConditionAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/PartsNumberMaintenance.svg b/src/icons/svg/PartsNumberMaintenance.svg new file mode 100644 index 00000000..106ec20b --- /dev/null +++ b/src/icons/svg/PartsNumberMaintenance.svg @@ -0,0 +1 @@ + diff --git a/src/views/ManufacturingCenter/EquipmentConditionAnalysis/index.vue b/src/views/ManufacturingCenter/EquipmentConditionAnalysis/index.vue index 07786a6a..80f55f85 100644 --- a/src/views/ManufacturingCenter/EquipmentConditionAnalysis/index.vue +++ b/src/views/ManufacturingCenter/EquipmentConditionAnalysis/index.vue @@ -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: {