From 192a6c1536d3f9017343634c17dc300c6fd98ff6 Mon Sep 17 00:00:00 2001
From: yuyu <1981343953@qq.com>
Date: 星期三, 02 八月 2023 09:36:23 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/yuanchu_code/frontend-zhongtian-ocean

---
 src/components/view/standard.vue |   87 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 11 deletions(-)

diff --git a/src/components/view/standard.vue b/src/components/view/standard.vue
index 853d4a2..883e3f1 100644
--- a/src/components/view/standard.vue
+++ b/src/components/view/standard.vue
@@ -12,6 +12,10 @@
     margin-bottom: 10px;
     padding: 0 20px;
   }
+  
+  .standard .title *{
+    font-size: 16px;
+  }
 
   .thing {
     width: 100%;
@@ -85,6 +89,10 @@
   .standard .title .el-button * {
     font-size: 14px;
   }
+  
+  .standard .title .el-button--default{
+    color: #004EA2;
+  }
 
   .standard .thing .left .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
     background: rgba(58, 124, 253, 0.3);
@@ -101,9 +109,9 @@
   <div class="standard">
     <div class="title">
       <el-row>
-        <el-col :span="12">鏍囧噯BOM</el-col>
+        <el-col :span="12" style="line-height: 32px;">鏍囧噯BOM</el-col>
         <el-col :span="12" style="text-align: right;">
-          <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;">鏂板</el-button>
+          <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;" @click="bomAddModelVisible= true">鏂板</el-button>
           <el-button icon="el-icon-edit-outline">淇敼</el-button>
           <el-button icon="el-icon-delete">鍒犻櫎</el-button>
         </el-col>
@@ -128,18 +136,33 @@
         <div class="choose">
           <span>绫诲瀷锛�</span>
           <el-select v-model="tableType" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 52px;">
-            <el-option value="宸ヨ壓鏂囦欢"></el-option>
-            <el-option value="鎶�鏈寚鏍�"></el-option>
+            <el-option :value="0" label="宸ヨ壓鏂囦欢"></el-option>
+            <el-option :value="1" label="鎶�鏈寚鏍�"></el-option>
           </el-select>
-          <span>{{tableType=='鎶�鏈寚鏍�'?'椤圭洰锛�':'宸ヨ壓鍚嶇О锛�'}}</span>
+          <span>{{tableType==1?'椤圭洰锛�':'宸ヨ壓鍚嶇О锛�'}}</span>
           <el-input v-model="searchName" size="small" placeholder="璇疯緭鍏�" style="width: 224px;margin-right: 24px;" clearable></el-input>
-          <el-button size="mini"><span>閲� 缃�</span></el-button>
-          <el-button size="mini" type="primary" style="background: #004EA2;"><span>鏌� 璇�</span></el-button>
+          <el-button size="mini" @click="()=>{searchName='';selectProductTableData()}"><span>閲� 缃�</span></el-button>
+          <el-button size="mini" type="primary" style="background: #004EA2;" @click="selectProductTableData"><span>鏌� 璇�</span></el-button>
         </div>
         <div class="table">
-          <technology></technology>
+          <technology v-if="tableData.length!==0" :tableType="tableType" :tableData="tableData"></technology>
         </div>
       </div>
+    </div>
+    <div class="bom-add-model">
+      <el-dialog
+        title="BOM鏂板"
+        :visible.sync="bomAddModelVisible"
+        width="30%"
+        :before-close="handleClose">
+        <el-form>
+          
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="bomAddModelVisible = false">鍙� 娑�</el-button>
+          <el-button type="primary" @click="bomAddModelVisible = false">纭� 瀹�</el-button>
+        </span>
+      </el-dialog>
     </div>
   </div>
 </template>
@@ -150,6 +173,7 @@
     components: {technology},
     data() {
       return {
+        // BOM鏍戞暟鎹粨鏋�
         list: [{
           id: 0,
           name: "鍘熸潗鏂�",
@@ -167,13 +191,24 @@
           children: []
         }],
         search: null,
-        tableType: "鎶�鏈寚鏍�",
-        searchName: ""
+        // 琛ㄦ牸绫诲瀷 1锛氭妧鏈寚鏍囷紝0锛氬伐鑹鸿矾绾�
+        tableType: 1,
+        // 鏌ヨ鏉′欢-鍚嶇О
+        searchName: "",
+        // 鐐瑰嚮閫変腑鏍戣妭鐐�
+        checkTreeNode: {},
+        tableData:[],
+        // 鎺у埗bom鏂板妯℃�佹鏄惁鏄剧ず
+        bomAddModelVisible: false
       }
     },
     watch: {
       search(val) {
         this.$refs.tree.filter(val);
+      },
+      tableType(val){
+        console.log(val)
+        this.selectProductTableData()
       }
     },
     mounted() {
@@ -181,7 +216,10 @@
     },
     methods: {
       handleNodeClick(data) {
-        console.log(data);
+        // console.log(data);
+        this.checkTreeNode = data
+        // this.selectMaterialTree()
+        this.selectProductTableData()
       },
       filterNode(value, data) {
         if (!value) return true;
@@ -210,7 +248,34 @@
               if (a.type == b.id) b.children = [a]
             })
           })
+          this.$nextTick().then(() => {
+          const firstNode = document.querySelector('.el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node')
+          firstNode.click()
+          // console.log(firstNode)
+          })
         })
+        
+      },
+      async selectProductTableData() {
+        switch (this.tableType) {
+          case 0:
+        const {data:technologyList} = await this.$axios.get(this.$api.url.selectTechnologyByMaterial,{params:{specificationId:this.checkTreeNode.id,technologyName:this.searchName}})
+        this.tableData = technologyList    
+            break;
+          case 1:
+        const {data:productList} = await this.$axios.get(this.$api.url.selectProductByMaterial,{params:{specifications:this.checkTreeNode.id,project:this.searchName}})
+        productList.forEach((item,index)=>{
+          item.name = item.father
+          item.index = index+1
+          item.id = item.father
+          if(item.children.length===1){
+            productList[index] = {...item.children[0],index: index+1,name:item.father}
+          }
+        })
+        this.tableData = productList
+            break;
+        }
+        console.log(this.tableData)
       }
     }
   }

--
Gitblit v1.9.3