田源
2024-01-26 e30d67f3b88515759bc468962375a2e1b07bf655
Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -99,6 +99,7 @@
export default {
  name: "classifyAuthDialog.vue",
  props: {
    // 当前点击节点的顶层节点
    classifyData: {
      type: "Object",
      default: "",
@@ -108,6 +109,10 @@
      type: "Boolean",
      default: false,
    },
    // 当前点击的节点
    TreeNode:{
      type:Object
    }
  },
  data() {
    return {
@@ -131,7 +136,9 @@
  },
  computed: {},
  mounted() {},
  created() {},
  created() {
    this.addIndex = this.classifyAuthData.length <= 0 ? 0 :this.classifyAuthData.length -1;
  },
  watch: {
    // 监听父组件传的窗口显示隐藏的值
    visible() {
@@ -160,24 +167,26 @@
                Object.keys(this.classifyAuthData[index]).forEach((key) => {
                  this.$set(this.classifyAuthData[index].authButton,item.code,true);
                });
                //添加 “查看全部禁用条件”
                if (item.code === "classify_view") {
                  this.$set(this.classifyAuthData[index].authButton, "allDisabled", true);
                  console.log(this.classifyAuthData[index].authButton.allDisabled)
                }
              } else {
                Object.keys(this.classifyAuthData[index]).forEach((key) => {
                  this.$set(this.classifyAuthData[index].authButton,item.code,false);
                });
                if(item.code === "classify_view"){
                  this.classifyAuthData[index].authButton.allDisabled = false;
                }
              }
            }
          });
        });
        //添加 “查看全部禁用条件”
        if (this.classifyAuthData) {
          this.classifyAuthData.forEach((classkey, classIndex) => {
            if (classkey.authButton.classify_view) {
              this.$set(this.classifyAuthData[classIndex].authButton,"allDisabled",true);
            } else {
              this.classifyAuthData[classIndex].authButton.allDisabled = false;
            }
          });
        }
        //强制刷新表格
        this.itemKey = uuidv4();
      });
@@ -233,8 +242,7 @@
        this.$message.warning("当前租户不存在角色信息!");
        return;
      }
      // console.log('this.roleList', this.roleList)
      this.addIndex++; //自定义生成添加行下标
      let item = {
        roleData: this.roleList[0].id,
        classifyItem: this.classifyData.label,
@@ -248,6 +256,7 @@
      });
      this.classifyAuthData.push(item);
      this.roleHandlerMethods(this.roleList[0].id, "add", this.addIndex);
      this.addIndex++; //自定义生成添加行下标
    },
    // 删除行
    subClassifyAuth() {
@@ -278,7 +287,7 @@
      let form = {
        classifyAuthList: [],
        isCLear: false, //默认是清空
        classifyId: this.classifyData.oid,
        classifyId: this.TreeNode.oid,
      };
      let isRepeat = false;
      if(this.classifyAuthData.length > 0){
@@ -300,7 +309,7 @@
          this.$message.warning("角色和分类已经存在,请重新配置!");
          return;
        }
        let flag = false;
        this.classifyAuthData.forEach((item) => {
          let itemButtonList = [];
@@ -319,7 +328,7 @@
          let data = {
            oid: item.oid,
            roleId: item.roleData,
            classifyId: this.classifyData.oid,
            classifyId: this.TreeNode.oid,
            buttonIds: itemButtonList.join(","),
            authType: "classify_auth",
          };
@@ -407,7 +416,7 @@
        });
        // 获取该分类下已授权的分类授权信息
        getClassifyAuthList({
          classifyId: this.classifyData.oid,
          classifyId: this.TreeNode.oid,
          authType: "classify_auth",
        }).then((res) => {
          //console.log(res.data.data);
@@ -427,7 +436,6 @@
                Vue.set(item, data, true);
              });
              this.classifyAuthData.push(item);
              this.addIndex = this.classifyAuthData.length - 1; //添加行下标等于classifyAuthData的长度-1
              this.roleHandlerMethods(authData.roleId, "create", index);
              // console.log('index', index)
            });