diff --git a/src/api/LogApi.ts b/src/api/LogApi.ts new file mode 100644 index 0000000..59c7381 --- /dev/null +++ b/src/api/LogApi.ts @@ -0,0 +1,29 @@ +import { api } from 'src/boot/axios'; +import { PageDto, PageQueryDto } from './ApiCommon'; + +const LogUriBase = '/api/log'; + +export interface Record { + id: number; + eventType: string; + fromUserId: number; + mobile: string; + userName: string; + createDateTime: string; +} + +export class PagingQueryParams extends PageQueryDto {} + +/** + * 分页查询事件信息列表 + * @param params + * @returns + */ +export async function pageQuery( + params: PagingQueryParams +): Promise> { + const response = await api.get(`${LogUriBase}/paging`, { + params: params, + }); + return response.data; +} diff --git a/src/components/SysMenu.vue b/src/components/SysMenu.vue index ee26e73..d05e70c 100644 --- a/src/components/SysMenu.vue +++ b/src/components/SysMenu.vue @@ -109,6 +109,21 @@ const list = reactive([ label: '权限接口管理', icon: 'menu_open', }, + { + path: '/sysManage/loginRecord', + label: '登录记录', + icon: 'description', + }, + { + path: '/sysManage/operateRecord', + label: '操作记录', + icon: 'receipt', + }, + { + path: '/sysManage/alarmRecord', + label: '报警记录', + icon: 'alarm_on', + }, ], }, ]); diff --git a/src/graphics/section/Section.ts b/src/graphics/section/Section.ts index 3ab5e19..a2586d4 100644 --- a/src/graphics/section/Section.ts +++ b/src/graphics/section/Section.ts @@ -8,7 +8,6 @@ import { distance2, splitLineEvenly, ILineGraphic, - epsilon, Vector2, } from 'jl-graphic'; import { @@ -29,6 +28,8 @@ export enum SectionPort { B = 'B', } +const sectionEpsilon = 0.1; + export interface ISectionData extends GraphicData { get code(): string; // 编号 set code(v: string); @@ -148,17 +149,17 @@ export class Section extends JlGraphic implements ILineGraphic { const destinationCodePosition = this.datas.childTransforms?.find( (t) => t.name === this.destinationCodeGraphic.name )?.transform.position; - // if (destinationCodePosition) { - // this.destinationCodeGraphic.position.set( - // destinationCodePosition.x, - // destinationCodePosition.y - // ); - // } else { - this.destinationCodeGraphic.position.set( - this.datas.points[0].x, - this.datas.points[0].y - 20 - ); - // } + if (destinationCodePosition) { + this.destinationCodeGraphic.position.set( + destinationCodePosition.x, + destinationCodePosition.y + ); + } else { + this.destinationCodeGraphic.position.set( + this.datas.points[0].x, + this.datas.points[0].y - 20 + ); + } } } @@ -244,7 +245,7 @@ export class Section extends JlGraphic implements ILineGraphic { distance2( this.localToCanvasPoint(this.getStartPoint()), section.localToCanvasPoint(section.getStartPoint()) - ) <= epsilon + ) <= sectionEpsilon ) { param = [SectionPort.A, SectionPort.A]; } @@ -252,7 +253,7 @@ export class Section extends JlGraphic implements ILineGraphic { distance2( this.localToCanvasPoint(this.getEndPoint()), section.localToCanvasPoint(section.getStartPoint()) - ) <= epsilon + ) <= sectionEpsilon ) { param = [SectionPort.B, SectionPort.A]; } @@ -260,7 +261,7 @@ export class Section extends JlGraphic implements ILineGraphic { distance2( this.localToCanvasPoint(this.getStartPoint()), section.localToCanvasPoint(section.getEndPoint()) - ) <= epsilon + ) <= sectionEpsilon ) { param = [SectionPort.A, SectionPort.B]; } @@ -268,7 +269,7 @@ export class Section extends JlGraphic implements ILineGraphic { distance2( this.localToCanvasPoint(this.getEndPoint()), section.localToCanvasPoint(section.getEndPoint()) - ) <= epsilon + ) <= sectionEpsilon ) { param = [SectionPort.B, SectionPort.B]; } diff --git a/src/graphics/turnout/Turnout.ts b/src/graphics/turnout/Turnout.ts index 3075798..ef06875 100644 --- a/src/graphics/turnout/Turnout.ts +++ b/src/graphics/turnout/Turnout.ts @@ -10,7 +10,6 @@ import { angleOfIncludedAngle, distance2, getParallelOfPolyline, - epsilon, Vector2, } from 'jl-graphic'; import { Section, SectionPort, SectionType } from '../section/Section'; @@ -22,6 +21,7 @@ import { import { KilometerSystem } from '../signal/Signal'; import { Station } from '../station/Station'; +const turnoutEpsilon = 0.1; export interface ITurnoutData extends GraphicData { get code(): string; set code(code: string); @@ -541,47 +541,45 @@ export class Turnout extends JlGraphic { buildRelation(): void { this.relationManage.deleteRelationOfGraphic(this); - /** 道岔和区段 */ - this.queryStore.queryByType
(Section.Type) - .forEach((section) => { - if (section.datas.sectionType === SectionType.TurnoutPhysical) { - if (section.datas.children.includes(this.datas.id)) { - this.relationManage.addRelation(this, section) - } - return + this.queryStore.queryByType
(Section.Type).forEach((section) => { + if (section.datas.sectionType === SectionType.TurnoutPhysical) { + if (section.datas.children.includes(this.datas.id)) { + this.relationManage.addRelation(this, section); + } + return; + } + this.getPortPoints().forEach((port, i) => { + if ( + distance2( + section.localToCanvasPoint(section.getStartPoint()), + this.localToCanvasPoint(port[port.length - 1]) + ) <= turnoutEpsilon + ) { + this.relationManage.addRelation( + new GraphicRelationParam( + this, + [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] + ), + new GraphicRelationParam(section, SectionPort.A) + ); + } + if ( + distance2( + section.localToCanvasPoint(section.getEndPoint()), + this.localToCanvasPoint(port[port.length - 1]) + ) <= turnoutEpsilon + ) { + this.relationManage.addRelation( + new GraphicRelationParam( + this, + [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] + ), + new GraphicRelationParam(section, SectionPort.B) + ); } - this.getPortPoints().forEach((port, i) => { - if ( - distance2( - section.localToCanvasPoint(section.getStartPoint()), - this.localToCanvasPoint(port[port.length - 1]) - ) <= epsilon - ) { - this.relationManage.addRelation( - new GraphicRelationParam( - this, - [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] - ), - new GraphicRelationParam(section, SectionPort.A) - ); - } - if ( - distance2( - section.localToCanvasPoint(section.getEndPoint()), - this.localToCanvasPoint(port[port.length - 1]) - ) <= epsilon - ) { - this.relationManage.addRelation( - new GraphicRelationParam( - this, - [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] - ), - new GraphicRelationParam(section, SectionPort.B) - ); - } - }); }); + }); /** 道岔和道岔 */ this.getPortPoints().forEach((thisPort, i) => { @@ -594,7 +592,7 @@ export class Turnout extends JlGraphic { distance2( this.localToCanvasPoint(thisPort[thisPort.length - 1]), turnout.localToCanvasPoint(otherPort[otherPort.length - 1]) - ) <= epsilon + ) <= turnoutEpsilon ) { const angle = angleOfIncludedAngle( this.localToCanvasPoint(thisPort[thisPort.length - 1]) /* 交点 */, @@ -668,9 +666,13 @@ export class Turnout extends JlGraphic { const pcRelation = this.relationManage .getRelationsOfGraphic(this) .find( - (relation) => relation.getRelationParam(this).param === TurnoutPort.C - && (!(relation.getOtherGraphic(this) instanceof Section - && relation.getOtherGraphic
(this).datas.sectionType !== SectionType.TurnoutPhysical)) + (relation) => + relation.getRelationParam(this).param === TurnoutPort.C && + !( + relation.getOtherGraphic(this) instanceof Section && + relation.getOtherGraphic
(this).datas.sectionType !== + SectionType.TurnoutPhysical + ) ); const pcDevice = pcRelation?.getOtherGraphic
(this); if (pcDevice) { diff --git a/src/pages/AlarmRecord.vue b/src/pages/AlarmRecord.vue new file mode 100644 index 0000000..e7a312b --- /dev/null +++ b/src/pages/AlarmRecord.vue @@ -0,0 +1,138 @@ + + + diff --git a/src/pages/LoginRecord.vue b/src/pages/LoginRecord.vue new file mode 100644 index 0000000..e7a312b --- /dev/null +++ b/src/pages/LoginRecord.vue @@ -0,0 +1,138 @@ + + + diff --git a/src/pages/OperateRecord.vue b/src/pages/OperateRecord.vue new file mode 100644 index 0000000..e7a312b --- /dev/null +++ b/src/pages/OperateRecord.vue @@ -0,0 +1,138 @@ + + + diff --git a/src/router/routes.ts b/src/router/routes.ts index e25f7a1..393a86e 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -86,6 +86,30 @@ const routes: RouteRecordRaw[] = [ }, component: () => import('pages/AuthPathManage.vue'), }, + { + path: 'loginRecord', + name: 'loginRecord', + meta: { + description: '登录记录', + }, + component: () => import('pages/LoginRecord.vue'), + }, + { + path: 'operateRecord', + name: 'operateRecord', + meta: { + description: '操作记录', + }, + component: () => import('pages/OperateRecord.vue'), + }, + { + path: 'alarmRecord', + name: 'alarmRecord', + meta: { + description: '报警记录', + }, + component: () => import('pages/AlarmRecord.vue'), + }, ], }, {