wangting
2024-12-05 1de239fd89d33d074d0031f2d1363a211dce98f4
Source/plt-web/plt-web-ui/src/views/authority/ui/dataAuthorization/dataView.vue
@@ -405,53 +405,9 @@
    departmentQueryController({queryAllLevel: true}).then(res => {
      const data = res.data.treeData;
      this.departData = this.departDtaFormAtter(data);
    }).catch(err => {
      this.$message.error(err);
    })
  },
  watch: {
    selectRow:{
      handler(val,oldval) {
        this.authData=[];
        if(val && val.rules){
          this.form=JSON.parse(JSON.stringify(val.rules));
          //this.getTemp(true);
          //this.getTemp(false)
          //构建授权主体数据
          if(val.rules.users){
            val.rules.users.split(',').forEach((item,i)=>{
              if(item){
                this.authData.push({
                  name:'{'+item+', '+item+', user}'
                })
              }
            })
          }
          if(val.rules.roles){
            val.rules.roles.split(',').forEach((item,i)=>{
              if(item){
                this.authData.push({
                  name:'{'+item+', '+item+', role}'
                })
              }
            })
          }
          if(val.rules.userGroups){
            val.rules.userGroups.split(',').forEach((item,i)=>{
              if(item){
                this.authData.push({
                  name:'{'+item+', '+item+', userGroup}'
                })
              }
            })
          }
        }else {
          this.form={};
        }
      },
      immediate: true,
      deep: true
    },
    actionMap:{
      handler(val) {
        this.actionDic=[];
@@ -467,6 +423,67 @@
      immediate: true,
      deep: true
    },
    selectRow:{
      handler(val,oldval) {
        this.authData=[];
        if(val && val.rules &&val.rules.length>0) {
          this.form = JSON.parse(JSON.stringify(val.rules[0]));
          //this.getTemp(true);
          //this.getTemp(false)
          //构建授权主体数据
          if (val.rules[0].users) {
            val.rules[0].users.split(',').forEach((item, i) => {
              if (item) {
                this.authData.push({
                  name: '{' + item + ', ' + item + ', user}'
                })
              }
            })
          }
          if (val.rules[0].roles) {
            val.rules[0].roles.split(',').forEach((item, i) => {
              if (item) {
                this.authData.push({
                  name: '{' + item + ', ' + item + ', role}'
                })
              }
            })
          }
          if (val.rules[0].userGroups) {
            val.rules[0].userGroups.split(',').forEach((item, i) => {
              if (item) {
                this.authData.push({
                  name: '{' + item + ', ' + item + ', userGroup}'
                })
              }
            })
          }
          //解析操作按钮选中值
          if (this.actionDic.length > 0) {
            let actionDicStr = JSON.stringify(this.actionDic);
            val.rules.forEach(item => {
              if (item.isGrand == 49) {
                let identifier = item.identifier.replace(this.btmNode.attributes.name + '_', '')
                if (actionDicStr.indexOf('"value":"'+identifier+'"}') != -1) {
                  this.actionForm.push(identifier)
                } else {
                  this.linkactionForm.push(identifier);
                }
              }
            })
          }
        }else {
          this.form={
            ruleName:'',
            ruleType:'0'
          };
          this.actionForm=[];
          this.linkactionForm=[];
        }
      },
      immediate: true,
      deep: true
    },
  },
  methods: {
    //选中用户