tree中,一级和二级的标题是固定的,动态得到数据,然后把数据放到二级中的某一个对应的标题中

<el-tree
                ref="tree"
                hghlight-currenti
                node-key="ID"
                lazy
                :load="loadNode"
                :data="treeData"
                :props="defaultProps"
              />
data() {
return {
treeData: [{ ID: 1, CODE: 'AAA', children: [] }, { ID: 2, CODE: 'BBB', children: [] }],
      // leftTreeDevices: [],
      telChildren: [{ ID: 1020200001, CODE: 'aa', SPEC_ID: '1020200001', isTag: true },
        { ID: 1020200002, CODE: 'bb', SPEC_ID: '1020200002', isTag: true },
        { ID: 1020200003, CODE: 'cc', SPEC_ID: '1020200003', isTag: true },
        { ID: 1020200004, CODE: 'dd', SPEC_ID: '1020200004', isTag: true }
      ],
  defaultProps: {
        children: 'children',
        label: 'CODE'
      },

}
}
methods{
loadNode(node, resolve) {
      if (node.level === 0) {
        return resolve(this.treeData)
      }
      if (node.level === 1) {
        if (node.data.ID === 1) {
          return resolve(this.telChildren)
        }
        // else if (node.data.ID === 2) {
        //   return resolve(this.wlwChildren)
        // } 
        else {
          resolve(null)
        }
      }
      if (node.level > 1) {
        setTimeout(() => {
          const conditionList = {
            counted: true,
            entityspecId: node.data.SPEC_ID,
            paginationMapParameter: {
              order: [{ attribute: 'CODE', type: 'ASC', nullsFirst: 'true' }],
              query: [],
              specItem: this.specItem
            },
            reduced: false,
            regionCode: ''
          }
          entity.queryWithoutPagination(conditionList).then(data => {
            const dataInfo = []
            if (data.count) {
              data.items.forEach(item => {
                item.entityInfo.isLeaf = true
                dataInfo.push(item.entityInfo)
              })
              resolve(dataInfo)
            } else {
              resolve(null)
            }
          }).catch(item => { resolve(null) })
        }, 1000)
      }
    },
//查询数据的接口
query2() {
      const relations = {
        // 机房规格ID
        aSpecId: 1010000000,
        zSpecId: '',
        // 关系规格ID
        relationSpecId: 1010210210000,
        specItem: [{ attribute: 'CODE' }],
        aCondition: [],
        zCondition: [],
        order: [{ attribute: 'CODE', type: 'ASC', nullsFirst: 'true' }],
        pagination: { index: this.pageNumber2, size: this.pageSize2 }
      }
      relations.aCondition.push({ attribute: 'ID', criteriaType: '21', value: this.deviceFacilityId })
      this.leftTreeOcableSegs = []

      relation.queryA(relations).then((rows) => {
        if (rows) {
          const dataInfo = []
          rows.items.forEach(item => { dataInfo.push(item.entityInfo) })
          // leftTreeOcableSegs得到的是数据库中返回的数据,
          //要把这个数据方法二级标题dd中显示,要怎么写
          this.leftTreeOcableSegs[0].children = dataInfo
          console.log(dataInfo)
          this.total2 = rows.count
          this.loading2 = false
        }
      }).catch(item => { this.loading2 = false })
    },

}

已解决

我选现在请求收到的数据,每个二级标题下都有,是什么原因,是不是缺少判断语句