From d46f3b348ab5f913cd15be977ce16137ee4343d0 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期四, 14 九月 2023 17:40:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/components/view/standard.vue |  105 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 95 insertions(+), 10 deletions(-)

diff --git a/src/components/view/standard.vue b/src/components/view/standard.vue
index 6a115b4..abef430 100644
--- a/src/components/view/standard.vue
+++ b/src/components/view/standard.vue
@@ -13,15 +13,16 @@
     </div>
     <div class="thing">
       <div class="left">
-        <el-row :gutter="5">
+        <el-row :gutter="5" style="position: fixed;top: 148px;z-index: 1;">
           <el-col :span="21">
             <el-input v-model="search" suffix-icon="el-icon-search" placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" size="small" clearable></el-input>
           </el-col>
           <el-col :span="2">
-            <el-button size="small" icon="el-icon-plus" @click="bomLeftAdd=true"></el-button>
+            <el-button size="mini" icon="el-icon-plus" @click="bomLeftAdd=true"></el-button>
           </el-col>
         </el-row>
-        <el-tree :data="list" ref="tree" default-expand-all :props="{ children: 'children', label: 'name' }"
+        <el-row style="margin-top: 16px;">
+          <el-tree :data="list" ref="tree" default-expand-all :props="{ children: 'children', label: 'name' }"
           node-key="id" :filter-node-method="filterNode" @node-click="handleNodeClick" highlight-current>
           <div class="custom-tree-node" slot-scope="{ node, data }">
             <span><i :class="`node_i ${data.code != '[5]' ? 'el-icon-folder-opened' : 'el-icon-tickets'}`"></i>
@@ -31,6 +32,7 @@
             </el-button>
           </div>
         </el-tree>
+        </el-row>
       </div>
       <div class="right">
         <div class="choose">
@@ -56,7 +58,7 @@
         </div>
 
         <div class="contentTable" v-if="this.typeselect == 0">
-          <technology @childData="getChildData"  :tableType="tableType" :tableData="tableData"></technology>
+          <technology @childData="getChildData" @updateDevice="updateDevice"  :tableType="tableType" :tableData="tableData"></technology>
         </div>
         <div class="contentTable" v-if="this.typeselect == 1">
           <target @childData="getChildData" :tableType="tableType" :tableData="tableData"></target>
@@ -391,6 +393,7 @@
     return {
       //瀛愮粍浠朵紶鐨刬d鍒楄〃
       childIds:[],
+      isUpdateDevice:false,
       //宸ュ簭鍒楄〃
       fatherList:[],
       deviceList:[],
@@ -505,6 +508,9 @@
     this.selectVersion()
   },
   methods: {
+    updateDevice(val){
+      this.isUpdateDevice = val;
+    },
     changeLeftAdd(){
         if(this.leftAdd.type.length===2){
           this.leftAdd.father=null
@@ -526,7 +532,26 @@
         this.$refs[formName].validate((valid) => {
           if (valid) {
             let obj=JSON.parse(JSON.stringify(this.leftAdd))
-            console.log(obj);
+            if(obj.type.length===1){
+              obj.type=this.getType(obj.type[0])
+                  this.$axios.post(this.$api.url.leftAddOneTwo,obj,{
+                     headers: { "Content-Type": "application/json" }
+                 }).then(res=>{
+                     this.$message({
+                      message: res.message,
+                      type: 'success'
+                      });
+                      this.leftAdd.type=[]
+                      this.leftAdd.father=null
+                      this.leftAdd.standard=null
+                      this.leftAdd.name=null
+                      this.leftAdd.specifications=null
+                      this.selectMaterialTree()
+                      this.bomLeftAdd=false  
+                      this.selectVersion() 
+                  })
+                  return
+            }
             let one=this.list.filter(item=>{
                 return item.name===obj.type[0]
               })[0]
@@ -544,7 +569,14 @@
                       message: res.message,
                       type: 'success'
                       });
-                      this.selectMaterialTree()   
+                      this.leftAdd.type=[]
+                      this.leftAdd.father=null
+                      this.leftAdd.standard=null
+                      this.leftAdd.name=null
+                      this.leftAdd.specifications=null
+                      this.selectMaterialTree()
+                      this.bomLeftAdd=false 
+                      this.selectVersion() 
                   })
               }else{
                 let three=two.children.filter(item=>{
@@ -560,7 +592,14 @@
                       message: res.message,
                       type: 'success'
                       });
-                      this.selectMaterialTree()   
+                      this.leftAdd.type=[]
+                      this.leftAdd.father=null
+                      this.leftAdd.standard=null
+                      this.leftAdd.name=null
+                      this.leftAdd.specifications=null
+                      this.selectMaterialTree()
+                      this.bomLeftAdd=false  
+                      this.selectVersion()
                   })
                 }else{
                   //鏂板鏍囧噯鍨嬪彿
@@ -580,7 +619,14 @@
                       message: res.message,
                       type: 'success'
                       });
-                      this.selectMaterialTree()   
+                      this.leftAdd.type=[]
+                      this.leftAdd.father=null
+                      this.leftAdd.standard=null
+                      this.leftAdd.name=null
+                      this.leftAdd.specifications=null
+                      this.selectMaterialTree()
+                      this.bomLeftAdd=false 
+                      this.selectVersion()  
                    })
                   }else{
                      let specificationsDto={
@@ -594,7 +640,13 @@
                       message: res.message,
                       type: 'success'
                       });
+                      this.leftAdd.type=[]
+                      this.leftAdd.father=null
+                      this.leftAdd.standard=null
+                      this.leftAdd.name=null
+                      this.leftAdd.specifications=null
                       this.selectMaterialTree()
+                      this.bomLeftAdd=false  
                       this.selectVersion()
                    })
                   }
@@ -730,6 +782,7 @@
       this.materialVisible = false;
       this.productVisible = false;
     },
+    //娓呯┖鏂板bom琛ㄥ崟
     clearBomAddModel(){
       if(this.typeselect == 0){
         this.deviceList=[];
@@ -740,6 +793,7 @@
         this.$refs["targetForm"].resetFields();
       }else if(this.typeselect == 2){
         this.mIdList = [];
+        this.materialForm.tableList = [];
         this.$refs["materialForm"].resetFields();
       }else{
         this.productDeviceList=[];
@@ -999,7 +1053,6 @@
         let arr = res.data;
         this.formatData(arr)
         this.tableData = arr;
-        console.log("arr--",arr);
       })
     },
     formatData(data){
@@ -1034,6 +1087,29 @@
             arr[idx].name = '鍗婃垚鍝�'
           }
         })
+        if(res.data.length<1){
+          let obj={
+            name: '鎴愬搧',
+          }
+          let obj2={
+            name: '鍗婃垚鍝�',
+          }
+          this.list.push(obj)
+          this.list.push(obj2)
+        }
+        if(res.data.length===1){
+          if(res.data[0].name==='鎴愬搧'){
+            this.list.push({
+            name: '鍗婃垚鍝�',
+          })
+          }
+          if(res.data[0].name==='鍗婃垚鍝�'){
+            this.list.push({
+            name: '鎴愬搧',
+          })
+          }
+        }
+        console.log(this.list);
         this.selectDataList()
         // 榛樿绗竴涓簲绾ц妭鐐规悳绱紝鏂板閰嶇疆椤�
         const treeOptions = JSON.parse(JSON.stringify(this.list));
@@ -1119,6 +1195,11 @@
     }
   },
   watch:{
+    isUpdateDevice(val){
+      if(val){
+        this.selectAll();
+      }
+    },
     search(val) {
         this.$refs.tree.filter(val);
     },
@@ -1126,12 +1207,16 @@
     handler(newVal, oldVal) {
     if(this.isLeftAdd){
       let tree=JSON.parse(JSON.stringify(this.list))
+      console.log(tree);
       let father=null;
       if(newVal.father!=null&&newVal.father!=''&&newVal.type.length>0){
           let one=tree.filter(item=>{
             return item.name===newVal.type[0]
           })[0]
           console.log(one);
+          if(one.children===undefined){
+            return
+          }
           let two=one.children.filter(item=>{
             return item.name===newVal.father
           })[0]
@@ -1206,7 +1291,7 @@
   padding: 0 12px;
 }
 
-.standard .right .contentTable{
+ .contentTable{
   width:98%;
   margin-left:1%;
 }

--
Gitblit v1.9.3