From 012340628a3ee5fd3c8c8bcd00e6819abad6a7d6 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 17 Oct 2024 09:33:01 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=8A=A5=E8=AD=A6?= =?UTF-8?q?=E5=88=97=E8=A1=A8+=E5=8E=BB=E6=8E=89=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SysMenu.vue | 10 --- src/pages/AlarmRecord.vue | 138 ------------------------------------- src/router/routes.ts | 13 +--- 3 files changed, 1 insertion(+), 160 deletions(-) delete mode 100644 src/pages/AlarmRecord.vue diff --git a/src/components/SysMenu.vue b/src/components/SysMenu.vue index d05e70c..2a23072 100644 --- a/src/components/SysMenu.vue +++ b/src/components/SysMenu.vue @@ -47,11 +47,6 @@ const list = reactive([ label: '监控', icon: 'computer', }, - { - path: '/alarmList', - label: '报警列表', - icon: 'access_alarm', - }, { path: '', label: '数据管理', @@ -104,11 +99,6 @@ const list = reactive([ label: '权限管理', icon: 'nature_people', }, - { - path: '/sysManage/authPath', - label: '权限接口管理', - icon: 'menu_open', - }, { path: '/sysManage/loginRecord', label: '登录记录', diff --git a/src/pages/AlarmRecord.vue b/src/pages/AlarmRecord.vue deleted file mode 100644 index e7a312b..0000000 --- a/src/pages/AlarmRecord.vue +++ /dev/null @@ -1,138 +0,0 @@ - - - diff --git a/src/router/routes.ts b/src/router/routes.ts index 393a86e..27d5a7f 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -108,7 +108,7 @@ const routes: RouteRecordRaw[] = [ meta: { description: '报警记录', }, - component: () => import('pages/AlarmRecord.vue'), + component: () => import('pages/AlarmInfoList.vue'), }, ], }, @@ -157,17 +157,6 @@ const routes: RouteRecordRaw[] = [ }, ], }, - { - path: '/alarmList', - component: () => import('layouts/MainLayout.vue'), - children: [ - { - path: '', - name: 'alarmList', - component: () => import('src/pages/AlarmInfoList.vue'), - }, - ], - }, // Always leave this as last one, // but you can also remove it From 00da31059b285b1021e0b4635dbef144b50007e5 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Fri, 18 Oct 2024 17:04:11 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E5=86=B3=E7=AD=96=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/DecisionInfo.ts | 2 ++ src/pages/DecisionInfoManage.vue | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/api/DecisionInfo.ts b/src/api/DecisionInfo.ts index ad4ff66..0eff91e 100644 --- a/src/api/DecisionInfo.ts +++ b/src/api/DecisionInfo.ts @@ -6,6 +6,8 @@ const AlertTipUriBase = '/api/alertTip'; interface AlarmInfoCreateParams { id: number; + lineId: number; + lineType: string; alertType: string; tipTimeIds: string[]; areaConfigId: number; diff --git a/src/pages/DecisionInfoManage.vue b/src/pages/DecisionInfoManage.vue index 309ba7c..7e7e331 100644 --- a/src/pages/DecisionInfoManage.vue +++ b/src/pages/DecisionInfoManage.vue @@ -73,6 +73,23 @@
{{ creatForm.id ? '编辑决策信息' : '新建决策信息' }}
+ + { }; onMounted(() => { + queryLineInfo(); setTimeout(() => { tableRef.value.requestServerInteraction(); }); @@ -306,6 +339,8 @@ const createFormShow = ref(false); const myForm = ref(null); const creatForm = reactive({ id: '', + lineId: '', + lineType: 'NCC', alertType: '', tipTimeIds: [], areaConfigId: '', @@ -313,6 +348,25 @@ const creatForm = reactive({ submissionInfo: '', }); +const optionsLineId = ref<{ label: string; value: number }[]>([]); +async function queryLineInfo() { + try { + let response = await pageQuery({ + current: 1, + size: 50, + }); + response.records.forEach((info) => { + optionsLineId.value.push({ label: info.name, value: info.lineId }); + }); + } catch (err) { + const error = err as ApiError; + $q.notify({ + type: 'negative', + message: error.title, + }); + } +} +const optionsLineType = ['NCC', 'OCC']; const optionsAlertType = [ '蓝显', '全线蓝显', @@ -372,6 +426,8 @@ function onCreate() { }); const params = { id: +creatForm.id, + lineId: +creatForm.lineId, + lineType: creatForm.lineType, alertType: (saveAlertTypeData as never)[creatForm.alertType], tipTimeIds: tipTimeIds, areaConfigId: areaConfigId as number, @@ -440,6 +496,8 @@ async function deleteData(row: AlarmInfoListItem) { function onReset() { creatForm.id = ''; + creatForm.lineId = ''; + creatForm.lineType = 'NCC'; creatForm.alertType = ''; creatForm.tipTimeIds = []; creatForm.areaConfigId = ''; From e90c25523e1c96a4423bd8ecc78d0a90789dd6a3 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Fri, 18 Oct 2024 17:19:40 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/LogApi.ts | 8 +++++- src/api/UserApi.ts | 43 ++++++++++++++++++++++++++++++ src/layouts/MainLayout.vue | 17 +++++++++--- src/pages/LoginRecord.vue | 52 ++++++++++++++++++++++++++++++++----- src/pages/OperateRecord.vue | 52 ++++++++++++++++++++++++++++++++----- src/router/index.ts | 33 +++++++++++++++++++++-- src/stores/user-store.ts | 19 ++++++++++++++ 7 files changed, 204 insertions(+), 20 deletions(-) create mode 100644 src/stores/user-store.ts diff --git a/src/api/LogApi.ts b/src/api/LogApi.ts index 59c7381..c8e0ae7 100644 --- a/src/api/LogApi.ts +++ b/src/api/LogApi.ts @@ -5,10 +5,16 @@ const LogUriBase = '/api/log'; export interface Record { id: number; + faceName: string; eventType: string; + subEventType: string; + uri: string; + method: string; + parameters: string; + requestSuccess: boolean; + userName: string; fromUserId: number; mobile: string; - userName: string; createDateTime: string; } diff --git a/src/api/UserApi.ts b/src/api/UserApi.ts index b3f09c4..5d1ce10 100644 --- a/src/api/UserApi.ts +++ b/src/api/UserApi.ts @@ -72,3 +72,46 @@ export async function pageQuery( }); return response.data; } + +/** + * 用户登出 + */ +export async function logout(): Promise { + const response = await api.post(`${UserUriBase}/logout`); + return response.data; +} + +interface tokenInfo { + token: string; + remainingSecond: number; +} + +/** + * 刷新token + */ +export async function refreshToken(): Promise { + const response = await api.post(`${UserUriBase}/refresh/token`); + return response.data; +} + +export interface role { + id: number; + name: string; + roleConfig: { + lineId: number; + lineType: string; + }; +} +interface userInfo { + remainingSecond: number; + roles: role[]; + defaultRole: string; +} + +/** + * 获取用户信息 + */ +export async function getUserInfo(): Promise { + const response = await api.post(`${UserUriBase}/info`); + return response.data; +} diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index f35de31..f676b83 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -124,6 +124,8 @@ import { webSocketConnect, closeWebSocketConnect, } from 'src/components/webSocketConnect'; +import { logout } from 'src/api/UserApi'; +import { ApiError } from 'src/boot/axios'; const leftDrawerOpen = ref(false); const router = useRouter(); @@ -210,9 +212,18 @@ function logOut() { message: '确认是否登出?', cancel: true, persistent: true, - }).onOk(() => { - clearJwtToken(); - router.push({ name: 'login' }); + }).onOk(async () => { + try { + await logout(); + clearJwtToken(); + router.push({ name: 'login' }); + } catch (err) { + const apiErr = err as ApiError; + $q.notify({ + type: 'negative', + message: apiErr.title, + }); + } }); } diff --git a/src/pages/LoginRecord.vue b/src/pages/LoginRecord.vue index e7a312b..c3a6d48 100644 --- a/src/pages/LoginRecord.vue +++ b/src/pages/LoginRecord.vue @@ -2,7 +2,7 @@
+ handleRefreshToken(), userInfo.remainingSecond * 1000 - 10000 ); - router.push({ name: 'home' }); + router.replace(getMonitorPath(userInfo.roles)); } catch (err) { visible.value = false; const apiErr = err as ApiError; diff --git a/src/pages/UserManage.vue b/src/pages/UserManage.vue index 4ed20d3..0df199a 100644 --- a/src/pages/UserManage.vue +++ b/src/pages/UserManage.vue @@ -39,7 +39,10 @@
-