wangting
2023-06-07 a5cb45db6a24630df3b8bab8df51cc153dd4c751
Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue
@@ -1,5 +1,5 @@
<template>
  <avue-input-tree :props="props" :lazy="lazy" :tree-load="treeLoad" :leaf-only="!referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree>
  <avue-input-tree ref="referTree" :props="props" :lazy="lazy" :tree-load="treeLoad" :node-click="nodeClick" :leaf-only="!referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree>
</template>
<script>
@@ -7,7 +7,7 @@
export default {
  name: "vciWebReferTree",
  props:["referConfig","value"],
  props:["referConfig","value","text"],
  data() {
    return {
      options: this.referConfig.options,
@@ -20,8 +20,9 @@
        //value:"value",
        //label:"title"
      },
      treeUrl: this.referConfig.options.url || '',//'/api/ubcs-code/codeClassify/treeCodeClassify',
      treeUrl: this.referConfig.options.url || '/api/ubcs-code/codeClassify/treeCodeClassify',
      treeData: [],
      currentNode:{},
      params: {},
      loadType: {'all': 'all', 'node': 'node'},
      copyParam: ['btmType', 'lnType', 'toBtmType', 'textField', 'valueField', 'parentFieldName', 'parentValue', 'sort', 'order', 'isDirection', 'whereSql', 'isMuti', 'queryScheme', 'isQueryAllColumn', 'queryColumn', 'split', 'loadType', 'onlyLeaf', 'onlyLeafText', 'parentUsedField']
@@ -29,6 +30,8 @@
  },
  created() {
    this.getParams();
    console.log('referConfig:')
    console.log(this.referConfig)
  },
  mounted() {
    if(!this.lazy){
@@ -42,7 +45,6 @@
  methods: {
    getParams:function (){
      var queryParams = {};
      debugger;
      if(this.options.extraParams){
        queryParams = this.options.extraParams;
      }
@@ -140,8 +142,16 @@
          }
        }))
      });
    },
    nodeClick(data){
      //不要用watch监听value值,会找不到text
      this.value=data[this.props.value];
      this.text=data[this.props.label];
      this.currentNode=data;
      this.$emit("setValue", {field:this.referConfig.field,showField:this.referConfig.showField,value:this.value,text:this.text,rawData:this.currentNode});
    }
  },
  watch:{
  }
}
</script>