From 7a6a21c52b5c9678a5a5224d26e3e17e57ee133c Mon Sep 17 00:00:00 2001 From: zhaoyz <11@22.com> Date: Fri, 26 Apr 2024 18:53:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86=E6=8E=88?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/menu.ts | 24 ++ src/api/role.ts | 25 +- .../form/empower-dialog.vue | 168 +++++----- src/views/permissions-manage/role-manage.vue | 35 ++- src/views/remote-manage/remote-control.vue | 286 +++++++++--------- 5 files changed, 301 insertions(+), 237 deletions(-) diff --git a/src/api/menu.ts b/src/api/menu.ts index d6c547e..1b432e5 100644 --- a/src/api/menu.ts +++ b/src/api/menu.ts @@ -24,6 +24,16 @@ export function getMenuTree(menuName?: string, parent?: string, type?: string) { }) } +export function getRoleTree(roleId: string) { + return new Promise(resolve => { + request.get(getMenuTreeUrl + "/" + roleId).then(res => { + resolve(res.data); + }).catch(err => { + resolve(err); + }); + }) +} + export function saveMenu(menu: any) { return new Promise((resolve, reject) => { request.post(menuUrl, menu).then((res: any) => { @@ -52,4 +62,18 @@ export function deleteById(id: string) { resolve(err); }) }) +} + +export function getUserMenu(type?: string, parentId?: string) { + return new Promise(resolve => { + const params: string[] = []; + if (type) params.push("type=" + type); + if (parentId) params.push("parentId=" + parentId); + request.get(menuUrl + (params.length > 0 ? "?" + params.join("&") : "")) + .then((res: any) => { + resolve(res.data); + }).catch(err => { + resolve(err); + }); + }) } \ No newline at end of file diff --git a/src/api/role.ts b/src/api/role.ts index 61b1530..0889019 100644 --- a/src/api/role.ts +++ b/src/api/role.ts @@ -1,7 +1,9 @@ import request, {getData} from "@/utils/request"; -const getRoleListUrl = '/admin/role/page'; +const getRoleListUrl = '/admin/role/tree'; const roleUrl = "/admin/role"; +const saveRoleMenuUrl = "/admin/role/menu"; +const getDetailsUrl = "/admin/role/details"; export function getRoleList(current: number, size: number, name?: string) { return new Promise((resolve, reject) => { @@ -25,3 +27,24 @@ export function addRole(role: any) { }) } +export function saveRoleMenus(roleId: string, menuIds: string) { + return new Promise(resolve => { + request.put(saveRoleMenuUrl, {roleId, menuIds}) + .then(res => { + resolve(res.data); + }).catch(err => { + resolve(err); + }) + }) +} + +export function getDetails(id: string) { + return new Promise(resolve => { + request(getDetailsUrl + "/" + id).then(res => { + resolve(res.data); + }).catch(err => { + resolve(err); + }) + }) +} + diff --git a/src/views/permissions-manage/form/empower-dialog.vue b/src/views/permissions-manage/form/empower-dialog.vue index 30a686d..e85c4c7 100644 --- a/src/views/permissions-manage/form/empower-dialog.vue +++ b/src/views/permissions-manage/form/empower-dialog.vue @@ -1,122 +1,108 @@ diff --git a/src/views/permissions-manage/role-manage.vue b/src/views/permissions-manage/role-manage.vue index f35a110..a2971ca 100644 --- a/src/views/permissions-manage/role-manage.vue +++ b/src/views/permissions-manage/role-manage.vue @@ -25,7 +25,20 @@ - + + + @@ -128,7 +141,7 @@ const removeData = (e?: any) => { } const empower = (e: any) => { setTimeout(() => { - empowerDialogRef.value.open() + empowerDialogRef.value.open(e) }) } const editData = (e: any) => { @@ -150,4 +163,20 @@ const paginationChange = (page: number, s: number) => { } - + diff --git a/src/views/remote-manage/remote-control.vue b/src/views/remote-manage/remote-control.vue index a64a745..73434d2 100644 --- a/src/views/remote-manage/remote-control.vue +++ b/src/views/remote-manage/remote-control.vue @@ -783,169 +783,171 @@ function startAI() { border-radius: 10px; } - .unusual-box { - width: 100%; - height: calc(100% - 45px); - // background: #F8F8F8; - border-left: 1px dashed #C1C1C1; - // border-radius: 4px; - margin-top: 5px; - padding: 8px 16px; - overflow-y: auto; + .unusual-box { + width: 100%; + height: calc(100% - 45px); + // background: #F8F8F8; + border-left: 1px dashed #C1C1C1; + // border-radius: 4px; + margin-top: 5px; + padding: 8px 16px; + overflow-y: auto; - li { - color: #F80000; - font-size: 14px; - line-height: 22px; - } - } - } + li { + color: #F80000; + font-size: 14px; + line-height: 22px; + } + } + } - & > .right-box { - width: calc(100% - 205px); - height: 100%; + & > .right-box { + width: calc(100% - 205px); + height: 100%; - .video-box { - position: relative; - width: 100%; - height: 270px; - background: $main-color; - /* background: url(@/assets/imgs/video_bck.png); + .video-box { + position: relative; + width: 100%; + height: 270px; + background: $main-color; + /* background: url(@/assets/imgs/video_bck.png); background-size: 100% 100%; */ - &:hover { - .icon-box { - display: flex; - } - } + &:hover { + .icon-box { + display: flex; + } + } - .icon-box { - display: none; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - font-size: 60px; - color: white; - background: rgba(black, .3); - justify-content: center; - align-items: center; - } + .icon-box { + display: none; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + font-size: 60px; + color: white; + background: rgba(black, .3); + justify-content: center; + align-items: center; + } - video { - width: 100%; - height: 100%; - object-fit: cover; - } - } + video { + width: 100%; + height: 100%; + object-fit: cover; + } + } - .message-box { - width: 100%; - height: 270px; - // margin-bottom: 5px; + .message-box { + width: 100%; + // height: 270px; + height: 149px; + // margin-bottom: 5px; - .message-log { - width: 100%; - height: calc(100% - 40px); - padding: 16px 20px; - box-sizing: border-box; - border: 1px solid #c8c8c8; - background: #f8f8f8; - overflow-y: auto; + .message-log { + width: 100%; + height: calc(100% - 40px); + max-height: 109px; + padding: 16px 20px; + box-sizing: border-box; + border: 1px solid #c8c8c8; + background: #f8f8f8; + overflow-y: auto; - li { - width: 100%; - font-size: 14px; - line-height: 1.6; - margin: 5px 0; + li { + width: 100%; + font-size: 14px; + line-height: 1.6; + margin: 5px 0; - &.align-right { - text-align: right; - } + &.align-right { + text-align: right; + } - span { - display: inline-block; - max-width: 80%; - padding: 6px 8px; - box-sizing: border-box; - border-radius: 8px; - color: white; - letter-spacing: 1px; - background: $main-color; - text-align: left; - } - } - } + span { + display: inline-block; + max-width: 80%; + padding: 6px 8px; + box-sizing: border-box; + border-radius: 8px; + color: white; + letter-spacing: 1px; + background: $main-color; + text-align: left; + } + } + } - .send-box { - width: 100%; - height: 40px; - display: flex; - justify-content: space-between; - align-items: flex-end; + .send-box { + width: 100%; + height: 40px; + display: flex; + justify-content: space-between; + align-items: flex-end; - .el-input { - width: calc(100% - 110px); - height: 32px; + .el-input { + width: calc(100% - 110px); + height: 32px; - :deep(.el-input__wrapper) { - background-color: #F2F3F5; - border-color: #C1C1C1; - } - } + :deep(.el-input__wrapper) { + background-color: #F2F3F5; + border-color: #C1C1C1; + } + } - .el-button { - padding: 0; - width: 100px; - line-height: 30px; - } - } - } - } - } + .el-button { + padding: 0; + width: 100px; + line-height: 30px; + } + } + } + } + } - .table-box { - width: 100%; - height: calc(50% - 264.5px); - margin-bottom: 20px; - flex-grow: 1; + .table-box { + width: 100%; + height: calc(50% - 264.5px); + margin-bottom: 20px; + flex-grow: 1; - :deep(.el-table__inner-wrapper) { - .el-table__cell { - padding: 6px 0; - } + :deep(.el-table__inner-wrapper) { + .el-table__cell { + padding: 6px 0; + } - .cell { - padding: 0 2px; - } + .cell { + padding: 0 2px; + } - .el-table__header-wrapper { - tr { - background-color: $main-color; - } + .el-table__header-wrapper { + tr { + background-color: $main-color; + } - th.el-table__cell { - color: white; - background-color: $main-color; - padding: 8px 0; - font-weight: 400; - } - } - } + th.el-table__cell { + color: white; + background-color: $main-color; + padding: 8px 0; + font-weight: 400; + } + } + } - .table-btn-box { - .el-button { - padding: 0 7px; - height: 24px; - line-height: 22px; + .table-btn-box { + .el-button { + padding: 0 7px; + height: 24px; + line-height: 22px; - &:not(:first-of-type) { - margin-left: 4px; - } - } - } - } - } - } + &:not(:first-of-type) { + margin-left: 4px; + } + } + } + } + } + } }