From 9187d56f6c52bd832db450cb94128aa3ffdcf19d Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 21 Sep 2022 15:30:51 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=AE=BE=E5=A4=87=E6=95=88=E7=8E=87?= =?UTF-8?q?=E5=88=86=E6=9E=90=E7=9A=84=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/operationComponent.js | 4 +- .../monitoring/equipmentEfficiency.vue | 121 +++++-- .../monitoring/equipmentEfficiencyGraph.vue | 308 ++++++++++++++++++ 3 files changed, 407 insertions(+), 26 deletions(-) create mode 100644 src/views/modules/monitoring/equipmentEfficiencyGraph.vue diff --git a/src/components/base-table/components/operationComponent.js b/src/components/base-table/components/operationComponent.js index bad72e8..a0b5427 100644 --- a/src/components/base-table/components/operationComponent.js +++ b/src/components/base-table/components/operationComponent.js @@ -19,7 +19,8 @@ export default { colors: { delete: '#FF5454', preview: '#f09843', - design: '#99089f' + design: '#99089f', + // 'view-trend': 'red' // add more... }, text: { @@ -30,6 +31,7 @@ export default { viewAttr: i18n.t('viewattr'), preview: i18n.t('preview'), design: i18n.t('design'), + 'view-trend': '查看趋势' // add more... } } diff --git a/src/views/modules/monitoring/equipmentEfficiency.vue b/src/views/modules/monitoring/equipmentEfficiency.vue index 5dadb23..d022236 100644 --- a/src/views/modules/monitoring/equipmentEfficiency.vue +++ b/src/views/modules/monitoring/equipmentEfficiency.vue @@ -46,8 +46,12 @@ - - + + + + + @@ -64,7 +68,7 @@ import i18n from '@/i18n' import BaseTable from '@/components/base-table' import TableOperateComponent from '@/components/base-table/components/operationComponent' import TableTextComponent from '@/components/base-table/components/detailComponent' - +import EquipmentEfficiencyGraph from './equipmentEfficiencyGraph.vue' import { calcMaxHeight } from '@/utils' import { timeFilter } from '@/utils/filters' import moment from 'moment' @@ -126,10 +130,13 @@ const tableConfigs = [ prop: 'operations', name: i18n.t('handle'), fixed: 'right', - width: 180, - subcomponent: TableOperateComponent, + width: 120, + subcomponent: TableTextComponent, // options: ['edit', 'delete'] - options: ['view-trend'] // 查看趋势 + // options: ['view-trend'] // 查看趋势 + buttonContent: '查看趋势', + actionName: 'view-trend', + emitFullData: true } ] @@ -139,10 +146,11 @@ export default { /** hfxny part */ factoryList: [], productLineList: [], + showGraph: false, /** */ calcMaxHeight, tableConfigs, - timeType: 'range', + timeType: 'date', rawTime: null, // [] or datetime dataForm: { type: 1, @@ -159,7 +167,7 @@ export default { } }, components: { - BaseTable + BaseTable, EquipmentEfficiencyGraph }, created() { @@ -233,8 +241,8 @@ export default { // 获取数据列表 getDataList() { const { startTime, endTime } = this.getTimeRange() - - this.dataListLoading = true + this.showGraph = false + // this.dataListLoading = true this.$http({ url: this.$http.adornUrl('/monitoring/eqAnalysis/oee'), method: 'post', @@ -243,21 +251,59 @@ export default { endTime, ftId: this.dataForm.ftId, productlines: this.dataForm.productlines, - limit: this.pageIndex, - page: this.pageSize, + // limit: this.pageIndex, + // page: this.pageSize, type: 1 } }).then(({ data: res }) => { - console.log('oee data:', res) - if (res.length) { - this.dataList = res - this.totalPage = res.length + if (res.data && res.code !== 500) { + console.log('oee data:', res) + if (res.data.length) { + this.dataList = res.data + // this.dataList = Array(20).fill(1) + } else { + this.dataList.splice(0) + } } else { this.dataList.splice(0) - this.totalPage = 0 + this.$message.error(res.msg) } }) }, + + // 查看趋势 + viewTrend(data) { + const { startTime, endTime } = this.getTimeRange() + const injectData = { + // 时间段 + startTime, + endTime, + // 设备id + equipmentId: data.eqId, + equipmentName: data.eqName, + // 时间类型, type 按年,按月,按日等 + type: 1, // 默认 type 1, 1无间隔;2按月分隔;3按周分隔;4按天分隔 + // 时长数据: 工作时长, 停机时长,故障时长 + workTime: data.workTime, + stopTime: data.stopTime, + downTime: data.downTime, + // 比例数据: 工作时长比率,停机时长比率,故障时长比率,速度开动率,OEE,TEEP + workRate: data.workRate, + stopRate: data.stopRate, + downRate: data.downRate, + peEfficiency: data.peEfficiency, + timeEfficiency: data.timeEfficiency + } + // console.log('trends data: ', data) + + this.showGraph = true + + setTimeout(() => { + // console.log('befoer graph: ', this.$refs.eegraph) + this.$refs.eegraph.init(injectData) // 注入初始数据,这些数据在组件内部用作条件,有可能会被更改 + }, 600) // 动画是500ms + }, + // 每页数 sizeChangeHandle(val) { this.pageSize = val @@ -273,16 +319,41 @@ export default { selectionChangeHandle(val) { this.dataListSelections = val }, - handleOperations({ type, data: id }) { + + handleOperations({ type, data }) { switch (type) { - case 'view-detail': - return this.addOrUpdateHandle(id, true) - case 'edit': - return this.addOrUpdateHandle(id) - case 'delete': - return this.deleteHandle(id) + case 'view-trend': + return this.viewTrend(data) + // return this.addOrUpdateHandle(id, true) + // case 'edit': + // return this.addOrUpdateHandle(id) + // case 'delete': + // return this.deleteHandle(id) } } } } + + + \ No newline at end of file diff --git a/src/views/modules/monitoring/equipmentEfficiencyGraph.vue b/src/views/modules/monitoring/equipmentEfficiencyGraph.vue new file mode 100644 index 0000000..4894ca0 --- /dev/null +++ b/src/views/modules/monitoring/equipmentEfficiencyGraph.vue @@ -0,0 +1,308 @@ + + + + + +