From 2bb9a863e75312fe90869ea3deea137b46b1bb1e Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 06 十一月 2023 17:46:43 +0800
Subject: [PATCH] 拉代码

---
 src/views/dashboard/components/ProcessInfo.vue |   83 +++++++++++++++++++++++++++++++++--------
 1 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/src/views/dashboard/components/ProcessInfo.vue b/src/views/dashboard/components/ProcessInfo.vue
index a75e342..fcc3045 100644
--- a/src/views/dashboard/components/ProcessInfo.vue
+++ b/src/views/dashboard/components/ProcessInfo.vue
@@ -3,39 +3,79 @@
     <div class="item-l-bng">
       <img src="~@/assets/images/process-model.png" />
     </div>
-    <div class="item-r">
-      <div class="item-r-t font_weight">{{ process.number }}</div>
-      <div class="item-r-b">{{ process.name }}</div>
-      <div class="item-r-b">{{ process.name }}</div>
+    <div class="item-r" @click="onDetailClick">
+      <div class="item-r-t font_weight">{{ craftModel.number }}</div>
+      <div class="item-r-b">浜у搧: {{ craftModel.product }}</div>
+      <div class="item-r-b">宸ヨ壓: {{ craftModel.procedure }}</div>
     </div>
-    <div class="tip-r">
+    <div v-if="craftModel.isUpdate" class="tip-r">
       <img src="~@/assets/images/process-tip.png" />
     </div>
-    <div class="tip-current">褰撳墠浣跨敤</div>
+    <div v-if="craftModel.number == task?.Procedure?.processModelNumber" class="tip-current">褰撳墠浣跨敤</div>
     <div class="btn">
-      <el-button type="primary" class="color_organge"> 鏇存柊宸ヨ壓</el-button>
+      <!-- :disabled="craftModel.isUpdate?false:true" -->
+      <el-button type="primary" class="color_organge" @click="onUpdateClick">
+        <el-icon v-if="loading" color="#fff" :size="16" class="refresh-top-icon">
+          <Loading />
+        </el-icon>
+        鏇存柊宸ヨ壓
+      </el-button>
     </div>
   </div>
 </template>
 <script setup lang="ts">
-import { computed, toRefs } from 'vue'
-export interface ProcessInfoProps {
-  process: process
-}
+import { toRefs, ref, watch } from 'vue'
+import { Loading } from '@element-plus/icons-vue'
+import type { CraftModel } from '@/api/craftModel'
+import type { Task } from '@/api/task'
+const props = defineProps<{
+  craftModel: CraftModel
+  activeArr: Array
+  task?: Task
+}>()
+const { craftModel, task, activeArr } = toRefs(props)
 
-const props = defineProps<ProcessInfoProps>()
-const { process } = toRefs(props)
+const emit = defineEmits<{
+  update: [craftModel: CraftModel]
+  detail: [craftModel: CraftModel]
+}>()
+const loading = ref(false)
+watch(activeArr.value, () => {
+  // 寮圭獥鏄剧ず鏃惰幏鍙栧伐鑹哄弬鏁�
+  if (activeArr.value) {
+    getLoading()
+  }
+})
+function getLoading() {
+  for (let i in activeArr.value) {
+    if (activeArr.value[i] == craftModel.value.number) {
+      loading.value = true
+      break
+    }
+  }
+}
+function onDetailClick() {
+  emit('detail', craftModel.value)
+}
+function onUpdateClick() {
+  if (loading.value) {
+    return true
+  }
+  emit('update', craftModel.value)
+}
 </script>
 
 <style scoped lang="scss">
 $status-running: #f76c0f;
 $status-done: #2c5dbb82;
+$status-ready: #00ff00f0;
+$status-disabled: #7b95d3;
 .font_weight {
   font-weight: 600;
 }
 .process-info {
   width: calc(50% - 35px);
-  height: 110px;
+  height: 140px;
   padding: 23px 10px 10px;
   background: $status-done;
   border-radius: 8px;
@@ -57,6 +97,11 @@
     img {
       width: 100%;
     }
+  }
+  .refresh-top-icon {
+    display: flex;
+    align-items: center;
+    color: #fff;
   }
 
   .item-r {
@@ -88,7 +133,7 @@
   }
 
   .tip-current {
-    background: green;
+    background: $status-ready;
     color: #fff;
     position: absolute;
     top: 0px;
@@ -102,12 +147,18 @@
   .btn {
     width: 100px;
     position: absolute;
-    right: 0px;
+    right: 10px;
     bottom: 10px;
     .el-button--primary {
       background: $status-running;
       border: 0 !important;
     }
+    .el-button.is-disabled,
+    .el-button.is-disabled:focus,
+    .el-button.is-disabled:hover {
+      color: #fff !important;
+      background: $status-disabled;
+    }
   }
 }
 </style>

--
Gitblit v1.8.0