wangting
2023-05-31 8befde9f52a8bf1a7cd13666d4396587b0a0b1cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
  <avue-input-tree :props="props" :lazy="lazy" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree>
</template>
 
<script>
import {getTree,getLazyTree} from "@/api/refer/tree";
import {getDeptLazyTree} from "@/api/system/dept";
 
export default {
  name: "vciWebReferTree",
  props:["options","value"],
  data() {
    return {
      lazy:this.options.loadType == 'node',
      isMuti:true,//options.muti,
      placeholder:'请选择内容',
      props: {
        value:this.options.valueField,
        label:this.options.textField
        //value:"value",
        //label:"title"
      },
      treeData:[{
        title:'选项1',
        value:0,
        children:[{
          title:'选项3',
          value:2
        },{
          title:'选项4',
          value:3
        }]
      },{
        title:'选项2',
        value:1
      }]
    };
  },
  created() {
 
  },
  mounted() {
    this.getTree();
  },
  methods: {
    getTree(){
      getTree({parentId:0},this.options.url).then(res => {
          this.treeData=res.data
 
          console.log(this.treeData)
        })
    },
    getLazyTree(){
      getLazyTree({parentId:0},this.options.url).then(res => {
        this.treeData=res.data.data
 
        console.log(this.treeData)
      })
    },
    treeLoad: function (tree,treeNode, resolve) {
      debugger;
      const parentId = (treeNode.level === 0) ? 0 : treeNode.data.id;
      /*getDeptLazyTree({parentId:parentId}).then(res => {
        resolve(res.data.data)
      });*/
    }
 
  }
}
</script>
 
<style scoped>
 
</style>