| | |
| | | nextNextMonthMaintenancePlanNum: 0, |
| | | twoMaintenanceChartData: [['-', '-', '-']], |
| | | barChart: '', |
| | | barChartData: [ |
| | | { |
| | | 'value': '32', |
| | | 'name': '401', |
| | | 'productionCode': '125487318', |
| | | 'productionId': '1729419336207761409' |
| | | }, |
| | | { |
| | | 'value': '23', |
| | | 'name': '406', |
| | | 'productionCode': '4212152142', |
| | | 'productionId': '1729419361201618945' |
| | | }, |
| | | { |
| | | 'value': '11', |
| | | 'name': '407', |
| | | 'productionCode': '321321345', |
| | | 'productionId': '1729419381665628161' |
| | | }, |
| | | { |
| | | 'value': '44', |
| | | 'name': '408', |
| | | 'productionCode': '536341343', |
| | | 'productionId': '1729670118396067842' |
| | | } |
| | | ], |
| | | barChartData: [], |
| | | doubleBarChart: '', |
| | | doubleBarChartData: {}, |
| | | efficiencyChartConfig: {}, |
| | |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.handleWindowResize) |
| | | this.drawCharts() |
| | | this.getChartDataByApi() |
| | | this.drawProblemChart() |
| | | }, |
| | | beforeDestroy() { |
| | | window.removeEventListener('resize', this.handleWindowResize) |
| | | }, |
| | | methods: { |
| | | /* 调用接口获取图表数据汇总方法 */ |
| | | getChartDataByApi() { |
| | | this.getRunningStateDataByApi() |
| | | this.getEfficiencyDataByApi() |
| | |
| | | this.getWarrantyMalfunctionDataByApi() |
| | | this.getMonthMaintenanceNumByApi() |
| | | this.getTwoMaintenanceChartDataByApi() |
| | | // this.getBarChartDataByApi() |
| | | this.getBarChartDataByApi() |
| | | this.getDoubleBarChartDataByApi() |
| | | }, |
| | | |
| | | /* 调用接口获取设备运行状态 */ |
| | | getRunningStateDataByApi() { |
| | | this.runningStateChart = this.$echarts.init(document.getElementById('running_state_chart')) |
| | | this.runningStateChart.showLoading({ |
| | | text: '数据加载中 ...', |
| | | color: '#0696e1', // 加载动画颜色 |
| | | textColor: '#fff', |
| | | maskColor: 'rgba(1, 25, 75, 0.2)' // 遮罩层 |
| | | }) |
| | | signageApi.getEquipmentStatusStatisticsApi() |
| | | .then(res => { |
| | | if (res.success) this.runningStateData = res.result.list |
| | |
| | | |
| | | /* 调用接口获取设备利用率 */ |
| | | getEfficiencyDataByApi() { |
| | | this.efficiencyChart = this.$echarts.init(document.getElementById('efficiency_chart')) |
| | | this.efficiencyChart.showLoading({ |
| | | text: '数据加载中 ...', |
| | | color: '#0696e1', // 加载动画颜色 |
| | | textColor: '#fff', |
| | | maskColor: 'rgba(1, 25, 75, 0.2)' // 遮罩层 |
| | | }) |
| | | signageApi.getEquipmentUtilizationStatisticsApi() |
| | | .then(res => { |
| | | if (res.success) this.efficiencyData = res.result |
| | |
| | | |
| | | /* 调用接口获取技术状态 */ |
| | | getTechConditionDataByApi() { |
| | | this.techConditionChart = this.$echarts.init(document.getElementById('tech_condition_chart')) |
| | | this.techConditionChart.showLoading({ |
| | | text: '数据加载中 ...', |
| | | color: '#0696e1', // 加载动画颜色 |
| | | textColor: '#fff', |
| | | maskColor: 'rgba(1, 25, 75, 0.2)' // 遮罩层 |
| | | }) |
| | | signageApi.getEquipmentTechnologyStatusListApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | if (res.success && res.result) { |
| | | this.techConditionData = [ |
| | | { value: res.result[0].qualifiedCount, name: '合格' }, |
| | | { value: res.result[0].disabledCount, name: '禁用' }, |
| | |
| | | |
| | | /* 调用接口获取设备报修故障 */ |
| | | getWarrantyMalfunctionDataByApi() { |
| | | this.warrantyMalfunctionChart = this.$echarts.init(document.getElementById('warranty_malfunction_chart')) |
| | | this.warrantyMalfunctionChart.showLoading({ |
| | | text: '数据加载中 ...', |
| | | color: '#0696e1', // 加载动画颜色 |
| | | textColor: '#fff', |
| | | maskColor: 'rgba(1, 25, 75, 0.2)' // 遮罩层 |
| | | }) |
| | | signageApi.getReportRepairEquipmentListApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | if (res.success && res.result) { |
| | | this.warrantyMalfunctionData = [ |
| | | { value: res.result[0].failurTotalCount, name: '报修' }, |
| | | { value: res.result[0].stopCount, name: '停机' }, |
| | |
| | | |
| | | /* 调用接口获取设备OEE统计 */ |
| | | getBarChartDataByApi() { |
| | | this.barChart = this.$echarts.init(document.getElementById('bar_chart')) |
| | | this.barChart.showLoading({ |
| | | text: '数据加载中 ...', |
| | | color: '#0696e1', // 加载动画颜色 |
| | | textColor: '#fff', |
| | | maskColor: 'rgba(1, 25, 75, 0.2)' // 遮罩层 |
| | | }) |
| | | signageApi.getEquipmentOEEStatistics() |
| | | .then(res => { |
| | | if (res.success) this.barChartData = res.result |
| | |
| | | |
| | | /* 调用接口获取设备OEE和利用率对比 */ |
| | | getDoubleBarChartDataByApi() { |
| | | this.doubleBarChart = this.$echarts.init(document.getElementById('double_bar_chart')) |
| | | this.doubleBarChart.showLoading({ |
| | | text: '数据加载中 ...', |
| | | color: '#0696e1', // 加载动画颜色 |
| | | textColor: '#fff', |
| | | maskColor: 'rgba(1, 25, 75, 0.2)' // 遮罩层 |
| | | }) |
| | | signageApi.getEquipmentMonthStatisticsApi() |
| | | .then(res => { |
| | | if (res.success) this.doubleBarChartData = res.result |
| | |
| | | }) |
| | | }, |
| | | |
| | | /* 绘制图表汇总方法 */ |
| | | drawCharts() { |
| | | this.drawRunningStateChart() |
| | | this.drawEfficiencyChart() |
| | | this.drawTechConditionChart() |
| | | this.drawWarrantyMalfunctionChart() |
| | | this.drawMaintenanceChart() |
| | | this.drawBarChart() |
| | | this.drawDoubleBarChart() |
| | | this.drawProblemChart() |
| | | }, |
| | | |
| | | /* 绘制设备运行状态玫瑰饼图 */ |
| | | drawRunningStateChart(productionId) { |
| | | this.runningStateChart = this.$echarts.init(document.getElementById('running_state_chart')) |
| | | const option = { |
| | | height: 300, |
| | | title: { |
| | |
| | | ] |
| | | } |
| | | this.runningStateChart.setOption(option, true) |
| | | this.runningStateChart.hideLoading() |
| | | |
| | | this.runningStateChart.on('click', params => { |
| | | this.$router.push({ |
| | |
| | | |
| | | /* 绘制设备利用率胶囊图 */ |
| | | drawEfficiencyChart() { |
| | | this.efficiencyChart = this.$echarts.init(document.getElementById('efficiency_chart')) |
| | | const data = this.efficiencyData |
| | | const colorArray = [ |
| | | { |
| | |
| | | bottom: '#F7B7A0' |
| | | } |
| | | ] |
| | | const defaultData = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100] |
| | | const defaultData = [] |
| | | const dataMax = +data.sort((x, y) => +y.value - +x.value)[0].value |
| | | let yAxisMax |
| | | if (dataMax === 0) yAxisMax = 1 // 若数据中最大值为0,则将背景默认值设置为1 |
| | | else yAxisMax = Math.ceil(dataMax / 5) * 5 // 设置柱图背景阴影默认值,思路为数据最大值最接近的能被5整除的数字 |
| | | const yAxisInterval = yAxisMax / 5 // 同时将刻度值分成5份 |
| | | data.forEach(item => defaultData.push(yAxisMax)) |
| | | const option = { |
| | | title: { |
| | | show: true, // 是否显示标题,默认为true |
| | |
| | | } |
| | | }, |
| | | show: true, |
| | | min: 0, |
| | | max: 'dataMax', |
| | | interval: yAxisInterval, |
| | | type: 'value', |
| | | axisTick: { |
| | | show: false |
| | |
| | | } |
| | | option.title.text = `${moment().format('M月D日')}利用率` |
| | | this.efficiencyChart.setOption(option, true) |
| | | |
| | | this.efficiencyChart.hideLoading() |
| | | this.efficiencyChart.on('click', params => { |
| | | // 点击触发的为柱状体,除此除外是标题 |
| | | if (params.componentType === 'series') { |
| | |
| | | |
| | | /* 绘制技术状态饼图 */ |
| | | drawTechConditionChart() { |
| | | this.techConditionChart = this.$echarts.init(document.getElementById('tech_condition_chart')) |
| | | const option = { |
| | | height: 300, |
| | | title: { |
| | |
| | | ] |
| | | } |
| | | this.techConditionChart.setOption(option, true) |
| | | this.techConditionChart.hideLoading() |
| | | }, |
| | | |
| | | /* 绘制设备报修故障饼图 */ |
| | | drawWarrantyMalfunctionChart() { |
| | | this.warrantyMalfunctionChart = this.$echarts.init(document.getElementById('warranty_malfunction_chart')) |
| | | const option = { |
| | | height: 300, |
| | | title: { |
| | |
| | | ] |
| | | } |
| | | this.warrantyMalfunctionChart.setOption(option, true) |
| | | this.warrantyMalfunctionChart.hideLoading() |
| | | }, |
| | | |
| | | /* 绘制车间保养滚动表 */ |
| | |
| | | |
| | | /* 绘制单柱图 */ |
| | | drawBarChart() { |
| | | this.barChart = this.$echarts.init(document.getElementById('bar_chart')) |
| | | const defaultData = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100] |
| | | const defaultData = [] |
| | | const dataMax = +this.barChartData.sort((x, y) => +y.value - +x.value)[0].value |
| | | let yAxisMax |
| | | if (dataMax === 0) yAxisMax = 1 // 若数据中最大值为0,则将背景默认值设置为1 |
| | | else yAxisMax = Math.ceil(dataMax / 5) * 5 // 设置柱图背景阴影默认值,思路为数据最大值最接近的能被5整除的数字 |
| | | const yAxisInterval = yAxisMax / 5 // 同时将刻度值分成5份 |
| | | this.barChartData.forEach(item => defaultData.push(yAxisMax)) |
| | | const option = { |
| | | title: { |
| | | show: true, // 是否显示标题,默认为true |
| | |
| | | }], |
| | | yAxis: [{ |
| | | name: '%', |
| | | max: 100, |
| | | min: 0, |
| | | max: yAxisMax, |
| | | interval: yAxisInterval, |
| | | axisLabel: { |
| | | formatter: '{value}', |
| | | color: '#e2e9ff' |
| | |
| | | } |
| | | option.title.text = moment().subtract(1, 'months').format('M月') + `OEE车间` |
| | | this.barChart.setOption(option, true) |
| | | this.barChart.hideLoading() |
| | | |
| | | this.barChart.on('click', params => { |
| | | console.log('params', params) |
| | |
| | | |
| | | /* 绘制双柱图 */ |
| | | drawDoubleBarChart() { |
| | | this.doubleBarChart = this.$echarts.init(document.getElementById('double_bar_chart')) |
| | | const option = { |
| | | color: ['#409EFF', '#0FC61A'], |
| | | tooltip: { |
| | |
| | | ] |
| | | } |
| | | this.doubleBarChart.setOption(option, true) |
| | | this.doubleBarChart.hideLoading() |
| | | }, |
| | | |
| | | /* 绘制问题滚动表 */ |