From 339111ff4fe09368d5c1ff998d67575e53f912c1 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期二, 04 三月 2025 17:44:41 +0800 Subject: [PATCH] 1、车间看板页面调整鼠标悬浮框样式 2、车间看板页面增加定时任务定时刷新后台接口 --- src/views/mdc/base/modules/WorkshopSignage/DeviceAlarmInfo.vue | 11 ++++- src/views/mdc/base/WorkshopSignage.vue | 64 +++++++++++++++++++++++++------ src/views/mdc/base/modules/WorkshopSignage/MonthUtilizationRateTrend.vue | 4 -- src/views/mdc/base/modules/WorkshopSignage/DayUtilizationRateTrend.vue | 7 ++- src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue | 3 - src/views/mdc/base/modules/WorkshopSignage/DeviceDragLayout.vue | 14 +++++-- 6 files changed, 73 insertions(+), 30 deletions(-) diff --git a/src/views/mdc/base/WorkshopSignage.vue b/src/views/mdc/base/WorkshopSignage.vue index 6db29b2..83acb27 100644 --- a/src/views/mdc/base/WorkshopSignage.vue +++ b/src/views/mdc/base/WorkshopSignage.vue @@ -5,7 +5,7 @@ <div class="left-col"> <div class="col-content"> <div class="content-title">{{workshopDetails.workshopName}}#璁惧鎯呭喌</div> - <workshop-device-overview :currentProductionId="currentProductionId" + <workshop-device-overview ref="workshopDeviceOverviewRef" :currentProductionId="currentProductionId" :equipmentStatusList="equipmentStatusList" :toDecimal2NoZero="toDecimal2NoZero"/> </div> <div class="col-content"> @@ -15,22 +15,25 @@ </div> <div class="col-content"> <div class="content-title">璁惧鍛ㄥ埄鐢ㄧ巼瓒嬪娍</div> - <week-utilization-rate-trend :currentProductionId="currentProductionId" :toDecimal2NoZero="toDecimal2NoZero"/> + <week-utilization-rate-trend ref="weekRateTrendRef" :currentProductionId="currentProductionId" + :toDecimal2NoZero="toDecimal2NoZero"/> </div> <div class="col-content"> <div class="content-title">璁惧鏃ュ埄鐢ㄧ巼瓒嬪娍</div> - <day-utilization-rate-trend :currentProductionId="currentProductionId" :toDecimal2NoZero="toDecimal2NoZero"/> + <day-utilization-rate-trend ref="dayRateTrendRef" :currentProductionId="currentProductionId" + :toDecimal2NoZero="toDecimal2NoZero"/> </div> <div class="col-content"> <div class="content-title">璁惧鎶ヨ淇℃伅</div> - <device-alarm-info/> + <device-alarm-info ref="deviceAlarmInfoRef" :currentProductionId="currentProductionId"/> </div> </div> <!--鍙充晶鎷栨嫿鍖哄煙--> <div class="right-col"> - <device-drag-layout :currentProductionId="currentProductionId" :equipmentStatusList="equipmentStatusList" - :getImgView="getImgView"/> + <device-drag-layout ref="deviceDragLayoutRef" :currentProductionId="currentProductionId" + :equipmentStatusList="equipmentStatusList" + :getImgView="getImgView" @handleTimeIntervalForShortOpen="handleTimeIntervalForShortOpen"/> </div> </div> </div> @@ -54,7 +57,7 @@ MonthUtilizationRateTrend, DayUtilizationRateTrend, WeekUtilizationRateTrend, - WorkshopDeviceOverview, + WorkshopDeviceOverview }, data() { return { @@ -82,20 +85,37 @@ statusImage: require('@/assets/WorskhopSignage/stateImg_gray.gif') } ], - deviceList: [], - isShowGuideline: false, - guidelineXTop: 0, - guidelineYLeft: 0, - isSwitchChecked: false, - isHasResizeOrDragDevice: false + timeIntervalForShortTime: null, + timeIntervalForLongTime: null } }, created() { if (!this.$route.params.productionId) return + // 鍦ㄦ澶勮幏鍙栬矾鐢卞弬鏁版槸涓轰簡浼犻�掑弬鏁扮粰瀛愮粍浠讹紝鑻ユ斁鍦╩ounted涓垯鏃犳硶浼犻�掔粰瀛愮粍浠� this.currentProductionId = this.$route.params.productionId }, mounted() { + if (!this.$route.params.productionId) return + // 鍦╩ounted涓璋冪敤姝ゆ柟娉曟槸涓轰簡鑾峰彇dom鍏冪礌 this.getWorkshopDetailsByApi() + + this.timeIntervalForShortTime = setInterval(() => { + this.$refs.workshopDeviceOverviewRef.getDeviceStatusCountByApi() + this.$refs.deviceAlarmInfoRef.getDeviceAlarmInfoByApi() + this.$refs.deviceDragLayoutRef.getDeviceListByApi() + }, 1000 * 60) + + this.timeIntervalForLongTime = setInterval(() => { + this.$refs.weekRateTrendRef.getChartDataByApi() + this.$refs.dayRateTrendRef.getChartDataByApi() + }, 1000 * 60 * 60) + }, + beforeDestroy() { + if (this.timeIntervalForShortTime || this.timeIntervalForLongTime) { + clearInterval(this.timeIntervalForShortTime) + clearInterval(this.timeIntervalForLongTime) + this.timeIntervalForShortTime = this.timeIntervalForLongTime = null + } }, methods: { // 閫氳繃杞﹂棿Id璋冪敤鎺ュ彛鑾峰彇杞﹂棿璇︾粏淇℃伅 @@ -109,6 +129,24 @@ }) }, + /** + * 鎺у埗鐭湡瀹氭椂浠诲姟寮�鍚笌鍏抽棴 + * @param checked 鍙充笅瑙掑姛鑳絪witch寮�鍏崇姸鎬� + */ + handleTimeIntervalForShortOpen(checked) { + if (checked) { + clearInterval(this.timeIntervalForShortTime) + this.timeIntervalForShortTime = null + console.log('鏆傚仠璁℃椂鍣�', this.timeIntervalForShortTime) + } else { + this.timeIntervalForShortTime = setInterval(() => { + this.$refs.workshopDeviceOverviewRef.getDeviceStatusCountByApi() + this.$refs.deviceAlarmInfoRef.getDeviceAlarmInfoByApi() + this.$refs.deviceDragLayoutRef.getDeviceListByApi() + }, 1000 * 60) + } + }, + // 淇濈暀涓や綅灏忔暟 toDecimal2NoZero(x) { const f = Math.round(x * 100) / 100 diff --git a/src/views/mdc/base/modules/WorkshopSignage/DayUtilizationRateTrend.vue b/src/views/mdc/base/modules/WorkshopSignage/DayUtilizationRateTrend.vue index 30ddbc4..33d6015 100644 --- a/src/views/mdc/base/modules/WorkshopSignage/DayUtilizationRateTrend.vue +++ b/src/views/mdc/base/modules/WorkshopSignage/DayUtilizationRateTrend.vue @@ -37,7 +37,6 @@ this.chartContainer = this.$echarts.init(document.getElementById(this.chartContainerId)) signageApi.getDayUtilizationRateApi(this.currentProductionId) .then(res => { - console.log('res==========', res) if (!res.success) return that.initChart(res.result) }) @@ -48,8 +47,10 @@ const option = { tooltip: { show: true, - trigger: 'item', - formatter: params => `${params.name}锛�${params.value}%` + trigger: 'axis', + formatter: function(params) { + return '<span style="display:inline-block; width:10px; height:10px; border-radius:100px; margin-right:5px; background:' + params[0].color + '"></span> ' + params[0].name + '   ' + '<span style="font-weight: bold"> ' + params[0].value + '%' + '</span>' + } }, legend: { show: false, diff --git a/src/views/mdc/base/modules/WorkshopSignage/DeviceAlarmInfo.vue b/src/views/mdc/base/modules/WorkshopSignage/DeviceAlarmInfo.vue index a3cfc86..5a79cf0 100644 --- a/src/views/mdc/base/modules/WorkshopSignage/DeviceAlarmInfo.vue +++ b/src/views/mdc/base/modules/WorkshopSignage/DeviceAlarmInfo.vue @@ -8,19 +8,24 @@ export default { name: 'DeviceAlarmInfo', components: {}, + props: { + currentProductionId: { + type: String + } + }, data() { return { config: {} } }, - mounted() { + created() { + if (!this.currentProductionId) return this.getDeviceAlarmInfoByApi() }, methods: { getDeviceAlarmInfoByApi() { const that = this - that.initChart() - signageApi.getWorkshopAlarmInfoApi() + signageApi.getWorkshopAlarmInfoApi(that.currentProductionId) .then(res => { if (!res.success) return that.initChart(res.result) diff --git a/src/views/mdc/base/modules/WorkshopSignage/DeviceDragLayout.vue b/src/views/mdc/base/modules/WorkshopSignage/DeviceDragLayout.vue index be81fb1..bba3cf5 100644 --- a/src/views/mdc/base/modules/WorkshopSignage/DeviceDragLayout.vue +++ b/src/views/mdc/base/modules/WorkshopSignage/DeviceDragLayout.vue @@ -42,7 +42,7 @@ <a-form layout="inline" v-has="'isCanDragAndResize'"> <a-form-item label="鍔熻兘寮�鍏�"> - <a-switch checked-children="寮�" un-checked-children="鍏�" v-model="isSwitchChecked" + <a-switch checked-children="寮�" un-checked-children="鍏�" v-model="isSwitchChecked" @change="handleSwitchChange" :disabled="isHasResizeOrDragDevice"/> </a-form-item> @@ -93,9 +93,15 @@ // 閫氳繃杞﹂棿Id璋冪敤鎺ュ彛鑾峰彇璁惧淇℃伅鍒楄〃 getDeviceListByApi() { const that = this - signageApi.getDeviceListInWorkshopSignagePageApi(that.currentProductionId).then((res) => { - if (res.success && res.result && res.result.length > 0) that.deviceList = res.result - }) + signageApi.getDeviceListInWorkshopSignagePageApi(that.currentProductionId) + .then((res) => { + if (res.success && res.result && res.result.length > 0) that.deviceList = res.result + }) + }, + + handleSwitchChange(checked) { + console.log('checked--------', checked) + this.$emit('handleTimeIntervalForShortOpen', checked) }, /** diff --git a/src/views/mdc/base/modules/WorkshopSignage/MonthUtilizationRateTrend.vue b/src/views/mdc/base/modules/WorkshopSignage/MonthUtilizationRateTrend.vue index 220259b..6f7ecab 100644 --- a/src/views/mdc/base/modules/WorkshopSignage/MonthUtilizationRateTrend.vue +++ b/src/views/mdc/base/modules/WorkshopSignage/MonthUtilizationRateTrend.vue @@ -47,9 +47,6 @@ color: ['#538dd6', '#ffff01', '#0bae8d', '#e26c0a', '#F6E1BE', '#7030a0', '#0ad0bb', '#FF9297', '#A40035'], tooltip: { trigger: 'axis', - textStyle: { - fontSize: '60%' - } }, legend: { //type:'scroll', @@ -72,7 +69,6 @@ containLabel: true }, 'dataZoom': [ - { 'type': 'inside', 'show': true, diff --git a/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue b/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue index 4fbe249..8fd0d92 100644 --- a/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue +++ b/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue @@ -48,9 +48,6 @@ color: ['#538dd6', '#ffff01', '#0bae8d', '#e26c0a', '#F6E1BE', '#7030a0', '#0ad0bb', '#FF9297', '#A40035'], tooltip: { trigger: 'axis', - textStyle: { - fontSize: '60%' - } }, legend: { //type:'scroll', -- Gitblit v1.9.3