From 35b1ce8f65b78fcdfdd56481b29ed8d74a8a6621 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期五, 03 十一月 2023 17:57:45 +0800 Subject: [PATCH] feat: 进度条背景色,对接设备切换组件接口数据 --- src/views/dashboard/components/ProcessingInfo.vue | 43 +++++-------------------------------------- 1 files changed, 5 insertions(+), 38 deletions(-) diff --git a/src/views/dashboard/components/ProcessingInfo.vue b/src/views/dashboard/components/ProcessingInfo.vue index 6aaf8d9..276eb7f 100644 --- a/src/views/dashboard/components/ProcessingInfo.vue +++ b/src/views/dashboard/components/ProcessingInfo.vue @@ -62,6 +62,7 @@ import type { ProductProgressParams } from '@/api' import { isNumber } from 'lodash-es' import { CHANNEL_NAME_MAP } from '@/common/constants' +import { usePLCStore } from '@/stores/plc' const props = defineProps<{ task?: Task @@ -94,6 +95,8 @@ return result > 100 ? 100 : result } +const plcStore = usePLCStore() + /** * 璁$畻瀹屾垚杩涘害, 浠诲姟鐘舵�佹湭鐢熶骇鍥哄畾涓� 0% 宸插畬鎴愬浐瀹氫负 100% 鐢熶骇涓垯浠巔lc鑾峰彇 */ @@ -107,47 +110,10 @@ } if (task?.value?.Procedure?.Status === 2) { - return calculateProgress(plcResponse?.value?.data as Statistics) + return calculateProgress(plcStore.plcInfo as Statistics) } return 0 -}) - -/** - * 濡傛灉浠诲姟鐘舵�佹槸杩涜涓�, 鍒欒疆璇� plc 鍙栬繘搴� - */ -const { - data: plcResponse, - run: startPLCPolling, - cancel: cancelPLCPolling -} = useRequest( - () => - getProductProgress({ - channel: task?.value?.Channel, - procedureId: task?.value?.Procedure.ID - } as ProductProgressParams), - { - manual: true, - pollingInterval: 6000, - pollingWhenHidden: false - } -) - -/** - * 浠诲姟鐘舵�佹槸鐢熶骇涓垯杞plc鍙栫洰鏍囨暟鍜屽畬鎴愭暟璁$畻瀹屾垚杩涘害 - */ -watch( - () => task?.value, - () => { - cancelPLCPolling() - if (task?.value?.Procedure?.Status === 2) { - startPLCPolling() - } - } -) - -onUnmounted(() => { - cancelPLCPolling() }) /** @@ -213,6 +179,7 @@ } :deep(.el-progress-bar__outer) { border-radius: 8px; + background-color: #13235a; } :deep(.el-progress-bar__inner) { border-radius: 8px; -- Gitblit v1.8.0