按钮级别的新版本,多级别的组织架构
loulijun2021
2023-08-22 746e355df3ce7b588f40e96e4f20ba35266e7190
src/views/basicSettings/roleList.vue
@@ -68,7 +68,7 @@
        </div>
        <div
          style="margin-left: 15px;width:100%;position: relative"
          style="margin-left: 10px;width:100%;position: relative"
        >
          <el-button
@@ -222,7 +222,7 @@
<script>
import waves from '@/directive/waves'
import {
  DataPermissions, RoleAddUpdateSava, RoleDeleteSava,
  RoleAddUpdateSava, RoleDeleteSava,
  RolePermissionSava,
  RolePermissionSearchRole,
  RolePermissionSearchRoleMenu,
@@ -230,6 +230,7 @@
} from '@/api/basicSettings'
import arrayToTree from 'array-to-tree'
import { throttle } from '@/utils/debounceAndThrottle'
import { DataPermissions } from '@/api/GeneralBasicData'
export default {
  name: 'RoleList',
@@ -319,7 +320,7 @@
    // 获取菜单权限对应的按钮
    async getRolePermissionSearchRoleMenuButton(rolecode) {
      const { data: res } = await RolePermissionSearchRoleMenuButton({ rolecode, type: this.activeName })
      this.allButtonData = JSON.parse(res[0].jsondate)
      this.allButtonData = res.length > 0 ? JSON.parse(res[0].jsondate) : []
    },
    // 获取菜单权限
    async getRolePermissionSearchRoleMenu(rolecode) {
@@ -589,21 +590,35 @@
    // 角色名称删除
    roleDeleteClick(self, node, data) {
      // console.log(self, node, data)
      const D = {
        rolecode: data.code,
        rolename: data.name,
        type: this.activeName
      }
      RoleDeleteSava(D).then(res => {
        if (res.code === '200') {
          this.$notify.success('角色删除成功!')
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const D = {
          rolecode: data.code,
          rolename: data.name,
          type: this.activeName
        }
        this.getRolePermissionSearchRole()
        RoleDeleteSava(D).then(res => {
          if (res.code === '200') {
            this.$notify.success('角色删除成功!')
          }
          this.getRolePermissionSearchRole()
        })
      }).catch(() => {
        this.$notify.info('已取消删除')
      })
    },
    // 角色名称保存   采用防抖形式
    roleSave: throttle(function(val) {
      val.isEdit = false
      if (val.name.trim().length === 0) {
        this.getRolePermissionSearchRole()
        return this.$notify.info('无效保存!')
      }
      const data = {
        rolecode: val.code,
        rolename: val.name,