From 57edffda445efc23fd17752dbb36fc1b91c0716a Mon Sep 17 00:00:00 2001
From: hailin <1356886193@qq.com>
Date: 星期三, 19 七月 2023 14:41:41 +0800
Subject: [PATCH] 标准库第二次修改的bug补交

---
 src/views/standardLibrary/index.vue |   59 +++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue
index a848a7a..10a4063 100644
--- a/src/views/standardLibrary/index.vue
+++ b/src/views/standardLibrary/index.vue
@@ -107,7 +107,7 @@
           <div>
             <el-pagination
               :current-page="pageParams.pageNo"
-              :page-sizes="[10, 20, 30, 40]"
+              :page-sizes="[1, 2, 3, 4]"
               :page-size="pageParams.pageNo"
               layout="total, sizes, prev, pager, next, jumper"
               :total="pageParams.total"
@@ -170,14 +170,18 @@
 
         }
       ],
+      // 鍒嗛〉鍙傛暟
       pageParams: {
         pageNo: 1,
-        pageSize: 10,
+        pageSize: 1,
         total: 3
       },
       tablespecifications: [
       ],
-      showTableCurrent: 0
+      // 閫変腑鑺傜偣瀵瑰簲鐨勮〃鏍� 0 鏄爣鍑嗚〃 1鏄瀷鍙疯〃 2瑙勬牸琛�
+      showTableCurrent: 0,
+      // 閫変腑鐨勮妭鐐规暟鎹�
+      selectNode: {}
     }
   },
   watch: {
@@ -210,9 +214,11 @@
       // console.log('children' in data)
       if (!('children' in data)) {
         // console.log('鐐瑰嚮瀛愯妭鐐�', data)
+        this.selectNode = data
         await this.getSpecifications(data)
         return
       }
+      this.selectNode = data
       await this.getSerialNumber(data)
     },
     specificationDetails(row) {
@@ -246,9 +252,24 @@
       ]
       this.showTableCurrent = 0
     },
+    // 鑾峰彇瀵瑰簲鍨嬪彿涓嬬殑鎵�鏈夎鏍�
+    async getSerialNumber(data) {
+      const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams })
+      console.log('鐐瑰嚮鐖惰妭鐐�', row)// 鏍规嵁鏍囧噯鑾峰彇瀵瑰簲鏍囧噯涓嬬殑瑙勬牸
+      this.tableData = row
+      this.pageParams.total = total
+      this.tablespecifications = [
+        {
+          prop: 'name',
+          label: '鍨嬪彿鍚嶇О',
+          minWidth: '150px'
+        }
+      ]
+      this.showTableCurrent = 1
+    },
     // 鑾峰彇鏍囧噯涓嬪搴旂殑鎵�鏈夊瀷鍙�
     async getSpecifications(data) {
-      const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, pageNo: 1, pageSize: 10 })
+      const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, ...this.pageParams })
       console.log(row)
       this.tableData = row
       this.pageParams.total = total
@@ -276,39 +297,29 @@
       ]
       this.showTableCurrent = 2
     },
-    // 鑾峰彇瀵瑰簲鍨嬪彿涓嬬殑鎵�鏈夎鏍�
-    async getSerialNumber(data) {
-      const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams })
-      console.log('鐐瑰嚮鐖惰妭鐐�', row)// 鏍规嵁鏍囧噯鑾峰彇瀵瑰簲鏍囧噯涓嬬殑瑙勬牸
-      this.tableData = row
-      this.pageParams.total = total
-      this.tablespecifications = [
-        {
-          prop: 'name',
-          label: '鍨嬪彿鍚嶇О',
-          minWidth: '150px'
-        }
-      ]
-      this.showTableCurrent = 1
-    },
-    handleSizeChange(val) {
-      console.log(`姣忛〉 ${val} 鏉)
-      this.pageParams.pageSize = val
+    // 鍒嗛〉鏉′欢鏀瑰彉鏃跺垽鏂渶瑕佸垎椤垫煡璇㈢殑鏂规硶
+    judgment() {
       switch (this.showTableCurrent) {
         case 0:
           this.getAllStandard()
           break
         case 1:
-          this.getAllStandard()
+          this.getSerialNumber(this.selectNode)
           break
         case 2:
-          this.getAllStandard()
+          this.getSpecifications(this.selectNode)
           break
       }
+    },
+    handleSizeChange(val) {
+      console.log(`姣忛〉 ${val} 鏉)
+      this.pageParams.pageSize = val
+      this.judgment()
     },
     handleCurrentChange(val) {
       console.log(`褰撳墠椤�: ${val}`)
       this.pageParams.pageNo = val
+      this.judgment()
     }
   }
 }

--
Gitblit v1.9.3