Explorar el Código

优化角色禁用不允许分配

RuoYi hace 1 año
padre
commit
90922844ea
Se han modificado 1 ficheros con 12 adiciones y 6 borrados
  1. 12 6
      ruoyi-ui/src/views/system/user/authRole.vue

+ 12 - 6
ruoyi-ui/src/views/system/user/authRole.vue

@@ -10,7 +10,7 @@
10
         </el-col>
10
         </el-col>
11
         <el-col :span="8" :offset="2">
11
         <el-col :span="8" :offset="2">
12
           <el-form-item label="登录账号" prop="userName">
12
           <el-form-item label="登录账号" prop="userName">
13
-            <el-input  v-model="form.userName" disabled />
13
+            <el-input v-model="form.userName" disabled />
14
           </el-form-item>
14
           </el-form-item>
15
         </el-col>
15
         </el-col>
16
       </el-row>
16
       </el-row>
@@ -20,10 +20,10 @@
20
     <el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)">
20
     <el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)">
21
       <el-table-column label="序号" type="index" align="center">
21
       <el-table-column label="序号" type="index" align="center">
22
         <template slot-scope="scope">
22
         <template slot-scope="scope">
23
-          <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
23
+          <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
24
         </template>
24
         </template>
25
       </el-table-column>
25
       </el-table-column>
26
-      <el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
26
+      <el-table-column type="selection" :reserve-selection="true" :selectable="checkSelectable" width="55" />
27
       <el-table-column label="角色编号" align="center" prop="roleId" />
27
       <el-table-column label="角色编号" align="center" prop="roleId" />
28
       <el-table-column label="角色名称" align="center" prop="roleName" />
28
       <el-table-column label="角色名称" align="center" prop="roleName" />
29
       <el-table-column label="权限字符" align="center" prop="roleKey" />
29
       <el-table-column label="权限字符" align="center" prop="roleKey" />
@@ -52,14 +52,14 @@ export default {
52
   name: "AuthRole",
52
   name: "AuthRole",
53
   data() {
53
   data() {
54
     return {
54
     return {
55
-       // 遮罩层
55
+      // 遮罩层
56
       loading: true,
56
       loading: true,
57
       // 分页信息
57
       // 分页信息
58
       total: 0,
58
       total: 0,
59
       pageNum: 1,
59
       pageNum: 1,
60
       pageSize: 10,
60
       pageSize: 10,
61
       // 选中角色编号
61
       // 选中角色编号
62
-      roleIds:[],
62
+      roleIds: [],
63
       // 角色信息
63
       // 角色信息
64
       roles: [],
64
       roles: [],
65
       // 用户信息
65
       // 用户信息
@@ -88,7 +88,9 @@ export default {
88
   methods: {
88
   methods: {
89
     /** 单击选中行数据 */
89
     /** 单击选中行数据 */
90
     clickRow(row) {
90
     clickRow(row) {
91
-      this.$refs.table.toggleRowSelection(row);
91
+      if (this.checkSelectable(row)) {
92
+        this.$refs.table.toggleRowSelection(row);
93
+      }
92
     },
94
     },
93
     // 多选框选中数据
95
     // 多选框选中数据
94
     handleSelectionChange(selection) {
96
     handleSelectionChange(selection) {
@@ -98,6 +100,10 @@ export default {
98
     getRowKey(row) {
100
     getRowKey(row) {
99
       return row.roleId;
101
       return row.roleId;
100
     },
102
     },
103
+    // 检查角色状态
104
+    checkSelectable(row) {
105
+      return row.status === "0" ? true : false;
106
+    },
101
     /** 提交按钮 */
107
     /** 提交按钮 */
102
     submitForm() {
108
     submitForm() {
103
       const userId = this.form.userId;
109
       const userId = this.form.userId;