From c510dc4ba61a983ea73c1b2e13a96738a1be56a2 Mon Sep 17 00:00:00 2001 From: yy <11@11.com> Date: Mon, 3 Jun 2024 09:13:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=8A=A8=E6=80=81=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/routes.ts | 2 - src/stores/user-info-store.ts | 147 +-- src/utils/request.ts | 2 +- src/views/login/login.vue | 881 +++++++++--------- src/views/logs-manage/index.vue | 118 +-- .../permissions-manage/doctor-manage.vue | 11 +- .../permissions-manage/form/doctor-form.vue | 336 ++++--- src/views/permissions-manage/index.vue | 29 +- src/views/permissions-manage/role-manage.vue | 3 +- src/views/remote-manage/chart/chart-line.vue | 2 +- .../remote-manage/part/remote-item-part.vue | 26 +- src/views/remote-manage/remote-control.vue | 40 +- src/views/system-manage/user-list.vue | 2 +- 13 files changed, 851 insertions(+), 748 deletions(-) diff --git a/src/router/routes.ts b/src/router/routes.ts index 388e27f..55660bc 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -21,7 +21,6 @@ export const constantRoute = [ { path: '/permissions-manage', name: '权限管理', - redirect: '/permissions-manage/doctor-manage', component: () => import('@/views/permissions-manage/index.vue'), children: [ { @@ -113,7 +112,6 @@ export const constantRoute = [ { path: '/logs-manage', name: '系统管理', - redirect: '/logs-manage/message-manage', component: () => import('@/views/logs-manage/index.vue'), children: [ { diff --git a/src/stores/user-info-store.ts b/src/stores/user-info-store.ts index cb1d107..42faec3 100644 --- a/src/stores/user-info-store.ts +++ b/src/stores/user-info-store.ts @@ -4,77 +4,88 @@ import {Local, Session} from "@/utils/storage"; import router from "@/router"; export const useUserStore = defineStore('login', { - state: () => { - return { - userInfo: { - account: '', - name: '', - /** - * 公司: 后台管理 - * 医院高级管理员: 首页、权限管理、患者管理、远程管理、日志管理 - * 医院中级管理员: 首页、患者管理、远程管理 - * 医院普通用户: 首页、患者管理 - */ - hospitalName: '', - hospitalId: '', - menuPathList: { - paths: [], - menus: [] - }, - roleName: '' - } as any, - showHomeMsg: false - } - }, - actions: { - getlogin() { - const onlineUser = Session.get("onlineUser"); - return this.userInfo.account && this.userInfo.account != null ? this.userInfo : onlineUser - }, - setlogin(key: string, e: any) { - this.userInfo[key] = e - Session.set("onlineUser", this.userInfo); - }, - logout() { - Session.clear(); - Local.clear(); - router.removeRoute("root"); - router.addRoute({ - name: "root", - path: "/", - redirect: "/login" - }) - }, - getMenuPathList(): Promise { - return new Promise(resolve => { - if (this.userInfo.menuPathList.paths.length == 0) { - getUserMenu().then((res: any) => { - if (res && res.code == 0) { - const paths: any = []; - const menus: any = []; - res.data.forEach((item: any) => { - handleMenuPath(item, paths, menus); - }); - this.userInfo.menuPathList = {paths, menus}; - resolve(this.userInfo.menuPathList); - } - }) - } else { - resolve(this.userInfo.menuPathList) + state: () => { + return { + userInfo: { + account: '', + name: '', + /** + * 公司: 后台管理 + * 医院高级管理员: 首页、权限管理、患者管理、远程管理、日志管理 + * 医院中级管理员: 首页、患者管理、远程管理 + * 医院普通用户: 首页、患者管理 + */ + hospitalName: '', + hospitalId: '', + menuPathList: { + paths: [], + menus: [] + }, + roleName: '' + } as any, + showHomeMsg: false + } + }, + actions: { + getlogin() { + const onlineUser = Session.get("onlineUser"); + return this.userInfo.account && this.userInfo.account != null ? this.userInfo : onlineUser + }, + setlogin(key: string, e: any) { + this.userInfo[key] = e + Session.set("onlineUser", this.userInfo); + }, + logout() { + Session.clear(); + Local.clear(); + router.removeRoute("root"); + router.addRoute({ + name: "root", + path: "/", + redirect: "/login" + }) + }, + getMenuPathList(): Promise { + return new Promise(resolve => { + if (this.userInfo.menuPathList.paths.length == 0) { + getUserMenu().then((res: any) => { + if (res && res.code == 0) { + const paths: any = []; + const menus: any = []; + res.data.forEach((item: any) => { + handleMenuPath(item, paths, menus); + }); + this.userInfo.menuPathList = {paths, menus}; + resolve(this.userInfo.menuPathList); + } + }) + } else { + resolve(this.userInfo.menuPathList) + } + }) + }, + getMenuChild(path: string) { + return new Promise(resolve => { + this.getMenuPathList().then((res: any) => { + res.menus.forEach((menu: any) => { + if (menu.path == path) { + resolve(menu.children) + } + }); + }) + }) } - }) } - }, }) function handleMenuPath(menu: any, paths: any, menus?: any) { - paths.push(menu.path); - if (menus) { - menus.push(menu); - } - if (menu.children && menu.children.length > 0) { - menu.children.forEach((child: any) => { - handleMenuPath(child, paths); - }) - } + paths.push(menu.path); + if (menus) { + menus.push(menu); + } + if (menu.children && menu.children.length > 0) { + menu.children.forEach((child: any) => { + handleMenuPath(child, paths); + }) + } } \ No newline at end of file diff --git a/src/utils/request.ts b/src/utils/request.ts index d461504..911565c 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -79,7 +79,7 @@ function handleResponse(response: any) { axiosInstance.interceptors.response.use(handleResponse, error => { const code = error.response.status || 200 - if (code == 424 || code == 401) { + if (code == 424) { ElMessageBox.confirm('令牌状态已过期,请点击重新登录', "系统提示", { confirmButtonText: "确定", cancelButtonText: "取消", diff --git a/src/views/login/login.vue b/src/views/login/login.vue index cdd190e..bc3e42d 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -1,127 +1,133 @@ diff --git a/src/views/logs-manage/index.vue b/src/views/logs-manage/index.vue index 8d0cdf9..a7b0b4a 100644 --- a/src/views/logs-manage/index.vue +++ b/src/views/logs-manage/index.vue @@ -1,78 +1,84 @@ diff --git a/src/views/permissions-manage/doctor-manage.vue b/src/views/permissions-manage/doctor-manage.vue index 8c90344..dbeaecf 100644 --- a/src/views/permissions-manage/doctor-manage.vue +++ b/src/views/permissions-manage/doctor-manage.vue @@ -24,9 +24,12 @@ -