|
@@ -41,11 +41,12 @@
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="createdAt" label="创建时间" width="170" align="center"></el-table-column>
|
|
<el-table-column prop="createdAt" label="创建时间" width="170" align="center"></el-table-column>
|
|
- <el-table-column label="操作" width="160" align="center">
|
|
|
|
|
|
+ <el-table-column label="操作" width="220" align="center" fixed="right">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-button size="small" type="text" @click="onOpenEditRole(scope.row)">修改</el-button>
|
|
<el-button size="small" type="text" @click="onOpenEditRole(scope.row)">修改</el-button>
|
|
<el-button size="small" text type="danger" @click="onRowDel(scope.row)">删除</el-button>
|
|
<el-button size="small" text type="danger" @click="onRowDel(scope.row)">删除</el-button>
|
|
<el-button size="small" text type="success" @click="permission(scope.row)">角色权限</el-button>
|
|
<el-button size="small" text type="success" @click="permission(scope.row)">角色权限</el-button>
|
|
|
|
+ <el-button size="small" text type="info" @click="dataPermission(scope.row)">数据权限</el-button>
|
|
<!-- <el-dropdown size="small">
|
|
<!-- <el-dropdown size="small">
|
|
<el-button type="text" size="small" style="margin-top:1px;margin-left:10px">更多
|
|
<el-button type="text" size="small" style="margin-top:1px;margin-left:10px">更多
|
|
<el-icon>
|
|
<el-icon>
|
|
@@ -66,6 +67,7 @@
|
|
</el-card>
|
|
</el-card>
|
|
<EditRole ref="editRoleRef" @getList="roleList" :list="tableData.data" />
|
|
<EditRole ref="editRoleRef" @getList="roleList" :list="tableData.data" />
|
|
<permissionVue ref="permissionRef" />
|
|
<permissionVue ref="permissionRef" />
|
|
|
|
+ <EditPer ref="dataPermissionRef" :dept-data="deptData" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -73,6 +75,7 @@
|
|
import { toRefs, reactive, onMounted, ref, defineComponent, toRaw, getCurrentInstance } from 'vue';
|
|
import { toRefs, reactive, onMounted, ref, defineComponent, toRaw, getCurrentInstance } from 'vue';
|
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
import EditRole from '/@/views/system/role/component/editRole.vue';
|
|
import EditRole from '/@/views/system/role/component/editRole.vue';
|
|
|
|
+import EditPer from '/@/views/system/role/component/editPer.vue';
|
|
import permissionVue from '/@/views/system/role/component/permission.vue';
|
|
import permissionVue from '/@/views/system/role/component/permission.vue';
|
|
import api from '/@/api/system';
|
|
import api from '/@/api/system';
|
|
// 定义接口来定义对象的类型
|
|
// 定义接口来定义对象的类型
|
|
@@ -86,6 +89,7 @@ interface TableData {
|
|
createdAt: string;
|
|
createdAt: string;
|
|
}
|
|
}
|
|
interface TableDataState {
|
|
interface TableDataState {
|
|
|
|
+ deptData: any[];
|
|
tableData: {
|
|
tableData: {
|
|
data: Array<TableData>;
|
|
data: Array<TableData>;
|
|
// total: number;
|
|
// total: number;
|
|
@@ -99,13 +103,15 @@ interface TableDataState {
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'apiV1SystemRoleList',
|
|
name: 'apiV1SystemRoleList',
|
|
- components: { EditRole, permissionVue },
|
|
|
|
|
|
+ components: { EditRole, permissionVue, EditPer },
|
|
setup() {
|
|
setup() {
|
|
const { proxy } = getCurrentInstance() as any;
|
|
const { proxy } = getCurrentInstance() as any;
|
|
const addRoleRef = ref();
|
|
const addRoleRef = ref();
|
|
const editRoleRef = ref();
|
|
const editRoleRef = ref();
|
|
const permissionRef = ref();
|
|
const permissionRef = ref();
|
|
|
|
+ const dataPermissionRef = ref();
|
|
const state = reactive<TableDataState>({
|
|
const state = reactive<TableDataState>({
|
|
|
|
+ deptData: [],
|
|
tableData: {
|
|
tableData: {
|
|
data: [],
|
|
data: [],
|
|
// total: 0,
|
|
// total: 0,
|
|
@@ -119,6 +125,13 @@ export default defineComponent({
|
|
// 初始化表格数据
|
|
// 初始化表格数据
|
|
const initTableData = () => {
|
|
const initTableData = () => {
|
|
roleList();
|
|
roleList();
|
|
|
|
+ api.dept
|
|
|
|
+ .getList({
|
|
|
|
+ status: 1,
|
|
|
|
+ })
|
|
|
|
+ .then((res: any) => {
|
|
|
|
+ state.deptData = res;
|
|
|
|
+ });
|
|
};
|
|
};
|
|
const roleList = () => {
|
|
const roleList = () => {
|
|
api.role.getList(state.tableData.param).then((res: Array<TableData>) => {
|
|
api.role.getList(state.tableData.param).then((res: Array<TableData>) => {
|
|
@@ -157,6 +170,10 @@ export default defineComponent({
|
|
ElMessage.error('该角色禁止被授权');
|
|
ElMessage.error('该角色禁止被授权');
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ // 设置数据权限
|
|
|
|
+ const dataPermission = async (row: any) => {
|
|
|
|
+ dataPermissionRef.value.openDialog(row);
|
|
|
|
+ };
|
|
|
|
|
|
// 页面加载时
|
|
// 页面加载时
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
@@ -167,6 +184,8 @@ export default defineComponent({
|
|
addRoleRef,
|
|
addRoleRef,
|
|
editRoleRef,
|
|
editRoleRef,
|
|
permissionRef,
|
|
permissionRef,
|
|
|
|
+ dataPermissionRef,
|
|
|
|
+ dataPermission,
|
|
permission,
|
|
permission,
|
|
onOpenAddRole,
|
|
onOpenAddRole,
|
|
onOpenEditRole,
|
|
onOpenEditRole,
|