From 39864dcc835f1e75efd3f20a99d50a7edae4a94f Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 06 十一月 2023 17:59:51 +0800
Subject: [PATCH] Merge branch 'wn' of http://192.168.5.5:10010/r/web/bulletin-board-style1 into dev

---
 src/views/dashboard/components/ProcessingInfo.vue |   64 ++++++--------------------------
 1 files changed, 12 insertions(+), 52 deletions(-)

diff --git a/src/views/dashboard/components/ProcessingInfo.vue b/src/views/dashboard/components/ProcessingInfo.vue
index 6aaf8d9..fe317d6 100644
--- a/src/views/dashboard/components/ProcessingInfo.vue
+++ b/src/views/dashboard/components/ProcessingInfo.vue
@@ -1,14 +1,7 @@
 <template>
   <div class="processing-info">
     <div class="step">
-      <el-steps
-        v-if="task?.AllProcedures"
-        :active="task.CurrentProcedureIndex ?? 0"
-        finish-status="success"
-        class="steps"
-      >
-        <el-step v-for="(item, index) in task.AllProcedures" :key="index" icon="" :title="item"></el-step>
-      </el-steps>
+      <TaskStep :active="task?.CurrentProcedureIndex ?? 0" :steps="task?.AllProcedures ?? []"></TaskStep>
     </div>
     <div class="details">
       <div class="row">
@@ -55,13 +48,12 @@
 <script setup lang="ts">
 // 鍔犲伐淇℃伅缁勪欢
 import type { Task } from '@/api/task'
-import { computed, onUnmounted, toRefs, watch } from 'vue'
+import { computed, toRefs } from 'vue'
 import { useDateFormat } from '@vueuse/core'
-import { useRequest } from 'vue-hooks-plus'
-import { getProductProgress } from '@/api'
-import type { ProductProgressParams } from '@/api'
 import { isNumber } from 'lodash-es'
 import { CHANNEL_NAME_MAP } from '@/common/constants'
+import { usePLCStore } from '@/stores/plc'
+import TaskStep from '@/views/dashboard/components/TaskStep.vue'
 
 const props = defineProps<{
   task?: Task
@@ -94,6 +86,8 @@
   return result > 100 ? 100 : result
 }
 
+const plcStore = usePLCStore()
+
 /**
  * 璁$畻瀹屾垚杩涘害, 浠诲姟鐘舵�佹湭鐢熶骇鍥哄畾涓� 0% 宸插畬鎴愬浐瀹氫负 100% 鐢熶骇涓垯浠巔lc鑾峰彇
  */
@@ -107,47 +101,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()
 })
 
 /**
@@ -167,9 +124,8 @@
 
 .step {
   width: 100%;
-  height: 66px;
+  height: 46px;
   overflow-x: auto;
-  margin-top: -5px;
   padding: 0 20px;
   .steps {
     height: 100%;
@@ -213,8 +169,12 @@
 }
 :deep(.el-progress-bar__outer) {
   border-radius: 8px;
+  background-color: #13235a;
 }
 :deep(.el-progress-bar__inner) {
   border-radius: 8px;
 }
+:deep(.el-step__icon .is-icon) {
+  background-color: transparent;
+}
 </style>

--
Gitblit v1.8.0