提交 5beefbbe 作者: 郁骅焌

配置修改

上级 84971b19
......@@ -5,5 +5,5 @@
NODE_ENV=development
# api接口地址
VITE_APP_BASE_URL='http://139.196.169.103:9003'
# VITE_APP_BASE_URL=''
# VITE_APP_BASE_URL='http://139.196.169.103:9003'
VITE_APP_BASE_URL=''
VITE_APP_SECRET_KEY=VkQo3+ADe3lTpoSUyyEbaVyME6mOq8Q+6JIEteEleaea7kmQTgnk68JuPAtWTgAsGoCU2uQMo4rmREvsTw/DN1E+OLY2UWUXz2WgJ3MapTEgDGrjEfKHn9Hr+C8zHbZxXrWnHWGuf73MUtkvxsdKhrouAeHTCI6cSTmiH5mt1zIxP63hb5ojP9cudqjGSiG/q4oZFcYoUuPilQz9OIv0xIpgLPaJvRAF7Vw45wRfHp3hIRbIksLlwxZlgecVpq69pYb3nyQ0dscV6DsTXz5walkN29Cf2wG/8WzKcMBI4fO6bFHwbqsP33+l+xefkkTC0a+124Pi8xcAZiiF/VQOrQ==
......@@ -5,8 +5,8 @@ node_modules
/dev-dist
# local env files
.env.local
.env.*.local
# .env.local
# .env.*.local
# Log files
logs
......
......@@ -74,7 +74,7 @@ const handleClearNotice = () => {
}
onBeforeMount(() => {
if (theme.value.showNotice) fetchData()
// if (theme.value.showNotice) fetchData()
})
</script>
......
......@@ -38,13 +38,15 @@ defineOptions({
.el-form-item:first-child {
margin: 0 0 calc(var(--el-margin) / 2) 0 !important;
margin-right: 12px !important;
}
.el-form-item + .el-form-item {
margin: 0 0 calc(var(--el-margin) / 2) 0 !important;
margin-right: 12px !important;
.el-button {
margin: 0 0 0 10px !important;
// margin: 0 0 0 10px !important;
}
}
......
.table-operation-button {
display: flex;
align-items: center;
justify-content: center;
}
......@@ -10,6 +10,7 @@
@use './technology' as *;
@use 'vsv-icon/dist/style.css' as *;
@use './var' as *;
@use './custom.scss' as *;
@mixin base-scrollbar {
&::-webkit-scrollbar {
......@@ -187,7 +188,7 @@ html {
&.el-form--inline.el-form--label-right {
.el-form-item:not(:first-child) {
.el-form-item__label {
margin-left: 10px;
// margin-left: 10px;
}
}
}
......@@ -609,7 +610,7 @@ html {
margin-right: 30px;
.el-form-item:last-child {
margin-bottom: 0;
// margin-bottom: 0;
}
.el-date-editor,
......
......@@ -99,4 +99,62 @@ export default [
}
},
},
{
url: '/system/dept/treeselect',
method: 'get',
response: () => {
return {
code: 200,
msg: 'success',
data: [
{
id: 100,
label: '若依科技',
children: [
{
id: 101,
label: '深圳总公司',
children: [
{
id: 103,
label: '研发部门',
},
{
id: 104,
label: '市场部门',
},
{
id: 105,
label: '测试部门',
},
{
id: 106,
label: '财务部门',
},
{
id: 107,
label: '运维部门',
},
],
},
{
id: 102,
label: '长沙分公司',
children: [
{
id: 108,
label: '市场部门',
},
{
id: 109,
label: '财务部门',
},
],
},
],
},
],
}
},
},
] as MockMethod[]
......@@ -29,7 +29,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '看板',
icon: 'dashboard-2-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -39,7 +39,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '创作中心',
icon: 'ancient-gate-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -50,7 +50,7 @@ const list: VabRouteRecord[] = [
title: '实时监控',
icon: 'vidicon-2-line',
dot: true,
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -60,7 +60,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '磁贴',
icon: 'collage-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -70,7 +70,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '独立布局',
icon: 'layout-masonry-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -82,7 +82,7 @@ const list: VabRouteRecord[] = [
icon: 'database-2-line',
target: '_blank',
badge: 'Hot',
guard: ['Admin'],
guard: ['admin'],
},
},
// {
......@@ -104,7 +104,7 @@ const list: VabRouteRecord[] = [
icon: 'apps-2-line',
noKeepAlive: true,
dot: true,
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -116,7 +116,7 @@ const list: VabRouteRecord[] = [
icon: 'file-word-line',
noKeepAlive: true,
badge: '99+',
guard: ['Admin'],
guard: ['admin'],
},
},
],
......@@ -128,7 +128,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '组件',
icon: 'code-box-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -257,7 +257,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/list/index.vue',
meta: {
title: '列表',
guard: ['Admin'],
guard: ['admin'],
icon: 'list-check-2',
},
},
......@@ -268,7 +268,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '编辑器',
icon: 'edit-box-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -277,7 +277,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/editor/wangEditor.vue',
meta: {
title: '富文本',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -286,7 +286,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/editor/mdEditor.vue',
meta: {
title: 'Markdown',
guard: ['Admin'],
guard: ['admin'],
},
},
],
......@@ -296,7 +296,7 @@ const list: VabRouteRecord[] = [
name: 'Form',
meta: {
title: '表单',
guard: ['Admin'],
guard: ['admin'],
icon: 'file-list-2-line',
},
children: [
......@@ -447,7 +447,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/description/index.vue',
meta: {
title: '描述',
guard: ['Admin'],
guard: ['admin'],
icon: 'slideshow-line',
},
},
......@@ -457,7 +457,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/tree/index.vue',
meta: {
title: '树',
guard: ['Admin'],
guard: ['admin'],
icon: 'node-tree',
},
},
......@@ -468,7 +468,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '上传',
icon: 'upload-cloud-2-line',
guard: ['Admin'],
guard: ['admin'],
dot: true,
},
},
......@@ -478,7 +478,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/notice/index.vue',
meta: {
title: '通知',
guard: ['Admin'],
guard: ['admin'],
icon: 'message-2-line',
},
},
......@@ -488,7 +488,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/progress/index.vue',
meta: {
title: '进度条',
guard: ['Admin'],
guard: ['admin'],
icon: 'footprint-line',
},
},
......@@ -498,7 +498,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/timeline/index.vue',
meta: {
title: '时间线',
guard: ['Admin'],
guard: ['admin'],
icon: 'time-line',
},
},
......@@ -508,7 +508,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/statistic/index.vue',
meta: {
title: '统计',
guard: ['Admin'],
guard: ['admin'],
icon: 'bar-chart-2-line',
},
},
......@@ -518,7 +518,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/segmented/index.vue',
meta: {
title: '分段控制器',
guard: ['Admin'],
guard: ['admin'],
icon: 'carousel-view',
dot: true,
},
......@@ -529,7 +529,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/image/index.vue',
meta: {
title: '图片',
guard: ['Admin'],
guard: ['admin'],
icon: 'image-2-line',
},
},
......@@ -539,7 +539,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/infiniteScroll/index.vue',
meta: {
title: '无限滚动',
guard: ['Admin'],
guard: ['admin'],
icon: 'align-vertically',
},
},
......@@ -549,7 +549,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/drawer/index.vue',
meta: {
title: '抽屉',
guard: ['Admin'],
guard: ['admin'],
icon: 'archive-drawer-line',
},
},
......@@ -559,7 +559,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/vab/carousel/index.vue',
meta: {
title: '走马灯',
guard: ['Admin'],
guard: ['admin'],
icon: 'switch-fill',
},
},
......@@ -590,7 +590,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '其他',
icon: 'archive-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -599,7 +599,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/echarts/index.vue',
meta: {
title: '图表',
guard: ['Admin'],
guard: ['admin'],
icon: 'bubble-chart-line',
noKeepAlive: true,
},
......@@ -610,7 +610,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/gantt/index.vue',
meta: {
title: '甘特图',
guard: ['Admin'],
guard: ['admin'],
icon: 'organization-chart',
},
},
......@@ -620,7 +620,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/video/index.vue',
meta: {
title: '视频播放器',
guard: ['Admin'],
guard: ['admin'],
icon: 'video-line',
dot: true,
},
......@@ -631,7 +631,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/workflow/index.vue',
meta: {
title: '工作流',
guard: ['Admin'],
guard: ['admin'],
icon: 'flow-chart',
},
},
......@@ -641,7 +641,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/sliderVerify/index.vue',
meta: {
title: '滑块验证码',
guard: ['Admin'],
guard: ['admin'],
icon: 'shield-check-line',
},
},
......@@ -651,7 +651,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/pdf/index.vue',
meta: {
title: 'Pdf',
guard: ['Admin'],
guard: ['admin'],
icon: 'file-pdf-line',
},
},
......@@ -661,7 +661,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/print/index.vue',
meta: {
title: '打印',
guard: ['Admin'],
guard: ['admin'],
icon: 'printer-line',
},
},
......@@ -671,7 +671,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/crop/index.vue',
meta: {
title: '裁剪',
guard: ['Admin'],
guard: ['admin'],
icon: 'crop-line',
badge: 'New',
},
......@@ -692,7 +692,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/count/index.vue',
meta: {
title: '数字自增长',
guard: ['Admin'],
guard: ['admin'],
icon: 'number-0',
},
},
......@@ -702,7 +702,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/magnifier/index.vue',
meta: {
title: '放大镜',
guard: ['Admin'],
guard: ['admin'],
icon: 'search-2-line',
},
},
......@@ -713,7 +713,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '签名',
icon: 'edit-2-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -722,7 +722,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/watermark/index.vue',
meta: {
title: '水印',
guard: ['Admin'],
guard: ['admin'],
icon: 'water-flash-line',
badge: 'New',
},
......@@ -733,7 +733,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/share/index.vue',
meta: {
title: '分享',
guard: ['Admin'],
guard: ['admin'],
icon: 'share-line',
dot: true,
},
......@@ -744,7 +744,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/paneSplit/index.vue',
meta: {
title: '面板分割',
guard: ['Admin'],
guard: ['admin'],
icon: 'split-cells-horizontal',
},
},
......@@ -781,7 +781,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/noLayout/index.vue',
meta: {
title: '全屏',
guard: ['Admin'],
guard: ['admin'],
icon: 'aspect-ratio-line',
dot: true,
fullscreen: true,
......@@ -793,7 +793,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/other/fixedWidth/index.vue',
meta: {
title: '定宽',
guard: ['Admin'],
guard: ['admin'],
icon: 'picture-in-picture-fill',
dot: true,
},
......@@ -804,7 +804,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '外链',
target: '_blank',
guard: ['Admin', 'Editor'],
guard: ['admin', 'Editor'],
icon: 'external-link-line',
},
},
......@@ -813,7 +813,7 @@ const list: VabRouteRecord[] = [
name: 'Iframe',
meta: {
title: '内嵌网页',
guard: ['Admin'],
guard: ['admin'],
icon: 'window-line',
},
children: [
......@@ -864,7 +864,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/tabs/index.vue',
meta: {
title: '多标签',
guard: ['Admin'],
guard: ['admin'],
icon: 'bank-card-line',
},
},
......@@ -874,7 +874,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/dynamicMeta/index.vue',
meta: {
title: '动态Meta',
guard: ['Admin'],
guard: ['admin'],
icon: 'notification-badge-line',
badge: '0',
},
......@@ -885,7 +885,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/guid/index.vue',
meta: {
title: '页面引导',
guard: ['Admin'],
guard: ['admin'],
icon: 'guide-line',
dot: true,
},
......@@ -896,7 +896,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/contextMenu/index.vue',
meta: {
title: '右键菜单',
guard: ['Admin'],
guard: ['admin'],
icon: 'align-right',
dot: true,
},
......@@ -907,7 +907,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/dialog/index.vue',
meta: {
title: '弹窗',
guard: ['Admin'],
guard: ['admin'],
icon: 'airplay-line',
badge: 'Hot',
},
......@@ -918,7 +918,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/anchor/index.vue',
meta: {
title: '锚点',
guard: ['Admin'],
guard: ['admin'],
icon: 'anchor-line',
},
},
......@@ -928,7 +928,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/randomTheme/index.vue',
meta: {
title: '随机换肤',
guard: ['Admin'],
guard: ['admin'],
icon: 'ai-generate',
},
},
......@@ -938,7 +938,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/throttleDebounce/index.vue',
meta: {
title: '节流防抖',
guard: ['Admin'],
guard: ['admin'],
icon: 'water-percent-line',
},
},
......@@ -948,7 +948,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/webSocket/index.vue',
meta: {
title: 'WebSocket',
guard: ['Admin'],
guard: ['admin'],
icon: 'microsoft-loop-line',
badge: 'New',
},
......@@ -959,7 +959,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/operate/errorLog/index.vue',
meta: {
title: '错误日志',
guard: ['Admin'],
guard: ['admin'],
icon: 'error-warning-line',
},
},
......@@ -968,7 +968,7 @@ const list: VabRouteRecord[] = [
name: 'DynamicSegment',
meta: {
title: '动态传参',
guard: ['Admin'],
guard: ['admin'],
icon: 'arrow-left-right-line',
},
children: [
......@@ -1023,7 +1023,7 @@ const list: VabRouteRecord[] = [
name: 'Menu1',
meta: {
title: '多级路由缓存',
guard: ['Admin'],
guard: ['admin'],
icon: 'route-line',
},
children: [
......@@ -1064,7 +1064,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '模板',
icon: 'clipboard-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1142,7 +1142,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/template/PasswordGenerator.vue',
meta: {
title: '密码生成器',
guard: ['Admin'],
guard: ['admin'],
icon: 'lock-password-line',
},
},
......@@ -1152,7 +1152,7 @@ const list: VabRouteRecord[] = [
component: '/@/views/template/RegularExpression.vue',
meta: {
title: '正则校验',
guard: ['Admin'],
guard: ['admin'],
icon: 'file-copy-2-line',
},
},
......@@ -1201,7 +1201,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '配置',
icon: 'user-settings-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1316,7 +1316,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '单栏',
icon: 'delete-column',
guard: ['Admin'],
guard: ['admin'],
levelHidden: true,
breadcrumbHidden: true,
},
......@@ -1340,7 +1340,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '商品',
icon: 'shopping-bag-3-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1456,7 +1456,7 @@ const list: VabRouteRecord[] = [
meta: {
title: 'GPT',
icon: 'chat-1-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1551,7 +1551,7 @@ const list: VabRouteRecord[] = [
title: '门户',
icon: 'building-line',
target: '_blank',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -1578,7 +1578,7 @@ const list: VabRouteRecord[] = [
meta: {
title: '外链',
target: '_blank',
guard: ['Admin'],
guard: ['admin'],
icon: 'external-link-line',
},
},
......@@ -1595,7 +1595,7 @@ const list: VabRouteRecord[] = [
export default [
{
url: '/router/getList',
url: '/getRoutersNew',
method: 'get',
response() {
return {
......
......@@ -7,12 +7,12 @@ const tokens: { [key: string]: string } = {
test: `test-token-${Random.guid()}-${Date.now()}`,
}
const username2role: { [key: string]: string[] } = {
admin: ['Admin'],
admin: ['admin'],
editor: ['Editor'],
test: ['Admin', 'Editor'],
test: ['admin', 'Editor'],
}
const role2permission: { [key: string]: string[] } = {
Admin: ['read:system', 'write:system', 'delete:system'],
admin: ['read:system', 'write:system', 'delete:system'],
Editor: ['read:system', 'write:system'],
Test: ['read:system'],
}
......@@ -35,7 +35,7 @@ export default [
},
},
{
url: '/login',
url: '/loginNew',
method: 'post',
response({ body }: any) {
const { username } = body
......@@ -75,7 +75,7 @@ export default [
},
},
{
url: '/userInfo',
url: '/getInfoNew',
method: 'get',
response(request: any) {
const authorization = request.headers.authorization || request.headers.Authorization
......@@ -103,7 +103,7 @@ export default [
},
{
url: '/logout',
method: 'get',
method: 'post',
response() {
return {
code: 200,
......
......@@ -2,28 +2,92 @@ import type { MockMethod } from 'vite-plugin-mock'
const List = [
{
id: '@id',
username: 'admin',
password: 'admin',
email: '@email',
roles: ['admin'],
datetime: '@datetime',
},
{
id: '@id',
username: 'editor',
password: 'editor',
email: '@email',
roles: ['editor'],
datetime: '@datetime',
createBy: 'admin',
createTime: '2024-12-03 02:42:51',
updateBy: null,
updateTime: null,
remark: '管理员',
userId: 1,
deptId: 103,
userName: 'admin',
nickName: '若依',
email: 'ry@163.com',
phonenumber: '15888888888',
sex: '1',
avatar: '',
password: null,
status: '0',
delFlag: '0',
loginIp: '127.0.0.1',
loginDate: '2024-12-12T06:59:14.000+00:00',
dept: {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
deptId: 103,
parentId: null,
ancestors: null,
deptName: '研发部门',
orderNum: null,
leader: '若依',
phone: null,
email: null,
status: null,
delFlag: null,
parentName: null,
children: [],
},
roles: [],
roleIds: null,
postIds: null,
roleId: null,
admin: true,
},
{
id: '@id',
username: 'test',
password: 'test',
email: '@email',
roles: ['admin', 'editor'],
datetime: '@datetime',
createBy: 'admin',
createTime: '2024-12-03 02:42:51',
updateBy: null,
updateTime: null,
remark: '测试员',
userId: 2,
deptId: 105,
userName: 'ry',
nickName: '若依',
email: 'ry@qq.com',
phonenumber: '15666666666',
sex: '1',
avatar: '',
password: null,
status: '0',
delFlag: '0',
loginIp: '127.0.0.1',
loginDate: '2024-12-03T02:42:51.000+00:00',
dept: {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
deptId: 105,
parentId: null,
ancestors: null,
deptName: '测试部门',
orderNum: null,
leader: '若依',
phone: null,
email: null,
status: null,
delFlag: null,
parentName: null,
children: [],
},
roles: [],
roleIds: null,
postIds: null,
roleId: null,
admin: false,
},
]
......@@ -38,7 +102,9 @@ export default [
return {
code: 200,
msg: 'success',
data: { list, total: mockList.length },
// data: { list, total: mockList.length },
rows: list,
total: mockList.length,
}
},
},
......@@ -62,4 +128,91 @@ export default [
}
},
},
{
url: '/system/user/',
method: 'get',
response() {
return {
msg: '操作成功',
code: 200,
roles: [
{
createBy: null,
createTime: '2024-12-03 02:42:52',
updateBy: null,
updateTime: null,
remark: '普通角色',
roleId: 2,
roleName: '普通角色',
roleKey: 'common',
roleSort: 2,
dataScope: '2',
menuCheckStrictly: true,
deptCheckStrictly: true,
status: '0',
delFlag: '0',
flag: false,
menuIds: null,
deptIds: null,
permissions: null,
admin: false,
},
],
posts: [
{
createBy: 'admin',
createTime: '2024-12-03 02:42:52',
updateBy: null,
updateTime: null,
remark: '',
postId: 1,
postCode: 'ceo',
postName: '董事长',
postSort: 1,
status: '0',
flag: false,
},
{
createBy: 'admin',
createTime: '2024-12-03 02:42:52',
updateBy: null,
updateTime: null,
remark: '',
postId: 2,
postCode: 'se',
postName: '项目经理',
postSort: 2,
status: '0',
flag: false,
},
{
createBy: 'admin',
createTime: '2024-12-03 02:42:52',
updateBy: null,
updateTime: null,
remark: '',
postId: 3,
postCode: 'hr',
postName: '人力资源',
postSort: 3,
status: '0',
flag: false,
},
{
createBy: 'admin',
createTime: '2024-12-03 02:42:52',
updateBy: null,
updateTime: null,
remark: '',
postId: 4,
postCode: 'user',
postName: '普通员工',
postSort: 4,
status: '0',
flag: false,
},
],
}
},
},
] as MockMethod[]
......@@ -23,3 +23,11 @@ export const doDelete = (data: any) => {
data,
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/system/dept/treeselect',
method: 'get',
})
}
......@@ -2,7 +2,7 @@ import request from '/@/utils/request'
export const getList = (params?: any) => {
return request({
url: '/router/getList',
url: '/getRoutersNew',
method: 'get',
params,
})
......
......@@ -14,7 +14,7 @@ interface FormType {
export const login = async (data: any) => {
if (loginRSA) data = { ...data, password: await encryptedData(data) }
return request({
url: '/login',
url: '/loginNew',
method: 'post',
data,
})
......@@ -22,7 +22,7 @@ export const login = async (data: any) => {
export const getUserInfo = () => {
return request({
url: '/userInfo',
url: '/getInfoNew',
method: 'get',
})
}
......@@ -30,7 +30,7 @@ export const getUserInfo = () => {
export const logout = () => {
return request({
url: '/logout',
method: 'get',
method: 'post',
})
}
......
import { parseStrEmpty } from '/@/utils/index'
import request from '/@/utils/request'
export function getList(params?: any) {
......@@ -23,3 +24,11 @@ export const doDelete = (data: any) => {
data,
})
}
// 查询用户详细
export function getUser(userId: any) {
return request({
url: `/system/user/${parseStrEmpty(userId)}`,
method: 'get',
})
}
......@@ -42,7 +42,7 @@ export const cliConfig: { [key: string]: string | number | boolean | Array<strin
// 开启打包分析
report: false,
// 禁止在生产环境下使用调试
disableDebugger: true,
disableDebugger: false,
// 是否关闭路由[Vue Router warn]: No match found for location with path "/*"报黄,
// 注意事项一旦关闭,路由出错后将无法在控制台检查到原因
disableRouterWarning: false,
......
......@@ -46,11 +46,11 @@ export const settingConfig: {
// 是否开启登录RSA加密
loginRSA: false,
// intelligence(前端导出路由)和all(后端导出路由)两种方式
authentication: 'intelligence',
authentication: 'all',
// 是否支持游客模式,支持情况下,访问白名单,可查看所有asyncRoutes
supportVisit: false,
// 是否开启roles字段进行角色权限控制(如果是all模式后端完全处理角色并进行json组装,可设置false不处理路由中的roles字段)
rolesControl: true,
rolesControl: false,
// vertical column comprehensive common布局时是否只保持一个子菜单的展开
uniqueOpened: false,
// vertical column comprehensive common布局时默认展开的菜单path,使用逗号隔开建议只展开一个
......
......@@ -37,7 +37,7 @@ export const themeConfig: ThemeType = {
//是否开启主题组件
showTheme: true,
//是否开启通知组件
showNotice: true,
showNotice: false,
//是否开启全屏组件
showFullScreen: true,
//是否开启右侧悬浮窗
......
import * as components from '@element-plus/icons-vue'
export default {
install: (app) => {
for (const key in components) {
const componentConfig = components[key];
app.component(componentConfig.name, componentConfig);
}
},
};
......@@ -4,11 +4,21 @@ import { setupI18n } from '/@/i18n'
import { setupRouter } from '/@/router'
import { setupStore } from '/@/store'
// 全局方法
import { addDateRange, resetForm } from '/@/utils/index'
// svg图标
import elementIcons from '/@/icon/elementIcon'
const app = createApp(App)
// 全局方法挂载
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.addDateRange = addDateRange
setupVab(app)
setupI18n(app)
setupStore(app)
setupRouter(app)
app.use(elementIcons)
app.mount('#app')
......@@ -90,7 +90,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '配置',
icon: 'user-settings-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -206,7 +206,7 @@ export const asyncRoutes: VabRouteRecord[] = [
// meta: {
// title: '单栏',
// icon: 'delete-column',
// guard: ['Admin'],
// guard: ['admin'],
// levelHidden: true,
// breadcrumbHidden: true,
// },
......
......@@ -87,7 +87,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '看板',
icon: 'dashboard-2-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -97,7 +97,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '创作中心',
icon: 'ancient-gate-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -108,7 +108,7 @@ export const asyncRoutes: VabRouteRecord[] = [
title: '实时监控',
icon: 'vidicon-2-line',
dot: 'success',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -118,7 +118,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '磁贴',
icon: 'collage-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -128,7 +128,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '独立布局',
icon: 'layout-masonry-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -140,7 +140,7 @@ export const asyncRoutes: VabRouteRecord[] = [
icon: 'database-2-line',
target: '_blank',
badge: 'Hot',
guard: ['Admin'],
guard: ['admin'],
},
},
// {
......@@ -162,7 +162,7 @@ export const asyncRoutes: VabRouteRecord[] = [
icon: 'apps-2-line',
noKeepAlive: true,
dot: true,
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -174,7 +174,7 @@ export const asyncRoutes: VabRouteRecord[] = [
icon: 'file-word-line',
noKeepAlive: true,
badge: '99+',
guard: ['Admin'],
guard: ['admin'],
},
},
],
......@@ -186,7 +186,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '组件',
icon: 'code-box-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -315,7 +315,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/list/index.vue'),
meta: {
title: '列表',
guard: ['Admin'],
guard: ['admin'],
icon: 'list-check-2',
},
},
......@@ -326,7 +326,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '编辑器',
icon: 'edit-box-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -335,7 +335,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/editor/wangEditor.vue'),
meta: {
title: '富文本',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -344,7 +344,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/editor/mdEditor.vue'),
meta: {
title: 'Markdown',
guard: ['Admin'],
guard: ['admin'],
},
},
],
......@@ -354,7 +354,7 @@ export const asyncRoutes: VabRouteRecord[] = [
name: 'Form',
meta: {
title: '表单',
guard: ['Admin'],
guard: ['admin'],
icon: 'file-list-2-line',
},
children: [
......@@ -505,7 +505,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/description/index.vue'),
meta: {
title: '描述',
guard: ['Admin'],
guard: ['admin'],
icon: 'slideshow-line',
},
},
......@@ -515,7 +515,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/tree/index.vue'),
meta: {
title: '树',
guard: ['Admin'],
guard: ['admin'],
icon: 'node-tree',
},
},
......@@ -526,7 +526,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '上传',
icon: 'upload-cloud-2-line',
guard: ['Admin'],
guard: ['admin'],
dot: true,
},
},
......@@ -536,7 +536,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/notice/index.vue'),
meta: {
title: '通知',
guard: ['Admin'],
guard: ['admin'],
icon: 'message-2-line',
},
},
......@@ -546,7 +546,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/progress/index.vue'),
meta: {
title: '进度条',
guard: ['Admin'],
guard: ['admin'],
icon: 'footprint-line',
},
},
......@@ -556,7 +556,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/timeline/index.vue'),
meta: {
title: '时间线',
guard: ['Admin'],
guard: ['admin'],
icon: 'time-line',
},
},
......@@ -566,7 +566,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/statistic/index.vue'),
meta: {
title: '统计',
guard: ['Admin'],
guard: ['admin'],
icon: 'bar-chart-2-line',
},
},
......@@ -576,7 +576,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/segmented/index.vue'),
meta: {
title: '分段控制器',
guard: ['Admin'],
guard: ['admin'],
icon: 'carousel-view',
dot: true,
},
......@@ -587,7 +587,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/image/index.vue'),
meta: {
title: '图片',
guard: ['Admin'],
guard: ['admin'],
icon: 'image-2-line',
},
},
......@@ -597,7 +597,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/infiniteScroll/index.vue'),
meta: {
title: '无限滚动',
guard: ['Admin'],
guard: ['admin'],
icon: 'align-vertically',
},
},
......@@ -607,7 +607,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/drawer/index.vue'),
meta: {
title: '抽屉',
guard: ['Admin'],
guard: ['admin'],
icon: 'archive-drawer-line',
},
},
......@@ -617,7 +617,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/vab/carousel/index.vue'),
meta: {
title: '走马灯',
guard: ['Admin'],
guard: ['admin'],
icon: 'switch-fill',
},
},
......@@ -648,7 +648,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '其他',
icon: 'archive-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -657,7 +657,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/echarts/index.vue'),
meta: {
title: '图表',
guard: ['Admin'],
guard: ['admin'],
icon: 'bubble-chart-line',
noKeepAlive: true,
},
......@@ -668,7 +668,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/gantt/index.vue'),
meta: {
title: '甘特图',
guard: ['Admin'],
guard: ['admin'],
icon: 'organization-chart',
},
},
......@@ -678,7 +678,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/video/index.vue'),
meta: {
title: '视频播放器',
guard: ['Admin'],
guard: ['admin'],
icon: 'video-line',
dot: 'warning',
},
......@@ -689,7 +689,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/workflow/index.vue'),
meta: {
title: '工作流',
guard: ['Admin'],
guard: ['admin'],
icon: 'flow-chart',
},
},
......@@ -699,7 +699,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/sliderVerify/index.vue'),
meta: {
title: '滑块验证码',
guard: ['Admin'],
guard: ['admin'],
icon: 'shield-check-line',
},
},
......@@ -709,7 +709,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/pdf/index.vue'),
meta: {
title: 'Pdf',
guard: ['Admin'],
guard: ['admin'],
icon: 'file-pdf-line',
},
},
......@@ -719,7 +719,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/print/index.vue'),
meta: {
title: '打印',
guard: ['Admin'],
guard: ['admin'],
icon: 'printer-line',
},
},
......@@ -729,7 +729,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/crop/index.vue'),
meta: {
title: '裁剪',
guard: ['Admin'],
guard: ['admin'],
icon: 'crop-line',
badge: 'New',
},
......@@ -750,7 +750,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/count/index.vue'),
meta: {
title: '数字自增长',
guard: ['Admin'],
guard: ['admin'],
icon: 'number-0',
},
},
......@@ -760,7 +760,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/magnifier/index.vue'),
meta: {
title: '放大镜',
guard: ['Admin'],
guard: ['admin'],
icon: 'search-2-line',
},
},
......@@ -771,7 +771,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '签名',
icon: 'edit-2-line',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -780,7 +780,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/watermark/index.vue'),
meta: {
title: '水印',
guard: ['Admin'],
guard: ['admin'],
icon: 'water-flash-line',
badge: 'New',
badgeType: 'warning',
......@@ -792,7 +792,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/share/index.vue'),
meta: {
title: '分享',
guard: ['Admin'],
guard: ['admin'],
icon: 'share-line',
dot: true,
},
......@@ -803,7 +803,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/paneSplit/index.vue'),
meta: {
title: '面板分割',
guard: ['Admin'],
guard: ['admin'],
icon: 'split-cells-horizontal',
},
},
......@@ -840,7 +840,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/noLayout/index.vue'),
meta: {
title: '全屏',
guard: ['Admin'],
guard: ['admin'],
icon: 'aspect-ratio-line',
dot: true,
fullscreen: true,
......@@ -852,7 +852,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/other/fixedWidth/index.vue'),
meta: {
title: '定宽',
guard: ['Admin'],
guard: ['admin'],
icon: 'picture-in-picture-fill',
dot: true,
},
......@@ -863,7 +863,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '外链',
target: '_blank',
guard: ['Admin', 'Editor'],
guard: ['admin', 'Editor'],
icon: 'external-link-line',
},
},
......@@ -872,7 +872,7 @@ export const asyncRoutes: VabRouteRecord[] = [
name: 'Iframe',
meta: {
title: '内嵌网页',
guard: ['Admin'],
guard: ['admin'],
icon: 'window-line',
},
children: [
......@@ -923,7 +923,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/tabs/index.vue'),
meta: {
title: '多标签',
guard: ['Admin'],
guard: ['admin'],
icon: 'bank-card-line',
},
},
......@@ -933,7 +933,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/dynamicMeta/index.vue'),
meta: {
title: '动态Meta',
guard: ['Admin'],
guard: ['admin'],
icon: 'notification-badge-line',
badge: '0',
badgeType: 'success',
......@@ -945,7 +945,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/guid/index.vue'),
meta: {
title: '页面引导',
guard: ['Admin'],
guard: ['admin'],
icon: 'guide-line',
dot: true,
},
......@@ -956,7 +956,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/contextMenu/index.vue'),
meta: {
title: '右键菜单',
guard: ['Admin'],
guard: ['admin'],
icon: 'align-right',
dot: true,
},
......@@ -967,7 +967,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/scrollTop/index.vue'),
meta: {
title: '滚动条位置记录',
guard: ['Admin'],
guard: ['admin'],
icon: 'scroll-to-bottom-line',
dot: true,
},
......@@ -979,7 +979,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/dialog/index.vue'),
meta: {
title: '弹窗',
guard: ['Admin'],
guard: ['admin'],
icon: 'airplay-line',
badge: 'Hot',
},
......@@ -990,7 +990,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/anchor/index.vue'),
meta: {
title: '锚点',
guard: ['Admin'],
guard: ['admin'],
icon: 'anchor-line',
},
},
......@@ -1000,7 +1000,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/randomTheme/index.vue'),
meta: {
title: '随机换肤',
guard: ['Admin'],
guard: ['admin'],
icon: 'ai-generate',
},
},
......@@ -1010,7 +1010,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/throttleDebounce/index.vue'),
meta: {
title: '节流防抖',
guard: ['Admin'],
guard: ['admin'],
icon: 'water-percent-line',
},
},
......@@ -1020,7 +1020,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/webSocket/index.vue'),
meta: {
title: 'WebSocket',
guard: ['Admin'],
guard: ['admin'],
icon: 'microsoft-loop-line',
badge: 'New',
},
......@@ -1031,7 +1031,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/operate/errorLog/index.vue'),
meta: {
title: '错误日志',
guard: ['Admin'],
guard: ['admin'],
icon: 'error-warning-line',
},
},
......@@ -1040,7 +1040,7 @@ export const asyncRoutes: VabRouteRecord[] = [
name: 'DynamicSegment',
meta: {
title: '动态传参',
guard: ['Admin'],
guard: ['admin'],
icon: 'arrow-left-right-line',
},
children: [
......@@ -1095,7 +1095,7 @@ export const asyncRoutes: VabRouteRecord[] = [
name: 'Menu1',
meta: {
title: '多级路由缓存',
guard: ['Admin'],
guard: ['admin'],
icon: 'route-line',
},
children: [
......@@ -1136,7 +1136,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '模板',
icon: 'clipboard-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1215,7 +1215,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/template/PasswordGenerator.vue'),
meta: {
title: '密码生成器',
guard: ['Admin'],
guard: ['admin'],
icon: 'lock-password-line',
},
},
......@@ -1225,7 +1225,7 @@ export const asyncRoutes: VabRouteRecord[] = [
component: () => import('/@/views/template/RegularExpression.vue'),
meta: {
title: '正则校验',
guard: ['Admin'],
guard: ['admin'],
icon: 'file-copy-2-line',
},
},
......@@ -1274,7 +1274,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '配置',
icon: 'user-settings-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1389,7 +1389,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '单栏',
icon: 'delete-column',
guard: ['Admin'],
guard: ['admin'],
levelHidden: true,
breadcrumbHidden: true,
},
......@@ -1413,7 +1413,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '商品',
icon: 'shopping-bag-3-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1529,7 +1529,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: 'GPT',
icon: 'chat-1-line',
guard: ['Admin'],
guard: ['admin'],
},
children: [
{
......@@ -1624,7 +1624,7 @@ export const asyncRoutes: VabRouteRecord[] = [
title: '门户',
icon: 'building-line',
target: '_blank',
guard: ['Admin'],
guard: ['admin'],
},
},
{
......@@ -1651,7 +1651,7 @@ export const asyncRoutes: VabRouteRecord[] = [
meta: {
title: '外链',
target: '_blank',
guard: ['Admin'],
guard: ['admin'],
icon: 'external-link-line',
},
},
......
......@@ -7,7 +7,7 @@ import { useTabsStore } from './tabs'
import { getUserInfo, login, logout } from '/@/api/user'
import { tokenName } from '/@/config'
import { getToken, removeToken, setToken } from '/@/utils/token'
import { isArray, isString } from '/@/utils/validate'
import { isArray } from '/@/utils/validate'
import { gp } from '/@vab/plugins/vab'
export const useUserStore = defineStore('user', {
......@@ -30,6 +30,10 @@ export const useUserStore = defineStore('user', {
this.token = token
setToken(token)
},
setUser(user: any) {
this.username = user.userName
this.avatar = user.avatar || './static/svg/avatar.svg'
},
/**
* @description 设置用户名
* @param {*} username
......@@ -87,30 +91,25 @@ export const useUserStore = defineStore('user', {
*/
async getUserInfo() {
const {
data: { username, avatar, roles, permissions },
data: { user, roles, permissions },
} = await getUserInfo()
/**
* 检验返回数据是否正常,无对应参数,将使用默认用户名,头像,Roles和Permissions
* username {String}
* avatar {String}
* user {Object}
* roles {List}
* ability {List}
*/
if (
(username && !isString(username)) ||
(avatar && !isString(avatar)) ||
(roles && !isArray(roles)) ||
(permissions && !isArray(permissions))
) {
if ((user && Object.keys(user).length === 0) || (roles && !isArray(roles)) || (permissions && !isArray(permissions))) {
const err = 'getUserInfo核心接口异常,请检查返回JSON格式是否正确'
gp.$baseMessage(err, 'error', 'hey')
throw err
} else {
const aclStore = useAclStore()
// 如不使用username用户名,可删除以下代码
if (username) this.setUsername(username)
// if (username) this.setUsername(username)
// 如不使用avatar头像,可删除以下代码
if (avatar) this.setAvatar(avatar)
// if (avatar) this.setAvatar(avatar)
if (user) this.setUser(user)
// 如不使用roles权限控制,可删除以下代码
if (roles) aclStore.setRole(roles)
// 如不使用permissions权限控制,可删除以下代码
......
......@@ -210,3 +210,37 @@ export function moveElement(array: any, oldIndex: any, newIndex: any) {
array.splice(newIndex, 0, element)
return array
}
// 添加日期范围
export function addDateRange(params: any, dateRange: any, propName: string) {
let search = params
search.params = typeof search.params === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}
dateRange = Array.isArray(dateRange) ? dateRange : []
if (dateRange.length === 0) {
return search
}
if (propName === undefined) {
search.params['beginTime'] = dateRange[0]
search.params['endTime'] = dateRange[1]
} else {
search.params[`begin${propName}`] = dateRange[0]
search.params[`end${propName}`] = dateRange[1]
}
return search
}
// 表单重置
export function resetForm(refName: string) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields()
}
}
// 转换字符串,undefined,null等转化为""
export function parseStrEmpty(str: any) {
if (!str || str == 'undefined' || str == 'null') {
return ''
}
return str
}
......@@ -49,7 +49,7 @@
</el-button>
</router-link>
<div v-throttle="handleLogin" class="login-other hidden-xs-only">
<!-- <div v-throttle="handleLogin" class="login-other hidden-xs-only">
<vab-icon icon="wechat-fill" style="color: #08c25f" />
<vab-icon icon="alipay-fill" style="color: #226bf3" />
<vab-icon icon="dingding-fill" style="color: #007ef8" />
......@@ -57,7 +57,7 @@
<vab-icon icon="tiktok-fill" style="color: #000000" />
<vab-icon icon="weibo-fill" style="color: #df1e33" />
<vab-icon icon="github-fill" style="color: #151515" />
</div>
</div> -->
</el-form>
</div>
</login-container>
......
......@@ -41,12 +41,12 @@
</el-form-item>
<el-form-item label="RBAC 角色控制">
<el-space wrap>
<el-button v-permissions="['Admin']" type="primary">拥有["Admin"]的按钮</el-button>
<el-button v-permissions="{ role: ['Admin'], mode: 'except' }" type="danger">未拥有["Admin"]的按钮</el-button>
<el-button v-permissions="['admin']" type="primary">拥有["admin"]的按钮</el-button>
<el-button v-permissions="{ role: ['admin'], mode: 'except' }" type="danger">未拥有["admin"]的按钮</el-button>
<el-button v-permissions="['Editor']" type="primary">拥有["Editor"]的按钮</el-button>
<el-button v-permissions="{ role: ['Editor'], mode: 'except' }" type="danger">未拥有["Editor"]的按钮</el-button>
<el-button v-permissions="{ role: ['Admin', 'Editor'], mode: 'allOf' }" type="primary">
同时拥有["Admin","Editor"]的按钮
<el-button v-permissions="{ role: ['admin', 'Editor'], mode: 'allOf' }" type="primary">
同时拥有["admin","Editor"]的按钮
</el-button>
<el-button v-permissions="['Test']" type="primary">拥有["Test"]的按钮</el-button>
</el-space>
......@@ -66,8 +66,8 @@
</el-form-item>
<el-form-item label="RBAC 角色&权限点控制">
<el-space wrap>
<el-button v-permissions="{ role: ['Admin'], permission: ['delete:system'] }" type="primary">
拥有["Admin"]或["delete:system"]的按钮
<el-button v-permissions="{ role: ['admin'], permission: ['delete:system'] }" type="primary">
拥有["admin"]或["delete:system"]的按钮
</el-button>
<el-button
v-permissions="{
......@@ -81,24 +81,24 @@
</el-button>
<el-button
v-permissions="{
role: ['Admin'],
role: ['admin'],
permission: ['delete:system'],
mode: 'except',
}"
type="danger"
>
未拥有["Admin"]和["delete:system"]的按钮
未拥有["admin"]和["delete:system"]的按钮
</el-button>
</el-space>
</el-form-item>
<el-form-item label="RBAC 自定义按钮&表格列权限控制">
<!-- hasPermission()是更加底层的方法,它可以使用 v-permissions 自定义指令中的所有格式的参数,非必要不建议使用,表格列隐藏展示可能用到下述代码 -->
<el-button v-if="hasPermission(['Admin'])" type="primary">拥有["Admin"]的按钮</el-button>
<el-button v-if="hasPermission({ role: ['Admin'], mode: 'except' })" type="danger">未拥有["Admin"]的按钮</el-button>
<el-button v-if="hasPermission(['admin'])" type="primary">拥有["admin"]的按钮</el-button>
<el-button v-if="hasPermission({ role: ['admin'], mode: 'except' })" type="danger">未拥有["admin"]的按钮</el-button>
<el-table border :data="tableData" style="display: block; margin-top: var(--el-margin)">
<el-table-column v-if="hasPermission(['Admin'])" label="拥有['Admin']的表格列" prop="yes" />
<el-table-column v-if="hasPermission({ role: ['Admin'], mode: 'except' })" label="未拥有['Admin']的表格列" prop="no" />
<el-table-column v-if="hasPermission(['admin'])" label="拥有['admin']的表格列" prop="yes" />
<el-table-column v-if="hasPermission({ role: ['admin'], mode: 'except' })" label="未拥有['admin']的表格列" prop="no" />
</el-table>
</el-form-item>
<el-form-item label="后端code指令强制开启锁屏">
......
<template>
<div class="user-management-container auto-height-container">
<vab-query-form>
<vab-query-form-left-panel :span="12">
<el-button :icon="Plus" type="primary" @click="handleAdd">添加</el-button>
<el-button :icon="Delete" type="danger" @click="handleDelete">批量删除</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form inline :model="queryForm" @submit.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.username" clearable placeholder="请输入用户名" />
</el-form-item>
<el-form-item>
<el-button :icon="Search" :loading="listLoading" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table ref="tableRef" v-loading="listLoading" border :data="list" @selection-change="setSelectRows">
<el-table-column type="selection" width="38" />
<div class="column-table-container no-background-container auto-height-container" :class="{ 'fullscreen-container': isFullscreen }">
<el-row :gutter="20">
<el-col :lg="5" :md="24" :sm="24" :xl="4" :xs="24">
<vab-card class="auto-height-card">
<el-input v-model="deptName" clearable placeholder="请输入部门名称" prefix-icon="Search" style="margin-bottom: 10px" />
<el-tree
ref="deptTreeRef"
:data="deptOptions"
default-expand-all
:expand-on-click-node="false"
:filter-node-method="filterNode"
highlight-current
node-key="id"
:props="{ label: 'label', children: 'children' }"
@node-click="handleNodeClick"
/>
</vab-card>
</el-col>
<el-col :lg="19" :md="24" :sm="24" :xl="20" :xs="24">
<vab-card class="auto-height-card">
<vab-query-form>
<vab-query-form-top-panel>
<el-form ref="queryRef" inline :model="queryForm" @submit.prevent>
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryForm.userName"
clearable
placeholder="请输入用户名称"
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item v-show="!fold" label="手机号码" prop="phonenumber">
<el-input
v-model="queryForm.phonenumber"
clearable
placeholder="请输入手机号码"
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item v-show="!fold" label="状态" prop="status">
<el-select v-model="queryForm.status" clearable placeholder="用户状态" style="width: 240px">
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item v-show="!fold" label="创建时间" prop="dateRange" style="width: 308px">
<el-date-picker
v-model="queryForm.dateRange"
end-placeholder="结束日期"
range-separator="-"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item>
<el-button icon="Search" :loading="listLoading" native-type="submit" type="primary" @click="queryData">查询</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button class="hidden-xs-only" text type="primary" @click="handleFold">
<span v-if="fold">展开</span>
<span v-else>合并</span>
<vab-icon class="vab-dropdown" :class="{ 'vab-dropdown-active': fold }" icon="arrow-up-s-line" />
</el-button>
</el-form-item>
</el-form>
</vab-query-form-top-panel>
<vab-query-form-left-panel :span="20">
<el-button icon="Plus" type="primary" @click="handleAdd">添加</el-button>
<el-button icon="Delete" type="danger" @click="handleDelete">删除</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="4">
<div class="custom-table-right-tools">
<el-button @click="queryData">
<vab-icon icon="refresh-line" />
</el-button>
<el-button @click="clickFullScreen">
<vab-icon :icon="isFullscreen ? 'fullscreen-exit-fill' : 'fullscreen-fill'" />
</el-button>
</div>
</vab-query-form-right-panel>
</vab-query-form>
<el-table ref="tableRef" v-loading="listLoading" border :data="list" @selection-change="setSelectRows">
<!-- <el-table-column type="selection" width="38" />
<el-table-column align="center" label="序号" width="55">
<template #default="{ $index }">
{{ $index + 1 }}
</template>
</el-table-column>
<el-table-column align="center" label="id" min-width="180" prop="id" show-overflow-tooltip />
<el-table-column align="center" label="用户名" min-width="120" prop="username" />
<el-table-column align="center" label="用户编号" min-width="180" prop="userId" show-overflow-tooltip />
<el-table-column align="center" label="用户名称" min-width="120" prop="userName" />
<el-table-column align="center" label="用户昵称" min-width="120" prop="nickName" />
<el-table-column align="center" label="部门" min-width="120" prop="nickName" />
<el-table-column align="center" label="邮箱" min-width="120" prop="email" show-overflow-tooltip />
<el-table-column align="center" label="角色" min-width="155">
......@@ -45,53 +112,120 @@
<el-button text type="danger" @click="handleDelete(row)">删除</el-button>
</template>
</el-table-column>
<template #empty>
<el-empty class="vab-data-empty" description="暂无数据" />
</template>
</el-table>
<vab-pagination
:current-page="queryForm.pageNo"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<user-management-edit ref="editRef" @fetch-data="fetchData" />
</template> -->
<el-table-column align="center" type="selection" width="50" />
<el-table-column key="userId" align="center" label="用户编号" min-width="120" prop="userId" />
<el-table-column key="userName" align="center" label="用户名称" min-width="160" prop="userName" :show-overflow-tooltip="true" />
<el-table-column key="nickName" align="center" label="用户昵称" min-width="160" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column
key="deptName"
align="center"
label="部门"
min-width="160"
prop="dept.deptName"
:show-overflow-tooltip="true"
/>
<el-table-column key="phonenumber" align="center" label="手机号码" prop="phonenumber" width="120" />
<el-table-column key="status" align="center" label="状态">
<template #default="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" width="160" />
<el-table-column align="center" fixed="right" label="操作" min-width="240">
<template #default="scope">
<div v-if="scope.row.userId !== 1" class="table-operation-button">
<el-button icon="Edit" link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button icon="Delete" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
<el-dropdown style="margin-left: 12px" @command="(command) => handleCommand(command, scope.row)">
<el-button icon="DArrowRight" link type="primary">更多</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="handleResetPwd" icon="Key">重置密码</el-dropdown-item>
<el-dropdown-item command="handleAuthRole" icon="CircleCheck">分配角色</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<vab-pagination
:current-page="queryForm.pageNum"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</vab-card>
</el-col>
</el-row>
<user-management-edit ref="editRef" :dept-options="deptOptions" @fetch-data="fetchData" />
</div>
</template>
<script lang="ts" setup>
import { Delete, Plus, Search } from '@element-plus/icons-vue'
import type { TableInstance } from 'element-plus'
import { deptTreeSelect } from '/@/api/departmentManagement'
import { doDelete, getList } from '/@/api/userManagement'
defineOptions({
name: 'UserManagement',
})
const { proxy } = getCurrentInstance() as any
const { exit, enter, isFullscreen: _isFullscreen } = useFullscreen()
const deptName = ref<string>('')
const deptOptions = ref<any>([])
const tableRef = ref<TableInstance>()
const fold = ref<boolean>(true)
const editRef = ref<any>(null)
const list = ref<any>([])
const listLoading = ref<boolean>(true)
const isFullscreen = ref<boolean>(false)
const total = ref<number>(0)
const selectRows = ref<any>([])
const queryForm = reactive<any>({
pageNo: 1,
pageNum: 1,
pageSize: 20,
username: '',
userName: undefined,
phonenumber: undefined,
status: undefined,
deptId: undefined,
dateRange: [],
})
const setSelectRows = (value: string) => {
selectRows.value = value
}
const handleAdd = () => {
editRef.value.showEdit()
}
// const handleEdit = (row: any = {}) => {
// editRef.value.showEdit(row)
// }
const handleEdit = (row: any = {}) => {
editRef.value.showEdit(row)
/** 修改按钮操作 */
function handleUpdate(row: any) {
console.log(row)
// reset();
// const userId = row.userId || ids.value;
// getUser(userId).then(response => {
// form.value = response.data;
// form.value.deptId = response.data.deptId;
// postOptions.value = response.posts;
// roleOptions.value = response.roles;
// form.value.postIds = response.postIds;
// form.value.roleIds = response.roleIds;
// open.value = true;
// title.value = "修改用户";
// form.password = "";
// });
}
const handleDelete = (row: any = {}) => {
......@@ -116,34 +250,161 @@ const handleDelete = (row: any = {}) => {
}
const handleSizeChange = (value: number) => {
queryForm.pageNo = 1
queryForm.pageNum = 1
queryForm.pageSize = value
fetchData()
}
const handleCurrentChange = (value: number) => {
queryForm.pageNo = value
queryForm.pageNum = value
fetchData()
}
/** 根据名称筛选部门树 */
watch(deptName, (val) => {
proxy.$refs['deptTreeRef'].filter(val)
})
watch(
_isFullscreen,
() => {
if (_isFullscreen.value) isFullscreen.value = true
else isFullscreen.value = false
},
{ immediate: true }
)
onActivated(() => {
tableRef.value?.doLayout()
})
onBeforeMount(() => {
getDeptTree()
fetchData()
})
/** 通过条件过滤节点 */
const filterNode = (value: any, data: any) => {
if (!value) return true
return data.label.includes(value)
}
/** 节点单击事件 */
function handleNodeClick(data: any) {
queryForm.deptId = data.id
console.log(queryForm)
handleQuery()
}
/** 查询部门下拉树结构 */
function getDeptTree() {
deptTreeSelect().then((response) => {
deptOptions.value = response.data
})
}
/** 点击全屏 */
const clickFullScreen = () => {
isFullscreen.value = !isFullscreen.value
isFullscreen.value ? enter() : exit()
}
/** 搜索条件折叠 */
const handleFold = () => {
fold.value = !fold.value
}
/** 搜索按钮操作 */
const queryData = () => {
queryForm.pageNo = 1
queryForm.pageNum = 1
fetchData()
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm('queryRef')
queryForm.deptId = undefined
// proxy.$refs.deptTreeRef.setCurrentKey(null);
handleQuery()
}
/** 查询用户列表 */
const fetchData = async () => {
listLoading.value = true
const { data } = await getList(queryForm)
list.value = data.list
total.value = data.total
const pp = Object.assign({}, proxy.addDateRange(queryForm, queryForm.dateRange))
delete pp.dateRange
const { rows, total: _total } = (await getList(pp)) as any
list.value = rows
total.value = _total
listLoading.value = false
}
onActivated(() => {
tableRef.value?.doLayout()
})
onBeforeMount(() => {
/** 搜索按钮操作 */
function handleQuery() {
queryForm.pageNum = 1
fetchData()
})
}
/** 用户状态修改 */
function handleStatusChange(row: any) {
console.log(row)
// let text = row.status === "0" ? "启用" : "停用";
// proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
// return changeUserStatus(row.userId, row.status);
// }).then(() => {
// proxy.$modal.msgSuccess(text + "成功");
// }).catch(function () {
// row.status = row.status === "0" ? "1" : "0";
// });
}
/** 更多操作 */
function handleCommand(command: string, row: any) {
switch (command) {
case 'handleResetPwd': {
handleResetPwd(row)
break
}
case 'handleAuthRole': {
handleAuthRole(row)
break
}
default: {
break
}
}
}
/** 跳转角色分配 */
function handleAuthRole(row: any) {
console.log(row)
// const userId = row.userId;
// router.push("/system/user-auth/role/" + userId);
}
/** 重置密码按钮操作 */
function handleResetPwd(row: any) {
console.log(row)
// proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// closeOnClickModal: false,
// inputPattern: /^.{5,20}$/,
// inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
// inputValidator: (value) => {
// if (/<|>|"|'|\||\\/.test(value)) {
// return "不能包含非法字符:< > \" ' \\\ |"
// }
// },
// }).then(({ value }) => {
// const encryptPassword = hex_md5(value)
// resetUserPwd(row.userId, encryptPassword).then(response => {
// proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
// });
// }).catch(() => { });
}
/** 新增按钮操作 */
const handleAdd = () => {
editRef.value.showEdit()
}
</script>
<template>
<vab-dialog v-model="dialogFormVisible" append-to-body :title="title" width="500px" @close="close">
<vab-dialog v-model="dialogFormVisible" append-to-body :title="title" width="600px" @close="close">
<el-form ref="formRef" label-width="80px" :model="form" :rules="rules">
<el-form-item label="用户名" prop="username">
<el-input v-model.trim="form.username" clearable />
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model.trim="form.password" clearable type="password" />
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model.trim="form.email" clearable />
</el-form-item>
<el-form-item label="角色" prop="roles">
<el-checkbox-group v-model="form.roles">
<el-checkbox label="admin" />
<el-checkbox label="editor" />
</el-checkbox-group>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" maxlength="30" placeholder="请输入用户昵称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<el-tree-select
v-model="form.deptId"
check-strictly
:data="deptOptions"
placeholder="请选择归属部门"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" maxlength="11" placeholder="请输入手机号码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" maxlength="50" placeholder="请输入邮箱" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" maxlength="30" placeholder="请输入用户名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" maxlength="20" placeholder="请输入用户密码" show-password type="password" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择">
<el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择">
<el-option
v-for="item in postOptions"
:key="item.postId"
:disabled="item.status == 1"
:label="item.postName"
:value="item.postId"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
:disabled="item.status == 1"
:label="item.roleName"
:value="item.roleId"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button type="primary" @click="save">保存</el-button>
<el-button type="primary" @click="save">确定</el-button>
<el-button @click="cancel">取 消</el-button>
</template>
</vab-dialog>
</template>
<script lang="ts" setup>
import type { FormInstance } from 'element-plus'
import { doEdit } from '/@/api/userManagement'
import { doEdit, getUser } from '/@/api/userManagement'
defineOptions({
name: 'UserManagementEdit',
......@@ -33,12 +113,29 @@ defineOptions({
const emit = defineEmits(['fetch-data'])
defineProps({
deptOptions: {
type: Array,
default: () => [],
},
})
const postOptions = ref<any>([])
const formRef = ref<FormInstance>()
const form = reactive<any>({
username: '',
password: '',
email: '',
roles: [],
userId: undefined,
deptId: undefined,
userName: undefined,
nickName: undefined,
password: undefined,
phonenumber: undefined,
email: undefined,
sex: undefined,
status: '0',
remark: undefined,
postIds: [],
roleIds: [],
})
const rules = reactive<any>({
username: [{ required: true, trigger: 'blur', message: '请输入用户名' }],
......@@ -65,6 +162,11 @@ defineExpose({
showEdit,
})
onMounted(async () => {
const { posts } = (await getUser(form.userId)) as any
postOptions.value = posts
})
const close = () => {
formRef.value?.clearValidate()
formRef.value?.resetFields()
......
......@@ -13,6 +13,7 @@
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noImplicitThis": false,
"noEmit": true,
"jsx": "preserve",
"sourceMap": true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论