he wei
2025-05-28 89527ed24f119c6cb281f153b7217cbcf862a12f
src/views/userMager/addEdit.vue
@@ -103,6 +103,7 @@
              v-model="formData.urole"
              size="mini"
              placeholder="请选择用户角色"
              @change="changeRole"
              class="width_140"
            >
              <el-option
@@ -157,6 +158,7 @@
              size="mini"
              placeholder="请选择用户权限组"
              class="width_140"
              @change="changePermitGroup"
              :disabled="!isCanChangePower"
            >
              <el-option
@@ -308,6 +310,7 @@
    let permits = this.$store.state.user.permits;
    let isCanChangePower = isHasPermit("permit_edit_permit", permits);
    return {
      permitGroupBakup: '',
      isCanChangePower,
      expirationTime: new Date(),
      startTime: new Date().format("yyyy-MM-dd hh:mm:ss"),
@@ -415,6 +418,9 @@
    isSysAdmin() {
      return this.userId == 1 ? true : false;
    },
    isSxty() {
      return this.$CFG.clientName.name === "sxty";
    }
  },
  mounted() {
    this.queryWhq(); //维护区
@@ -422,6 +428,10 @@
    this.searchGroup(); // 查询权限组
    if (this.status == "add") {
      this.formData.urole = 2;
      if (this.isSxty) {
        this.formData.permitGroupId = 210002;
        this.permitGroupBakup = 210002;
      }
    } else {
      this.formData.urole = this.opt.urole;
      this.formData.visitTime = this.opt.visitTime;
@@ -458,7 +468,9 @@
              return true;
            }
          });
          this.formData.permitGroupId = permitGroupId;
          if (!this.isSxty) {
            this.formData.permitGroupId = permitGroupId;
          }
        })
        .catch((error) => {
          console.log(error);
@@ -631,6 +643,50 @@
        }
      );
    },
    changeRole() {
      // 如果是太供  需要做处理 用户权限组需自动变更成对应的
      //   label: "领导层", 10  对应权限组ID  管理员组的permit_group_id   210001
      //   label: "管理员", 0   对应权限组ID  管理员组的permit_group_id   210001
      //  label: "维护组长", 1  对应权限组ID   运维权限组的permit_group_id   210002
      //  label: "维护组员", 2  对应权限组ID   运维权限组的permit_group_id   210002
      //  label: "监控层"  , 12  对应权限组ID   监视权限组的permit_group_id   210003
      if (this.isSxty && this.status == 'add') {
        switch(this.formData.urole) {
          case 10:
            this.formData.permitGroupId = 210001;
            break;
          case 0:
            this.formData.permitGroupId = 210001;
            break;
          case 1:
            this.formData.permitGroupId = 210002;
            break;
          case 2:
            this.formData.permitGroupId = 210002;
            break;
          case 12:
            this.formData.permitGroupId = 210003;
            break;
        }
        this.permitGroupBakup = this.formData.permitGroupId;
      }
    },
    changePermitGroup(val) {
      console.log('val', val, this.formData.permitGroupId, '=============');
      if (this.isSxty) {
        this.$layer.confirm('当前选择的权限组与用户角色不匹配,继续修改可能会丢失当前角色的部分权限,确认更改用户权限吗?', {
            icon: 3
        },  (index) => {
            this.$layer.close(index);
            this.permitGroupBakup = val;
        }, (index) => {
            this.$layer.close(index);
            this.formData.permitGroupId = this.permitGroupBakup;
        });
      }
    },
  },
};
</script>