From 826cd5b51d5106cfea07e397eda184fb15ec7a30 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期五, 02 八月 2024 14:33:59 +0800
Subject: [PATCH] 修改

---
 web/src/views/modules/basicInfo/ProductModelTree.vue |   42 ++++++++++++++++++++++++++++--------------
 1 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/web/src/views/modules/basicInfo/ProductModelTree.vue b/web/src/views/modules/basicInfo/ProductModelTree.vue
index 0688faf..7069d48 100644
--- a/web/src/views/modules/basicInfo/ProductModelTree.vue
+++ b/web/src/views/modules/basicInfo/ProductModelTree.vue
@@ -1,13 +1,15 @@
 <template>
   <div class="product-tree-container">
-    <el-input
-      placeholder="杈撳叆鍚嶇О杩涜杩囨护"
-      style="width: 60%"
-      v-model="filterText"
-      size="small"
-      clearable
-    ></el-input>
-    <el-button v-if="isShow" type="primary" @click="add()" style="margin: 10px 0 0 10px;padding: 9px 18px !important;">鏂板鍨嬪彿</el-button>
+    <!-- <el-input
+       placeholder="杈撳叆鍚嶇О杩涜杩囨护"
+       style="width: 60%"
+       v-model="filterText"
+       size="small"
+       clearable
+     ></el-input>-->
+    <el-button v-if="isShow" type="primary" @click="add()"
+               style="margin: 10px 0 0 10px;padding: 9px 18px !important;">鏂板鍨嬪彿
+    </el-button>
     <el-divider></el-divider>
     <el-tree
       style="height: 90%;overflow: auto"
@@ -45,6 +47,10 @@
         type: Number,
         default: 1
       },
+      productId: {
+        type: Number,
+        default: null
+      },
     },
 
     data() {
@@ -69,22 +75,30 @@
       AddOrUpdate
     }
     ,
-    mounted() {
-      this.getProductList()
-    },
+    /* mounted() {
+       this.getProductList()
+     },*/
     methods: {
       // 鑾峰彇绯荤粺鍒楄〃
       async getProductList() {
         let params = {
           showXdy: this.showXdy,
-          ztShow: this.basic
+          ztShow: this.basic,
+          productId: this.productId
         }
         let res = await this.$http.get('/basicInfo/XhProductModel/tree', {params: params})
         this.productList = res.data
-        if (this.basic) {
+        if (this.basic === '3') {
           if (this.productList && this.productList[0].children) {
             this.defaultId = this.productList[0].children[0].id
-            console.log(this.defaultId, 'this.defaultID')
+            this.$nextTick(() => {
+              this.$refs.tree.setCurrentKey(this.defaultId); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
+            });
+            this.$emit('on-default', this.defaultId)
+          }
+        } else{
+          if (this.productList[0].id) {
+            this.defaultId = this.productList[0].id
             this.$nextTick(() => {
               this.$refs.tree.setCurrentKey(this.defaultId); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
             });

--
Gitblit v1.9.1