<script>
import {getBomTreeStructure} from "../../../../../api/quotation/quoteOfRouting";

export default {
  name: "quoteRouting",
  props:{
    detail:{
      type:Object,
      request:true,
    },
    height:{
      type:Number,
      default:400,
    }
  },
  data(){
    return{
      treeLoading:false,
      routingTreeStructure:[],
      routingProps:{
        label:'label',
        value:'value',
        children:'list'
      },
      selectRouting:[],
    }
  },
  methods:{
    nodeClick(val){

    },
    getBomTreeStructure(){
      let params = {
        site:this.detail.site,
        testPartNo:this.detail.productNo
      }
      getBomTreeStructure(params).then(({data})=>{
        if (data && data.code === 0){
          this.routingTreeStructure = data.rows
        }else {
          this.$message.warning(data.msg)
        }
      }).catch((error)=>{
        this.$message.error(error)
      })
    }
  }
}
</script>

<template>
<div>
  {{detail}}
  <el-container>
    <el-aside width="24%" style="padding: 0;" :style="{height: height}" v-loading="treeLoading">
      <el-tree :data="routingTreeStructure"
               :props="routingProps"
               @node-click="nodeClick"
               node-key="value" style="height: 100%"
               default-expand-all
               highlight-current ref="tree"
      ></el-tree>
    </el-aside>
    <el-main style="padding: 0">

    </el-main>
  </el-container>
</div>
</template>

<style scoped>

</style>
