石广澎
2024-01-02 0cd1631ceaa93e6483908fd692d2cb693b85324b
增加图片验证码和登录日志
权限管理优化
6个文件已修改
418 ■■■■■ 已修改文件
admin-web/src/components/myTree/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/login/index.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemManger/server/user/edit.vue 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemManger/server/user/editRole.vue 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemManger/server/user/index.vue 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemSetting/role/index.vue 187 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/components/myTree/index.vue
@@ -127,8 +127,8 @@
        }
      }
    },
    onSelect(selectedNodes) {
      const param = { id: selectedNodes.id, name: selectedNodes.label };
    onSelect(selectedNodes,a,b) {
      const param = { id: selectedNodes.id, name: selectedNodes.label,lv: a.level};
      if (selectedNodes.code) {
        param.code = selectedNodes.code;
      }
admin-web/src/views/login/index.vue
@@ -52,7 +52,9 @@
                      :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
                    /></span>
                  </el-form-item>
                  <el-form-item prop="code" class="captcha" v-if="loginForm.verifyType==='code' && captchaEnabled">
                  <template v-if="loginForm.verifyType==='code' && captchaEnabled">
                    <div class="f-lable">验证码</div>
                    <el-form-item prop="code" class="captcha">
                    <el-input
                      v-model.trim="loginForm.code"
                      style="width: 218px"
@@ -66,6 +68,7 @@
                      <span v-show="showCaptchatImg">已失效</span>
                    </div>
                  </el-form-item>
                  </template>
                  <el-button
                    id="loginBtn"
                    :loading="loading"
admin-web/src/views/systemManger/server/user/edit.vue
@@ -1,5 +1,5 @@
<template>
  <win-sm :title="setting.title" @close="close" :width="'800px'">
  <win-sm :title="setting.title" @close="close" :width="'800px'" :loading="loading">
    <el-alert
      style="margin-bottom: 10px"
      title="温馨提示:用户初始密码为123456"
@@ -13,13 +13,14 @@
      </el-form-item>
      <el-form-item label="部门" prop="sysDeptId">
        <el-select v-model="formData.sysDeptId">
            <el-option v-for="(item,index) in deptmentOptions" :key="index" :label="item.name" :value="item.id"></el-option>
          <el-option v-for="(item,index) in deptmentOptions" :key="index" :label="item.name"
                     :value="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="人员姓名" prop="userName">
        <el-input v-model="formData.userName" clearable maxlength="20" show-word-limit style="width: 250px"/>
      </el-form-item>
      <el-form-item label="员工编号" prop="userCode">
      <el-form-item label="登录名" prop="userCode">
        <el-input v-model="formData.userCode" clearable maxlength="20" show-word-limit style="width: 250px"/>
      </el-form-item>
      <el-form-item label="手机号" prop="userPhone">
@@ -86,8 +87,19 @@
            }
        },
        data() {
    // 参数1: rule 对象, 是校验规则, 一般不用
    // 参数2: value 校验项的数据
    // 参数3: callback 回调函数, 决定是否校验通过
    const checkedListCheck = (rule, value, callback) => {
      if (this.checkedList.length < 1) {
        callback(new Error('至少选择一个'))
      } else {
        callback()
      }
    }
            return {
                deptmentOptions:[],
      loading: true,
                checkAll: false,
                checkedList: [],
                roleList: [
@@ -127,7 +139,7 @@
                        {required: true, message: '请输入人员姓名', trigger: 'blur'}
                    ],
                    userCode: [
                        {required: true, message: '请输入员工编号', trigger: 'blur'}
          {required: true, message: '请输入登录名', trigger: 'blur'}
                    ],
                    userPhone: [
                        {required: true, message: '请输入手机号', trigger: 'blur'}
@@ -138,30 +150,28 @@
                    seq: [
                        {required: true, message: '请输入顺序号', trigger: 'blur'}
                    ],
        // 角色配置的验证
        roleSetting: [
          {validator: checkedListCheck, required: true, trigger: 'blur'},
        ],
                }
            }
        },
        created() {
            this.getInfo()
            this.getAllRole()
            this.getDeptmentOptions()
  async created() {
    this.title = this.setting.title
    if (this.setting.id != null) {
      await this.getInfo()
    }
    await this.getAllRole()
    await this.getDeptmentOptions()
    this.loading = false
        },
        methods: {
            // 获取所有角色
            getAllRole() {
              // const user = this.$store.getters.userInfo
              // this.data_scope = 1
              // if (user.lv == 1) {
              //   this.data_scope = 1
              // }
              // if (user.lv == 2) {
              //   this.data_scope = 2
              // }
              // if (user.lv == 3) {
              //   this.data_scope = 3
              // }
              this.data_scope = 1
              role.listRoleByDataScope({dataScope: this.data_scope}).then(response => {
    async getAllRole() {
      this.data_scope = this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : ''
      await role.listRoleByDataScope({dataScope: this.setting.data_scope}).then(response => {
                  if (response) {
                    this.roleOptions = response;
                  } else {
@@ -171,8 +181,8 @@
                    }
                );
            },
            getDeptmentOptions(){
                departmentListAll({tenantId:this.setting.tenantId}).then(res=>{
    async getDeptmentOptions() {
      await departmentListAll({tenantId: this.setting.tenantId}).then(res => {
                    this.deptmentOptions = res
                })
            },
@@ -189,11 +199,10 @@
                let checkedCount = value.length;
                this.checkAll = checkedCount === this.roleOptions.length;
            },
            getInfo() {
    async getInfo() {
                this.title = this.setting.title
                if (this.setting.id != null) {
                    // 查询数据
                    user.getUser({id: this.setting.id}).then(res => {
      await user.getUser({id: this.setting.id}).then(res => {
                        const data = res.data
                        this.formData = Object.assign(this.formData, data)
                        if (this.formData.projectStart != null && this.formData.projectStart > 0) {
@@ -209,21 +218,18 @@
                            this.handleCheckedCitiesChange(res.list)
                        }
                    })
                }
            },
            close() {
                this.formData = {
                    projectName: '',
                    projectSubName: '',
                    projectCode: '',
                    projectContact: '',
                    projectTel: '',
                    projectEmail: '',
                    projectStart: null,
                    projectEnd: null,
                    projectDesc: '',
                    status: 1
                },
        sysDeptId: '',
        userName: '',
        userCode: '',
        userPhone: '',
        sex: 1,
        status: 1,
        remark: '',
        seq: null,
      }
                    this.$emit('close')
            },
            save() {
@@ -253,8 +259,11 @@
                            this.$message.error('服务开始时间和服务结束时间必须成对出现')
                            return
                        }
          if (this.loading) return;
          this.loading = true
                        if (params.id) {
                            user.upd(params).then(res => {
              this.loading = false
                                if (res) {
                                    this.$message.success('保存成功!')
                                    this.close()
@@ -262,9 +271,12 @@
                                } else {
                                    this.$message.error('保存失败')
                                }
            }).catch(() => {
              this.loading = false
                            })
                        } else {
                            user.add(params).then(res => {
              this.loading = false
                                if (res) {
                                    this.$message.success('保存成功!')
                                    this.close()
@@ -272,6 +284,8 @@
                                } else {
                                    this.$message.error('保存失败')
                                }
            }).catch(() => {
              this.loading = false
                            })
                        }
                    } else {
admin-web/src/views/systemManger/server/user/editRole.vue
@@ -1,5 +1,5 @@
<template>
  <win :title="setting.title" @close="close" :width="'800px'">
  <win :title="setting.title" @close="close" :width="'800px'" :loading="loading">
    <el-form  :model="formData"  class="demo-ruleForm" label-width="100px">
      <el-form-item label="角色配置"  prop="roleSetting">
        <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
@@ -36,6 +36,7 @@
  },
  data() {
    return {
      loading: true,
      data_scope: null,
      checkAll:false,
      checkedList:[],
@@ -69,30 +70,21 @@
      }
    }
  },
  created() {
    this.getInfo()
    this.getAllRole()
  async created() {
    this.title = this.setting.title
    if (this.setting.id != null) {
      await this.getInfo()
    }
    await this.getAllRole()
    this.loading = false
  },
  methods: {
    // 获取所有角色
    getAllRole() {
      const user = this.$store.getters.userInfo
      // debugger
      // if (user == undefined){
    async getAllRole() {
      // const user = this.$store.getters.userInfo
      //   this.data_scope = 1
      // } else {
      //   if (user.lv==null|| user.lv== 1) {
      //     this.data_scope = 1
      //   }
      //   if (user.lv && user.lv== 2) {
      //     this.data_scope = 2
      //   }
      //   if (user.lv && user.lv== 3) {
      //     this.data_scope = 3
      //   }
      // }
      this.data_scope = 1
      role.listRoleByDataScope({dataScope: this.data_scope}).then(response => {
      this.data_scope = this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : ''
      await role.listRoleByDataScope({dataScope: this.setting.data_scope}).then(response => {
            if (response) {
              this.roleOptions = response;
            } else {
@@ -115,11 +107,9 @@
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.roleOptions.length;
    },
    getInfo() {
      this.title = this.setting.title
      if ( this.setting.id != null ) {
    async getInfo() {
        // 查询数据
        user.getUser({ id: this.setting.id }).then(res => {
      await user.getUser({id: this.setting.id}).then(res => {
          const data = res.data
          this.formData = Object.assign(this.formData, data)
          this.checkedList = res.list.map(x=>{
@@ -129,29 +119,27 @@
              this.handleCheckedCitiesChange(res.list)
          }
        })
      }
    },
    close() {
        this.formData = {
          projectName: '',
          projectSubName: '',
          projectCode: '',
          projectContact: '',
          projectTel: '',
          projectEmail: '',
          projectStart: null,
          projectEnd: null,
          projectDesc: '',
          status: 1
        },
        userName: '',
        userCode: '',
        userPhone: '',
        sex: 1,
        status: 1,
        remark: '',
        seq: null
      }
      this.$emit('close')
    },
    save() {
        const params = Object.assign({}, this.formData)
        params.roleList=this.checkedList
        if (params.id) {
            console.log(params+'params')
        if (this.loading) return;
        this.loading = true
            user.updRole(params).then(res => {
          this.loading = false
                if (res) {
                    this.$message.success('保存成功!')
                    this.close()
@@ -159,6 +147,8 @@
                } else {
                    this.$message.error('保存失败')
                }
        }).catch(() => {
          this.loading = false
            })
        }
    }
admin-web/src/views/systemManger/server/user/index.vue
@@ -45,6 +45,7 @@
import editRole from './editRole';
import * as finsystenant from '@/api/baseSetting/finsystenant';
import * as user from '@/api/user';
import {LongToDateTime} from "@/utils/DateFormatter";
export default {
  name: 'index',
@@ -57,7 +58,7 @@
      treeDataList: [],
      // 搜索条件
      filterFrom: {
        tenantCode: 0,
        tenantCode: null,
        userName: null,
        userCode: null,
      },
@@ -66,6 +67,7 @@
      tenantId: null, //区划id
      tenantCode: null, //区划code
      tenantName: null, //区划名称
      data_scope: 0, //角色范围
      editSetting: {
        title: '',
        id: '',
@@ -75,6 +77,7 @@
      // 编辑角色配置
      editRoleSetting: {
        title: '',
        data_scope: 0,
        id: '',
        show: false,
      },
@@ -105,10 +108,10 @@
        },
        // 列信息
        columns: [
          { title: '编号', field: 'userCode', align: 'left' },
          { title: '用户姓名', field: 'userName', align: 'left' },
          { title: '登录名', field: 'userPhone', align: 'center' },
          { title: '所属机构', field: 'tenantName', align: 'center', width: 150 },
          {title: '人员姓名', field: 'userName', align: 'left', minWidth: 140},
          {title: '登录名', field: 'userCode', align: 'left', minWidth: 140},
          {title: '手机号', field: 'userPhone', align: 'center', width: 110},
          { title: '所属机构', field: 'tenantName', align: 'center', minWidth: 150 },
          { title: '部门', field: 'sysDeptName', align: 'center' },
          {
            field: 'status',
@@ -145,15 +148,15 @@
          width: '250', // 列宽
          attr: [
            {
              title: '编辑',
              events: (row) => {
                this.showAdd(row.id);
              },
            },
            {
              title: '角色',
              events: (row) => {
                this.showEditRole(row.id);
              },
            },
            {
              title: '编辑',
              events: (row) => {
                this.showAdd(row.id);
              },
            },
            {
@@ -180,8 +183,27 @@
  created() {
    // 获取机构树
    this.initTreeData();
    this.data_scope = this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : ''
    if(this.data_scope===0){
      this.data_scope=1
    }
    this.editSetting.data_scope = this.data_scope;
    this.editRoleSetting.data_scope = this.data_scope;
  },
  methods: {
    //导入
    importUser() {
      this.importSetting.dialogShow = true
      this.importSetting.onSuccess = (response, callBack) => {
        if (response.code === 1) {
          this.$message.success(response.msg)
          this.search(1)
        } else {
          this.$message.warning(response.msg)
        }
        callBack()
      }
    },
    // 左侧树初始化
    initTreeData() {
      finsystenant.getTree().then((res) => {
@@ -217,13 +239,17 @@
          id: param.id,
          name: param.name,
          code: param.code,
          lv: param.lv,
        },
      );
      let data_scope = Number(this.data_scope) + (param.lv-1)
      if (this.p.code != undefined && this.p.code != null) {
        this.filterFrom.tenantCode = this.p.code;
        this.tenantId = this.p.id;
        this.tenantName = this.p.name;
        this.editSetting.tenantCode = this.p.code;
        this.editSetting.data_scope = data_scope;
        this.editRoleSetting.data_scope = data_scope;
      } else {
        this.filterFrom.tenantCode = 0;
      }
@@ -278,6 +304,22 @@
      this.editSetting.title = title;
      this.editSetting.show = true;
    },
    // 删除用户账号
    del(row) {
      row.isDelete = 0;
      this.$modal
        .confirm('是否要删除"' + row.userName + '"的账号?')
        .then(function () {
          user.updateStatus(row).then((res) => {
          });
        })
        .then((res) => {
          this.$message.success('删除成功!');
          this.search();
        })
        .catch(() => {
        });
    },
    showEditRole(id) {
      let title = '添加';
      if (id != null) {
admin-web/src/views/systemSetting/role/index.vue
@@ -2,104 +2,6 @@
  <div class="app-container">
    <el-container>
      <el-card class="box-card" style="width: 100%" shadow="never">
        <!--    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">-->
        <!--      <el-form-item label="角色名称" prop="roleName">-->
        <!--        <el-input-->
        <!--          v-model="queryParams.roleName"-->
        <!--          placeholder="请输入"-->
        <!--          clearable-->
        <!--          @keyup.enter.native="handleQuery"-->
        <!--          style="width: 150px"-->
        <!--        />-->
        <!--      </el-form-item>-->
        <!--      <el-form-item label="状态" prop="status">-->
        <!--        <el-select-->
        <!--          style="width: 150px"-->
        <!--          v-model="queryParams.status"-->
        <!--          placeholder="请选择"-->
        <!--          clearable>-->
        <!--          <el-option-->
        <!--            v-for="dict in constants.normalOrDisabled"-->
        <!--            :key="dict.value"-->
        <!--            :label="dict.label"-->
        <!--            :value="dict.value"-->
        <!--          />-->
        <!--        </el-select>-->
        <!--      </el-form-item>-->
        <!--      <el-form-item>-->
        <!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>-->
        <!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
        <!--      </el-form-item>-->
        <!--    </el-form>-->
        <!--    <el-row :gutter="10" class="mb8">-->
        <!--      <el-col :span="1.5">-->
        <!--        <el-button-->
        <!--          type="primary"-->
        <!--          plain-->
        <!--          icon="el-icon-plus"-->
        <!--          size="mini"-->
        <!--          @click="handleAdd"-->
        <!--          v-hasPermi="['system:role:add']"-->
        <!--        >新增</el-button>-->
        <!--      </el-col>-->
        <!--    </el-row>-->
        <!--    <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">-->
        <!--      <el-table-column type="selection" width="55" align="center" />-->
        <!--      <el-table-column label="角色编号" prop="role_id" width="160" />-->
        <!--      <el-table-column label="角色名称" prop="role_name" :show-overflow-tooltip="true" width="150" />-->
        <!--      <el-table-column label="权限字符" prop="role_key" :show-overflow-tooltip="true" width="150" />-->
        <!--      <el-table-column label="显示顺序" prop="role_sort" width="100" />-->
        <!--      <el-table-column label="状态" align="center" width="100">-->
        <!--        <template slot-scope="scope">-->
        <!--          <el-switch-->
        <!--            v-model="scope.row.status"-->
        <!--            :active-value=0-->
        <!--            :inactive-value=1-->
        <!--            @change="handleStatusChange(scope.row)"-->
        <!--          ></el-switch>-->
        <!--        </template>-->
        <!--      </el-table-column>-->
        <!--      <el-table-column label="备注" align="center" prop="remark" width="180">-->
        <!--      </el-table-column>-->
        <!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">-->
        <!--        <template slot-scope="scope">-->
        <!--          <el-button-->
        <!--            size="mini"-->
        <!--            type="text"-->
        <!--            icon="el-icon-edit"-->
        <!--            @click="handleUpdate(scope.row)"-->
        <!--            v-hasPermi="['system:role:edit']"-->
        <!--          >修改</el-button>-->
        <!--          <el-button-->
        <!--            size="mini"-->
        <!--            type="text"-->
        <!--            icon="el-icon-delete"-->
        <!--            @click="handleDelete(scope.row)"-->
        <!--            v-hasPermi="['system:role:remove']"-->
        <!--          >删除</el-button>-->
        <!--&lt;!&ndash;          <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">-->
        <!--            <span class="el-dropdown-link">-->
        <!--              <i class="el-icon-d-arrow-right el-icon&#45;&#45;right"></i>更多-->
        <!--            </span>-->
        <!--            <el-dropdown-menu slot="dropdown">-->
        <!--              <el-dropdown-item command="handleDataScope" icon="el-icon-circle-check"-->
        <!--                v-hasPermi="['system:role:edit']">数据权限</el-dropdown-item>-->
        <!--              <el-dropdown-item command="handleAuthUser" icon="el-icon-user"-->
        <!--                v-hasPermi="['system:role:edit']">分配用户</el-dropdown-item>-->
        <!--            </el-dropdown-menu>-->
        <!--          </el-dropdown>&ndash;&gt;-->
        <!--        </template>-->
        <!--      </el-table-column>-->
        <!--    </el-table>-->
        <!--    <el-pagination-->
        <!--      :current-page="queryParams.pageNum"-->
        <!--      :page-sizes="constants.page.limit"-->
        <!--      :layout="constants.page.layout"-->
        <!--      :total="this.total"-->
        <!--      @size-change="changeSize"-->
        <!--      @current-change="changePage"-->
        <!--    />-->
        <!--搜索条件-->
        <div class="filter-container">
          <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
        </div>
@@ -113,11 +15,11 @@
    </el-container>
    <!-- 添加或修改角色配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
      <el-form v-loading="loading" ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="角色名称" prop="role_name">
          <el-input v-model="form.role_name" placeholder="请输入角色名称"/>
        </el-form-item>
        <el-form-item prop="role_key">
        <!--        <el-form-item prop="role_key">
          <span slot="label">
            <el-tooltip content="角色标识,目前暂未使用" placement="top">
              <i class="el-icon-question"></i>
@@ -125,7 +27,7 @@
            角色标识
          </span>
          <el-input v-model="form.role_key" placeholder="请输入角色标识"/>
        </el-form-item>
                </el-form-item>-->
        <el-form-item label="角色顺序" prop="role_sort">
          <el-input-number v-model="form.role_sort" controls-position="right" :min="0"/>
        </el-form-item>
@@ -133,23 +35,19 @@
          <el-radio-group v-model="form.status">
            <el-radio :label="0">正常</el-radio>
            <el-radio :label="1">禁用</el-radio>
            <!--            <el-radio-->
            <!--              v-for="dict in constants.normalOrDisabled"-->
            <!--              :key="dict.value"-->
            <!--              :label="dict.value"-->
            <!--            >{{dict.label}}</el-radio>-->
          </el-radio-group>
        </el-form-item>
<!--        <el-form-item label="角色范围">
        <el-form-item label="角色范围">
          <el-radio-group v-model="form.data_scope">
            <el-radio :label="1" checked>省</el-radio>
            <el-radio :label="2">市</el-radio>
            <el-radio :label="3">县</el-radio>
            <el-radio v-if="$store.getters.userInfo.lv<2" :label="1">省</el-radio>
            <el-radio v-if="$store.getters.userInfo.lv<3" :label="2">市</el-radio>
            <el-radio v-if="$store.getters.userInfo.lv<4" :label="3">县</el-radio>
          </el-radio-group>
        </el-form-item>-->
        </el-form-item>
        <el-form-item label="菜单权限">
          <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
          <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
          <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选
          </el-checkbox>
          <el-checkbox v-model="form.menu_check_strictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动
          </el-checkbox>
          <el-tree
@@ -176,9 +74,9 @@
</template>
<script>
import {addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole} from "@/api/system/role";
import {roleMenuTreeselect, treeselect as menuTreeselect} from "@/api/system/menu";
import {listOrgRoot, roleDeptTreeselect, treeselect as deptTreeselect} from "@/api/system/dept";
import {listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus} from "@/api/system/role";
import {treeselect as menuTreeselect, roleMenuTreeselect} from "@/api/system/menu";
import {treeselect as deptTreeselect, roleDeptTreeselect, listOrgRoot} from "@/api/system/dept";
import MyTableV2 from "@/components/myTable/myTableV2";
import SettingIplatform from '@/utils/settingIplatform';
import items from './items'
@@ -262,9 +160,10 @@
      tableShow: false,
      // 表格数据
      table: {
        autoLoad: false,
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        url: SettingIplatform.apiBaseURL + '/system/role/list', // 请求地址
        url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/user/query/role', // 请求地址
        // 工具条
        tools: {
          columnsCtrl: {// 列控制按钮
@@ -286,12 +185,12 @@
        },
        // 列信息
        columns: [
          {title: '角色编号', field: 'role_id', align: 'center',},
          {title: '角色名称', field: 'role_name', align: 'center',},
          {title: '权限字符', field: 'role_key', align: 'center',},
          {title: '顺序号', field: 'role_sort', align: 'center',},
          {title: '角色编号', field: 'role_id', align: 'center', width: 135},
          {title: '角色名称', field: 'role_name', align: 'left', minWidth: 200},
          // {title: '权限字符', field: 'role_key', align: 'center', width: 100},
          {title: '显示顺序', field: 'role_sort', align: 'center', width: 100},
          {
            title: '状态', field: 'status', align: 'center',
            title: '状态', field: 'status', align: 'center', width: 100,
            switch: row => {
              const result = {}
              if (row.status == 0) {
@@ -314,7 +213,7 @@
              return result
            }
          },
          // {title: '备注', field: 'remark', align: 'left', width: '250px'},
          {title: '备注', field: 'remark', align: 'left', minWidth: 200},
        ],
        // 操作信息
        operation: {
@@ -368,6 +267,9 @@
      },
      // 表单参数
      form: {
        role_name: '',
        role_key: '',
        role_sort: '',
        data_scope: 1,
        status: 1
      },
@@ -395,6 +297,7 @@
  methods: {
    fifterForm(params) {
      this.queryParams = Object.assign(this.queryParams, params)
      this.queryParams.status = 0
      this.search(1)
    },
    // 查询table列表
@@ -407,33 +310,30 @@
    },
    /** 获取顶级机构列表选择框 2022-12-15 */
    getRootOrgList() {
      this.loading = true;
      listOrgRoot().then(response => {
        this.rootOrgList = response;
        this.selectedRootOrgId = this.rootOrgList[0].id;
        this.queryParams.orgId = this.selectedRootOrgId;
        this.loading = false;
      }).then(() => {
        this.tableShow = true
        this.$nextTick(() => {
        this.search(1);
      }).catch(function () {
        // this.loading = false;
        })
      });
    },
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      this.selectedRootOrgId = this.queryParams.orgId;
      listRole(this.queryParams).then(response => {
          this.roleList = response.datas;
          this.total = response.totalRows;
          this.loading = false;
        }
      );
    },
    /** 查询菜单树结构 */
    getMenuTreeselect() {
      menuTreeselect().then(response => {
    async getMenuTreeselect() {
      await menuTreeselect().then(response => {
        this.menuOptions = response;
      });
    },
@@ -503,14 +403,15 @@
      if (this.$refs.menu != undefined) {
        this.$refs.menu.setCheckedKeys([]);
      }
      this.menuExpand = false,
        this.menuNodeAll = false,
        this.deptExpand = true,
        this.deptNodeAll = false,
      this.menuExpand = false
      this.menuNodeAll = false
      this.deptExpand = true
      this.deptNodeAll = false
        this.form = {
          org_id: undefined, // 顶级机构ID
          role_id: undefined,
          role_name: undefined,
        data_scope: this.$store.getters.userInfo ? this.$store.getters.userInfo.lv : 1,
          role_key: "None",
          role_sort: 0,
          status: 0,
@@ -593,13 +494,15 @@
      }
    },
    /** 新增按钮操作 */
    handleAdd() {
    async handleAdd() {
      this.loading = true
      this.reset();
      this.getMenuTreeselect();
      await this.getMenuTreeselect();
      // 2022-12-18 添加上顶级机构ID
      this.form.org_id = this.selectedRootOrgId;
      this.open = true;
      this.title = "添加角色";
      this.loading = false
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
@@ -607,6 +510,7 @@
      // const roleId = row.role_id || this.ids
      const roleId = row.role_id;
      const roleMenu = this.getRoleMenuTreeselect(roleId);
      this.loading = true
      getRole(roleId).then(response => {
        this.form = response;
        this.open = true;
@@ -623,6 +527,9 @@
          });
        });
        this.title = "修改角色";
        this.loading = false
      }).catch(() => {
        this.loading = false
      });
    },
    /** 选择角色权限范围触发 */
@@ -658,20 +565,22 @@
          // 2022-12-19,把这两个字段设置为数值,目前暂不使用,要不后台类型转换错误(boolean)
          this.form.menu_check_strictly = 1;
          this.form.dept_check_strictly = 1;
          // 2023-11-30 增加默认data_scope为1
          // this.form.data_scope = 1;
          if (this.form.role_id != undefined) {
            this.form.menuIds = this.getMenuAllCheckedKeys();
            updateRole(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
              this.search()
            });
          } else {
            this.form.menuIds = this.getMenuAllCheckedKeys();
            addRole(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
              this.search()
            });
          }
        }
@@ -694,7 +603,7 @@
      this.$modal.confirm('是否确认删除角色为"' + row.role_name + '"的数据项?').then(function () {
        return delRole(roleIds);
      }).then(() => {
        this.this.search();
        this.search();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });