xiejun
2023-11-30 c0e4323f851c5216d1b020bc4177a8566e77bfd2
Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -1,12 +1,14 @@
<template>
  <div class="app" style="display: flex;">
  <div class="app" style="position: relative;">
    <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false"
               :option="Treeoption" style="width: fit-content;" @node-click="nodeClick">
      <template slot-scope="{ node }">
        <span v-html="node.label"></span>
      </template>
    </avue-tree>
    <div style="display: inline-block;"><i class="el-icon-refresh refresh-icon" @click="getTreeLists"></i></div>
    <div style="position: absolute; right: 0px; top: -1px;">
      <el-link class="refresh-icon" icon="el-icon-refresh" @click="getTreeLists"></el-link>
    </div>
  </div>
</template>
@@ -34,6 +36,7 @@
    return {
      TreeValue: '',
      idData: '',
      referTreeId: '',
      masterVrBtnList: [],
      tableHeadFindData: [],
      tableHeadDataFateher: [],
@@ -56,11 +59,15 @@
        //   console.log(node)
        //   console.log(resolve)
        // }
        treeLoad: function (node, resolve) {
        treeLoad: (node, resolve) => {
          if (node.data != false) {
            const parentId = (node.level === 0) ? 0 : node.data.oid;
            const parentBtmName = node.data.attributes.btmname
            getTreeList({parentOid: parentId, parentBtmName: parentBtmName}).then(res => {
            const parentBtmName = node.data.attributes.btmname;
            getTreeList({
              parentOid: parentId,
              parentBtmName: parentBtmName,
              'conditionMap[btmTypeId]': this.referTreeId
            }).then(res => {
              resolve(res.data.map(item => {
                return {
                  ...item,
@@ -103,8 +110,11 @@
            this.$message.error("主数据分类查询为空!");
          } else {
            this.Treedata = res.data;
            const [firstProperty] = res.data;
            this.ModifyProperties(this.Treedata, 'text', 'label');
            this.referTreeId = firstProperty.attributes.btmTypeId;
            // console.log(this.referTreeId)
            this.codeClassifyOid = firstProperty.oid;
            this.coderuleoid = firstProperty.attributes.coderuleoid;
            this.$emit("coderuleoid", this.coderuleoid)
@@ -114,7 +124,7 @@
            });
            this.$emit("coderuleoid", this.coderuleoid)
            this.$emit('Treedata', this.Treedata)
            console.log(this.Treedata)
            // console.log(this.Treedata)
          }
        }
      }).catch(res => {
@@ -152,6 +162,7 @@
    TableHeadRend() {
      const index = this.$route.query.id.indexOf('@');
      const result = this.$route.query.id.substring(0, index);
      // console.log(this.$route)
      return new Promise((resolve, reject) => {
        MasterTable({
          codeClassifyOid: this.nodeClickList.oid,
@@ -190,7 +201,7 @@
    async nodeClick(data) {
      try {
        // console.log(data)
        this.TreeValue = data.label.split(" ")[0].trim();
        this.TreeValue = data.label.split("</span>")[1].trim();
        // console.log('TreeValue',this.TreeValue)
        this.$emit('TreeValue', this.TreeValue)
        this.nodeClickList = data;
@@ -200,6 +211,7 @@
        this.TableRend(); // TableHeadRend() 方法完成后再执行 TableRend()
        this.$emit('nodeClick', this.templateOids)
        this.$emit("codeClassifyOid", this.nodeClickList.oid)
        this.$emit("nodeClickList", this.nodeClickList)
      } catch (error) {
        // 处理错误
        this.$message.error(error)