|
@@ -18,8 +18,15 @@
|
|
:index="indexMethod"
|
|
:index="indexMethod"
|
|
></el-table-column>
|
|
></el-table-column>
|
|
<el-table-column prop="name" label="角色名称"></el-table-column>
|
|
<el-table-column prop="name" label="角色名称"></el-table-column>
|
|
- <el-table-column class-name="action-column" label="操作" width="120px">
|
|
|
|
|
|
+ <el-table-column class-name="action-column" label="操作" width="220px">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="!scope.row.defaultRole"
|
|
|
|
+ class="btn-"
|
|
|
|
+ type="text"
|
|
|
|
+ @click="toSetDefaultRole(scope.row)"
|
|
|
|
+ >设置为内置角色</el-button
|
|
|
|
+ >
|
|
<el-button
|
|
<el-button
|
|
v-if="!scope.row.defaultRole"
|
|
v-if="!scope.row.defaultRole"
|
|
class="btn-primary"
|
|
class="btn-primary"
|
|
@@ -49,7 +56,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { ABLE_TYPE } from "@/constants/enumerate";
|
|
import { ABLE_TYPE } from "@/constants/enumerate";
|
|
-import { userRoleListPage } from "../api";
|
|
|
|
|
|
+import { userRoleListPage, setRoleDefault } from "../api";
|
|
import { deleteRole } from "../../base/api";
|
|
import { deleteRole } from "../../base/api";
|
|
import ModifySystemRole from "../components/ModifySystemRole";
|
|
import ModifySystemRole from "../components/ModifySystemRole";
|
|
|
|
|
|
@@ -87,6 +94,22 @@ export default {
|
|
this.curRole = {};
|
|
this.curRole = {};
|
|
this.$refs.ModifySystemRole.open();
|
|
this.$refs.ModifySystemRole.open();
|
|
},
|
|
},
|
|
|
|
+ toSetDefaultRole(row) {
|
|
|
|
+ const action = row.defaultRole ? "取消" : "设置";
|
|
|
|
+ this.$confirm(`确定要${action}角色【${row.name}】为内置角色吗?`, "提示", {
|
|
|
|
+ type: "warning"
|
|
|
|
+ })
|
|
|
|
+ .then(async () => {
|
|
|
|
+ const defaultRole = !row.defaultRole;
|
|
|
|
+ await setRoleDefault({
|
|
|
|
+ id: row.id,
|
|
|
|
+ defaultRole
|
|
|
|
+ });
|
|
|
|
+ row.defaultRole = defaultRole;
|
|
|
|
+ this.$message.success("操作成功!");
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ },
|
|
toDelete(row) {
|
|
toDelete(row) {
|
|
this.$confirm(`确定要删除角色【${row.name}】吗?`, "提示", {
|
|
this.$confirm(`确定要删除角色【${row.name}】吗?`, "提示", {
|
|
type: "warning"
|
|
type: "warning"
|