|
@@ -1,220 +1,328 @@
|
|
|
-<style scoped lang="scss">
|
|
|
|
|
-.system-container {
|
|
|
|
|
-
|
|
|
|
|
- :deep(.el-card__body) {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- flex-direction: column;
|
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
- flex: 1;
|
|
|
|
|
- overflow: auto;
|
|
|
|
|
-
|
|
|
|
|
- .el-table {
|
|
|
|
|
- flex: 1;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.page-content {
|
|
|
|
|
- margin-bottom: 20px;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.page-pager {
|
|
|
|
|
- background-color: #fff;
|
|
|
|
|
- height: 24px;
|
|
|
|
|
-}
|
|
|
|
|
-</style>
|
|
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="system-container layout-padding">
|
|
|
|
|
- <el-card shadow="hover" class="layout-padding-auto">
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <el-form
|
|
|
|
|
- :model="state.formQuery"
|
|
|
|
|
- ref="queryRef"
|
|
|
|
|
- size="default" label-width="0px" class="mt5 mb5">
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="state.formQuery.roleName"
|
|
|
|
|
- placeholder="角色名"
|
|
|
|
|
- clearable
|
|
|
|
|
- @blur="loadData(true)"
|
|
|
|
|
- class="wd150 mr10">
|
|
|
|
|
- </el-input>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <el-button class="ml10" plain size="default" type="success" @click="loadData(true)">
|
|
|
|
|
- <SvgIcon name="ele-Search"/>
|
|
|
|
|
- 查询
|
|
|
|
|
|
|
+ <div class="system-role-container layout-padding">
|
|
|
|
|
+ <div class="system-role-padding layout-padding-auto layout-padding-view">
|
|
|
|
|
+ <div class="system-user-search mb15">
|
|
|
|
|
+ <el-input v-model="state.formQuery.roleName" clearable size="default"
|
|
|
|
|
+ placeholder="请输入角色名称" style="max-width: 180px"></el-input>
|
|
|
|
|
+
|
|
|
|
|
+ <ext-button icon="ele-Search" type="primary" plain class="ml10" @click="loadData" name="查询"/>
|
|
|
|
|
+ <!-- <el-button size="default" type="primary" class="ml10">-->
|
|
|
|
|
+ <!-- <el-icon>-->
|
|
|
|
|
+ <!-- <ele-Search/>-->
|
|
|
|
|
+ <!-- </el-icon>-->
|
|
|
|
|
+ <!-- 查询-->
|
|
|
|
|
+ <!-- </el-button>-->
|
|
|
|
|
+ <el-button size="default" type="success" class="ml10" @click="handleOpenDialog(0,false)">
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <ele-FolderAdd/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ 新增角色
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- </el-form>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-button v-if="state.changed" size="default" type="success" class="ml10" @click="handleSaveRolePermission">
|
|
|
|
|
+ <SvgIcon name="ele-Printer"/>
|
|
|
|
|
+ 保存设置
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
<el-table
|
|
<el-table
|
|
|
- :header-cell-style="{background:'#eef1f6',color:'#606266'}"
|
|
|
|
|
- border
|
|
|
|
|
- stripe="stripe"
|
|
|
|
|
- :height="state.tableData.height"
|
|
|
|
|
- highlight-current-row
|
|
|
|
|
- current-row-key="id"
|
|
|
|
|
- row-key="id"
|
|
|
|
|
|
|
+ ref="tableRef"
|
|
|
:data="state.tableData.data"
|
|
:data="state.tableData.data"
|
|
|
v-loading="state.tableData.loading"
|
|
v-loading="state.tableData.loading"
|
|
|
- @selection-change="handleTableSelectionChange"
|
|
|
|
|
- @sort-change="handleTableSortChange">
|
|
|
|
|
|
|
+ border
|
|
|
|
|
+ row-key="id"
|
|
|
|
|
+ :tree-props="{children:'children'}"
|
|
|
|
|
+ @cell-click="handleToggleRoleCheck"
|
|
|
|
|
+ style="width: 100%">
|
|
|
<template #empty>
|
|
<template #empty>
|
|
|
<el-empty></el-empty>
|
|
<el-empty></el-empty>
|
|
|
</template>
|
|
</template>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- v-for="field in state.tableData.columns"
|
|
|
|
|
- :key="field.prop"
|
|
|
|
|
- :label="field.label"
|
|
|
|
|
- :column-key="field.prop"
|
|
|
|
|
- :width="field.width"
|
|
|
|
|
- :min-width="field.minWidth"
|
|
|
|
|
- :fixed="field.fixed"
|
|
|
|
|
- :sortable="field.sortable"
|
|
|
|
|
- :show-overflow-tooltip="!field.fixed&&field.width>150"
|
|
|
|
|
- >
|
|
|
|
|
- <template #default="{row}">
|
|
|
|
|
- <template v-if="field.prop==='expand'">
|
|
|
|
|
- <p style="padding-left: 2em;" v-html="row[field.prop]"></p>
|
|
|
|
|
|
|
+ v-for="(col,idx) in state.columns"
|
|
|
|
|
+ :key="col.prop"
|
|
|
|
|
+ :label="col.label"
|
|
|
|
|
+ :width="col.width"
|
|
|
|
|
+ :min-width="col.minWidth"
|
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
|
+ :fixed="col.fixed"
|
|
|
|
|
+ :align="col.prop==='permName'?'left':'center'">
|
|
|
|
|
+ <template #header>
|
|
|
|
|
+ <template v-if="idx>0">
|
|
|
|
|
+ <div class="role-header-item">{{ col.label }}
|
|
|
|
|
+ <SvgIcon v-if="!state.immutableRoleList.includes(col.prop)" name="ele-Setting"
|
|
|
|
|
+ @click="handleOpenDialog(col.prop.split('_')[1],false)"/>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-else>
|
|
|
|
|
- <div>{{row[field.prop]}}</div>
|
|
|
|
|
|
|
+ <template v-if="idx===0">
|
|
|
|
|
+ 权限
|
|
|
|
|
+ <span style="cursor: pointer;font-size: 12px;margin-left: 8px;color:#ccc" @click="handleExpandSwitch">{{state.expandAll?'收起':'展开'}} </span>
|
|
|
</template>
|
|
</template>
|
|
|
-
|
|
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <template v-if="scope.column.label!=='权限'">
|
|
|
|
|
+ <el-icon color="#5FB878" v-if="scope.row[col.prop]">
|
|
|
|
|
+ <CircleCheckFilled/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <span v-else>
|
|
|
|
|
+ <SvgIcon name="ele-CircleCheck"></SvgIcon>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else ><span :title="scope.row.perm">{{ scope.row[col.prop] }}</span></template>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- <ext-page class="page-pager" v-model:value="state.pageQuery" @change="loadData(false)"/>
|
|
|
|
|
- </el-card>
|
|
|
|
|
|
|
+ <RoleDialog ref="roleDialogRef" @refresh="loadData()"/>
|
|
|
</div>
|
|
</div>
|
|
|
-<!-- <RoleDialog ref="roleDialogRef" @refresh="loadData(true)"/>-->
|
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
-<script setup lang="ts" name="RoleList">
|
|
|
|
|
-import {defineAsyncComponent, reactive, onMounted, onBeforeMount, ref, getCurrentInstance, nextTick, onBeforeUnmount} from 'vue';
|
|
|
|
|
-import {$body,$get} from "/@/utils/request";
|
|
|
|
|
|
|
+<script setup lang="ts" name="systemRole">
|
|
|
|
|
+import {defineAsyncComponent, reactive, onMounted, ref,nextTick} from 'vue';
|
|
|
|
|
+import {$body, $get} from "/@/utils/request";
|
|
|
|
|
+import u from "/@/utils/u";
|
|
|
import {Msg} from "/@/utils/message";
|
|
import {Msg} from "/@/utils/message";
|
|
|
|
|
+import {CircleCheckFilled} from '@element-plus/icons-vue'
|
|
|
|
|
+import ExtButton from "/@/components/form/ExtButton.vue";
|
|
|
|
|
|
|
|
|
|
+// 引入组件
|
|
|
|
|
+const RoleDialog = defineAsyncComponent(() => import('/@/views/admin/role/dialog.vue'));
|
|
|
|
|
|
|
|
-import ExtPage from '/@/components/form/ExtPage.vue'
|
|
|
|
|
-
|
|
|
|
|
-import mittBus from '/@/utils/mitt';
|
|
|
|
|
-
|
|
|
|
|
-// const RoleDialog = defineAsyncComponent(() => import("/@/views/page/RoleDialog.vue"));
|
|
|
|
|
-
|
|
|
|
|
-//定义引用
|
|
|
|
|
-const queryRef = ref();
|
|
|
|
|
|
|
+const tableRef = ref();
|
|
|
|
|
+// 定义变量内容
|
|
|
const roleDialogRef = ref();
|
|
const roleDialogRef = ref();
|
|
|
-
|
|
|
|
|
-//定义变量
|
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
|
- formQuery: {},
|
|
|
|
|
- pageQuery: {
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 10,
|
|
|
|
|
- total: 0
|
|
|
|
|
- },
|
|
|
|
|
tableData: {
|
|
tableData: {
|
|
|
- height: 500,
|
|
|
|
|
- data: [] as Array < any >,
|
|
|
|
|
|
|
+ data: [] as Array<any>,
|
|
|
loading: false,
|
|
loading: false,
|
|
|
- columns: [
|
|
|
|
|
- {label: '角色名', prop: 'roleName', resizable: true},
|
|
|
|
|
- {label: '角色描述', prop: 'roleDesc', resizable: true},
|
|
|
|
|
- {label: '角色列表', prop: 'permissions', resizable: true},
|
|
|
|
|
- {label: '创建时间', prop: 'createTime', sortable: 'custom', resizable: true},
|
|
|
|
|
- {label: '更新时间', prop: 'updateTime', sortable: 'custom', resizable: true},
|
|
|
|
|
- {
|
|
|
|
|
- label: '操作', prop: 'action', width: 180, align: 'center', fixed: 'right',
|
|
|
|
|
- }
|
|
|
|
|
- ],
|
|
|
|
|
},
|
|
},
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// 监听双向绑定 modelValue 的变化
|
|
|
|
|
-// watch(
|
|
|
|
|
-// () => state.pageIndex,
|
|
|
|
|
-// () => {
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// );
|
|
|
|
|
-
|
|
|
|
|
-//生命周期钩子
|
|
|
|
|
-onBeforeMount(() => {
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
- loadData();
|
|
|
|
|
|
|
+ pageQuery: {
|
|
|
|
|
+ pageIndex: 1,
|
|
|
|
|
+ pageSize: 20,
|
|
|
|
|
+ },
|
|
|
|
|
+ formQuery: {
|
|
|
|
|
+ roleName: null,
|
|
|
|
|
+ },
|
|
|
|
|
+ columns: [{label: '权限', prop: 'permName', width: 200, fixed: 'left'}] as Array<IBaseField>,
|
|
|
|
|
+ expandAll: false,
|
|
|
|
|
+ immutableRoleList: [] as Array<string>,
|
|
|
|
|
+ changed : false
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
- nextTick(() => {
|
|
|
|
|
- let bodyHeight = document.body.clientHeight;
|
|
|
|
|
- let queryHeight = queryRef.value.$el.clientHeight;
|
|
|
|
|
- state.tableData.height = bodyHeight - queryHeight - 320
|
|
|
|
|
|
|
+const handleExpandSwitch = ()=>{
|
|
|
|
|
+ state.expandAll = !state.expandAll;
|
|
|
|
|
+ nextTick(()=>{
|
|
|
|
|
+ state.tableData.data.forEach(row=>{
|
|
|
|
|
+ tableRef.value.toggleRowExpansion(row,state.expandAll);
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- mittBus.on("role.refresh", () => {
|
|
|
|
|
- loadData();
|
|
|
|
|
- })
|
|
|
|
|
-});
|
|
|
|
|
|
|
+const loadPermissionList = (roleList: Array<any>) => {
|
|
|
|
|
+ $get(`/permission/listPermission`, {pageSize: -1}).then((res: any) => {
|
|
|
|
|
+ //构造权限数组
|
|
|
|
|
+ let data = [] as Array<any>;
|
|
|
|
|
+ var permMap = u.groupByKey(res, "pid");
|
|
|
|
|
+ console.log(permMap)
|
|
|
|
|
+ let roleMap = new Map();
|
|
|
|
|
+ state.immutableRoleList = [] as Array<string>;
|
|
|
|
|
+ roleList.forEach(role => {
|
|
|
|
|
+ state.columns.push({
|
|
|
|
|
+ label: role.roleName,
|
|
|
|
|
+ prop: 'role_' + role.id,
|
|
|
|
|
+ width: (role.roleName).length * 24 + 45,
|
|
|
|
|
+ });
|
|
|
|
|
+ roleMap.set(role.id, role)
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(state.columns)
|
|
|
|
|
+ let topPermissionList = permMap['0']
|
|
|
|
|
+ if (u.isEmptyOrNull(topPermissionList)) {
|
|
|
|
|
+ Msg.message("没有权限数据", 'error')
|
|
|
|
|
+ state.tableData.loading = false;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-onBeforeUnmount(() => {
|
|
|
|
|
- mittBus.off("role.refresh")
|
|
|
|
|
-})
|
|
|
|
|
|
|
+ topPermissionList.forEach((top: any) => {
|
|
|
|
|
+ let {id, name, value} = top;
|
|
|
|
|
+ let childrenPermissionList = permMap[id.toString()];
|
|
|
|
|
+ let record = {
|
|
|
|
|
+ children: [] as Array<any>,
|
|
|
|
|
+ permName: name,
|
|
|
|
|
+ id: id,
|
|
|
|
|
+ perm: value,
|
|
|
|
|
+ // hasChildren: !u.isEmptyOrNull(childrenPermissionList)
|
|
|
|
|
+ } as any;
|
|
|
|
|
+ roleList.forEach(role => {
|
|
|
|
|
+ record['role_' + role.id] = !!(role.permissions && role.permissions.includes(value));
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ let children = [] as Array<any>;
|
|
|
|
|
+ if (!u.isEmptyOrNull(childrenPermissionList)) {
|
|
|
|
|
+ childrenPermissionList.forEach((child: any) => {
|
|
|
|
|
+ let childRecord = {
|
|
|
|
|
+ permName: child.name,
|
|
|
|
|
+ id: child.id,
|
|
|
|
|
+ perm: child.value,
|
|
|
|
|
+ } as any;
|
|
|
|
|
+ roleList.forEach(role => {
|
|
|
|
|
+ childRecord['role_' + role.id] = !!(role.permissions && role.permissions.includes(child.value));
|
|
|
|
|
+ })
|
|
|
|
|
+ children.push(childRecord);
|
|
|
|
|
+ });
|
|
|
|
|
+ //
|
|
|
|
|
+ record.children = children;
|
|
|
|
|
+ }
|
|
|
|
|
+ data.push(record);
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
|
|
|
|
|
-//region 方法区
|
|
|
|
|
|
|
+ state.tableData.data = data;
|
|
|
|
|
+ console.log(state.tableData.data)
|
|
|
|
|
+ state.tableData.loading = false;
|
|
|
|
|
+ }).catch(e => {
|
|
|
|
|
+ //console.log(e)
|
|
|
|
|
+ state.tableData.loading = false;
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
// 初始化表格数据
|
|
// 初始化表格数据
|
|
|
-const loadData = (refresh: boolean = false) => {
|
|
|
|
|
- if (refresh) {
|
|
|
|
|
- state.pageQuery.pageNum = 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+const loadData = () => {
|
|
|
|
|
+ state.columns = [{label: '权限', prop: 'permName', width: 120, fixed: 'left'}];
|
|
|
|
|
+ state.tableData.data = [];
|
|
|
state.tableData.loading = true;
|
|
state.tableData.loading = true;
|
|
|
- $get(`/admin-user/listRole`, {...state.formQuery, ...state.pageQuery}).then((res: any) => {
|
|
|
|
|
- let {list, total} = res;
|
|
|
|
|
- state.tableData.data = list;
|
|
|
|
|
- state.pageQuery.total = total;
|
|
|
|
|
- state.tableData.loading = false;
|
|
|
|
|
|
|
+ $get(`/role/list`, {...state.formQuery}).then((res: any) => {
|
|
|
|
|
+ //构造权限数组
|
|
|
|
|
+ loadPermissionList(res);
|
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
|
console.error(e)
|
|
console.error(e)
|
|
|
state.tableData.loading = false;
|
|
state.tableData.loading = false;
|
|
|
})
|
|
})
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
-// 打开修改用户弹窗
|
|
|
|
|
-const onRowClick = (type: string, row: any) => {
|
|
|
|
|
- roleDialogRef.value.open(type, row);
|
|
|
|
|
|
|
+// 打开新增角色弹窗
|
|
|
|
|
+const handleOpenDialog = (id: number, readonly: boolean) => {
|
|
|
|
|
+ roleDialogRef.value.openDialog(id, readonly);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 删除用户
|
|
|
|
|
-const onRowDel = (row: any) => {
|
|
|
|
|
- Msg.confirm(`此操作将永久删除:『${row.name}』,是否继续?`).then(() => {
|
|
|
|
|
- $get(`/role/delete/${row.id}`).then(() => {
|
|
|
|
|
- Msg.message("删除成功", 'success')
|
|
|
|
|
- }).catch(() => {
|
|
|
|
|
- Msg.message("删除失败", 'error')
|
|
|
|
|
|
|
+const handleToggleRoleCheck = (row, column, cell, event) => {
|
|
|
|
|
+ state.changed = true;
|
|
|
|
|
+ console.log(row, column, cell)
|
|
|
|
|
+ if(column.rawColumnKey==='permName'){
|
|
|
|
|
+ // tableRef.value
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let index = state.tableData.data.findIndex(k => k.id === row.id);
|
|
|
|
|
+ if (index >= 0) {
|
|
|
|
|
+ let record = state.tableData.data[index];
|
|
|
|
|
+ //console.log(record)
|
|
|
|
|
+ let bol = !record[column.rawColumnKey];
|
|
|
|
|
+ state.tableData.data[index][column.rawColumnKey] = bol;
|
|
|
|
|
+ if (!u.isEmptyOrNull(record.children)) {
|
|
|
|
|
+ record.children.forEach((r:any)=>{
|
|
|
|
|
+ r[column.rawColumnKey]= bol;
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ state.tableData.data.forEach(record => {
|
|
|
|
|
+ if (!u.isEmptyOrNull(record.children)) {
|
|
|
|
|
+ let r = record.children.find((k: any) => k.id === row.id);
|
|
|
|
|
+ if (r) {
|
|
|
|
|
+ r[column.rawColumnKey] = !r[column.rawColumnKey]
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
- });
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
-const handleTableSelectionChange = (selection: any) => {
|
|
|
|
|
- console.log("handleTableSelectionChange>>", selection)
|
|
|
|
|
- // emit("on-check-change", selection)
|
|
|
|
|
|
|
+const handleSaveRolePermission = () => {
|
|
|
|
|
+ let updateRoles = [] as Array<any>;
|
|
|
|
|
+ let map = new Map();
|
|
|
|
|
+
|
|
|
|
|
+ let keys = Object.keys(state.tableData.data[0])
|
|
|
|
|
+ console.log(state.tableData.data)
|
|
|
|
|
+ state.tableData.data.forEach(record => {
|
|
|
|
|
+ keys.forEach((k: string) => {
|
|
|
|
|
+ if (k.startsWith("role_")) {
|
|
|
|
|
+ if (record[k]) {
|
|
|
|
|
+ let roleId = k.split("_")[1];
|
|
|
|
|
+ let newVar = map.get(roleId);
|
|
|
|
|
+ if (!newVar) {
|
|
|
|
|
+ map.set(roleId, [record.perm])
|
|
|
|
|
+ } else {
|
|
|
|
|
+ newVar.push(record.perm);
|
|
|
|
|
+ map.set(roleId, newVar);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!u.isEmptyOrNull(record.children)) {
|
|
|
|
|
+ record.children.forEach((child: any) => {
|
|
|
|
|
+ if (k.startsWith("role_")) {
|
|
|
|
|
+ if (child[k]) {
|
|
|
|
|
+ let roleId = k.split("_")[1];
|
|
|
|
|
+ let newVar = map.get(roleId);
|
|
|
|
|
+ if (!newVar) {
|
|
|
|
|
+ map.set(roleId, [child.perm])
|
|
|
|
|
+ } else {
|
|
|
|
|
+ newVar.push(child.perm);
|
|
|
|
|
+ map.set(roleId, newVar);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ //console.log(map)
|
|
|
|
|
+ map.forEach((value: Array<string>, key: any) => {
|
|
|
|
|
+ updateRoles.push({
|
|
|
|
|
+ id: Number(key),
|
|
|
|
|
+ permissions: value.join("|")
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ $body(`/role/saveList`,updateRoles).then(()=>{
|
|
|
|
|
+ Msg.message("更新成功","success");
|
|
|
|
|
+ state.changed = false;
|
|
|
|
|
+ nextTick(()=>{
|
|
|
|
|
+ loadData();
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleTableSortChange = (column, prop, order) => {
|
|
|
|
|
- console.log("handleTableSortChange>>", column, prop, order)
|
|
|
|
|
- // emit("on-sort-change", column)
|
|
|
|
|
|
|
+// 页面加载时
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ loadData();
|
|
|
|
|
+});
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
|
+.role-header-item {
|
|
|
|
|
+ display: inline-flex;
|
|
|
|
|
+ justify-content: space-around;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+
|
|
|
|
|
+ i {
|
|
|
|
|
+ margin-left: 3px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.permission-box {
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-//endregion
|
|
|
|
|
|
|
+.system-role-container {
|
|
|
|
|
+ .system-role-padding {
|
|
|
|
|
+ padding: 15px;
|
|
|
|
|
|
|
|
|
|
+ .el-table {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-// 暴露变量
|
|
|
|
|
-// defineExpose({
|
|
|
|
|
-// loadData,
|
|
|
|
|
-// });
|
|
|
|
|
-</script>
|
|
|
|
|
|
|
+:deep(.el-table thead th.el-table__cell ) {
|
|
|
|
|
+ background: var(--el-fill-color-light);
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|