田源
2024-01-30 3cc2b58dcb169f147bc5bdccfd782514d736531d
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -44,25 +44,25 @@
            </el-button>
          </div>
          <!-- 左侧树-->
          <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata"
                     :defaultExpandAll="false"
                     :option="Treeoption"
                     class="classifyTree"
                     style="height: 690px"
                     @node-click="nodeClick"
          >
            <template slot-scope="{ node, data }" class="el-tree-node__label">
              <el-tooltip :content="$createElement('div', { domProps: { innerHTML: node.label } })" class="item"
                          effect="dark"
                          open-delay="500"
                          placement="right-start">
          <div style="height:  calc(100vh - 242px);overflow: auto">
            <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata"
                       :defaultExpandAll="false"
                       :option="Treeoption"
                       class="classifyTree"
                       @node-click="nodeClick"
            >
              <template slot-scope="{ node, data }" class="el-tree-node__label">
                <el-tooltip :content="$createElement('div', { domProps: { innerHTML: node.label } })" class="item"
                            effect="dark"
                            open-delay="500"
                            placement="right-start">
                <span style="font-size: 14px;">
                {{ (node || {}).label }}
              </span>
              </el-tooltip>
            </template>
          </avue-tree>
                </el-tooltip>
              </template>
            </avue-tree>
          </div>
        </div>
        <!-- 树节点添加对话框-->
@@ -123,6 +123,7 @@
        </el-dialog>
        <!-- 分类授权对话框-->
        <classify-auth-dialog
          :TreeNode="TreeEditObj"
          :classifyData="classifyData"
          :visible.sync="classifyAuthVisible"
        ></classify-auth-dialog>
@@ -349,7 +350,6 @@
  TreeSave,
  TreeDel,
  TreeCheckDel,
  TreeObjcet,
  TreeEnable,
  TreeDeactivate,
  gridCodeClassifyTemplate,
@@ -512,6 +512,7 @@
      Treedata: [],
      CloneTreedata: [],
      Treeoption: {
        height:'auto',
        addBtn: false,
        editBtn: false,
        delBtn: false,
@@ -708,7 +709,7 @@
    },
    treeStyle() {
      return {
        height: this.btnAuthList.length > 0 ? '620px' : '785px',
        height: this.allButtons ? '610px' : '690px',
      };
    },
    crudTreeOption() {
@@ -778,7 +779,7 @@
        this.$message.warning('请至少选择一条数据!')
        return;
      }
      this.classifyData = this.nodeClickList;
      // this.classifyData = this.nodeClickList;
      this.classifyAuthVisible = true;
    },
    // 数据授权对话框打开
@@ -787,7 +788,7 @@
        this.$message.warning('请至少选择一条数据!')
        return;
      }
      this.classifyData = this.nodeClickList;
      // this.classifyData = this.nodeClickList;
      this.dataAuthVisible = true;
    },
    flowingDependHandler() {
@@ -1151,6 +1152,10 @@
    },
    //树点击事件
    async nodeClick(data) {
      const response = this.findTheTopLevelNode(data,this.Treedata)
      this.classifyData = response;
      // console.log(response)
      // console.log('response',response.attributes.id)
      this.allButtons = true;
      getAuthButtonList({classifyId: data.oid, code: "classifyTree", authType: "classify_auth"}).then(res => {
        this.btnAuthList = res.data.data;
@@ -1166,9 +1171,8 @@
      try {
        this.requestCount += 1;
        const [res1, res2, res3] = await Promise.all([
          TreeObjcet(data.oid),
          getObjectByOid(data.oid),
          gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': data.oid}),
          getObjectByOid(data.oid)
        ]);
        this.FlagObj = res1.data.data;
        this.Formlist = res2.data.data.filter(item => {
@@ -1186,7 +1190,7 @@
          this.ProData = [];
          this.crudOid = ''
        }
        this.TreeEditObj = res3.data.data;
        this.TreeEditObj = res1.data.data;
        if (this.TreeEditObj.isParticipateCheck === null || this.TreeEditObj.isParticipateCheck === undefined || this.TreeEditObj.isParticipateCheck === "") {
          this.$set(this.TreeEditObj, "isParticipateCheck", 1)
          return
@@ -1196,6 +1200,32 @@
      }
    },
    // 递归查找顶层节点Id
    findTheTopLevelNode(data,TreeData){
      if(data.parentId === ""){
        return data;
      }
      const parentNode = this.findParentNode(data.parentId, TreeData);
      if (parentNode) {
        return this.findTheTopLevelNode(parentNode, TreeData); // 继续查找父节点
      }
    },
    // 递归查找出来多层节点的父节点
    findParentNode(parentId, TreeData){
      for (const node of TreeData) {
        if (node.oid === parentId) {
          return node;
        }
        // 如果当前节点还有子节点,继续去查子节点的父节点
        if (node.children) {
          const parentNode = this.findParentNode(parentId, node.children);
          if (parentNode) {
            return parentNode;
          }
        }
      }
      return null;
    },
    async gridCode() {
      try {
        const res = await gridCodeClassifyTemplateAttr({
@@ -1471,9 +1501,9 @@
</script>
<style lang="scss" scoped>
.el-container {
  height: 100%;
}
//.el-container {
//  height: 100%;
//}
.el-aside {
  //height: calc(100% - 30px);
@@ -1518,4 +1548,8 @@
.headerCon > .el-button:nth-child(9) {
  margin-left: 0;
}
///deep/.el-scrollbar__bar.is-vertical{
//  width: 8px;
//}
</style>