田源
2024-01-26 e30d67f3b88515759bc468962375a2e1b07bf655
数据授权新需求(百分之七十)
已修改3个文件
87 ■■■■■ 文件已修改
Source/UBCS-WEB/src/api/omd/btmType.js 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/api/omd/btmType.js
Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -136,7 +136,9 @@
  },
  computed: {},
  mounted() {},
  created() {},
  created() {
    this.addIndex = this.classifyAuthData.length <= 0 ? 0 :this.classifyAuthData.length -1;
  },
  watch: {
    // 监听父组件传的窗口显示隐藏的值
    visible() {
@@ -165,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();
      });
@@ -238,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,
@@ -253,6 +256,7 @@
      });
      this.classifyAuthData.push(item);
      this.roleHandlerMethods(this.roleList[0].id, "add", this.addIndex);
      this.addIndex++; //自定义生成添加行下标
    },
    // 删除行
    subClassifyAuth() {
@@ -432,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)
            });
Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
@@ -60,8 +60,8 @@
          <el-checkbox
            v-if="item.type === 'checkbox'"
            v-model="row[item.prop]"
            @change="checkBoxToChangeTheEvent(row[item.prop],item.code)"
            :disabled="row.authButton.allDisabled ? true : row.authButton[item.code]">
            :disabled="row.authButton.allDisabled ? true : row.authButton[item.code]"
            @change="checkBoxToChangeTheEvent(row[item.prop],item.code,row,item.prop)">
          </el-checkbox>
        </template>
      </el-table-column>
@@ -128,6 +128,11 @@
        this.loadAuthPage();
      }
    },
    classifyAuthData(newval){
      this.addIndex = newval.length <= 0 ? 0 :newval.length-1;
      console.log(this.addIndex)
    }
  },
  computed: {},
  mounted() {
@@ -135,11 +140,21 @@
  created() {
  },
  methods: {
    checkBoxToChangeTheEvent(check,code){
      // console.log(check,code)
      // if(code === "data_view" && check){
      //
      // }
    checkBoxToChangeTheEvent(check, code, row, id) {
      if (code === "data_view") {
        row.checkTheStatus = check;
      } else if (!row.checkTheStatus) {
        this.$message.warning('请先勾选查看按钮!');
        // 在条件不满足时将多选框状态设置为false
        row[id] = false;
      }
      if (!row.checkTheStatus) {
        this.classifyAuthButton.forEach(key => {
          // 查看为false时将所有多选框状态设置为false
          row[key.id] = false;
        });
      }
    },
    // 关闭对话框
    closeDialog() {
@@ -155,6 +170,7 @@
        const filteredItems = this.classifyAuthButton.filter(item =>
          !res.data.data.some(x => x.id === item.id)
        );
        //和表格列进行对比
        this.classifyAuthHeader.forEach((item) => {
          const isMatched = filteredItems.some((x) => x.id === item.prop);
@@ -163,26 +179,25 @@
              if (isMatched) {
                Object.keys(this.classifyAuthData[index]).forEach((key) => {
                  this.$set(this.classifyAuthData[index].authButton,item.code,true);
                  //添加 “查看全部禁用条件”
                  if (item.code === "data_view") {
                    this.$set(this.classifyAuthData[index].authButton, "allDisabled", true);
                  }
                });
              } else {
                Object.keys(this.classifyAuthData[index]).forEach((key) => {
                  this.$set(this.classifyAuthData[index].authButton,item.code,false);
                });
                if(item.code === "data_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();
      });
@@ -204,14 +219,14 @@
              if (isMatched) {
                Object.keys(currentRow).forEach((key) => {
                  currentRow.authButton[item.code] = true;
                  if (!currentRow.authButton.classify_view) {
                  if (!currentRow.authButton.data_view) {
                    currentRow.authButton.allDisabled = false;
                  }
                });
              } else {
                Object.keys(currentRow).forEach((key) => {
                  currentRow.authButton[item.code] = false;
                  if (!currentRow.authButton.classify_view) {
                  if (!currentRow.authButton.data_view) {
                    currentRow.authButton.allDisabled = false;
                  }
                });
@@ -230,7 +245,7 @@
        this.$message.warning("当前租户不存在角色信息!");
        return;
      }
      this.addIndex++; //自定义生成添加行下标
      let item = {
        roleData: this.roleList[0].id,
        classifyItem: this.classifyData.label,
@@ -412,7 +427,6 @@
                Vue.set(item, data, true);
              });
              this.classifyAuthData.push(item);
              this.addIndex = this.classifyAuthData.length - 1; //添加行下标等于classifyAuthData的长度-1
              this.roleHandlerMethods(authData.roleId, 'create', index)
            })
          }