提交 737d51e0 authored 作者: 张耀丹's avatar 张耀丹

用户管理、菜单管理、数据字典=》按钮权限

上级 ae4056ba
......@@ -3,16 +3,16 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" @click="handlerRefreshCache" preIcon="ant-design:sync-outlined"> 刷新缓存</a-button>
<a-button type="primary" @click="openRecycleModal(true)" preIcon="ant-design:hdd-outlined"> 回收站</a-button>
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate" v-auth="'system:dict:add'"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-auth="'system:dict:export'"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls" v-auth="'system:dict:import'">导入</j-upload-button>
<a-button type="primary" @click="handlerRefreshCache" preIcon="ant-design:sync-outlined" v-auth="'system:dict:refresh'"> 刷新缓存</a-button>
<a-button type="primary" @click="openRecycleModal(true)" preIcon="ant-design:hdd-outlined" v-auth="'system:dict:recycleBin'"> 回收站</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<a-menu-item key="1" @click="batchHandleDelete" v-auth="'system:dict:delete'">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
......@@ -172,10 +172,12 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'system:dict:edit',
},
{
label: '字典配置',
onClick: handleItem.bind(null, record),
auth: 'system:dict:config',
},
{
label: '删除',
......@@ -183,6 +185,7 @@
title: '确定删除吗?',
confirm: handleDelete.bind(null, record),
},
auth: 'system:dict:delete',
},
];
}
......
......@@ -2,14 +2,14 @@
<div class="p-4">
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增菜单</a-button>
<a-button type="primary" v-auth="'system:permission:add'" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增菜单</a-button>
<a-button type="primary" preIcon="ic:round-expand" @click="expandAll">展开全部</a-button>
<a-button type="primary" preIcon="ic:round-compress" @click="collapseAll">折叠全部</a-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<a-menu-item key="1" @click="batchHandleDelete" v-auth="'system:permission:deleteBatch'">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
......@@ -22,7 +22,7 @@
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<MenuDrawer @register="registerDrawer" @success="handleSuccess" :showFooter="showFooter" />
......@@ -65,7 +65,7 @@
actionColOptions: { xs: 24, sm: 12, md: 6, lg: 6, xl: 6, xxl: 6 },
},
actionColumn: {
width: 120,
width: 130,
},
},
});
......@@ -167,27 +167,17 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'system:permission:edit',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
// {
// label: '详情',
// onClick: handleDetail.bind(null, record),
// },
{
label: '添加下级',
onClick: handleAddSub.bind(null, record),
auth: 'system:permission:addRule',
},
{
label: '数据规则',
onClick: handleDataRule.bind(null, record),
},
// {
// label: '数据规则',
// onClick: handleDataRule.bind(null, record),
// },
{
label: '删除',
color: 'error',
......@@ -195,6 +185,7 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
auth: 'system:permission:delete',
},
];
}
......
......@@ -36,9 +36,6 @@
import { columns, searchFormSchema } from './role.data';
import { list, deleteRole, batchDeleteRole, getExportUrl, getImportUrl } from './role.api';
import { useListPage } from '/@/hooks/system/useListPage';
//按钮权限问题
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
const showFooter = ref(true);
const [roleUserDrawer, { openDrawer: openRoleUserDrawer }] = useDrawer();
const [registerDrawer, { openDrawer }] = useDrawer();
......@@ -140,17 +137,17 @@
{
label: '用户',
onClick: handleUser.bind(null, record),
ifShow: () => hasPermission('system:role:user'),
auth: 'system:role:user',
},
{
label: '授权',
onClick: handlePerssion.bind(null, record),
ifShow: () => hasPermission('system:role:permission'),
auth: 'system:role:permission',
},
{
label: '编辑',
onClick: handleEdit.bind(null, record),
ifShow: () => hasPermission('system:role:edit'),
auth: 'system:role:edit',
},
{
label: '删除',
......@@ -158,12 +155,12 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
ifShow: () => hasPermission('system:role:delete'),
auth: 'system:role:delete',
},
{
label: '首页配置',
onClick: handleIndexConfig.bind(null, record.roleCode),
ifShow: () => hasPermission('system:role:config'),
auth: 'system:role:config',
},
];
}
......
......@@ -20,11 +20,11 @@
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate" v-show="isAuth('system:user:add')"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate" v-auth="'system:user:add'"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-auth="'system:user:export'"> 导出</a-button>
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
<!-- <a-button type="primary" @click="handleSyncUser" preIcon="ant-design:sync-outlined"> 同步流程</a-button> -->
<a-button type="primary" @click="openModal(true, {})" preIcon="ant-design:hdd-outlined"> 回收站</a-button>
<a-button type="primary" @click="openModal(true, {})" preIcon="ant-design:hdd-outlined" v-auth="'system:user:recycleBin'"> 回收站</a-button>
<JThirdAppButton biz-type="user" :selected-row-keys="selectedRowKeys" syncToApp syncToLocal @sync-finally="onSyncFinally" />
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
......@@ -51,7 +51,7 @@
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<!--用户抽屉-->
......@@ -73,7 +73,6 @@
//ts语法
import { ref, watchEffect, unref } from 'vue';
import { BasicTable, TableAction, ActionItem } from '/@/components/Table';
import { isAuth } from '/@/utils/auth/isAuth';
import UserDrawer from './UserDrawer.vue';
import UserRecycleBinModal from './UserRecycleBinModal.vue';
import PasswordModal from './PasswordModal.vue';
......@@ -321,31 +320,20 @@
* 操作栏
*/
function getTableAction(record): ActionItem[] {
if (isAuth('system:user:edit')) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
// ifShow: () => hasPermission('system:user:edit'),
},
];
} else {
return [];
}
}
/**
* 下拉操作栏
*/
function getDropDownAction(record): ActionItem[] {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'system:user:edit',
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '密码',
//auth: 'user:changepwd',
onClick: handleChangePassword.bind(null, record.username),
auth: 'system:user:changepwd',
},
{
label: '删除',
......@@ -353,6 +341,7 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
auth: 'system:user:delete',
},
{
label: '冻结',
......@@ -361,6 +350,7 @@
title: '确定冻结吗?',
confirm: handleFrozen.bind(null, record, 2),
},
auth: 'system:user:frozenBatch',
},
{
label: '解冻',
......@@ -369,10 +359,12 @@
title: '确定解冻吗?',
confirm: handleFrozen.bind(null, record, 1),
},
auth: 'system:user:frozenBatch',
},
{
label: '代理人',
onClick: handleAgentSettings.bind(null, record.username),
auth: 'system:user:agent',
},
];
}
......
......@@ -26,7 +26,7 @@
</a-tree-select>
</template>
<template #tableTitle>
<a-button type="primary" @click="view"> 查看</a-button>
<a-button type="primary" @click="view" v-auth="'ywkz-kgpsxx-view'"> 查看</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" v-auth="'ywkz-kgpsxx-dc'" @click="onExportXls"> 导出</a-button>
</template>
</BasicTable>
......
......@@ -30,7 +30,7 @@
</template>
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-auth="'supervise:export'"> 导出</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
......
......@@ -23,8 +23,6 @@
import { columns, searchFormSchema } from './components/data';
import { getDkhcsList, getExportUrl } from './components/api';
import { useModal } from '/@/components/Modal';
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
//注册model
const [registerModal, { openModal }] = useModal();
//注册table数据
......@@ -74,7 +72,7 @@
{
label: '核实',
onClick: handleEdit.bind(null, record),
ifShow: () => hasPermission('xcjd:xchsqk:hs'),
auth: 'xcjd:xchsqk:hs',
},
];
}
......
......@@ -30,9 +30,6 @@
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './api';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
//按钮权限问题
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
//注册model
const [registerModal, { openModal }] = useModal();
const [registerKeyModal, { openModal: openKeyModal }] = useModal();
......@@ -109,7 +106,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
ifShow: () => hasPermission('ggxjk-edit'),
auth: 'ggxjk-edit',
},
{
label: '删除',
......@@ -117,7 +114,7 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
ifShow: () => hasPermission('ggxjk-delete'),
auth: 'ggxjk-delete',
},
];
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论