From c7f3fd5215399b37d0511b3bd555150ff1b13507 Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期一, 29 四月 2024 10:39:30 +0800
Subject: [PATCH] fix:回退原先版本

---
 src/views/newDashboard/index.vue |   64 ++++++++++++++------------------
 src/common/utils/request.ts      |   13 ++++--
 src/router/index.ts              |    4 +-
 3 files changed, 38 insertions(+), 43 deletions(-)

diff --git a/src/common/utils/request.ts b/src/common/utils/request.ts
index 82f6c31..68da2d3 100644
--- a/src/common/utils/request.ts
+++ b/src/common/utils/request.ts
@@ -60,11 +60,14 @@
     } else if (message.includes('Request failed with status code')) {
       message = '绯荤粺鎺ュ彛' + message.substr(message.length - 3) + '寮傚父'
     }
-    ElMessage({
-      message: message,
-      type: 'error',
-      duration: 3 * 1000
-    })
+    const token = getToken()
+    if (token) {
+      ElMessage({
+        message: message,
+        type: 'error',
+        duration: 3 * 1000
+      })
+    }
     return Promise.reject(error)
   }
 )
diff --git a/src/router/index.ts b/src/router/index.ts
index f75ea53..8c7a0f6 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,7 +1,7 @@
 import { createRouter, createWebHashHistory } from 'vue-router'
-//import DashboardView from '../views/dashboard/index.vue'
+import DashboardView from '../views/dashboard/index.vue'
 import loginView from '../views/login/loginView.vue'
-import DashboardView from '../views/newDashboard/index.vue'
+//import DashboardView from '../views/newDashboard/index.vue'
 const router = createRouter({
   history: createWebHashHistory(import.meta.env.BASE_URL),
   routes: [
diff --git a/src/views/newDashboard/index.vue b/src/views/newDashboard/index.vue
index be49404..459041a 100644
--- a/src/views/newDashboard/index.vue
+++ b/src/views/newDashboard/index.vue
@@ -24,8 +24,8 @@
 const activeTaskTab = ref(1)
 const projectList = ref([])
 const productList = ref([])
-const projectIdArray = ref([])
-const productIdArray = ref([])
+const projectIdArray = ref('')
+const productIdArray = ref('')
 const workerList = ref([])
 const pageData = ref({ page: 1, pageSize: 1000 })
 const modalObj = ref({ modalValue: false })
@@ -62,7 +62,7 @@
     if (code == 200) {
       projectList.value = data
       if (Array.isArray(data) && data.length > 0) {
-        projectIdArray.value[0] = data[0].id
+        projectIdArray.value = data[0].id
         queryProduct()
       }
     }
@@ -70,12 +70,12 @@
 }
 //2.鏍规嵁椤圭洰缂栧彿鏌ヨ浜у搧鍒楄〃
 const queryProduct = () => {
-  if (projectIdArray.value && projectIdArray.value.length > 0) {
-    getProductApi({ projectId: projectIdArray.value[0], ...pageData.value }).then(({ code, data }) => {
+  if (projectIdArray.value) {
+    getProductApi({ projectId: projectIdArray.value, ...pageData.value }).then(({ code, data }) => {
       if (code == 200) {
         productList.value = data
         if (Array.isArray(data) && data.length > 0) {
-          productIdArray.value[0] = data[0].id
+          productIdArray.value = data[0].id
           queryQualityProcedure()
           queryQualityCount()
         }
@@ -83,20 +83,20 @@
     })
   } else {
     productList.value = []
-    productIdArray.value = []
+    productIdArray.value = ''
   }
 }
 //3.鏌ヨ宸ュ簭璐ㄦ鍒楄〃
 const queryQualityProcedure = () => {
   const params: any = { status: activeTaskTab.value, projectId: '', productId: '', ...pageData.value, keyword: '' }
-  if (Array.isArray(projectIdArray.value) && projectIdArray.value.length > 0) {
-    params.projectId = projectIdArray.value[0] + ''
+  if (projectIdArray.value) {
+    params.projectId = projectIdArray.value + ''
   } else {
     qualityList.value = []
     return
   }
-  if (Array.isArray(productIdArray.value) && productIdArray.value.length > 0) {
-    params.productId = productIdArray.value[0] + ''
+  if (productIdArray.value) {
+    params.productId = productIdArray.value + ''
   } else {
     qualityList.value = []
     return
@@ -127,14 +127,14 @@
 //6.鏌ヨ璐ㄦ鏁版嵁缁熻
 const queryQualityCount = () => {
   const params: IQualityCountParams = { productId: '', projectId: '' }
-  if (Array.isArray(projectIdArray.value) && projectIdArray.value.length > 0) {
-    params.projectId = projectIdArray.value[0] + ''
+  if (projectIdArray.value) {
+    params.projectId = projectIdArray.value + ''
   } else {
     qualityCountObj.value = { ...DEFAULT_QUALITY_COUNT }
     return
   }
-  if (Array.isArray(productIdArray.value) && productIdArray.value.length > 0) {
-    params.productId = productIdArray.value[0] + ''
+  if (productIdArray.value) {
+    params.productId = productIdArray.value + ''
   } else {
     qualityCountObj.value = { ...DEFAULT_QUALITY_COUNT }
     return
@@ -217,27 +217,19 @@
           v-model="projectIdArray"
           :teleported="false"
           size="large"
-          :multiple-limit="1"
-          multiple
           placeholder="椤圭洰"
+          :clearable="true"
           @change="queryProduct"
         >
-          <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id" multiple>
+          <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id">
             <div class="item-option">
               <div>{{ item.id }}</div>
               <div>{{ item.projectName }}</div>
             </div>
           </el-option>
         </el-select>
-        <el-select
-          v-model="productIdArray"
-          :teleported="false"
-          size="large"
-          :multiple-limit="1"
-          multiple
-          placeholder="浜у搧"
-        >
-          <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id" multiple>
+        <el-select v-model="productIdArray" :teleported="false" size="large" placeholder="浜у搧" :clearable="true">
+          <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
             <div class="item-option">
               <div>{{ item.id }}</div>
               <div>{{ item.name }}</div>
@@ -392,15 +384,18 @@
       .el-select {
         width: 256px;
         :deep(.el-select__wrapper) {
-          background-color: transparent !important;
+          // background-color: transparent !important;
+        }
+        :deep(.el-select__placeholder) {
+          //color: white;
         }
       }
       .el-select-dropdown__item {
-        color: white;
+        //color: white;
       }
       .el-select-dropdown__item.is-hovering {
-        color: #fff;
-        background: transparent !important;
+        //color: #fff;
+        //background: transparent !important;
         /*background: linear-gradient(*/
         /*to right,*/
         /*rgba(147, 250, 255, 0),*/
@@ -410,8 +405,8 @@
       }
       :deep(.el-select__popper) {
         width: 100%;
-        border: 1px solid #1ca898;
-        background: deepskyblue;
+        //border: 1px solid #1ca898;
+        // background: deepskyblue;
       }
       .item-option {
         width: 100%;
@@ -429,9 +424,6 @@
         background: transparent;
         font-size: 16px;
         color: white;
-      }
-      :deep(.el-icon) {
-        display: none;
       }
     }
   }

--
Gitblit v1.8.0