| | |
| | | </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-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 }"> |
| | |
| | | </el-button> |
| | | </div> |
| | | </el-tree> |
| | | </el-row> |
| | | </div> |
| | | <div class="right"> |
| | | <div class="choose"> |
| | |
| | | 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] |
| | |
| | | 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() |
| | | }) |
| | | }else{ |
| | | let three=two.children.filter(item=>{ |
| | |
| | | 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() |
| | | }) |
| | | }else{ |
| | | //新增标准型号 |
| | |
| | | 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() |
| | | }) |
| | | }else{ |
| | | let specificationsDto={ |
| | |
| | | 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() |
| | | }) |
| | | } |
| | |
| | | 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)); |
| | |
| | | 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] |