田源
2023-06-15 859a64b36d107b147f44eccd0c0a76471c5e49ea
Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -9,7 +9,7 @@
<script>
import {getTreeList} from "@/api/MasterData/master";
import {mapMutations, mapState} from "vuex";
import {TableData} from "@/api/GetItem";
import {TableData,MasterTable} from "@/api/GetItem";
export default {
  name: "MasterTree",
@@ -29,6 +29,8 @@
  },
  data(){
    return{
      tableHeadDataFateher:[],
      templateOids:"",
      tableDataArray:[],
      codeClassifyOid:"",
      coderuleoid:"",
@@ -97,23 +99,48 @@
        }
      }
    },
    //树点击事件
    nodeClick(data){
      this.nodeClickList = data;
      console.log(this.currentPage,this.pageSize)
    //表格刷新
    TableRend(){
      TableData({
        templateOid: this.templateOid,
        codeClassifyOid: this.codeClassifyOid,
        page: this.pageSize,
        limit:this.currentPage,
        templateOid: this.templateOids,
        codeClassifyOid: this.nodeClickList.oid,
        page: this.currentPage,
        limit: this.pageSize,
      }).then(res => {
        console.log(res)
        // this.page.total = res.data.total;
        // this.data = res.data.data;
        this.tableDataArray=res.data.data;
        this.$emit('tableDataArray',this.tableDataArray)
        console.log(this.tableDataArray)
        this.$emit('total',res.data.total)
        console.log('table',this.tableDataArray)
      })
    },
    //表格头部
    TableHeadRend() {
      return new Promise((resolve,reject)=>{
        MasterTable({
          codeClassifyOid: this.nodeClickList.oid,
          functionId: 5,
        }).then(res => {
          this.tableHeadDataFateher = res.data;
          this.templateOids = res.data.tableDefineVO.oid;
          this.$emit('tableHeadDataFateher', this.tableHeadDataFateher);
          resolve();
        }).catch(err=>{
          reject(err)
        })
      })
    },
    //树点击事件
    async nodeClick(data) {
      try {
        this.nodeClickList = data;
        await this.TableHeadRend(); // 先执行 TableHeadRend()
        this.TableRend(); // TableHeadRend() 方法完成后再执行 TableRend()
        this.$emit('nodeClick',this.templateOids)
        console.log(this.templateOids)
      } catch (error) {
        // 处理错误
        this.$message.error(error)
      }
    }
  }
}