田源
2024-01-18 4c37374149d56aef3f0a923dd5f41f9a01839500
提交代码
已修改2个文件
47 ■■■■■ 文件已修改
Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -180,7 +180,6 @@
              })
            }
          });
          console.log('created', this.classifyAuthData)
        });
      }
    },
@@ -224,7 +223,7 @@
            this.$set(this.classifyAuthData[classIndex], 'allDisabled', true)
          }
        });
        console.log(this.classifyAuthData)
        //强制刷新表格
        this.itemKey = uuidv4();
      })
Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
@@ -108,6 +108,9 @@
      roleList: [],
      //当前选中的表格行
      selectList: [],
      itemKey: '',
      addIndex: Number,
      currentRow: {}
    };
  },
  watch: {
@@ -139,6 +142,7 @@
              let columnItem = {
                label: item.name,
                prop: item.id,
                code: item.code,
                type: "checkbox",
                width: 180,
              };
@@ -171,6 +175,8 @@
                });
                //console.log(item)
                this.classifyAuthData.push(item);
                this.addIndex = this.classifyAuthData.length - 1; //添加行下标等于classifyAuthData的长度-1
                // this.roleHandlerMethods(authData.roleId, 'create', this.addIndex)
              })
            }
          });
@@ -184,6 +190,44 @@
  created() {
  },
  methods: {
    roleHandlerMethods(id, type, index) {
      if (this.classifyAuthData.length < 0) {
        return;
      }
      getButtonsByRoleId({roleId: id, code: 'classifyTree'}).then(res => {
        // 找到this.classifyAuthButton中没有对应的属性
        const filteredItems = this.classifyAuthButton.filter(item => {
          return !res.data.data.find(x => x.id === item.id);
        });
        //拿表格列头循环和没有对应的属性进行比较
        this.classifyAuthHeader.forEach((item) => {
          if (filteredItems.some(x => x.id === item.prop)) {
            this.$nextTick(() => {
              if (this.classifyAuthData[index] !== undefined && this.classifyAuthData[index] !== null) {
                Object.keys(this.classifyAuthData[index]).forEach((key) => {
                  if (item.prop === key) {
                    // this.classifyAuthData[index] = Object.assign({}, this.classifyAuthData[index], {[key]: undefined});
                    this.$set(this.classifyAuthData[index], item.code, true);
                  }
                });
              }
            })
          }
        });
        //添加 “查看全部禁用条件”
        this.classifyAuthData.forEach((classkey, classIndex) => {
          if (classkey.classify_view) {
            this.$set(this.classifyAuthData[classIndex], 'allDisabled', true)
          }
        });
        //强制刷新表格
        this.itemKey = uuidv4();
      })
    },
    // 关闭对话框
    closeDialog() {
      this.$emit('update:visible', false);