ludc
2023-10-10 309a30c45f8a614bfdb4f6ef9816e5df49ae6afa
Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -1,9 +1,11 @@
<template>
  <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false"
             :option="Treeoption"
             style="height: calc(100vh - 150px);"
             @node-click=" nodeClick"
  ></avue-tree>
  <div style="overflow: auto; height: calc(100vh - 150px);">
    <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false" :option="Treeoption" @node-click="nodeClick" style="width: fit-content;">
      <template slot-scope="{ node }">
        <span style="display: inline-block;">{{ node.label }}</span>
      </template>
    </avue-tree>
  </div>
</template>
<script>
@@ -15,7 +17,7 @@
  props: {
    pageSize: {
      type: String,
      default: "10"
      default: "100"
    },
    currentPage: {
      type: String,
@@ -28,6 +30,7 @@
  },
  data() {
    return {
      TreeValue:'',
      idData: '',
      masterVrBtnList: [],
      tableHeadFindData: [],
@@ -80,16 +83,23 @@
      this.idData = result
      // console.log(this.$route)
      getTreeList({'conditionMap[id]': this.idData}).then(res => {
        this.Treedata = res.data;
        const [firstProperty] = res.data;
        this.ModifyProperties(this.Treedata, 'text', 'label');
        this.codeClassifyOid = firstProperty.oid;
        this.coderuleoid = firstProperty.attributes.coderuleoid;
        this.$emit("coderuleoid", this.coderuleoid)
        this.$emit('Treedata', this.Treedata)
        if(res){
          if(res.data.length === 0){
            this.$message.error("主数据分类查询为空!");
          }else{
            this.Treedata = res.data;
            const [firstProperty] = res.data;
            this.ModifyProperties(this.Treedata, 'text', 'label');
            this.codeClassifyOid = firstProperty.oid;
            this.coderuleoid = firstProperty.attributes.coderuleoid;
            this.$emit("coderuleoid", this.coderuleoid)
            this.$emit('Treedata', this.Treedata)
          }
        }
      }).catch(res => {
        // console.log(res)
        this.$message.error(res)
      })
      });
    },
    //定义一个修改数据属性名的方法
@@ -158,6 +168,10 @@
    //树点击事件
    async nodeClick(data) {
      try {
        // console.log(data)
        this.TreeValue=data.label.split(" ")[0].trim();
        console.log('TreeValue',this.TreeValue)
        this.$emit('TreeValue',this.TreeValue)
        this.nodeClickList = data;
        this.tableHeadDataFateher = []
        this.tableHeadFindData = []