From 839597ccc640a10ed9de88bd30916fc454693f0b Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期一, 11 九月 2023 09:25:45 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.22:9001/r/mom-before

---
 src/components/view/standard.vue |  175 +++++++++++++++++++++++++++++++---------------------------
 1 files changed, 94 insertions(+), 81 deletions(-)

diff --git a/src/components/view/standard.vue b/src/components/view/standard.vue
index 94c7173..4662f9b 100644
--- a/src/components/view/standard.vue
+++ b/src/components/view/standard.vue
@@ -16,11 +16,11 @@
       <div class="left">
         <el-input v-model="search" suffix-icon="el-icon-search" placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" size="small" clearable></el-input>
 
-        <el-tree :data="list" ref="tree" :default-expand-all="false" :props="{ children: 'children', label: 'name' }"
+        <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 != '[4]' ? 'el-icon-folder-opened' : 'el-icon-tickets'}`"></i>
-              {{ data.name }}</span>
+            <span><i :class="`node_i ${data.code != '[5]' ? 'el-icon-folder-opened' : 'el-icon-tickets'}`"></i>
+              {{ data.code }}{{ data.name }}</span>
             <el-button type="text" size="mini" @click.stop="remove(node, data)">
               <i class="el-icon-delete"></i>
             </el-button>
@@ -42,7 +42,7 @@
           <span>{{ tableType == 1 ? '椤圭洰锛�' : '宸ヨ壓鍚嶇О锛�' }}</span>
           <el-input v-model="searchName" size="small" placeholder="璇疯緭鍏�" style="width: 224px;margin-right: 24px;"
             clearable></el-input>
-          <span>{{ tableType == 1 ? '鐗堟湰锛�' : '宸ヨ壓鍚嶇О锛�' }}</span>
+          <span>{{ tableType == 1 ? '鐗堟湰锛�' : '鐗堟湰锛�' }}</span>
           <el-select v-model="VER" @change="verevent" style="width: 280px;" placeholder="璇烽�夋嫨">
             <el-option v-for="item in version" :key="item" :label="item" :value="item">
             </el-option>
@@ -52,54 +52,24 @@
               璇�</span></el-button>
         </div>
 
-        <!-- <div v-if="this.typeselect == 0">
-          宸ヨ壓璺嚎
+        <div v-if="this.typeselect == 0">
+          <technology  :tableType="tableType" :tableData="tableData"></technology>
         </div>
         <div v-if="this.typeselect == 1">
           鎶�鏈寚鏍�
         </div>
         <div v-if="this.typeselect == 2">
-          鐗╂枡娓呭崟
+          <material  :tableType="tableType" :tableData="tableData"></material>
         </div>
         <div v-if="this.typeselect == 3">
           鐢熶骇宸ヨ壓
-        </div> -->
-
-        <!-- <div>
-          <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="name" border
-            @selection-change="handleSelectionChange" default-expand-all
-            :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
-            <el-table-column type="selection" width="55">
-            </el-table-column>
-            <el-table-column type="index" width="50" label="搴忓彿">
-            </el-table-column>
-            <el-table-column prop="name" label="宸ュ簭" sortable width="300px">
-              <template slot-scope="scope">
-                        <el-tag>
-                            <div class="firstDiv" :style="`color: ${scope.row.children? '#16a7ff' : '#58c173'}`">
-                            {{ scope.row.children ? "01" : "02" }}
-                            </div>
-                        </el-tag>
-                        <span style="color: black">{{ scope.row.name }}</span>
-
-                        </template>
-            </el-table-column>
-            <el-table-column prop="" sortable label="宸ヨ壓鍚嶇О">
-            </el-table-column>
-            <el-table-column prop="" label="鎸囨爣鍚嶇О">
-            </el-table-column>
-            <el-table-column prop="" label="鍗曚綅">
-            </el-table-column>
-            <el-table-column prop="" label="鍐呮帶鍊�">
-            </el-table-column>
-            <el-table-column prop="unit" label="鏍囧噯鍊�">
-            </el-table-column>
-          </el-table>
-        </div> -->
-
-        <div class="table">
-          <technology v-if="tableData.length !== 0" :tableType="tableType" :tableData="tableData"></technology>
         </div>
+        <!-- <div class="table">
+          <technology v-if="tableData.length !== 0" :tableType="tableType" :tableData="tableData"></technology>
+        </div> -->
+        <!-- <div class="table">
+          <technology v-if="tableData.length !== 0" :tableType="tableType" :tableData="tableData"></technology>
+        </div> -->
       </div>
     </div>
 
@@ -107,7 +77,7 @@
     <div class="bom-add-model">
       <el-dialog title="BOM鏂板" :visible.sync="bomAddModelVisible" width="30%">
         <el-form>
-            
+
         </el-form>
         <span slot="footer" class="dialog-footer">
           <el-button @click="bomAddModelVisible = false">鍙� 娑�</el-button>
@@ -120,8 +90,10 @@
 
 <script>
 import technology from "./standard-table/technology.vue"
+import material from "./standard-table/material.vue"
 export default {
-  components: { technology },
+  components: { technology,material },
+
   data() {
     return {
       // BOM鏍戞暟鎹粨鏋�
@@ -152,18 +124,43 @@
   //   }
   // },
   mounted() {
+    this.tableType=0
     this.selectMaterialTree()
     this.selectVersion()
-    this.selectAll()
   },
   methods: {
+    selectDataList() {
+				this.list.forEach(a => {
+					a.code = '[1]'
+					if (a.children != undefined) {
+						a.children.forEach(b => {
+							b.code = '[2]'
+							if (b.children != undefined) {
+								b.children.forEach(c => {
+									c.code = '[3]'
+                  if (c.children != undefined) {
+								c.children.forEach(d => {
+									d.code = '[4]'
+                  if (d.children != undefined) {
+								d.children.forEach(e => {
+									e.code = '[5]'
+								})
+							}
+								})
+							}
+								})
+							}
+						})
+					}
+				})
+			},
     handleSelectionChange() {
 
     },
     TYPE(val) {//绫诲瀷.鏁版嵁
       console.log(val);
       this.typeselect = val
-     
+
       // console.log(this.typeselect);
       this.selectVersion()
     },
@@ -171,8 +168,8 @@
       console.log(val);
       this.returntree = val
     },
-    selectVersion() {//鐗堟湰
-      this.$axios.get(this.$api.url.selectVersion, {
+    async selectVersion() {//鐗堟湰
+      let v=await this.$axios.get(this.$api.url.selectVersion, {
         params: {
           specificationsId: this.returntree.id,
           type: this.typeselect,
@@ -182,7 +179,25 @@
         this.version = this.verdata.map(el => {
           return el = `v${el}`
         })
-        console.log(this.verdata);
+        // console.log("鐗堟湰");
+        return this.verdata[0]
+      })
+      this.character=v
+      this.VER="v"+v
+      console.log(this.character);
+      this.selectAll()
+    },
+    //鍙充晶鏁版嵁
+    selectAll() {
+      this.$axios.get(this.$api.url.selectAll, {
+        params: {
+          specificationsId: this.returntree.id,//tree鐨勭偣鍑诲弽棣�
+          type: this.typeselect,//绫诲瀷
+          version: this.character,//鐗堟湰
+        }
+      }).then(res => {
+        console.log(res.data);
+        this.tableData = res.data
       })
     },
     verevent(val) {
@@ -195,23 +210,11 @@
       // delete newObj.v
       // console.log(newObj);
     },
-    //鍙充晶鏁版嵁
-    selectAll() {
-      console.log(this.$axios.get(this.$api.url.selectAll));
-      this.$axios.get(this.$api.url.selectAll, {
-        params: {
-          specificationsId: this.returntree.id,
-          type: this.typeselect,
-          version: this.character,
-        }
-      }).then(res => {
-        this.tableData = res.data
-      })
-    },
     //浜旂骇鏍�
-    selectMaterialTree() {
-      this.$axios.get(this.$api.url.selectTreeByMaterial).then(res => {
-        this.list = res.data
+    async selectMaterialTree() {
+      let _that=this
+      let res=await this.$axios.get(this.$api.url.selectTreeByMaterial).then( res => {
+        _that.list = res.data
         this.list.forEach((el, idx, arr) => {
           if (idx == 0) {
             arr[idx].name = '鎴愬搧'
@@ -219,24 +222,34 @@
           if (idx == 1) {
             arr[idx].name = '鍗婃垚鍝�'
           }
-          el.children.forEach((newEl, newIdx, newArr) => {
-            if (newIdx == 0) {
-              newArr[newIdx].name = '姗¤兌杩炴帴鍣�'
-            }
-            if (newIdx == 1) {
-              newArr[newIdx].name = '閲戝睘杩炴帴鍣�'
-            }
-            if (newIdx == 2) {
-              newArr[newIdx].name = '婀挎彃鎷旂數杩炴帴鍣�'
-            }
-            if (newIdx == 3) {
-              newArr[newIdx].name = '鍒嗘敮缁勪欢'
-            }
-          })
         })
-        console.log(this.list);
+        this.selectDataList()
+        return _that.list
       })
+     let s= this.filterChildren(res)
+     console.log(s);
     },
+    filterChildren(list){
+       let one=list.filter(item=>{
+        return item.children!=undefined
+      })[0]
+      let two=one.children.filter(item=>{
+        return item.children!=undefined
+      })[0]
+      let three=two.children.filter(item=>{
+        return item.children!=undefined
+      })[0]
+      let four=three.children.filter(item=>{
+        return item.children!=undefined
+      })[0]
+      return four.children[0]
+    },
+     isObject(param) {
+        return typeof param === 'object' && param !== null;
+    },
+    isArray(param) {
+  return Array.isArray(param);
+},
     filterNode(value, data) {
       if (!value) return true;
       return data.label.indexOf(value) !== -1;

--
Gitblit v1.9.3