优化角色模板

This commit is contained in:
gyq
2025-12-15 09:17:09 +08:00
parent 62ffea861e
commit 279ce0a4f1
3 changed files with 37 additions and 5 deletions

View File

@@ -3,7 +3,8 @@
<div class="content">
<div class="title">选择模板快速创建好角色</div>
<div class="role_template">
<div class="item" v-for="item in list" :key="item.id" @click="selectRoleHandle(item)">
<div class="item" :class="{ active: item.cehcked }" v-for="item in list" :key="item.id"
@click="selectRoleHandle(item)">
<div class="header">
<div class="title">
{{ item.name }}
@@ -84,6 +85,11 @@ async function submitHandle() {
await saveByTemplate({
id: item.id
})
ElNotification({
title: '注意',
message: '角色创建成功',
type: 'success'
})
emits('success')
visible.value = false
} catch (error) {
@@ -125,6 +131,10 @@ onMounted(() => {
padding: 14px 18px;
transition: all .3s ease-in-out;
&.active {
border-color: var(--el-color-primary);
}
&:hover {
cursor: pointer;
border-color: var(--el-color-primary);
@@ -144,6 +154,7 @@ onMounted(() => {
.role_list {
display: flex;
gap: 2px;
div {
flex: 1;
@@ -154,6 +165,10 @@ onMounted(() => {
}
.rl_r {
display: flex;
flex-direction: column;
gap: 4px;
.row {
display: flex;
justify-content: flex-end;

View File

@@ -20,7 +20,7 @@
<!-- <el-table-column label="操作人" prop=""></el-table-column> -->
<el-table-column label="操作" width="250">
<template v-slot="scope">
<el-button link type="primary" @click="handleOpenAssignPermDialog(scope.row)"
<el-button link type="success" @click="handleOpenAssignPermDialog(scope.row)"
v-if="scope.row.pid !== null">分配权限</el-button>
<el-button link type="primary" @click="addTempateDialogRef.show(2, scope.row)" v-else>添加角色</el-button>
<el-button link type="primary" @click="addTempateDialogRef.show(2, scope.row, 2)"
@@ -156,7 +156,7 @@ function handlePlatformTypeChange(e) {
// 打开分配菜单菜单弹窗
async function handleOpenAssignPermDialog(row) {
const roleId = row.id;
const roleId = row.roleId;
dialog.row = row;
if (roleId) {
assignPermDialogVisible.value = true;
@@ -288,8 +288,11 @@ const permTreeRef = ref(null)
// 分配菜单菜单提交
async function handleAssignPermSubmit() {
try {
const roleId = checkedRole.value.roleId;
const roleId = checkedRole.value.id;
const name = checkedRole.value.name;
console.log(roleId, name);
if (roleId) {
const checkedMenuIds = permTreeRef
.value.getCheckedNodes(false, true)

View File

@@ -21,7 +21,8 @@
end-placeholder="结束时间" @change="timeChange" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchHandle">搜索</el-button>
<el-button type="primary" :loading="tableData.loading" icon="Search" @click="searchHandle">搜索</el-button>
<el-button :loading="tableData.loading" icon="Refresh" @click="resetHandle">重置</el-button>
</el-form-item>
</el-form>
</div>
@@ -206,6 +207,19 @@ function searchHandle() {
goodsRecordTotalAjax()
}
function resetHandle() {
time.value = []
queryForm.startTime = ''
queryForm.endTime = ''
queryForm.pointsGoodsName = ''
queryForm.goodsCategory = ''
queryForm.receiveType = ''
queryForm.status = ''
goodsRecordPageAjax();
goodsRecordTotalAjax()
}
// 分页大小发生变化
function handleSizeChange(e) {
tableData.size = e;