From 42b92ac28031c87593693ed927229d31eaa4e9c7 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 09 十一月 2023 11:34:59 +0800
Subject: [PATCH] feat: 优化

---
 src/views/dashboard/components/TaskControl.vue     |   10 ++++++----
 src/views/dashboard/components/TaskInfo.vue        |    2 +-
 src/views/dashboard/components/ProcessingInfo.vue  |   16 ++++++++--------
 src/views/dashboard/components/ChannelCollapse.vue |    2 +-
 src/stores/tasks.ts                                |   10 +++++-----
 5 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/stores/tasks.ts b/src/stores/tasks.ts
index e115738..032e7b8 100644
--- a/src/stores/tasks.ts
+++ b/src/stores/tasks.ts
@@ -28,11 +28,8 @@
     return getTaskList(params)
       .then((res) => {
         channels.value = res.data
-
         // 棣栨鑾峰彇閫氶亾鏁版嵁鏃惰嚜鍔ㄩ�変腑绗竴涓换鍔�
-        if (!activeTask?.value) {
-          selectFirstTask(channels.value)
-        }
+        selectFirstTask(channels.value)
       })
       .catch((err) => {
         console.error(err)
@@ -44,12 +41,15 @@
     const firstNotEmptyChannel = Object.entries(channels).find((ele) => {
       const taskList = (ele[1] as TasksResponse)?.Tasks
 
-      return !!taskList.length
+      return !!taskList?.length
     })
 
     if (firstNotEmptyChannel) {
       const channelNumber = +firstNotEmptyChannel[0]
       activeTask.value = channels[channelNumber].Tasks[0]
+    } else {
+      // 濡傛灉娌℃湁浠诲姟灏辨竻绌哄綋鍓嶉�変腑鐨勪换鍔�
+      activeTask.value = undefined
     }
   }
 
diff --git a/src/views/dashboard/components/ChannelCollapse.vue b/src/views/dashboard/components/ChannelCollapse.vue
index bde2dd9..ca875c8 100644
--- a/src/views/dashboard/components/ChannelCollapse.vue
+++ b/src/views/dashboard/components/ChannelCollapse.vue
@@ -4,7 +4,7 @@
       <el-collapse-item
         v-for="(channel, channelNumber) in channels"
         :key="channelNumber"
-        :title="CHANNEL_NAME_MAP[channelNumber] + ' 閫氶亾'"
+        :title="CHANNEL_NAME_MAP[channelNumber] + ' 閫氶亾' + ' (' + (channel?.TaskCount ?? 0) + ')'"
         :name="String(channelNumber)"
       >
         <TaskInfo
diff --git a/src/views/dashboard/components/ProcessingInfo.vue b/src/views/dashboard/components/ProcessingInfo.vue
index fe317d6..a466947 100644
--- a/src/views/dashboard/components/ProcessingInfo.vue
+++ b/src/views/dashboard/components/ProcessingInfo.vue
@@ -5,13 +5,13 @@
     </div>
     <div class="details">
       <div class="row">
-        <div class="col">宸ュ崟缂栧彿: {{ task?.Order?.workOrderId || '' }}</div>
-        <div class="col">璁㈠崟缂栧彿: {{ task?.Order?.orderId || '' }}</div>
+        <div class="col">宸ュ崟缂栧彿: {{ task?.Order?.workOrderId ?? '--' }}</div>
+        <div class="col">璁㈠崟缂栧彿: {{ task?.Order?.orderId ?? '--' }}</div>
       </div>
 
       <div class="row">
         <div class="col">浜у搧鍚嶇О: {{ task?.Order?.productName || '--' }}</div>
-        <div class="col">鏁伴噺: {{ task?.Order?.amount || 0 }}{{ task?.Order?.unit }}</div>
+        <div class="col">鏁伴噺: {{ task?.Order?.amount ?? '--' }}{{ task?.Order?.unit }}</div>
       </div>
       <div class="row">
         <div class="col">浜よ揣鏃ユ湡: {{ task?.Order?.deliverDate || '--' }}</div>
@@ -26,8 +26,8 @@
         <div class="col">閫氶亾: {{ isNumber(task?.Channel) ? CHANNEL_NAME_MAP[task?.Channel] : '--' }}</div>
       </div>
       <div class="row">
-        <div class="col">瀹㈡埛鍚嶇О: {{ task?.Order?.customer || '' }}</div>
-        <div class="col">鍙傛暟瑕佹眰: {{ task?.Order?.parameter || '' }}</div>
+        <div class="col">瀹㈡埛鍚嶇О: {{ task?.Order?.customer || '--' }}</div>
+        <div class="col">鍙傛暟瑕佹眰: {{ task?.Order?.parameter || '--' }}</div>
       </div>
     </div>
     <div class="process">
@@ -115,7 +115,7 @@
   if (!timestamp) {
     return '--'
   }
-  const time = useDateFormat(timestamp * 1000, 'YYYY-MM-DD', { locales: 'zh-cn' })
+  const time = useDateFormat(timestamp * 1000, 'YYYY-MM-DD HH:mm:ss', { locales: 'zh-cn' })
   return time.value
 }
 </script>
@@ -143,7 +143,7 @@
   }
 }
 .details {
-  font-size: 18px;
+  font-size: 17px;
   padding: 10px 20px;
   color: $text-color;
   .row {
@@ -158,7 +158,7 @@
   }
 }
 .process {
-  font-size: 18px;
+  font-size: 17px;
   padding: 10px 20px;
   color: $text-color;
   display: flex;
diff --git a/src/views/dashboard/components/TaskControl.vue b/src/views/dashboard/components/TaskControl.vue
index 6791ac2..e8e60e1 100644
--- a/src/views/dashboard/components/TaskControl.vue
+++ b/src/views/dashboard/components/TaskControl.vue
@@ -21,8 +21,10 @@
         寮�濮嬬敓浜�
       </BigButton>
       <template v-if="task?.Procedure.Status === 2 || task?.Procedure.Status === 3">
-        <BigButton class="btn" bg-color="#ff9933">鎵撳嵃</BigButton>
-        <BigButton class="btn" bg-color="#00cc33" @click="openReportModal">鎶ュ伐</BigButton>
+        <BigButton class="btn" bg-color="#ff9933" :disabled="task?.Procedure.Status === 3">鎵撳嵃</BigButton>
+        <BigButton class="btn" bg-color="#00cc33" :disabled="task?.Procedure.Status === 3" @click="openReportModal">
+          鎶ュ伐
+        </BigButton>
         <el-popconfirm
           width="340"
           confirm-button-text="纭畾"
@@ -36,7 +38,7 @@
           @confirm="finishTaskProduce"
         >
           <template #reference>
-            <BigButton class="btn" bg-color="#ff0000">瀹屾垚</BigButton>
+            <BigButton class="btn" bg-color="#ff0000" :disabled="task?.Procedure.Status === 3">瀹屾垚</BigButton>
           </template>
         </el-popconfirm>
       </template>
@@ -119,7 +121,7 @@
   if (!timestamp) {
     return '--'
   }
-  const time = useDateFormat(timestamp * 1000, 'YYYY-MM-DD', { locales: 'zh-cn' })
+  const time = useDateFormat(timestamp * 1000, 'YYYY-MM-DD HH:mm:ss', { locales: 'zh-cn' })
   return time.value
 }
 // 鎶ュ伐
diff --git a/src/views/dashboard/components/TaskInfo.vue b/src/views/dashboard/components/TaskInfo.vue
index d0ba6e1..969ba26 100644
--- a/src/views/dashboard/components/TaskInfo.vue
+++ b/src/views/dashboard/components/TaskInfo.vue
@@ -41,7 +41,7 @@
 
 const planTimeText = computed(() => {
   const format = (date: number) => {
-    return useDateFormat(date, 'YYYY-MM-DD', { locales: 'zh-cn' })
+    return useDateFormat(date, 'YYYY-MM-DD HH:mm:ss', { locales: 'zh-cn' })
   }
 
   const startTime = task.value.Procedure?.startTime

--
Gitblit v1.8.0