|
|
@ -3,23 +3,27 @@ |
|
|
@ 时间: 2023-05-26 09:32:10 |
|
|
@ 时间: 2023-05-26 09:32:10 |
|
|
@ 备注: |
|
|
@ 备注: |
|
|
--> |
|
|
--> |
|
|
<script lang='ts' setup> |
|
|
<script lang="ts" setup> |
|
|
defineOptions({ |
|
|
defineOptions({ |
|
|
name: "setuprole", |
|
|
name: "setuprole", |
|
|
inheritAttrs: false, |
|
|
inheritAttrs: false, |
|
|
}); |
|
|
}); |
|
|
import { searchRoleWord, roleLietCont, editRoleContKeyword } from "@/api/system/roleapi/types"; //数据结构 |
|
|
import { |
|
|
|
|
|
searchRoleWord, |
|
|
|
|
|
roleLietCont, |
|
|
|
|
|
editRoleContKeyword, |
|
|
|
|
|
} from "@/api/system/roleapi/types"; //数据结构 |
|
|
import { getSystemRoleList, editRoleContStatus } from "@/api/system/roleapi/rolecont"; //封装api请求 |
|
|
import { getSystemRoleList, editRoleContStatus } from "@/api/system/roleapi/rolecont"; //封装api请求 |
|
|
import AddCont from "@/views/powermanage/rolepower/setuprole/addrole.vue" //新增角色页面 |
|
|
import AddCont from "@/views/powermanage/rolepower/setuprole/addrole.vue"; //新增角色页面 |
|
|
import EditCont from "@/views/powermanage/rolepower/setuprole/editrole.vue" //编辑角色页面 |
|
|
import EditCont from "@/views/powermanage/rolepower/setuprole/editrole.vue"; //编辑角色页面 |
|
|
import SetupRolePower from "@/views/powermanage/rolepower/setuprole/setuprolepower.vue" //配置权限 |
|
|
import SetupRolePower from "@/views/powermanage/rolepower/setuprole/setuprolepower.vue"; //配置权限 |
|
|
import StaffingRole from "@/views/powermanage/rolepower/setuprole/staffingrole.vue" //配置角色使用人员 |
|
|
import StaffingRole from "@/views/powermanage/rolepower/setuprole/staffingrole.vue"; //配置角色使用人员 |
|
|
|
|
|
|
|
|
const queryFormRef = ref(ElForm); //查询表单 |
|
|
const queryFormRef = ref(ElForm); //查询表单 |
|
|
const searchForm = reactive<searchRoleWord>({ name: "" }); //查询表单数据 |
|
|
const searchForm = reactive<searchRoleWord>({ name: "" }); //查询表单数据 |
|
|
const ids = ref<number[]>([]); //批量删除的ID |
|
|
const ids = ref<number[]>([]); //批量删除的ID |
|
|
const loading = ref(false); //页面加载 |
|
|
const loading = ref(false); //页面加载 |
|
|
const roleContList = ref<roleLietCont[]>([]) |
|
|
const roleContList = ref<roleLietCont[]>([]); |
|
|
const openAddBox = ref(false); //新增角色 |
|
|
const openAddBox = ref(false); //新增角色 |
|
|
const openEditBox = ref(false); //编辑角色 |
|
|
const openEditBox = ref(false); //编辑角色 |
|
|
const openSetupPowerBox = ref(false); //配置权限 |
|
|
const openSetupPowerBox = ref(false); //配置权限 |
|
|
@ -31,10 +35,9 @@ const currentRoleCont = reactive<editRoleContKeyword>({}); |
|
|
* 搜索角色 |
|
|
* 搜索角色 |
|
|
*/ |
|
|
*/ |
|
|
function searchRoleList() { |
|
|
function searchRoleList() { |
|
|
getSystemRoleList(searchForm) |
|
|
getSystemRoleList(searchForm).then(({ data }) => { |
|
|
.then(({ data }) => { |
|
|
|
|
|
roleContList.value = data; |
|
|
roleContList.value = data; |
|
|
}) |
|
|
}); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 行checkbox change事件 |
|
|
* 行checkbox change事件 |
|
|
@ -60,10 +63,10 @@ function openAddRoleDialog() { |
|
|
* 打开编辑角色页面 |
|
|
* 打开编辑角色页面 |
|
|
*/ |
|
|
*/ |
|
|
function openEditRoleDialog(roleCont: roleLietCont) { |
|
|
function openEditRoleDialog(roleCont: roleLietCont) { |
|
|
currentRoleCont.id = roleCont.id.toString() |
|
|
currentRoleCont.id = roleCont.id.toString(); |
|
|
currentRoleCont.name = roleCont.name |
|
|
currentRoleCont.name = roleCont.name; |
|
|
currentRoleCont.sort = roleCont.sort |
|
|
currentRoleCont.sort = roleCont.sort; |
|
|
openEditBox.value = true |
|
|
openEditBox.value = true; |
|
|
// console.log("监听数据--->",openEditBox.value,currentRoleCont); |
|
|
// console.log("监听数据--->",openEditBox.value,currentRoleCont); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -75,7 +78,7 @@ function handleDelete(delId?: number) { |
|
|
ElMessage.warning("请勾选删除项"); |
|
|
ElMessage.warning("请勾选删除项"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
let dictTypeIdAry = delRoleIds.split(",") |
|
|
let dictTypeIdAry = delRoleIds.split(","); |
|
|
ElMessageBox.confirm("确认删除已选中的数据项?", "警告", { |
|
|
ElMessageBox.confirm("确认删除已选中的数据项?", "警告", { |
|
|
confirmButtonText: "确定", |
|
|
confirmButtonText: "确定", |
|
|
cancelButtonText: "取消", |
|
|
cancelButtonText: "取消", |
|
|
@ -93,23 +96,23 @@ function handleDelete(delId?: number) { |
|
|
* 配置权限 |
|
|
* 配置权限 |
|
|
*/ |
|
|
*/ |
|
|
function openSetupPwoerDialog(roleCont: roleLietCont) { |
|
|
function openSetupPwoerDialog(roleCont: roleLietCont) { |
|
|
currentRoleCont.id = roleCont.id.toString() |
|
|
currentRoleCont.id = roleCont.id.toString(); |
|
|
currentRoleCont.name = "配置 < " + roleCont.name + " > 权限" |
|
|
currentRoleCont.name = "配置 < " + roleCont.name + " > 权限"; |
|
|
currentRoleCont.sort = roleCont.sort |
|
|
currentRoleCont.sort = roleCont.sort; |
|
|
openSetupPowerBox.value = true; |
|
|
openSetupPowerBox.value = true; |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 配置使用人员 |
|
|
* 配置使用人员 |
|
|
*/ |
|
|
*/ |
|
|
function openSetupUsersDialog(roleCont: roleLietCont) { |
|
|
function openSetupUsersDialog(roleCont: roleLietCont) { |
|
|
currentRoleCont.id = roleCont.id.toString() |
|
|
currentRoleCont.id = roleCont.id.toString(); |
|
|
currentRoleCont.name = roleCont.name |
|
|
currentRoleCont.name = roleCont.name; |
|
|
currentRoleCont.sort = roleCont.sort |
|
|
currentRoleCont.sort = roleCont.sort; |
|
|
openSetupUsersBox.value = true; |
|
|
openSetupUsersBox.value = true; |
|
|
} |
|
|
} |
|
|
const searchRoleListsun = () => { |
|
|
const searchRoleListsun = () => { |
|
|
searchRoleList(); |
|
|
searchRoleList(); |
|
|
} |
|
|
}; |
|
|
//注册一个回调函数,在组件挂载完成后执行。 |
|
|
//注册一个回调函数,在组件挂载完成后执行。 |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
searchRoleList(); |
|
|
searchRoleList(); |
|
|
@ -135,7 +138,7 @@ onMounted(() => { |
|
|
<el-card shadow="never"> |
|
|
<el-card shadow="never"> |
|
|
<template #header> |
|
|
<template #header> |
|
|
<el-form ref="queryFormRef" :model="searchForm" :inline="true"> |
|
|
<el-form ref="queryFormRef" :model="searchForm" :inline="true"> |
|
|
<el-row style="padding-left: 20px;"> |
|
|
<el-row style="padding-left: 20px"> |
|
|
<el-col :span="19"> |
|
|
<el-col :span="19"> |
|
|
<el-form-item label="关键字" prop="keywords"> |
|
|
<el-form-item label="关键字" prop="keywords"> |
|
|
<el-input v-model="searchForm.name" placeholder="角色名称" clearable /> |
|
|
<el-input v-model="searchForm.name" placeholder="角色名称" clearable /> |
|
|
@ -143,28 +146,44 @@ onMounted(() => { |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="5" class="flex-end"> |
|
|
<el-col :span="5" class="flex-end"> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button type="primary" @click="searchRoleList"><template |
|
|
<el-button type="primary" @click="searchRoleList" |
|
|
#icon><i-ep-search /></template>搜索</el-button> |
|
|
><template #icon><i-ep-search /></template>搜索</el-button |
|
|
|
|
|
> |
|
|
<el-button @click="resetQuery"> |
|
|
<el-button @click="resetQuery"> |
|
|
<template #icon><i-ep-refresh /></template> |
|
|
<template #icon><i-ep-refresh /></template> |
|
|
重置</el-button> |
|
|
重置</el-button |
|
|
|
|
|
> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</el-form> |
|
|
</el-form> |
|
|
<!-- --> |
|
|
<!-- --> |
|
|
</template> |
|
|
</template> |
|
|
<div style="margin-bottom: 15px;height: 32px;display: flex;"> |
|
|
<div style="margin-bottom: 15px; height: 32px; display: flex"> |
|
|
<el-button type="primary" @click="openAddRoleDialog()" |
|
|
<el-button |
|
|
v-hasPerm="['124066798512386048']"><i-ep-plus />新增</el-button> |
|
|
type="primary" |
|
|
<el-button plain type="primary" v-hasPerm="['124066956029472768']" :disabled="ids.length === 0" |
|
|
@click="openAddRoleDialog()" |
|
|
@click="handleDelete()"><i-ep-delete />删除</el-button> |
|
|
v-hasPerm="['124066798512386048']" |
|
|
|
|
|
><i-ep-plus />新增</el-button |
|
|
|
|
|
> |
|
|
|
|
|
<el-button |
|
|
|
|
|
plain |
|
|
|
|
|
type="primary" |
|
|
|
|
|
v-hasPerm="['124066956029472768']" |
|
|
|
|
|
:disabled="ids.length === 0" |
|
|
|
|
|
@click="handleDelete()" |
|
|
|
|
|
><i-ep-delete />删除</el-button |
|
|
|
|
|
> |
|
|
<span class="select-text">已选 {{ selectTableLength }} 条</span> |
|
|
<span class="select-text">已选 {{ selectTableLength }} 条</span> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-table |
|
|
<el-table v-loading="loading" highlight-current-row :data="roleContList" stripe |
|
|
v-loading="loading" |
|
|
@selection-change="handleSelectionChange"> |
|
|
highlight-current-row |
|
|
|
|
|
:data="roleContList" |
|
|
|
|
|
stripe |
|
|
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
|
|
> |
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
<el-table-column label="角色名称" prop="name" /> |
|
|
<el-table-column label="角色名称" prop="name" /> |
|
|
<el-table-column label="排序" prop="sort" align="center" width="200" /> |
|
|
<el-table-column label="排序" prop="sort" align="center" width="200" /> |
|
|
@ -176,14 +195,38 @@ onMounted(() => { |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column fixed="right" label="操作" align="center"> |
|
|
<el-table-column fixed="right" label="操作" align="center"> |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<el-button v-hasPerm="['124067026950959104']" type="primary" link size="small" |
|
|
<el-button |
|
|
@click.stop="openSetupPwoerDialog(scope.row)">配置权限</el-button> |
|
|
v-hasPerm="['124067026950959104']" |
|
|
<el-button v-hasPerm="['124067108593086464']" type="primary" link size="small" |
|
|
type="primary" |
|
|
@click.stop="openSetupUsersDialog(scope.row)">使用人员</el-button> |
|
|
link |
|
|
<el-button v-hasPerm="['124066883237326848']" type="primary" link size="small" |
|
|
size="small" |
|
|
@click.stop="openEditRoleDialog(scope.row)">编辑</el-button> |
|
|
@click.stop="openSetupPwoerDialog(scope.row)" |
|
|
<el-button v-hasPerm="['124066956029472768']" type="primary" link size="small" |
|
|
>配置权限</el-button |
|
|
@click.stop="handleDelete(scope.row.id)">删除</el-button> |
|
|
> |
|
|
|
|
|
<el-button |
|
|
|
|
|
v-hasPerm="['124067108593086464']" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
link |
|
|
|
|
|
size="small" |
|
|
|
|
|
@click.stop="openSetupUsersDialog(scope.row)" |
|
|
|
|
|
>使用人员</el-button |
|
|
|
|
|
> |
|
|
|
|
|
<el-button |
|
|
|
|
|
v-hasPerm="['124066883237326848']" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
link |
|
|
|
|
|
size="small" |
|
|
|
|
|
@click.stop="openEditRoleDialog(scope.row)" |
|
|
|
|
|
>编辑</el-button |
|
|
|
|
|
> |
|
|
|
|
|
<el-button |
|
|
|
|
|
v-hasPerm="['124066956029472768']" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
link |
|
|
|
|
|
size="small" |
|
|
|
|
|
@click.stop="handleDelete(scope.row.id)" |
|
|
|
|
|
>删除</el-button |
|
|
|
|
|
> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
@ -191,16 +234,27 @@ onMounted(() => { |
|
|
<!--新增角色--> |
|
|
<!--新增角色--> |
|
|
<AddCont v-model:addIsShow="openAddBox" /> |
|
|
<AddCont v-model:addIsShow="openAddBox" /> |
|
|
<!--编辑角色--> |
|
|
<!--编辑角色--> |
|
|
<EditCont v-model:isShow="openEditBox" :roleCont="currentRoleCont" @refreshRoleList="searchRoleListsun" /> |
|
|
<EditCont |
|
|
|
|
|
v-model:isShow="openEditBox" |
|
|
|
|
|
:roleCont="currentRoleCont" |
|
|
|
|
|
@refreshRoleList="searchRoleListsun" |
|
|
|
|
|
/> |
|
|
<!--配置权限--> |
|
|
<!--配置权限--> |
|
|
<SetupRolePower v-model:powerIsShow="openSetupPowerBox" :roleId="currentRoleCont.id" |
|
|
<SetupRolePower |
|
|
:roleTitle="currentRoleCont.name" /> |
|
|
v-model:powerIsShow="openSetupPowerBox" |
|
|
|
|
|
:roleId="currentRoleCont.id" |
|
|
|
|
|
:roleTitle="currentRoleCont.name" |
|
|
|
|
|
/> |
|
|
<!--配置角色使用人员--> |
|
|
<!--配置角色使用人员--> |
|
|
<StaffingRole v-model:userIsShow="openSetupUsersBox" :roleId="currentRoleCont.id" |
|
|
<StaffingRole |
|
|
:roleTitle="currentRoleCont.name" @refreshRoleUserList="searchRoleListsun" /> |
|
|
v-model:userIsShow="openSetupUsersBox" |
|
|
|
|
|
:roleId="currentRoleCont.id" |
|
|
|
|
|
:roleTitle="currentRoleCont.name" |
|
|
|
|
|
@refreshRoleUserList="searchRoleListsun" |
|
|
|
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<style lang='scss' scoped> |
|
|
<style lang="scss" scoped> |
|
|
::v-deep(.el-card__header) { |
|
|
::v-deep(.el-card__header) { |
|
|
padding: 0 !important; |
|
|
padding: 0 !important; |
|
|
height: 78px !important; |
|
|
height: 78px !important; |
|
|
|