Merge remote-tracking branch 'origin/develop' into local-test

This commit is contained in:
joylink_fanyuhong 2024-10-10 10:49:20 +08:00
commit 9d8a8b5b14
32 changed files with 3480 additions and 310 deletions

2
package-lock.json generated
View File

@ -11,7 +11,7 @@
"@quasar/extras": "^1.16.4",
"axios": "^1.2.1",
"google-protobuf": "^3.21.4",
"jl-graphic": "git+http://120.46.212.6:3000/joylink/graphic-pixi.git#v0.1.15",
"jl-graphic": "git+http://120.46.212.6:3000/joylink/graphic-pixi.git#v0.1.18",
"js-base64": "^3.7.5",
"pinia": "^2.0.11",
"quasar": "^2.16.0",

View File

@ -18,7 +18,7 @@
"@quasar/extras": "^1.16.4",
"axios": "^1.2.1",
"google-protobuf": "^3.21.4",
"jl-graphic": "git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.15",
"jl-graphic": "git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.18",
"js-base64": "^3.7.5",
"pinia": "^2.0.11",
"quasar": "^2.16.0",
@ -27,10 +27,10 @@
},
"devDependencies": {
"@quasar/app-vite": "^1.9.0",
"@types/google-protobuf": "^3.15.6",
"@types/node": "^12.20.21",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@types/google-protobuf": "^3.15.6",
"autoprefixer": "^10.4.2",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",

147
public/iscsMenuIcon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 67 KiB

@ -1 +1 @@
Subproject commit 1672a8c0e2b41c4076c1dc9ec852f425dcba21c3
Subproject commit 49c235a66f0f6a89c68039bd904eadd9497f8219

View File

@ -3,7 +3,30 @@
</template>
<script setup lang="ts">
import { watch, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useAuthStore } from 'src/stores/auth-store';
import { getLoginUserInfo } from 'src/api/UserApi';
import { saveJwtToken } from 'src/configs/TokenManage';
defineOptions({
name: 'App'
name: 'App',
});
const route = useRoute();
const authStore = useAuthStore();
watch(
() => route.params.token,
async () => {
if (route.params.token) {
saveJwtToken(route.params.token as string);
const res = await getLoginUserInfo();
authStore.setUserId(res.loginUserInfo.id);
}
}
);
onMounted(async () => {
const res = await getLoginUserInfo();
authStore.setUserId(res.loginUserInfo.id);
});
</script>

View File

@ -21,6 +21,14 @@ export const iscsStyleOption = [
},
];
export const searchTscsStyleOption = [
{
label: '全部',
value: IscsStyle.UNKNOWN,
},
...iscsStyleOption,
];
export interface DraftItem {
id: number;
name: string;
@ -33,8 +41,11 @@ export interface DraftItem {
createdAt: string;
updatedAt: string;
defaultReleaseDataName: string;
userName: string;
}
export interface IscsDataOptions {
style: IscsStyle;
}
export interface PagingQueryParams {
paging: {
page: number;
@ -42,9 +53,10 @@ export interface PagingQueryParams {
};
query: {
dataType: DraftDataType;
userId?: number;
options?: IscsDataOptions;
name?: string;
isShared?: boolean;
userId?: number;
};
}
export interface DraftIscsDataDto {
@ -52,9 +64,6 @@ export interface DraftIscsDataDto {
options: IscsDataOptions;
}
export interface IscsDataOptions {
style: IscsStyle;
}
export async function draftPageQuery(
params: PagingQueryParams
): Promise<PageDto<DraftIscsDataDto>> {
@ -63,7 +72,7 @@ export async function draftPageQuery(
userDraftIscsDataPaging(paging: $paging, query: $query) {
total
items {
draftData {id name dataType userId defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName}
draftData {id name dataType userName defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName}
options {style}
}
}
@ -84,7 +93,7 @@ export async function sharedDraftPageQuery(
sharedDraftIscsDataPaging(paging: $paging, query: $query) {
total
items {
draftData {id name dataType userId defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName}
draftData {id name dataType userName defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName}
options {style}
}
}
@ -97,6 +106,25 @@ export async function sharedDraftPageQuery(
return response.data.data.sharedDraftIscsDataPaging;
}
/**
* 稿
* @param id 稿id
*/
export function draftDataExist(variables: {
dataType: DraftDataType;
name: string;
}) {
const query = `
query draftDataExist($dataType: DataType,$name: String) {
draftDataExist(dataType: $dataType,name: $name)
}
`;
return api.post('', {
query,
variables,
});
}
/**
* 稿
* @param params
@ -208,10 +236,7 @@ export function saveDraft(variables: { id: number; data: string }) {
* @param variables
* @returns
*/
export async function saveAsDraft(variables: {
id: number;
name: string;
}) {
export async function saveAsDraft(variables: { id: number; name: string }) {
const mutation = `
mutation saveAsNewDraftData($id: Int,$name: String) {
saveAsNewDraftData(id: $id,name: $name){

View File

@ -14,6 +14,7 @@ export interface PublishItem {
createdAt: string;
updatedAt: string;
description: string;
userName: string;
}
interface PagingQueryParams {
@ -26,6 +27,7 @@ interface PagingQueryParams {
userId?: number;
name?: string;
isPublished?: boolean;
options?: IscsDataOptions;
};
}
export interface PublishIscsDataDto {
@ -52,6 +54,25 @@ export function setDefaultPublish(variables: {
});
}
/**
* 稿
* @param id 稿id
*/
export function isReleaseDataNameExists(variables: {
dataType: DraftDataType;
name: string;
}) {
const query = `
query isReleaseDataNameExists($dataType: DataType,$name: String) {
isReleaseDataNameExists(dataType: $dataType,name: $name)
}
`;
return api.post('', {
query,
variables,
});
}
/**
* 稿
* @param draftId 稿id
@ -110,7 +131,7 @@ export async function publishPageQuery(
releaseIscsDataPaging(page: $page, query: $query) {
total
items {
releaseData {id name dataType usedVersionId userId isPublished createdAt updatedAt description }
releaseData {id name dataType usedVersionId userName isPublished createdAt updatedAt description }
options {style}
}
}
@ -162,7 +183,7 @@ export async function getPublishHistoryById(variables: {
releaseDataVersionPaging(dataId: $dataId, page: $page) {
total
items {
id releaseDataId description userId createdAt
id releaseDataId description userName createdAt
}
}
}

98
src/api/UserApi.ts Normal file
View File

@ -0,0 +1,98 @@
import { api } from 'src/boot/axios';
import { PageDto } from './ApiCommon';
export interface User {
id: string;
name: string;
mobile: string;
email: string;
roles: [];
createdAt: string;
updatedAt: string;
}
export interface PagingQueryParams {
page: {
page: number;
itemsPerPage: number;
};
query: {
id?: string;
name?: string;
mobile?: string;
email?: string;
roles?: [];
};
}
/**
*
* @param params
* @returns
*/
export async function userPageQuery(
params: PagingQueryParams
): Promise<PageDto<User>> {
const query = `
query userPaging($page: PageQueryDto, $query: UserQueryDto) {
userPaging(page: $page, query: $query) {
total
items {
id name mobile email roles createdAt updatedAt
}
}
}
`;
const response = await api.post('', {
query,
variables: params,
});
return response.data.data.userPaging;
}
/**
*
*/
export async function getLoginUserInfo() {
const query = `
query loginUserInfo {
loginUserInfo{
id
}
}
`;
const response = await api.post('', {
query,
});
return response.data.data;
}
/**
*
*/
export async function syncUsersInfo() {
const mutation = `
mutation syncUser {
syncUser
}
`;
const response = await api.post('', {
query: mutation,
});
return response.data.data;
}
/**
* jwt令牌(mqtt验证)
*/
export async function getJwt() {
const query = `
query getJwt {
getJwt
}
`;
const response = await api.post('', {
query: query,
});
return response.data.data;
}

View File

@ -84,7 +84,7 @@
<script setup lang="ts">
import { QBar, useDialogPluginComponent } from 'quasar';
import { ref, onMounted, onUnmounted, reactive } from 'vue';
import { ref, onMounted, onUnmounted, reactive, watch } from 'vue';
import ResizableDivWidth from './ResizableDivWidth.vue';
import ResizableDivHeight from './ResizableDivHeight.vue';
@ -121,6 +121,14 @@ const props = withDefaults(
}
);
watch(
() => props.height,
() => {
dialogHeight.value = props.height;
lastDialogHeight = props.height;
}
);
const { dialogRef, onDialogHide /* , onDialogCancel, onDialogOK */ } =
useDialogPluginComponent();

View File

@ -6,7 +6,11 @@
<div class="text-h6">{{ drawStore.drawGraphicName + ' 模板' }}</div>
</q-card-section>
<q-separator inset></q-separator>
<q-card-section> </q-card-section>
<q-card-section>
<template v-if="drawStore.drawGraphicType === Line.Type">
<line-template></line-template>
</template>
</q-card-section>
</q-card>
</div>
<!-- 画布或图形对象属性 -->
@ -29,6 +33,9 @@
<rect-property
v-else-if="drawStore.selectedGraphicType === Rect.Type"
/>
<line-property
v-else-if="drawStore.selectedGraphicType === Line.Type"
/>
<cctv-button-property
v-else-if="drawStore.selectedGraphicType === CCTVButton.Type"
/>
@ -50,6 +57,9 @@ import cctvButtonProperty from './properties/CCTV/CCTVButtonProperty.vue';
import { CCTVButton } from 'src/graphics/CCTV/cctvButton/CCTVButton';
import RectProperty from './properties/RectProperty.vue';
import { Rect } from 'src/graphics/rect/Rect';
import LineTemplate from './templates/LineTemplate.vue';
import LineProperty from './properties/LineProperty.vue';
import { Line } from 'src/graphics/line/Line';
const drawStore = useDrawStore();
</script>

View File

@ -0,0 +1,58 @@
<template>
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="lineModel.id" label="id" />
<q-input
outlined
type="number"
v-model.number="lineModel.segmentsCount"
v-if="lineModel.isCurve"
@blur="onUpdate"
label="曲线分段数"
/>
<q-input
outlined
v-model="lineModel.lineColor"
@blur="onUpdate"
label="线色"
lazy-rules
:rules="[(val) => (val && val.length > 0) || '线色不能为空']"
>
<template v-slot:append>
<q-icon name="colorize" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-color
v-model="lineModel.lineColor"
@change="
(val) => {
lineModel.lineColor = val;
onUpdate();
}
"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
<q-input
outlined
v-model.number="lineModel.lineWidth"
type="number"
@blur="onUpdate"
label="宽度"
lazy-rules
:rules="[(val) => (val && val > 0) || '宽度必须大于0']"
/>
</q-form>
</template>
<script setup lang="ts">
import { useDrawStore } from 'src/stores/draw-store';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { LineData } from 'src/drawApp/graphics/LineInteraction';
const drawStore = useDrawStore();
const { data: lineModel, onUpdate } = useFormData(
new LineData(),
drawStore.getDrawApp()
);
</script>

View File

@ -1,6 +1,6 @@
<template>
<q-form>
<q-input outlined readonly v-model="rectModel.id" label="id" hint="" />
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="rectModel.id" label="id" />
<q-input
outlined
v-model.number="rectModel.lineWidth"
@ -10,7 +10,6 @@
lazy-rules
:rules="[(val) => (val && val > 0) || '画布宽必须大于0']"
/>
<q-input
outlined
v-model="rectModel.lineColor"

View File

@ -0,0 +1,42 @@
<template>
<q-form>
<q-btn-toggle
v-model="template.isCurve"
:options="[
{ label: '曲线(Q)', value: true },
{ label: '直线(Z)', value: false },
]"
@update:model-value="onUpdate"
toggle-color="primary"
></q-btn-toggle>
<q-input
v-model="template.segmentsCount"
v-if="template.isCurve"
label="曲线分段数"
@blur="onUpdate"
></q-input>
</q-form>
</template>
<script setup lang="ts">
import { LineTemplate, ILineTemplateProperty } from 'src/graphics/line/Line';
import { useDrawStore } from 'src/stores/draw-store';
import { reactive } from 'vue';
const drawStore = useDrawStore();
const template = reactive<ILineTemplateProperty>({
isCurve: false,
segmentsCount: 10,
});
function onUpdate() {
const gt = drawStore.drawGraphicTemplate as LineTemplate;
if (gt) {
gt.isCurve = template.isCurve;
gt.segmentsCount = template.segmentsCount;
}
}
</script>

View File

@ -3,66 +3,116 @@ import { IscsStyle } from 'src/api/DraftApi';
//达实智能(福州一号线)
const DA_SHI_ZHI_NENG = [
{
menuName: '火灾报警',
submenu: [
{ sunMenuName: '站台报警' },
{ sunMenuName: '站厅报警' },
{ sunMenuName: '系统状态' },
menuName: 'Plan',
icon: 'svguse:../iscsMenuIcon.svg#icon-Plan',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-Plan-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: 'PSCADA',
icon: 'svguse:../iscsMenuIcon.svg#icon-PSCADA',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PSCADA-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: 'BAS',
icon: 'svguse:../iscsMenuIcon.svg#icon-BAS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-BAS-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: 'FAS',
icon: 'svguse:../iscsMenuIcon.svg#icon-FAS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-FAS-active',
sunMenu: [
{ sunMenuName: '设备分区图' },
{ sunMenuName: '火灾报警平面图' },
{ sunMenuName: 'FAS气灭系统图' },
],
},
{
menuName: '机电',
submenu: [
{ sunMenuName: '大系统' },
{ sunMenuName: '小系统' },
{ sunMenuName: '水系统' },
{ sunMenuName: '照明' },
{ sunMenuName: '电、扶梯' },
{ sunMenuName: '给排水' },
{ sunMenuName: '模式' },
{ sunMenuName: '隧道通风' },
{ sunMenuName: '时间表' },
{ sunMenuName: '权限交接' },
{ sunMenuName: '传感器' },
{ sunMenuName: '车站网络' },
],
menuName: 'TFDS',
icon: 'svguse:../iscsMenuIcon.svg#icon-TFDS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-TFDS-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '广播',
submenu: [{ sunMenuName: '子目录' }],
menuName: 'AFC',
icon: 'svguse:../iscsMenuIcon.svg#icon-AFC',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-AFC-active',
sunMenu: [{ sunMenuName: '屏蔽门' }],
},
{
menuName: '乘客信息',
submenu: [{ sunMenuName: '子目录' }],
menuName: 'CCTV',
icon: 'svguse:../iscsMenuIcon.svg#icon-CCTV',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-CCTV-active',
sunMenu: [{ sunMenuName: '监控布局图' }, { sunMenuName: 'CCTV设备布局图' }],
},
{
menuName: '闭路电视',
submenu: [
{ sunMenuName: '车站控制' },
{ sunMenuName: '车站时序' },
{ sunMenuName: '车站时序编辑' },
{ sunMenuName: '车站设备状态' },
],
menuName: 'PIS',
icon: 'svguse:../iscsMenuIcon.svg#icon-PIS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PIS-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '屏蔽门',
submenu: [{ sunMenuName: '屏蔽门' }],
menuName: 'PA',
icon: 'svguse:../iscsMenuIcon.svg#icon-PA',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PA-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '售检票',
submenu: [{ sunMenuName: '子目录' }],
menuName: 'SIG/RAD',
icon: 'svguse:../iscsMenuIcon.svg#icon-SIG/RAD',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-SIG/RAD-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '门禁',
submenu: [{ sunMenuName: '子目录' }],
menuName: 'ACS',
icon: 'svguse:../iscsMenuIcon.svg#icon-ACS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-ACS-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '防淹门',
submenu: [{ sunMenuName: '子目录' }],
menuName: 'PSD',
icon: 'svguse:../iscsMenuIcon.svg#icon-PSD',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PSD-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '网络状态',
submenu: [{ sunMenuName: '子目录' }],
menuName: 'FG',
icon: 'svguse:../iscsMenuIcon.svg#icon-FG',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-FG-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: 'ALM',
icon: 'svguse:../iscsMenuIcon.svg#icon-ALM',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-ALM-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: 'NMS',
icon: 'svguse:../iscsMenuIcon.svg#icon-NMS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-NMS-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: 'OPS',
icon: 'svguse:../iscsMenuIcon.svg#icon-OPS',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-OPS-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '数据',
icon: 'svguse:../iscsMenuIcon.svg#icon-Data',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-Data-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
{
menuName: '联动',
icon: 'svguse:../iscsMenuIcon.svg#icon-Linkage',
activeIcon: 'svguse:../iscsMenuIcon.svg#icon-Linkage-active',
sunMenu: [{ sunMenuName: '子目录' }],
},
];

View File

@ -22,6 +22,10 @@ import { RectData } from './graphics/RectInteraction';
import { common } from 'src/protos/common';
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
import { saveDraft } from 'src/api/DraftApi';
import { sync_data_message } from 'src/protos/sync_data_message';
import { LineDraw } from 'src/graphics/line/LineDrawAssistant';
import { Line, LineTemplate } from 'src/graphics/line/Line';
import { LineData } from './graphics/LineInteraction';
const UndoOptions: MenuItemOptions = {
name: '撤销',
@ -49,6 +53,7 @@ export function initCommonDrawApp(app: IDrawApp) {
new ArrowDraw(app, new ArrowTemplate(new ArrowData()));
new TextContentDraw(app, new TextContentTemplate(new IscsTextData()));
new RectDraw(app, new RectTemplate(new RectData()));
new LineDraw(app, new LineTemplate(new LineData()));
// 画布右键菜单
app.registerMenu(DefaultCanvasMenu);
@ -76,6 +81,7 @@ interface ICommonStorage {
arrows: iscsGraphicData.Arrow[];
iscsTexts: iscsGraphicData.IscsText[];
rects: iscsGraphicData.Rect[];
lines: iscsGraphicData.Line[];
}
export function loadCommonDrawDatas(storage: ICommonStorage): GraphicData[] {
const datas: GraphicData[] = [];
@ -89,6 +95,9 @@ export function loadCommonDrawDatas(storage: ICommonStorage): GraphicData[] {
storage.rects.forEach((rect) => {
datas.push(new RectData(rect));
});
storage.lines.forEach((line) => {
datas.push(new LineData(line));
});
return datas;
}
@ -111,6 +120,9 @@ export function saveCommonDrawDatas(app: IDrawApp, storage: ICommonStorage) {
} else if (g instanceof Rect) {
const rectData = g.saveData();
storage.rects.push((rectData as RectData).data);
} else if (g instanceof Line) {
const lineData = g.saveData();
storage.lines.push((lineData as LineData).data);
}
});
@ -142,3 +154,66 @@ export function setUniqueIdPrefix(
) {
UniqueIdPrefix = newUniqueIdPrefix;
}
export function handlerCommonTypeData(data: sync_data_message.UpdataData) {
switch (data.type) {
case Rect.Type:
return new RectData(iscsGraphicData.Rect.deserialize(data.data));
case Arrow.Type:
return new ArrowData(iscsGraphicData.Arrow.deserialize(data.data));
case TextContent.Type:
return new IscsTextData(iscsGraphicData.IscsText.deserialize(data.data));
}
}
export function handlerNoEditCommonData(
data: sync_data_message.UpdataData,
storage: ICommonStorage,
operationType: string
) {
switch (data.type) {
case Rect.Type:
const rectData = iscsGraphicData.Rect.deserialize(data.data);
// syncNoEditData(operationType, rectData, storage.rects);
if (operationType === 'graphic-create') {
storage.rects.push(rectData);
} else if (operationType === 'graphic-delete') {
const index = storage.rects.findIndex(
(ele) => ele.common.id === rectData.common.id
);
storage.rects.splice(index, 1);
} else if (operationType === 'graphic-drag') {
const index = storage.rects.findIndex(
(ele) => ele.common.id === rectData.common.id
);
storage.rects[index] = rectData;
}
console.log(rectData, storage);
break;
case Arrow.Type:
const arrowData = iscsGraphicData.Arrow.deserialize(data.data);
syncNoEditData(operationType, arrowData, storage.arrows);
break;
case TextContent.Type:
const iscsTextData = iscsGraphicData.IscsText.deserialize(data.data);
syncNoEditData(operationType, iscsTextData, storage.iscsTexts);
break;
}
}
export function syncNoEditData(
operationType: string,
data: any,
dataArray: any[]
) {
console.log(data, dataArray, '====');
if (operationType === 'graphic-create') {
dataArray.push(data);
} else if (operationType === 'graphic-delete') {
const index = dataArray.findIndex((ele) => ele.id === data.id);
dataArray.splice(index, 1);
} else if (operationType === 'graphic-drag') {
const index = dataArray.findIndex((ele) => ele.id === data.id);
dataArray[index] = data;
}
}

View File

@ -0,0 +1,68 @@
import * as pb_1 from 'google-protobuf';
import { GraphicDataBase } from './GraphicDataBase';
import { ILineData, Line } from 'src/graphics/line/Line';
import { IPointData } from 'pixi.js';
import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import { common } from 'src/protos/common';
export class LineData extends GraphicDataBase implements ILineData {
constructor(data?: iscsGraphicData.Line) {
let line;
if (!data) {
line = new iscsGraphicData.Line({
common: GraphicDataBase.defaultCommonInfo(Line.Type),
});
} else {
line = data;
}
super(line);
}
public get data(): iscsGraphicData.Line {
return this.getData<iscsGraphicData.Line>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get points(): IPointData[] {
return this.data.points;
}
set points(points: IPointData[]) {
this.data.points = points.map((p) => new common.Point({ x: p.x, y: p.y }));
}
get isCurve(): boolean {
return this.data.isCurve;
}
set isCurve(v: boolean) {
this.data.isCurve = v;
}
get segmentsCount(): number {
return this.data.segmentsCount;
}
set segmentsCount(v: number) {
this.data.segmentsCount = v;
}
get lineWidth(): number {
return this.data.lineWidth;
}
set lineWidth(v: number) {
this.data.lineWidth = v;
}
get lineColor(): string {
return this.data.lineColor;
}
set lineColor(v: string) {
this.data.lineColor = v;
}
clone(): LineData {
return new LineData(this.data.cloneMessage());
}
copyFrom(data: LineData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: LineData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}

View File

@ -5,13 +5,16 @@ import {
JlGraphic,
KeyListener,
newDrawApp,
ClientEngine,
} from 'jl-graphic';
import {
handlerCommonTypeData,
initCommonDrawApp,
loadCommonDrawDatas,
saveCommonDrawDatas,
saveDrawToServer,
handlerNoEditCommonData,
} from './commonApp';
import { CCTVButtonData } from './graphics/CCTV/CCTVButtonInteraction';
import { CCTVButtonDraw } from 'src/graphics/CCTV/cctvButton/CCTVButtonDrawAssistant';
@ -19,7 +22,12 @@ import { CCTVButtonTemplate } from 'src/graphics/CCTV/cctvButton/CCTVButton';
import { useDrawStore } from 'src/stores/draw-store';
import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import { getDraft } from 'src/api/DraftApi';
import { getJwt } from 'src/api/UserApi';
import { fromUint8Array, toUint8Array } from 'js-base64';
import { getWebsocketUrl } from 'src/configs/UrlManage';
import { sync_data_message } from 'src/protos/sync_data_message';
import { useAuthStore } from 'src/stores/auth-store';
// import { getOnlyToken } from 'src/configs/TokenManage';
let drawApp: IDrawApp | null = null;
@ -43,6 +51,14 @@ export function initIscsDrawApp(): IDrawApp {
dataLoader: loadDrawDatas,
isSupportDeletion: isSupportDeletion,
});
getJwt().then((res) => {
drawApp.enableWsMassaging({
engine: ClientEngine.MQTT,
wsUrl: `${getWebsocketUrl()}`,
token: res.getJwt as string,
});
});
const app = drawApp;
initCommonDrawApp(app);
new CCTVButtonDraw(app, new CCTVButtonTemplate(new CCTVButtonData()));
@ -57,26 +73,182 @@ export function initIscsDrawApp(): IDrawApp {
},
})
);
app.on('loadfinish', () => {
handleSubscribe(app);
});
app.on('destroy', async () => {
resetData();
});
return drawApp;
}
function handleSubscribe(app: IDrawApp) {
const drawStore = useDrawStore();
app.subscribe({
destination: `/rtss_simulation/draft/iscs/${drawStore.draftId}`,
messageHandle: (message: Uint8Array) => {
const syncData = sync_data_message.SyncData.deserialize(message);
console.log(syncData.userId, useAuthStore().userId, 'userID', syncData);
if (syncData.userId === useAuthStore().userId) {
console.info('当前用户操作');
return;
}
if (
syncData.submenu === drawStore.selectSubmenuAndStation.submenu &&
syncData.station === drawStore.selectSubmenuAndStation.station
) {
if (syncData.operationType === 'graphic-create') {
syncData.datas.forEach((data) => {
const proto = handlerTypeData(data);
const template = app.getGraphicTemplatesByType(proto.graphicType);
const g = template.new();
g.loadData(proto);
app.addGraphics(g);
});
} else if (syncData.operationType === 'graphic-drag') {
syncData.datas.forEach((data) => {
const g = app.queryStore.queryById(data.id);
const proto = handlerTypeData(data);
g.updateData(proto);
});
} else if (syncData.operationType === 'graphic-delete') {
const graphics: JlGraphic[] = [];
syncData.datas.forEach((data) => {
const g = app.queryStore.queryById(data.id);
graphics.push(g);
});
app.deleteGraphics(...graphics);
}
} else {
storage = iscsGraphicData.IscsGraphicStorage.deserialize(
toUint8Array(base64)
);
if (syncData.submenu === '火灾报警平面图') {
for (let i = 0; i < storage.fasPlatformAlarmStorages.length; i++) {
const fasPlatformAlarm = storage.fasPlatformAlarmStorages[i];
if (fasPlatformAlarm.stationName == syncData.station) {
// canvasProperty = fasPlatformAlarm.canvas;
// datas = loadCommonDrawDatas(fasPlatformAlarm);
// break;
syncData.datas.forEach((data) => {
handlerNoEditCommonData(
data,
fasPlatformAlarm,
syncData.operationType
);
});
storage.fasPlatformAlarmStorages[i] = fasPlatformAlarm;
console.log(fasPlatformAlarm, 'fasPlatformAlarm');
}
}
} else if (syncData.submenu === '监控布局图') {
for (
let i = 0;
i < storage.cctvOfStationControlStorages.length;
i++
) {
const ctvOfStationControl = storage.cctvOfStationControlStorages[i];
if (ctvOfStationControl.stationName == syncData.station) {
// canvasProperty = ctvOfStationControl.canvas;
// datas = loadCommonDrawDatas(ctvOfStationControl);
// ctvOfStationControl.cctvButtons.forEach((cctvButton) => {
// datas.push(new CCTVButtonData(cctvButton));
// });
// break;
syncData.datas.forEach((data) => {
handlerNoEditCommonData(
data,
ctvOfStationControl,
syncData.operationType
);
});
}
}
}
}
},
graphicQueryer: (state, store) => {
return store.queryById(+state.code);
},
});
}
function handlerTypeData(data: sync_data_message.UpdataData) {
const proto = handlerCommonTypeData(data);
if (proto) {
return proto;
} else {
throw new Error('获取数据异常:无法匹配到数据类型');
}
// switch (data.type) {
// case Rect.Type:
// return new RectData(iscsGraphicData.Rect.deserialize(data.data));
// }
}
export function handlerPublish(message: string) {
console.log(message);
}
let hasLoadData = false;
let base64 = '';
export async function loadDrawDatas(): Promise<IGraphicStorage> {
const drawStore = useDrawStore();
const id = drawStore.draftId;
if (!id) {
throw new Error('获取数据异常为获取到草稿地图ID');
}
const { data: base64 } = await getDraft(id);
if (!hasLoadData) {
base64 = (await getDraft(id)).data;
hasLoadData = true;
}
if (base64) {
const storage = iscsGraphicData.IscsGraphicStorage.deserialize(
toUint8Array(base64)
);
const datas = loadCommonDrawDatas(storage);
storage.cctvButtons.forEach((cctvButton) => {
datas.push(new CCTVButtonData(cctvButton));
});
if (!hasLoadData) {
storage = iscsGraphicData.IscsGraphicStorage.deserialize(
toUint8Array(base64)
);
}
let datas = [];
let canvasProperty;
switch (drawStore.selectSubmenuAndStation.submenu) {
case '火灾报警平面图':
for (let i = 0; i < storage.fasPlatformAlarmStorages.length; i++) {
const fasPlatformAlarm = storage.fasPlatformAlarmStorages[i];
if (
fasPlatformAlarm.stationName ==
drawStore.selectSubmenuAndStation.station
) {
canvasProperty = fasPlatformAlarm.canvas;
datas = loadCommonDrawDatas(fasPlatformAlarm);
break;
}
}
break;
case '监控布局图':
for (let i = 0; i < storage.cctvOfStationControlStorages.length; i++) {
const ctvOfStationControl = storage.cctvOfStationControlStorages[i];
if (
ctvOfStationControl.stationName ==
drawStore.selectSubmenuAndStation.station
) {
canvasProperty = ctvOfStationControl.canvas;
datas = loadCommonDrawDatas(ctvOfStationControl);
ctvOfStationControl.cctvButtons.forEach((cctvButton) => {
datas.push(new CCTVButtonData(cctvButton));
});
break;
}
}
default:
break;
}
return {
canvasProperty: storage.canvas,
canvasProperty,
datas: datas,
};
} else {
@ -86,12 +258,76 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
}
}
const stationOption = ['会展中心', '火车站', '丈八一路'];
let storage: iscsGraphicData.IscsGraphicStorage;
export function saveDrawDatas(app: IDrawApp) {
let storage = new iscsGraphicData.IscsGraphicStorage();
storage = saveCommonDrawDatas(
app,
storage
) as iscsGraphicData.IscsGraphicStorage;
const drawStore = useDrawStore();
if (!storage) {
storage = new iscsGraphicData.IscsGraphicStorage();
}
if (!storage?.fasPlatformAlarmStorages.length) {
stationOption.forEach((station) =>
storage?.fasPlatformAlarmStorages.push(
new iscsGraphicData.FASPlatformAlarmStorage({
stationName: station,
})
)
);
}
if (!storage?.cctvOfStationControlStorages.length) {
stationOption.forEach((station) =>
storage?.cctvOfStationControlStorages.push(
new iscsGraphicData.CCTVOfStationControlStorage({
stationName: station,
})
)
);
}
switch (drawStore.selectSubmenuAndStation.submenu) {
case '火灾报警平面图':
for (let i = 0; i < storage.fasPlatformAlarmStorages.length; i++) {
let fasPlatformAlarm = storage.fasPlatformAlarmStorages[i];
if (
fasPlatformAlarm.stationName ==
drawStore.selectSubmenuAndStation.station
) {
fasPlatformAlarm = new iscsGraphicData.FASPlatformAlarmStorage({
stationName: drawStore.selectSubmenuAndStation.station,
});
const fasStorage = saveCommonDrawDatas(
app,
fasPlatformAlarm
) as iscsGraphicData.FASPlatformAlarmStorage;
storage.fasPlatformAlarmStorages[i] = fasStorage;
break;
}
}
break;
case '监控布局图':
for (let i = 0; i < storage.cctvOfStationControlStorages.length; i++) {
let cctvOfStationControl = storage.cctvOfStationControlStorages[i];
if (
cctvOfStationControl.stationName ==
drawStore.selectSubmenuAndStation.station
) {
cctvOfStationControl =
new iscsGraphicData.CCTVOfStationControlStorage({
stationName: drawStore.selectSubmenuAndStation.station,
});
const cctvStorage = saveCommonDrawDatas(
app,
cctvOfStationControl
) as iscsGraphicData.CCTVOfStationControlStorage;
storage.cctvOfStationControlStorages[i] = cctvStorage;
break;
}
}
break;
default:
break;
}
const graphics = app.queryStore.getAllGraphics();
/* graphics.forEach((g) => {
if (TrackSection.Type === g.type) {
@ -102,3 +338,9 @@ export function saveDrawDatas(app: IDrawApp) {
const base64 = fromUint8Array(storage.serialize());
return base64;
}
function resetData() {
storage = new iscsGraphicData.IscsGraphicStorage();
hasLoadData = false;
base64 = '';
}

108
src/graphics/line/Line.ts Normal file
View File

@ -0,0 +1,108 @@
import { IPointData } from 'pixi.js';
import {
GraphicData,
JlGraphic,
JlGraphicTemplate,
VectorText,
convertToBezierParams,
ILineGraphic,
} from 'jl-graphic';
import { LineGraphic } from '../lineGraphic/LineGraphic';
export interface ILineData extends GraphicData {
get code(): string; // 编号
set code(v: string);
get points(): IPointData[]; // 线坐标点
set points(points: IPointData[]);
get isCurve(): boolean; // 是否曲线
set isCurve(v: boolean);
get segmentsCount(): number; // 曲线分段数
set segmentsCount(v: number);
get lineWidth(): number; // 线宽
set lineWidth(v: number);
get lineColor(): string; // 线色
set lineColor(v: string);
clone(): ILineData;
copyFrom(data: ILineData): void;
eq(other: ILineData): boolean;
}
export class Line extends JlGraphic implements ILineGraphic {
static Type = 'Line';
lineGraphic: LineGraphic;
labelGraphic: VectorText;
childLines: Line[] = [];
constructor() {
super(Line.Type);
this.lineGraphic = new LineGraphic();
this.transformSave = true;
this.addChild(this.lineGraphic);
}
doRepaint() {
if (this.datas.points.length < 2) {
throw new Error('Link坐标数据异常');
}
this.lineGraphic.clear();
this.lineGraphic.isCurve = this.datas.isCurve;
if (this.lineGraphic.isCurve) {
this.lineGraphic.segmentsCount = this.datas.segmentsCount;
}
this.lineGraphic.points = this.datas.points;
this.lineGraphic.lineStyle(this.datas.lineWidth, this.datas.lineColor);
this.lineGraphic.paint();
}
getVerticesList(): IPointData[] {
if (this.datas.isCurve) {
return [
this.datas.points[0],
...convertToBezierParams(this.datas.points).map((param) => param.p2),
];
} else {
return this.datas.points;
}
}
getStartPoint() {
return this.datas.points[0];
}
getEndPoint(): IPointData {
return this.datas.points[this.datas.points.length - 1];
}
get datas(): ILineData {
return this.getDatas<ILineData>();
}
get linePoints(): IPointData[] {
return this.datas.points;
}
set linePoints(points: IPointData[]) {
const old = this.datas.clone();
old.points = points;
this.updateData(old);
}
}
export interface ILineTemplateProperty {
isCurve: boolean;
segmentsCount: number;
}
export class LineTemplate
extends JlGraphicTemplate<Line>
implements ILineTemplateProperty
{
isCurve = false;
segmentsCount = 10;
constructor(dataTemplate: ILineData) {
super(Line.Type, { dataTemplate });
}
new() {
const g = new Line();
g.loadData(this.datas);
return g;
}
}

View File

@ -0,0 +1,480 @@
import {
DisplayObject,
FederatedMouseEvent,
Graphics,
IHitArea,
IPointData,
Point,
} from 'pixi.js';
import {
DraggablePoint,
GraphicDrawAssistant,
GraphicInteractionPlugin,
GraphicTransformEvent,
IDrawApp,
IGraphicApp,
JlGraphic,
KeyListener,
VectorText,
calculateMirrorPoint,
convertToBezierParams,
linePoint,
pointPolygon,
BezierCurveEditPlugin,
IEditPointOptions,
ILineGraphic,
PolylineEditPlugin,
addWayPoint,
clearWayPoint,
ContextMenu,
MenuItemOptions,
AbsorbableLine,
AbsorbablePosition,
AbsorbablePoint,
distance,
} from 'jl-graphic';
import { ILineData, Line, LineTemplate } from './Line';
import { getWayLineIndex } from './LineUtils';
export const LineConsts = {
lineColor: '#f00',
lineWidth: 3,
};
export class LineDraw extends GraphicDrawAssistant<LineTemplate, ILineData> {
points: Point[] = [];
graphic = new Graphics();
keyQListener = new KeyListener({
value: 'KeyQ',
global: true,
onPress: () => {
if (this.points.length === 0) {
this.graphicTemplate.isCurve = true;
}
},
});
keyZListener = new KeyListener({
value: 'KeyZ',
global: true,
onPress: () => {
if (this.points.length === 0) {
this.graphicTemplate.isCurve = false;
}
},
});
constructor(app: IDrawApp, template: LineTemplate) {
super(app, template, 'sym_o_timeline', '线条Line');
this.container.addChild(this.graphic);
LinePointEditPlugin.init(app, this);
}
bind(): void {
super.bind();
this.app.addKeyboardListener(this.keyQListener, this.keyZListener);
}
unbind(): void {
super.unbind();
this.app.removeKeyboardListener(this.keyQListener, this.keyZListener);
}
onLeftDown(e: FederatedMouseEvent): void {
const { x, y } = this.toCanvasCoordinates(e.global);
const p = new Point(x, y);
if (this.graphicTemplate.isCurve) {
if (this.points.length == 0) {
this.points.push(p);
} else {
this.points.push(p, p.clone());
}
} else {
this.points.push(p);
}
}
onLeftUp(e: FederatedMouseEvent): void {
const template = this.graphicTemplate;
if (template.isCurve) {
const mp = this.toCanvasCoordinates(e.global);
if (this.points.length === 1) {
this.points.push(new Point(mp.x, mp.y));
} else if (this.points.length > 1) {
const cp2 = this.points[this.points.length - 2];
const p = this.points[this.points.length - 1];
cp2.copyFrom(calculateMirrorPoint(p, mp));
this.points.push(mp);
}
}
}
onRightClick(): void {
if (this.points.length < 2) {
this.finish();
return;
}
this.createAndStore(true);
}
onEsc(): void {
if (this.points.length < 2) {
this.finish();
return;
}
this.createAndStore(true);
}
redraw(p: Point): void {
if (this.points.length < 1) return;
const template = this.graphicTemplate;
this.graphic.clear();
this.graphic.lineStyle(LineConsts.lineWidth, LineConsts.lineColor);
const ps = [...this.points];
if (template.isCurve) {
if (ps.length === 1) {
this.graphic.moveTo(ps[0].x, ps[0].y);
this.graphic.lineTo(p.x, p.y);
} else {
if ((ps.length + 1) % 3 === 0) {
ps.push(p.clone(), p.clone());
} else {
const cp = ps[ps.length - 2];
const p1 = ps[ps.length - 1];
const mp = calculateMirrorPoint(p1, p);
cp.copyFrom(mp);
}
const bps = convertToBezierParams(ps);
bps.forEach((bp) => {
this.graphic.drawBezierCurve(
bp.p1,
bp.p2,
bp.cp1,
bp.cp2,
template.segmentsCount
);
});
}
} else {
ps.push(p);
ps.forEach((p, i) => {
if (i !== 0) {
this.graphic.lineTo(p.x, p.y);
} else {
this.graphic.moveTo(p.x, p.y);
}
});
}
}
prepareData(data: ILineData): boolean {
const template = this.graphicTemplate;
if (
(!template.isCurve && this.points.length < 2) ||
(template.isCurve && this.points.length < 4)
) {
console.log('Line绘制因点不够取消绘制');
return false;
}
if (template.isCurve) {
this.points.pop();
}
data.isCurve = template.isCurve;
data.segmentsCount = template.segmentsCount;
data.points = this.points;
data.lineColor = LineConsts.lineColor;
data.lineWidth = LineConsts.lineWidth;
return true;
}
clearCache(): void {
this.points = [];
this.graphic.clear();
}
}
export class LineGraphicHitArea implements IHitArea {
line: Line;
constructor(line: Line) {
this.line = line;
}
contains(x: number, y: number): boolean {
if (this.line.datas.isCurve) {
const bps = convertToBezierParams(this.line.datas.points);
for (let i = 0; i < bps.length; i++) {
const bp = bps[i];
if (
pointPolygon(
{ x, y },
[bp.p1, bp.cp1, bp.cp2, bp.p2],
this.line.datas.lineWidth
)
) {
return true;
}
}
} else {
for (let i = 1; i < this.line.datas.points.length; i++) {
const p1 = this.line.datas.points[i - 1];
const p2 = this.line.datas.points[i];
if (linePoint(p1, p2, { x, y }, this.line.datas.lineWidth)) {
return true;
}
}
}
return false;
}
}
function buildAbsorbablePositions(
line: Line,
dp: DraggablePoint
): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const changePoints = line.localToCanvasPoints(...line.datas.points);
for (let i = 0; i < changePoints.length; i++) {
if (changePoints[i].equals(dp)) {
const { width, height } = line.getGraphicApp().canvas;
if (i == 0 || i == changePoints.length - 1) {
const ps =
i == 0 ? changePoints[1] : changePoints[changePoints.length - 2];
const x = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
const y = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
aps.push(x, y);
} else {
const generateAxisPoint = [changePoints[i - 1], changePoints[i + 1]];
generateAxisPoint.forEach((point) => {
const x = new AbsorbableLine(
{ x: 0, y: point.y },
{ x: width, y: point.y }
);
const y = new AbsorbableLine(
{ x: point.x, y: 0 },
{ x: point.x, y: height }
);
aps.push(x, y);
});
}
break;
}
}
if (line instanceof Line) {
const lines = line.queryStore.queryByType<Line>(Line.Type);
lines.forEach((item) => {
if (item.id !== line.id) {
item.localToCanvasPoints(...item.datas.points).forEach((p) => {
aps.push(new AbsorbablePoint(p));
});
}
});
}
return aps;
}
export function onEditPointCreate(g: ILineGraphic, dp: DraggablePoint): void {
const line = g as Line;
dp.on('transformstart', (e: GraphicTransformEvent) => {
if (e.isShift()) {
line.getGraphicApp().setOptions({
absorbablePositions: buildAbsorbablePositions(line, dp),
});
}
});
}
class LinePolylineEditPlugin extends PolylineEditPlugin {
static Name = 'LinePolylineEditPlugin';
labels: VectorText[] = [];
constructor(g: ILineGraphic, options?: IEditPointOptions) {
super(g, options);
this.name = LinePolylineEditPlugin.Name;
}
}
class LineBazierCurveEditPlugin extends BezierCurveEditPlugin {
static Name = 'LineBazierCurveEditPlugin';
labels: VectorText[] = [];
constructor(g: ILineGraphic, options?: IEditPointOptions) {
super(g, options);
this.name = LineBazierCurveEditPlugin.Name;
}
}
export const addWaypointConfig: MenuItemOptions = {
name: '添加路径点',
};
export const clearWaypointsConfig: MenuItemOptions = {
name: '清除所有路径点',
};
const LineEditMenu: ContextMenu = ContextMenu.init({
name: '区段编辑菜单',
groups: [
{
items: [addWaypointConfig, clearWaypointsConfig],
},
],
});
export class LinePointEditPlugin extends GraphicInteractionPlugin<Line> {
static Name = 'LinePointDrag';
drawAssistant: LineDraw;
constructor(app: IGraphicApp, da: LineDraw) {
super(LinePointEditPlugin.Name, app);
this.drawAssistant = da;
app.registerMenu(LineEditMenu);
}
static init(app: IGraphicApp, da: LineDraw) {
return new LinePointEditPlugin(app, da);
}
filter(...grahpics: JlGraphic[]): Line[] | undefined {
return grahpics.filter((g) => g.type == Line.Type) as Line[];
}
bind(g: Line): void {
g.lineGraphic.eventMode = 'static';
g.lineGraphic.cursor = 'pointer';
g.lineGraphic.hitArea = new LineGraphicHitArea(g);
g.transformSave = true;
g.on('selected', this.onSelected, this);
g.on('unselected', this.onUnselected, this);
g.on('transformstart', this.onDragMove, this);
g.on('_rightclick', this.onContextMenu, this);
}
unbind(g: Line): void {
g.off('selected', this.onSelected, this);
g.off('unselected', this.onUnselected, this);
g.off('transformstart', this.onDragMove, this);
g.off('_rightclick', this.onContextMenu, this);
}
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const line = target.getGraphic() as Line;
this.app.updateSelected(line);
const p = line.screenToLocalPoint(e.global);
addWaypointConfig.handler = () => {
const linePoints = line.linePoints;
const { start, end } = getWayLineIndex(linePoints, p);
addWayPoint(line, false, start, end, p);
};
clearWaypointsConfig.handler = () => {
clearWayPoint(line, false);
};
LineEditMenu.open(e.global);
}
onSelected(g: DisplayObject): void {
const line = g as Line;
if (line.datas.isCurve) {
let lep = line.getAssistantAppend<LineBazierCurveEditPlugin>(
LineBazierCurveEditPlugin.Name
);
if (!lep) {
lep = new LineBazierCurveEditPlugin(line, {
onEditPointCreate,
});
line.addAssistantAppend(lep);
}
lep.showAll();
} else {
let lep = line.getAssistantAppend<LinePolylineEditPlugin>(
LinePolylineEditPlugin.Name
);
if (!lep) {
lep = new LinePolylineEditPlugin(line, { onEditPointCreate });
line.addAssistantAppend(lep);
}
lep.showAll();
}
}
onUnselected(g: DisplayObject): void {
const line = g as Line;
if (line.datas.isCurve) {
const lep = line.getAssistantAppend<LineBazierCurveEditPlugin>(
LineBazierCurveEditPlugin.Name
);
if (lep) {
lep.hideAll();
}
} else {
const lep = line.getAssistantAppend<LinePolylineEditPlugin>(
LinePolylineEditPlugin.Name
);
if (lep) {
lep.hideAll();
}
}
}
onDragMove(e: GraphicTransformEvent) {
const line = e.target as Line;
this.app.setOptions({
absorbablePositions: buildDragMoveAbsorbablePositions(line),
});
}
}
type dragType = Line;
function buildDragMoveAbsorbablePositions(
target: dragType
): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const lines = target.queryStore.queryByType<Line>(Line.Type);
lines.forEach((line) => {
if (line.id !== target.id) {
line.localToCanvasPoints(...line.datas.points).forEach((p) => {
aps.push(new DragMoveAbsorbablePoint(p)); //区段端点
});
}
});
return aps;
}
class DragMoveAbsorbablePoint extends AbsorbablePoint {
moveTarget:
| {
position: IPointData;
portPos: IPointData[];
}
| undefined;
constructor(point: IPointData, absorbRange = 15) {
super(point, absorbRange);
}
tryAbsorb(...dragTargets: dragType[]): void {
const dragTarget = dragTargets[0];
if (this.moveTarget == undefined) {
this.moveTarget = {
position: dragTarget
.getGraphicApp()
.toCanvasCoordinates(dragTarget.getGlobalPosition()),
portPos: [
dragTarget.localToCanvasPoint(dragTarget.getStartPoint()),
dragTarget.localToCanvasPoint(dragTarget.getEndPoint()),
],
};
}
dragTarget
.localToCanvasPoints(...dragTarget.datas.points)
.forEach((p, i) => {
if (
distance(this._point.x, this._point.y, p.x, p.y) < this.absorbRange &&
this.moveTarget
) {
dragTarget.updatePositionByCanvasPosition(
new Point(
this.moveTarget.position.x +
this._point.x -
this.moveTarget.portPos[i].x,
this.moveTarget.position.y +
this._point.y -
this.moveTarget.portPos[i].y
)
);
}
});
}
}

View File

@ -0,0 +1,42 @@
import { calculateDistanceFromPointToLine, calculateFootPointFromPointToLine } from "jl-graphic";
import { IPointData } from 'pixi.js';
//获取所选线段的索引
export function getWayLineIndex(
points: IPointData[],
p: IPointData
): { start: number; end: number } {
let start = 0;
let end = 0;
let minDistance = 0;
for (let i = 1; i < points.length; i++) {
const sp = points[i - 1];
const ep = points[i];
let distance = calculateDistanceFromPointToLine(sp, ep, p);
distance = Math.round(distance * 100) / 100;
if (i == 1) {
minDistance = distance;
}
if (distance == minDistance) {
const minX = Math.min(sp.x, ep.x);
const maxX = Math.max(sp.x, ep.x);
const minY = Math.min(sp.y, ep.y);
const maxY = Math.max(sp.y, ep.y);
const point = calculateFootPointFromPointToLine(sp, ep, p);
if (
point.x >= minX &&
point.x <= maxX &&
point.y >= minY &&
point.y <= maxY
) {
start = i - 1;
}
}
if (distance < minDistance) {
minDistance = distance;
start = i - 1;
}
}
end = start + 1;
return { start, end };
}

View File

@ -0,0 +1,51 @@
import { Graphics, IPointData } from 'pixi.js';
import { assertBezierPoints, convertToBezierParams } from 'jl-graphic';
export class LineGraphic extends Graphics {
static Type = 'LineGraphic';
private _points: IPointData[] = [];
public get points(): IPointData[] {
return this._points;
}
public set points(value: IPointData[]) {
if (!this.isCurve) {
if (value.length < 2) {
throw Error('Polyline must have at least 2 points');
}
} else {
assertBezierPoints(value);
}
this._points = value;
}
private _segmentsCount = 10;
public get segmentsCount(): number {
return this._segmentsCount;
}
public set segmentsCount(value: number) {
if (value < 1) {
throw Error('segmentsCount must be at least 1');
}
this._segmentsCount = value;
}
isCurve = false;
constructor() {
super();
}
paint() {
if (this.isCurve) {
const bps = convertToBezierParams(this.points);
bps.forEach((bp) => {
this.drawBezierCurve(bp.p1, bp.p2, bp.cp1, bp.cp2, this.segmentsCount);
});
} else {
this.moveTo(this.points[0].x, this.points[0].y);
for (let i = 1; i < this.points.length; i++) {
this.lineTo(this.points[i].x, this.points[i].y);
}
}
}
}

View File

@ -1,8 +1,13 @@
<template>
<q-layout view="hHh LpR fFf">
<q-header reveal class="bg-primary text-white">
<q-toolbar>
<q-toolbar-title class="q-gutter-sm">
<q-header class="bg-primary text-white">
<div class="top-menu">
<div class="top-menu-left">成都地铁</div>
<div class="top-menu-middle">
<span class="data-margin">{{ currentData }}</span>
<span class="data-margin">{{ currentTime }}</span>
</div>
<div class="top-menu-right">
<q-btn color="accent" label="功能菜单">
<q-menu>
<q-list style="min-width: 100px">
@ -18,49 +23,140 @@
</q-list>
</q-menu>
</q-btn>
<template v-for="item in iscsTypeConfig" :key="item.menuName">
<q-btn-dropdown color="teal" :label="item.menuName">
<q-list>
<q-item
v-for="subItem in item.submenu"
:key="subItem.submenu"
clickable
v-close-popup
@click="onTopMenuClick(subItem.sunMenuName)"
>
<q-item-section>
<q-item-label>{{ subItem.sunMenuName }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</template>
</q-toolbar-title>
<q-btn square color="purple" style="margin-right: 10px" icon="search">
<q-popup-edit
ref="popupEdit"
v-model="searchId"
:cover="false"
:offset="[0, 10]"
v-slot="scope"
>
<q-input
color="accent"
v-model="scope.value"
label="设备Id"
dense
autofocus
@keyup.enter="scope.set"
<q-btn square color="purple" icon="search">
<q-popup-edit
ref="popupEdit"
v-model="searchId"
:cover="false"
:offset="[0, 10]"
v-slot="scope"
>
<template v-slot:prepend>
<q-icon name="search" color="accent" />
</template>
</q-input>
</q-popup-edit>
</q-btn>
<q-btn color="info" label="返回" @click="backConfirm" />
<q-btn dense flat round icon="menu" @click="toggleRightDrawer" />
</q-toolbar>
<q-input
color="accent"
v-model="scope.value"
label="设备Id"
dense
autofocus
@keyup.enter="scope.set"
>
<template v-slot:prepend>
<q-icon name="search" color="accent" />
</template>
</q-input>
</q-popup-edit>
</q-btn>
<q-btn color="info" label="返回" @click="backConfirm" />
<q-btn dense flat round icon="menu" @click="toggleRightDrawer" />
</div>
</div>
<div class="menu-nav">
<span class="menu-nav-leftTxet">{{
drawStore.selectSubmenuAndStation.station
}}</span>
<div class="menu-nav-right">
<div
class="menu-nav-contain"
v-for="(item, index) in menuOption"
:key="index"
@click="selectedMenu(item.value)"
>
<q-icon
size="18px"
class="menu-nav-img"
:name="selectMenuName == item.value ? item.activeIcon : item.icon"
/>
<div
class="menu-nav-text"
:class="{
active: selectMenuName == item.value,
}"
>
{{ item.value }}
</div>
</div>
</div>
</div>
<div class="subMenu-nav">
<span class="menu-nav-leftTxet" />
<q-btn-toggle
v-model="selectSubMenuName"
no-caps
toggle-color="grey-10"
toggle-text-color="blue-8"
:options="subMenuOption"
@update:model-value="selectedSubMenu"
/>
</div>
<div class="station-nav">
<div class="station-list-left">
<div
class="station-list-left-box"
:class="{
active: clickOCC,
}"
@click="clickOCCFn()"
/>
<div class="station-list-left-text">OCC</div>
</div>
<div class="station-list">
<div class="station-list-contain">
<div class="station-line" />
<div
v-for="(item, index) in stationOption"
:key="index"
class="station-box-contain"
>
<div class="station-box">
<div
class="station-list-box"
:class="{
active: selectStationName == item.value,
left: index == 0,
right: index == stationOption.length - 1,
}"
@click="selectedStation(item.value)"
/>
</div>
<div
class="station-name"
:class="
index == 0
? 'station-name-first'
: index % 2 == 1
? 'station-name-down'
: 'station-name-up'
"
>
{{ item.value }}
</div>
</div>
</div>
</div>
<div class="station-list-right">
<div
class="station-list-right-contain"
v-for="(item, index) in stationListRightOption"
:key="index"
>
<div
v-if="index < stationListRightOption.length - 1"
class="station-list-right-line"
/>
<div
class="station-list-right-box"
:class="{
active: clickStationListRightName == item,
}"
@click="clickStationListRighrOrOcc(item)"
/>
<div class="station-list-right-box-text">
{{ item }}
</div>
</div>
</div>
</div>
<q-resize-observer @resize="onHeaderResize" />
</q-header>
@ -74,6 +170,13 @@
<div id="draw-app-container" class="overflow-hidden"></div>
</q-page-container>
<q-footer>
<q-toolbar>
<q-toolbar-title>状态栏</q-toolbar-title>
</q-toolbar>
<q-resize-observer @resize="onFooterResize" />
</q-footer>
<q-dialog
v-model="saveAsDialog"
persistent
@ -103,12 +206,12 @@
<draggable-dialog
seamless
title="绘制工具"
:width="230"
:height="50"
:width="130"
:height="drawDialogHeight"
v-model="showDrawTool"
canNotClose
>
<q-btn-toggle
<!-- <q-btn-toggle
v-model="selectUtil"
color="brown"
text-color="white"
@ -116,15 +219,22 @@
toggle-text-color="black"
:options="utilsOption"
@update:model-value="drawSelect"
>
<template
v-for="(ctl, idx) in utilsOption"
:key="idx"
v-slot:[ctl.value]
>
<q-tooltip>{{ ctl.tip }}</q-tooltip>
> -->
<div class="row wrap">
<template v-for="(ctl, idx) in utilsOption" :key="idx">
<q-btn
square
style="margin: 4px"
color="brown"
@click="drawSelect(ctl.value)"
:icon="ctl.icon"
>
</q-btn>
</template>
</q-btn-toggle>
</div>
<!-- <q-tooltip>{{ ctl.tip }}</q-tooltip> -->
<!-- </q-btn-toggle> -->
</draggable-dialog>
<q-resize-observer @resize="onResize" />
</q-layout>
@ -132,9 +242,9 @@
<script setup lang="ts">
import DrawProperties from 'src/components/draw-app/IscsDrawProperties.vue';
import { onMounted, reactive, ref, watch } from 'vue';
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import { date, useQuasar } from 'quasar';
import { useDrawStore } from 'src/stores/draw-store';
import { CCTVButton } from 'src/graphics/CCTV/cctvButton/CCTVButton';
import { Arrow } from 'src/graphics/arrow/Arrow';
@ -146,6 +256,9 @@ import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { successNotify } from 'src/utils/CommonNotify';
import { saveDrawDatas } from 'src/drawApp/iscsApp';
import { saveDrawToServer } from 'src/drawApp/commonApp';
import { sync_data_message } from 'src/protos/sync_data_message';
import { useAuthStore } from 'src/stores/auth-store';
import { Line } from 'src/graphics/line/Line';
const $q = useQuasar();
const route = useRoute();
@ -153,6 +266,7 @@ const router = useRouter();
const searchId = ref(0);
const drawStore = useDrawStore();
const showDrawTool = ref(true);
const drawDialogHeight = ref(44);
watch(
() => drawStore.drawMode,
@ -192,9 +306,10 @@ function toggleRightDrawer() {
//
const selectUtil = ref();
const utilsOption: ControlItem[] = reactive([]);
const drawSelect = (item: string) => {
function drawSelect(item: string) {
drawStore.getDrawApp().interactionPlugin(item).resume();
};
}
class ControlItem {
value: string;
slot: string;
@ -218,16 +333,31 @@ const leftMenuConfig = [
{ label: '另存为', click: () => (saveAsDialog.value = true) },
];
let iscsTypeConfig = ref([]);
onMounted(() => {
console.log('绘制应用layout mounted');
const dom = document.getElementById('draw-app-container');
iscsTypeConfig.value = getIscsStyleConfig(route.query.iscsStyle as IscsStyle);
initMunuOption();
intervalId = setInterval(updateTime, 1000);
if (dom) {
drawStore.setDraftId(+route.params.id as number);
const drawApp = drawStore.initDrawApp();
drawApp.bindDom(dom);
drawApp.reload();
const _record = drawApp.opRecord.record;
drawApp.opRecord.record = function (op) {
handleRecordData(op);
_record.call(drawApp.opRecord, op);
};
const _undo = drawApp.opRecord.undo;
drawApp.opRecord.undo = function () {
_undo.call(drawApp.opRecord);
console.log('undo');
};
const _redo = drawApp.opRecord.redo;
drawApp.opRecord.redo = function () {
_redo.call(drawApp.opRecord);
console.log('redo');
};
onResize();
} else {
drawStore.setDraftId(null);
@ -236,6 +366,7 @@ onMounted(() => {
Arrow.Type,
TextContent.Type,
Rect.Type,
Line.Type,
CCTVButton.Type,
];
drawAssistantsTypes.forEach((type) => {
@ -250,11 +381,13 @@ onMounted(() => {
);
}
});
drawDialogHeight.value = 44 * Math.ceil(utilsOption.length / 2);
});
const canvasWidth = ref(0);
const canvasHeight = ref(0);
const headerHeight = ref(0);
const footerHeight = ref(0);
const rightWidth = ref(0);
function onHeaderResize(size: { height: number; width: number }) {
@ -262,6 +395,11 @@ function onHeaderResize(size: { height: number; width: number }) {
onResize();
}
function onFooterResize(size: { height: number; width: number }) {
footerHeight.value = size.height;
onResize();
}
function onRightResize(size: { height: number; width: number }) {
rightWidth.value = size.width;
onResize();
@ -272,7 +410,7 @@ function onResize() {
const clientHeight = document.documentElement.clientHeight;
canvasWidth.value =
clientWidth - (rightDrawerOpen.value ? rightWidth.value : 0);
canvasHeight.value = clientHeight - headerHeight.value;
canvasHeight.value = clientHeight - headerHeight.value - footerHeight.value;
const dom = document.getElementById('draw-app-container');
if (dom) {
dom.style.width = canvasWidth.value + 'px';
@ -308,12 +446,366 @@ async function saveAs(name: string) {
}
}
function onTopMenuClick(name: string) {
console.log(name);
drawStore.clickSubmenuName = name;
//
let intervalId = null;
const currentData = ref(date.formatDate(new Date(), 'YYYY-MM-DD'));
const currentTime = ref(date.formatDate(new Date(), 'HH:mm:ss'));
const updateTime = () => {
currentData.value = date.formatDate(new Date(), 'YYYY-MM-DD');
currentTime.value = date.formatDate(new Date(), 'HH:mm:ss');
};
//
const selectMenuName = ref('');
let menuOption = [];
function selectedMenu(menuName: string) {
selectMenuName.value = menuName;
for (let i = 0; i < iscsTypeConfig.length; i++) {
if (iscsTypeConfig[i].menuName == menuName) {
subMenuOption.value = iscsTypeConfig[i].sunMenu.map((sunMenu) => {
return { label: sunMenu.sunMenuName, value: sunMenu.sunMenuName };
});
selectSubMenuName.value = subMenuOption.value[0].value;
selectedSubMenu(selectSubMenuName.value);
break;
}
}
}
const selectSubMenuName = ref('');
const subMenuOption = ref([]);
function selectedSubMenu(subName: string) {
drawStore.selectSubmenuAndStation.submenu = subName;
forceReloadDate();
}
let iscsTypeConfig: {
menuName: string;
icon: string;
activeIcon: string;
sunMenu: { sunMenuName: string }[];
}[] = [];
function initMunuOption() {
iscsTypeConfig = getIscsStyleConfig(route.query.iscsStyle as IscsStyle);
menuOption = iscsTypeConfig.map((menu) => {
return {
label: menu.menuName,
value: menu.menuName,
icon: menu.icon,
activeIcon: menu.activeIcon,
};
});
selectMenuName.value = menuOption[0].value;
subMenuOption.value = iscsTypeConfig[0].sunMenu.map((sunMenu) => {
return { label: sunMenu.sunMenuName, value: sunMenu.sunMenuName };
});
selectSubMenuName.value = subMenuOption.value[0].value;
drawStore.selectSubmenuAndStation.submenu = selectSubMenuName.value;
drawStore.selectSubmenuAndStation.station = stationOption[0].value;
}
const selectStationName = ref('会展中心');
const stationOption = [
{ label: '会展中心', value: '会展中心' },
{ label: '火车站', value: '火车站' },
{ label: '丈八一路', value: '丈八一路' },
{ label: '会展中心1', value: '会展中心1' },
{ label: '火车站1', value: '火车站1' },
{ label: '丈八一路1', value: '丈八一路1' },
{ label: '会展中心2', value: '会展中心2' },
{ label: '火车站2', value: '火车站2' },
{ label: '丈八一路2', value: '丈八一路2' },
{ label: '会展中心3', value: '会展中心3' },
{ label: '火车站3', value: '火车站3' },
{ label: '丈八一路3', value: '丈八一路3' },
{ label: '会展中心4', value: '会展中心4' },
{ label: '火车站4', value: '火车站4' },
{ label: '丈八一路4', value: '丈八一路4' },
];
function selectedStation(name: string) {
selectStationName.value = name;
drawStore.selectSubmenuAndStation.station = name;
forceReloadDate();
}
function handleRecordData(op) {
const drawApp = drawStore.getDrawApp();
const syncData = {
operationType: op.type,
datas: [],
submenu: drawStore.selectSubmenuAndStation.submenu,
station: drawStore.selectSubmenuAndStation.station,
userId: useAuthStore().userId,
};
op.obj.forEach((g) => {
const gData = g.saveData();
syncData.datas.push(
new sync_data_message.UpdataData({
id: g.id,
type: g.type,
data: gData.data.serialize(),
})
);
});
drawApp.publishMessage(
`/rtss_simulation/draft/iscs/${drawStore.draftId}`,
new sync_data_message.SyncData({ ...syncData }).serialize()
);
}
function forceReloadDate() {
const drawApp = drawStore.getDrawApp();
const graphics = drawApp.queryStore.getAllGraphics();
graphics.forEach((graphic) => (graphic.visible = false));
drawApp.deleteGraphics(...graphics);
drawApp.updateSelected();
drawApp.forceReload();
}
const clickOCC = ref(false);
function clickOCCFn() {
clickOCC.value = !clickOCC.value;
}
const clickStationListRightName = ref('');
const stationListRightOption = [
'车辆段',
'火车南主所',
'皂角树主所',
'红星停车场',
'香山主所',
];
function clickStationListRighrOrOcc(buttonLabel: string) {
clickStationListRightName.value = buttonLabel;
}
onUnmounted(() => {
drawStore.destroy();
clearInterval(intervalId);
});
</script>
<style lang="scss" scoped>
.top-menu {
display: flex;
justify-content: center;
align-items: center;
height: 40px;
background-color: #1473a3;
.top-menu-left {
width: 80px;
font-size: 20px;
margin-left: 30px;
}
.top-menu-middle {
flex: 1;
text-align: center;
padding-left: 150px;
.data-margin {
margin-right: 80px;
font-size: 20px;
}
}
.top-menu-right {
min-width: 80px;
display: flex;
gap: 10px;
}
}
.menu-nav {
display: flex;
width: 100%;
height: 60px;
background-image: linear-gradient(to bottom, #616567, #424548);
.menu-nav-leftTxet {
display: inline-block;
min-width: 140px;
font-size: 18px;
text-align: center;
line-height: 60px;
}
.menu-nav-right {
display: flex;
.menu-nav-contain {
display: flex;
justify-content: center;
align-items: center;
position: relative;
height: 100%;
cursor: pointer;
.menu-nav-img {
position: absolute;
top: 10px;
}
.menu-nav-text {
width: 90px;
margin-top: 28px;
text-align: center;
color: white;
font-size: 18px;
}
.menu-nav-text.active {
color: #4fb6ec;
}
}
}
}
.subMenu-nav {
background-color: #5c6163;
.menu-nav-leftTxet {
display: inline-block;
min-width: 140px;
font-size: 16px;
}
}
.station-nav {
display: flex;
width: 100%;
height: 65px;
background-color: #b7e7fe;
.station-list-left {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 4vw;
background-color: #61cbff;
.station-list-left-box {
cursor: pointer;
width: 1vw;
height: 1vw;
border-radius: 1vw;
background: radial-gradient(circle, #aaabae, #717171);
border-left: 1px #fdfdfd solid;
border-right: 1px #262626 solid;
}
.station-list-left-box.active {
background: radial-gradient(circle, #43f5fa, #1f88be);
}
.station-list-left-text {
position: absolute;
bottom: 4px;
color: black;
}
}
.station-list {
width: 82%;
height: 100%;
.station-list-contain {
display: flex;
position: relative;
justify-content: space-between;
width: 96%;
height: 100%;
margin-left: 2%;
.station-line {
position: absolute;
width: 100%;
height: 12px;
background-image: linear-gradient(to bottom, #9c9c9c, #f0f0f0, #9c9c9c);
top: 25px;
border: 1px #505050 solid;
}
.station-box-contain {
display: inline-block;
position: relative;
height: 100%;
.station-box {
display: inline-block;
position: relative;
width: 1vw;
margin-top: 20px;
cursor: pointer;
.station-list-box {
position: absolute;
width: 1vw;
height: 1vw;
border-radius: 1vw;
top: 10px;
background: radial-gradient(circle, #aaabae, #717171);
border-left: 1px #fdfdfd solid;
border-right: 1px #262626 solid;
transform: translateY(-50%);
}
.station-list-box.active {
background: radial-gradient(circle, #43f5fa, #1f88be);
}
.station-list-box.left {
left: -2px;
}
.station-list-box.right {
left: 2px;
}
}
.station-name {
color: black;
font-size: 12px;
position: absolute;
}
.station-name-first {
transform: translateX(-50%);
top: 5px;
white-space: nowrap;
left: 0%;
}
.station-name-up {
top: 5px;
transform: translateX(-50%);
left: 25%;
white-space: nowrap;
}
.station-name-down {
top: 45px;
transform: translateX(-25%);
white-space: nowrap;
left: 0%;
}
}
}
}
.station-list-right {
display: flex;
align-items: center;
width: 14vw;
background-color: #61cbff;
.station-list-right-contain {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
position: relative;
height: 100%;
.station-list-right-line {
position: absolute;
left: 90%;
width: 1px;
height: 100%;
background-color: #aaabae;
}
.station-list-right-box {
position: absolute;
top: 10px;
cursor: pointer;
width: 1vw;
height: 1vw;
border-radius: 1vw;
background: radial-gradient(circle, #aaabae, #717171);
border-left: 1px #fdfdfd solid;
border-right: 1px #262626 solid;
}
.station-list-right-box-text {
position: relative;
width: 3em;
margin-top: 28px;
word-break: break-all;
white-space: normal;
color: black;
font-size: 12px;
}
.station-list-right-box.active {
background: radial-gradient(circle, #43f5fa, #1f88be);
}
}
}
}
</style>

View File

@ -121,19 +121,24 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ref, reactive } from 'vue';
import SysMenu from 'src/components/SysMenu.vue';
import { useRoute } from 'vue-router';
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
// import { useRoute } from 'vue-router';
import { clearJwtToken } from 'src/configs/TokenManage';
import { Dialog } from 'quasar';
// import { getLoginUserInfo } from 'src/api/UserApi';
// import { useAuthStore } from 'src/stores/auth-store';
const route = useRoute();
// const route = useRoute();
// const authStore = useAuthStore();
onMounted(() => {
if (route.params.token) {
saveJwtToken(route.params.token as string);
}
});
// onMounted(async () => {
// if (route.params.token) {
// saveJwtToken(route.params.token as string);
// const res = await getLoginUserInfo();
// authStore.setUserId(res.loginUserInfo.id);
// }
// });
const leftDrawerOpen = ref(false);
function toggleLeftDrawer() {

View File

@ -15,19 +15,35 @@
@request="onRequest"
>
<template v-slot:top-right>
<q-input
dense
debounce="1000"
v-model="filter.name"
label="名称"
></q-input>
<q-btn flat round color="primary" icon="search" />
<q-btn
color="primary"
v-if="route.name == 'iscsDraft'"
label="新建"
@click="createFormShow = true"
/>
<div class="q-gutter-md q-mt-none row justify-center items-start">
<q-input dense debounce="1000" v-model="filter.name" label="名称" />
<q-select
dense
v-model="filter.iscsStyle"
:options="searchTscsStyleOption"
emit-value
map-options
options-dense
class="ellipsis"
label="ISCS风格"
style="width: 130px"
/>
<q-select
v-if="route.name == 'iscsDraft'"
dense
v-model="filter.isShared"
:options="isSharedOption"
class="ellipsis"
label="共享相关"
style="width: 130px"
/>
<q-btn
color="primary"
v-if="route.name == 'iscsDraft'"
label="新建"
@click="createFormShow = true"
/>
</div>
</template>
<template v-slot:header-cell-name="props">
<q-th :props="props">
@ -128,6 +144,7 @@
v-model="createForm.draftName"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入名称!']"
@blur="checkDraftName"
/>
<q-select
v-model="createForm.style"
@ -173,6 +190,7 @@
v-model="publishForm.pubName"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入名称!']"
@blur="checkPublishName"
/>
<q-input
outlined
@ -249,6 +267,8 @@ import {
sharedDraftPageQuery,
PagingQueryParams,
iscsStyleOption,
searchTscsStyleOption,
draftDataExist,
} from '../api/DraftApi';
import { ApiError } from 'src/boot/axios';
import { useRoute, useRouter } from 'vue-router';
@ -258,10 +278,10 @@ import {
PublishItem,
publishPageQuery,
setDefaultPublish,
isReleaseDataNameExists,
} from 'src/api/PublishApi';
import { useAuthStore } from 'src/stores/auth-store';
import { PageDto } from 'src/api/ApiCommon';
import { useDrawStore } from 'src/stores/draw-store';
const $q = useQuasar();
const router = useRouter();
@ -272,7 +292,6 @@ const props = withDefaults(
{ sizeHeight: 500 }
);
const authStore = useAuthStore();
const drawStore = useDrawStore();
const route = useRoute();
const tableHeight = computed(() => {
@ -300,9 +319,9 @@ const columnDefs: QTableColumn[] = [
align: 'center',
},
{
name: 'userId',
name: 'userName',
label: '创建人',
field: 'userId',
field: 'userName',
align: 'center',
},
{
@ -339,6 +358,8 @@ const tableRef = ref();
const rows = reactive([]);
const filter = reactive({
name: '',
iscsStyle: IscsStyle.UNKNOWN,
isShared: '全部',
});
const loading = ref(false);
const pagination = ref({
@ -353,8 +374,6 @@ const pagination = ref({
let allRequestData: DraftIscsDataDto[] = [];
async function onRequest(props: any) {
const { page, rowsPerPage } = props.pagination;
const filter = props.filter;
loading.value = true;
const variables: PagingQueryParams = {
paging: {
@ -363,9 +382,19 @@ async function onRequest(props: any) {
},
query: {
dataType: DraftDataType.ISCS,
name: filter.name,
},
};
if (filter.name) {
Object.assign(variables.query, { name: filter.name });
}
if (filter.iscsStyle) {
Object.assign(variables.query, { options: { style: filter.iscsStyle } });
}
if (filter.isShared !== '全部') {
Object.assign(variables.query, {
isShared: filter.isShared == '共享' ? true : false,
});
}
try {
let response: PageDto<DraftIscsDataDto>;
if (route.name == 'iscsDraft') {
@ -402,14 +431,29 @@ function getTypeName(row: DraftItem) {
return iscsStyleName || '';
}
//
const isSharedOption = ['全部', '共享', '不共享'];
//
const createFormShow = ref(false);
const createForm = reactive({
draftName: '',
style: IscsStyle.DA_SHI_ZHI_NENG,
});
const myForm = ref<QForm | null>(null);
async function checkDraftName() {
if (!createForm.draftName) return;
const res = await draftDataExist({
dataType: DraftDataType.ISCS,
name: createForm.draftName,
});
if (res.data.data.draftDataExist) {
$q.notify({
type: 'negative',
message: '草稿名字已存在,请换一个名字',
});
}
}
function onCreate() {
myForm.value?.validate().then(async (res) => {
if (res) {
@ -439,7 +483,6 @@ function onCreate() {
//
function goToPath(row: DraftItem) {
drawStore.clickSubmenuName = '车站控制';
let path = `/iscsPainting/${row.id}`;
const iscsStyle = allRequestData.find((item) => item.draftData.id == row.id)
.options.style;
@ -468,6 +511,20 @@ function newPublish(row: DraftItem) {
publishForm.note = '';
}
async function checkPublishName() {
if (!publishForm.draftName) return;
const res = await isReleaseDataNameExists({
dataType: DraftDataType.ISCS,
name: publishForm.draftName,
});
if (res.data.data.isReleaseDataNameExists) {
$q.notify({
type: 'negative',
message: '发布名字已存在,请换一个名字',
});
}
}
const publishNameDisable = ref(false);
function publishToDefault(row: DraftItem) {
if (!row.defaultReleaseDataId) {
@ -503,6 +560,7 @@ function publishDraftGraphics() {
type: 'positive',
message: '发布成功',
});
tableRef.value.requestServerInteraction();
}
});
} else {
@ -519,6 +577,7 @@ function publishDraftGraphics() {
} else {
publishNameDisable.value = false;
publishFormShow.value = false;
tableRef.value.requestServerInteraction();
$q.notify({
type: 'positive',
message: '发布成功',
@ -621,6 +680,7 @@ const draftInfo = ref<DraftItem>({
createdAt: '',
updatedAt: '',
defaultReleaseDataName: '',
userName: '',
});
const publishColumnDefs: QTableColumn[] = [

View File

@ -18,13 +18,28 @@
@request="onRequest"
>
<template v-slot:top-right>
<q-input
dense
debounce="1000"
v-model="filter.name"
label="名称"
></q-input>
<q-btn flat round color="primary" icon="search" />
<div class="q-gutter-md q-mt-none row justify-center items-start">
<q-input dense debounce="1000" v-model="filter.name" label="名称" />
<q-select
dense
v-model="filter.iscsStyle"
:options="searchTscsStyleOption"
emit-value
map-options
options-dense
class="ellipsis"
label="ISCS风格"
style="width: 130px"
/>
<q-select
dense
v-model="filter.isPublished"
:options="isPublishedOption"
class="ellipsis"
label="上下架"
style="width: 130px"
/>
</div>
</template>
<template v-slot:header-cell-name="props">
@ -141,7 +156,12 @@ import {
import { useRoute } from 'vue-router';
import { ApiError } from 'src/boot/axios';
import { nextTick } from 'process';
import { DraftDataType, iscsStyleOption } from 'src/api/DraftApi';
import {
DraftDataType,
IscsStyle,
iscsStyleOption,
searchTscsStyleOption,
} from 'src/api/DraftApi';
const route = useRoute();
const $q = useQuasar();
@ -186,9 +206,9 @@ const columnDefs: QTableColumn[] = [
align: 'center',
},
{
name: 'userId',
name: 'userName',
label: '发布人',
field: 'userId',
field: 'userName',
align: 'center',
},
{
@ -210,6 +230,8 @@ const tableRef = ref();
const rows = reactive([]);
const filter = reactive({
name: '',
iscsStyle: IscsStyle.UNKNOWN,
isPublished: '全部',
});
const loading = ref(false);
const pagination = ref({
@ -234,9 +256,19 @@ async function onRequest(props: any) {
},
query: {
dataType: DraftDataType.ISCS,
name: filter.name,
},
};
if (filter.name) {
Object.assign(variables.query, { name: filter.name });
}
if (filter.iscsStyle) {
Object.assign(variables.query, { options: { style: filter.iscsStyle } });
}
if (filter.isPublished !== '全部') {
Object.assign(variables.query, {
isPublished: filter.isPublished == '上架' ? true : false,
});
}
try {
const response = await publishPageQuery(variables);
pagination.value.rowsNumber = response.total;
@ -268,6 +300,9 @@ function getTypeName(row: PublishItem) {
return iscsStyleName || '';
}
//
const isPublishedOption = ['全部', '上架', '下架'];
//
function dataReleaseFn(row: PublishItem) {
if (row.isPublished) {
@ -402,13 +437,14 @@ const historyInfo = ref<PublishItem>({
createdAt: '',
updatedAt: '',
description: '',
userName: '',
});
const historyColumnDefs: QTableColumn[] = [
{
name: 'userId',
name: 'userName',
label: '发布人',
field: 'userId',
field: 'userName',
required: true,
align: 'center',
},

200
src/pages/UserManage.vue Normal file
View File

@ -0,0 +1,200 @@
<template>
<div class="q-pa-md">
<q-table
ref="tableRef"
title="用户列表"
:style="{ height: tableHeight + 'px' }"
class="my-sticky-virtscroll-table"
:rows="rows"
:columns="columnDefs"
row-key="id"
v-model:pagination="pagination"
:rows-per-page-options="[10, 20, 50, 100]"
:loading="loading"
:filter="filter"
binary-state-sort
@request="onRequest"
>
<template v-slot:top-right>
<div class="q-gutter-md q-mt-none row justify-center items-start">
<q-input dense debounce="1000" v-model="filter.name" label="名称" />
<q-select
dense
v-model="filter.roles"
:options="rolesOptions"
multiple
emit-value
map-options
options-dense
label="角色"
style="min-width: 150px"
/>
<q-btn
:disable="operateDisabled"
color="primary"
label="同步"
@click="syncUsersInfoFn"
/>
</div>
</template>
<template v-slot:body-cell-roles="props">
<q-td :props="props">
<div class="q-gutter-sm row justify-center">
<q-chip
outline
size="sm"
color="primary"
v-for="(item, index) in props.row.roles"
:key="index"
>
{{ getRolesName(item) }}
</q-chip>
</div>
</q-td>
</template>
</q-table>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue';
import { useQuasar, type QTableColumn } from 'quasar';
import {
PagingQueryParams,
userPageQuery,
syncUsersInfo,
} from '../api/UserApi';
import { ApiError } from 'src/boot/axios';
const $q = useQuasar();
const props = withDefaults(
defineProps<{
sizeHeight: number;
}>(),
{ sizeHeight: 500 }
);
const tableHeight = computed(() => {
return props.sizeHeight - 32;
});
onMounted(() => {
tableRef.value.requestServerInteraction();
});
const columnDefs: QTableColumn[] = [
{ name: 'id', label: '用户ID', field: 'id', align: 'center' },
{
name: 'name',
label: '用户名',
field: 'name',
required: true,
align: 'center',
},
{
name: 'roles',
label: '角色',
field: 'roles',
required: true,
align: 'center',
},
{
name: 'mobile',
label: '手机号',
field: 'mobile',
align: 'center',
},
{
name: 'email',
label: '邮箱',
field: 'email',
align: 'center',
},
{
name: 'createdAt',
label: '创建时间',
field: (row) => new Date(row.createdAt).toLocaleString(),
align: 'center',
},
{
name: 'updatedAt',
label: '更新时间',
field: (row) => new Date(row.updatedAt).toLocaleString(),
align: 'center',
},
];
const tableRef = ref();
const rows = reactive([]);
const filter = reactive({
name: '',
roles: [],
});
const loading = ref(false);
const pagination = ref({
sortBy: 'desc',
descending: false,
page: 1,
rowsPerPage: 10,
rowsNumber: 10,
});
// eslint-disable-next-line
async function onRequest(props: any) {
const { page, rowsPerPage } = props.pagination;
const filter = props.filter;
loading.value = true;
const variables: PagingQueryParams = {
page: {
page: page,
itemsPerPage: rowsPerPage,
},
query: {},
};
if (filter.name) {
Object.assign(variables.query, { name: filter.name });
}
if (filter.roles) {
Object.assign(variables.query, { roles: filter.roles });
}
try {
const response = await userPageQuery(variables);
pagination.value.rowsNumber = response.total;
pagination.value.page = page;
pagination.value.rowsPerPage = rowsPerPage;
rows.splice(0, rows.length, ...(response.items as []));
} catch (err) {
const error = err as ApiError;
$q.notify({
type: 'negative',
message: error.title,
});
} finally {
loading.value = false;
}
}
const rolesOptions = [
{ label: '管理员', value: 'ADMIN' },
{ label: '用户', value: 'USER' },
];
function getRolesName(role: string) {
for (let i = 0; i < rolesOptions.length; i++) {
if (rolesOptions[i].value == role) {
return rolesOptions[i].label;
}
}
}
const operateDisabled = ref(false);
async function syncUsersInfoFn() {
operateDisabled.value = true;
const res = await syncUsersInfo();
operateDisabled.value = false;
if (res.syncUser) {
tableRef.value.requestServerInteraction();
}
}
</script>

View File

@ -5,20 +5,23 @@
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace common {
export enum Role {
Role_Unknown = 0,
Role_Admin = 1,
Role_User = 2
}
export enum DataType {
DataType_Unknown = 0,
DataType_Em = 1,
DataType_Ibp = 2,
DataType_Psl = 3,
DataType_Iscs = 4
}
export enum IscsStyle {
IscsStyle_Unknown = 0,
DaShiZhiNeng = 1
IscsStyle_DaShiZhiNeng = 1
}
export enum FeatureType {
FeatureType_Unknown = 0,
FeatureType_Simulation = 1,
FeatureType_Ur = 1,
FeatureType_RunPlan = 2
}
export class Canvas extends pb_1.Message {

View File

@ -9,112 +9,55 @@ export namespace iscsGraphicData {
export class IscsGraphicStorage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
canvas?: dependency_1.common.Canvas;
arrows?: Arrow[];
iscsTexts?: IscsText[];
rects?: Rect[];
cctvButtons?: CCTVButton[];
cctvOfStationControlStorages?: CCTVOfStationControlStorage[];
fasPlatformAlarmStorages?: FASPlatformAlarmStorage[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
if ("cctvOfStationControlStorages" in data && data.cctvOfStationControlStorages != undefined) {
this.cctvOfStationControlStorages = data.cctvOfStationControlStorages;
}
if ("arrows" in data && data.arrows != undefined) {
this.arrows = data.arrows;
}
if ("iscsTexts" in data && data.iscsTexts != undefined) {
this.iscsTexts = data.iscsTexts;
}
if ("rects" in data && data.rects != undefined) {
this.rects = data.rects;
}
if ("cctvButtons" in data && data.cctvButtons != undefined) {
this.cctvButtons = data.cctvButtons;
if ("fasPlatformAlarmStorages" in data && data.fasPlatformAlarmStorages != undefined) {
this.fasPlatformAlarmStorages = data.fasPlatformAlarmStorages;
}
}
}
get canvas() {
return pb_1.Message.getWrapperField(this, dependency_1.common.Canvas, 1) as dependency_1.common.Canvas;
get cctvOfStationControlStorages() {
return pb_1.Message.getRepeatedWrapperField(this, CCTVOfStationControlStorage, 1) as CCTVOfStationControlStorage[];
}
set canvas(value: dependency_1.common.Canvas) {
pb_1.Message.setWrapperField(this, 1, value);
set cctvOfStationControlStorages(value: CCTVOfStationControlStorage[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get has_canvas() {
return pb_1.Message.getField(this, 1) != null;
get fasPlatformAlarmStorages() {
return pb_1.Message.getRepeatedWrapperField(this, FASPlatformAlarmStorage, 2) as FASPlatformAlarmStorage[];
}
get arrows() {
return pb_1.Message.getRepeatedWrapperField(this, Arrow, 2) as Arrow[];
}
set arrows(value: Arrow[]) {
set fasPlatformAlarmStorages(value: FASPlatformAlarmStorage[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get iscsTexts() {
return pb_1.Message.getRepeatedWrapperField(this, IscsText, 3) as IscsText[];
}
set iscsTexts(value: IscsText[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get rects() {
return pb_1.Message.getRepeatedWrapperField(this, Rect, 4) as Rect[];
}
set rects(value: Rect[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get cctvButtons() {
return pb_1.Message.getRepeatedWrapperField(this, CCTVButton, 5) as CCTVButton[];
}
set cctvButtons(value: CCTVButton[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.common.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof IscsText.prototype.toObject>[];
rects?: ReturnType<typeof Rect.prototype.toObject>[];
cctvButtons?: ReturnType<typeof CCTVButton.prototype.toObject>[];
cctvOfStationControlStorages?: ReturnType<typeof CCTVOfStationControlStorage.prototype.toObject>[];
fasPlatformAlarmStorages?: ReturnType<typeof FASPlatformAlarmStorage.prototype.toObject>[];
}): IscsGraphicStorage {
const message = new IscsGraphicStorage({});
if (data.canvas != null) {
message.canvas = dependency_1.common.Canvas.fromObject(data.canvas);
if (data.cctvOfStationControlStorages != null) {
message.cctvOfStationControlStorages = data.cctvOfStationControlStorages.map(item => CCTVOfStationControlStorage.fromObject(item));
}
if (data.arrows != null) {
message.arrows = data.arrows.map(item => Arrow.fromObject(item));
}
if (data.iscsTexts != null) {
message.iscsTexts = data.iscsTexts.map(item => IscsText.fromObject(item));
}
if (data.rects != null) {
message.rects = data.rects.map(item => Rect.fromObject(item));
}
if (data.cctvButtons != null) {
message.cctvButtons = data.cctvButtons.map(item => CCTVButton.fromObject(item));
if (data.fasPlatformAlarmStorages != null) {
message.fasPlatformAlarmStorages = data.fasPlatformAlarmStorages.map(item => FASPlatformAlarmStorage.fromObject(item));
}
return message;
}
toObject() {
const data: {
canvas?: ReturnType<typeof dependency_1.common.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof IscsText.prototype.toObject>[];
rects?: ReturnType<typeof Rect.prototype.toObject>[];
cctvButtons?: ReturnType<typeof CCTVButton.prototype.toObject>[];
cctvOfStationControlStorages?: ReturnType<typeof CCTVOfStationControlStorage.prototype.toObject>[];
fasPlatformAlarmStorages?: ReturnType<typeof FASPlatformAlarmStorage.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
if (this.cctvOfStationControlStorages != null) {
data.cctvOfStationControlStorages = this.cctvOfStationControlStorages.map((item: CCTVOfStationControlStorage) => item.toObject());
}
if (this.arrows != null) {
data.arrows = this.arrows.map((item: Arrow) => item.toObject());
}
if (this.iscsTexts != null) {
data.iscsTexts = this.iscsTexts.map((item: IscsText) => item.toObject());
}
if (this.rects != null) {
data.rects = this.rects.map((item: Rect) => item.toObject());
}
if (this.cctvButtons != null) {
data.cctvButtons = this.cctvButtons.map((item: CCTVButton) => item.toObject());
if (this.fasPlatformAlarmStorages != null) {
data.fasPlatformAlarmStorages = this.fasPlatformAlarmStorages.map((item: FASPlatformAlarmStorage) => item.toObject());
}
return data;
}
@ -122,16 +65,10 @@ export namespace iscsGraphicData {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.has_canvas)
writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer));
if (this.arrows.length)
writer.writeRepeatedMessage(2, this.arrows, (item: Arrow) => item.serialize(writer));
if (this.iscsTexts.length)
writer.writeRepeatedMessage(3, this.iscsTexts, (item: IscsText) => item.serialize(writer));
if (this.rects.length)
writer.writeRepeatedMessage(4, this.rects, (item: Rect) => item.serialize(writer));
if (this.cctvButtons.length)
writer.writeRepeatedMessage(5, this.cctvButtons, (item: CCTVButton) => item.serialize(writer));
if (this.cctvOfStationControlStorages.length)
writer.writeRepeatedMessage(1, this.cctvOfStationControlStorages, (item: CCTVOfStationControlStorage) => item.serialize(writer));
if (this.fasPlatformAlarmStorages.length)
writer.writeRepeatedMessage(2, this.fasPlatformAlarmStorages, (item: FASPlatformAlarmStorage) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -142,19 +79,10 @@ export namespace iscsGraphicData {
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.canvas, () => message.canvas = dependency_1.common.Canvas.deserialize(reader));
reader.readMessage(message.cctvOfStationControlStorages, () => pb_1.Message.addToRepeatedWrapperField(message, 1, CCTVOfStationControlStorage.deserialize(reader), CCTVOfStationControlStorage));
break;
case 2:
reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Arrow.deserialize(reader), Arrow));
break;
case 3:
reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 3, IscsText.deserialize(reader), IscsText));
break;
case 4:
reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 4, Rect.deserialize(reader), Rect));
break;
case 5:
reader.readMessage(message.cctvButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 5, CCTVButton.deserialize(reader), CCTVButton));
reader.readMessage(message.fasPlatformAlarmStorages, () => pb_1.Message.addToRepeatedWrapperField(message, 2, FASPlatformAlarmStorage.deserialize(reader), FASPlatformAlarmStorage));
break;
default: reader.skipField();
}
@ -793,6 +721,214 @@ export namespace iscsGraphicData {
return Rect.deserialize(bytes);
}
}
export class Line extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: dependency_1.common.CommonInfo;
code?: string;
points?: dependency_1.common.Point[];
isCurve?: boolean;
segmentsCount?: number;
lineWidth?: number;
lineColor?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
}
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("points" in data && data.points != undefined) {
this.points = data.points;
}
if ("isCurve" in data && data.isCurve != undefined) {
this.isCurve = data.isCurve;
}
if ("segmentsCount" in data && data.segmentsCount != undefined) {
this.segmentsCount = data.segmentsCount;
}
if ("lineWidth" in data && data.lineWidth != undefined) {
this.lineWidth = data.lineWidth;
}
if ("lineColor" in data && data.lineColor != undefined) {
this.lineColor = data.lineColor;
}
}
}
get common() {
return pb_1.Message.getWrapperField(this, dependency_1.common.CommonInfo, 1) as dependency_1.common.CommonInfo;
}
set common(value: dependency_1.common.CommonInfo) {
pb_1.Message.setWrapperField(this, 1, value);
}
get has_common() {
return pb_1.Message.getField(this, 1) != null;
}
get code() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get points() {
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.Point, 3) as dependency_1.common.Point[];
}
set points(value: dependency_1.common.Point[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get isCurve() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set isCurve(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
get segmentsCount() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set segmentsCount(value: number) {
pb_1.Message.setField(this, 5, value);
}
get lineWidth() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
}
set lineWidth(value: number) {
pb_1.Message.setField(this, 6, value);
}
get lineColor() {
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
}
set lineColor(value: string) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: {
common?: ReturnType<typeof dependency_1.common.CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof dependency_1.common.Point.prototype.toObject>[];
isCurve?: boolean;
segmentsCount?: number;
lineWidth?: number;
lineColor?: string;
}): Line {
const message = new Line({});
if (data.common != null) {
message.common = dependency_1.common.CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
if (data.points != null) {
message.points = data.points.map(item => dependency_1.common.Point.fromObject(item));
}
if (data.isCurve != null) {
message.isCurve = data.isCurve;
}
if (data.segmentsCount != null) {
message.segmentsCount = data.segmentsCount;
}
if (data.lineWidth != null) {
message.lineWidth = data.lineWidth;
}
if (data.lineColor != null) {
message.lineColor = data.lineColor;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof dependency_1.common.CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof dependency_1.common.Point.prototype.toObject>[];
isCurve?: boolean;
segmentsCount?: number;
lineWidth?: number;
lineColor?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
if (this.code != null) {
data.code = this.code;
}
if (this.points != null) {
data.points = this.points.map((item: dependency_1.common.Point) => item.toObject());
}
if (this.isCurve != null) {
data.isCurve = this.isCurve;
}
if (this.segmentsCount != null) {
data.segmentsCount = this.segmentsCount;
}
if (this.lineWidth != null) {
data.lineWidth = this.lineWidth;
}
if (this.lineColor != null) {
data.lineColor = this.lineColor;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.has_common)
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.points.length)
writer.writeRepeatedMessage(3, this.points, (item: dependency_1.common.Point) => item.serialize(writer));
if (this.isCurve != false)
writer.writeBool(4, this.isCurve);
if (this.segmentsCount != 0)
writer.writeInt32(5, this.segmentsCount);
if (this.lineWidth != 0)
writer.writeInt32(6, this.lineWidth);
if (this.lineColor.length)
writer.writeString(7, this.lineColor);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Line {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Line();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.common, () => message.common = dependency_1.common.CommonInfo.deserialize(reader));
break;
case 2:
message.code = reader.readString();
break;
case 3:
reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.common.Point.deserialize(reader), dependency_1.common.Point));
break;
case 4:
message.isCurve = reader.readBool();
break;
case 5:
message.segmentsCount = reader.readInt32();
break;
case 6:
message.lineWidth = reader.readInt32();
break;
case 7:
message.lineColor = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Line {
return Line.deserialize(bytes);
}
}
export class CCTVButton extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@ -1381,4 +1517,397 @@ export namespace iscsGraphicData {
return TemperatureDetector.deserialize(bytes);
}
}
export class CCTVOfStationControlStorage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
stationName?: string;
canvas?: dependency_1.common.Canvas;
arrows?: Arrow[];
iscsTexts?: IscsText[];
rects?: Rect[];
cctvButtons?: CCTVButton[];
lines?: Line[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4, 5, 6, 7], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("stationName" in data && data.stationName != undefined) {
this.stationName = data.stationName;
}
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
}
if ("arrows" in data && data.arrows != undefined) {
this.arrows = data.arrows;
}
if ("iscsTexts" in data && data.iscsTexts != undefined) {
this.iscsTexts = data.iscsTexts;
}
if ("rects" in data && data.rects != undefined) {
this.rects = data.rects;
}
if ("cctvButtons" in data && data.cctvButtons != undefined) {
this.cctvButtons = data.cctvButtons;
}
if ("lines" in data && data.lines != undefined) {
this.lines = data.lines;
}
}
}
get stationName() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set stationName(value: string) {
pb_1.Message.setField(this, 1, value);
}
get canvas() {
return pb_1.Message.getWrapperField(this, dependency_1.common.Canvas, 2) as dependency_1.common.Canvas;
}
set canvas(value: dependency_1.common.Canvas) {
pb_1.Message.setWrapperField(this, 2, value);
}
get has_canvas() {
return pb_1.Message.getField(this, 2) != null;
}
get arrows() {
return pb_1.Message.getRepeatedWrapperField(this, Arrow, 3) as Arrow[];
}
set arrows(value: Arrow[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get iscsTexts() {
return pb_1.Message.getRepeatedWrapperField(this, IscsText, 4) as IscsText[];
}
set iscsTexts(value: IscsText[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get rects() {
return pb_1.Message.getRepeatedWrapperField(this, Rect, 5) as Rect[];
}
set rects(value: Rect[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
get cctvButtons() {
return pb_1.Message.getRepeatedWrapperField(this, CCTVButton, 6) as CCTVButton[];
}
set cctvButtons(value: CCTVButton[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
get lines() {
return pb_1.Message.getRepeatedWrapperField(this, Line, 7) as Line[];
}
set lines(value: Line[]) {
pb_1.Message.setRepeatedWrapperField(this, 7, value);
}
static fromObject(data: {
stationName?: string;
canvas?: ReturnType<typeof dependency_1.common.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof IscsText.prototype.toObject>[];
rects?: ReturnType<typeof Rect.prototype.toObject>[];
cctvButtons?: ReturnType<typeof CCTVButton.prototype.toObject>[];
lines?: ReturnType<typeof Line.prototype.toObject>[];
}): CCTVOfStationControlStorage {
const message = new CCTVOfStationControlStorage({});
if (data.stationName != null) {
message.stationName = data.stationName;
}
if (data.canvas != null) {
message.canvas = dependency_1.common.Canvas.fromObject(data.canvas);
}
if (data.arrows != null) {
message.arrows = data.arrows.map(item => Arrow.fromObject(item));
}
if (data.iscsTexts != null) {
message.iscsTexts = data.iscsTexts.map(item => IscsText.fromObject(item));
}
if (data.rects != null) {
message.rects = data.rects.map(item => Rect.fromObject(item));
}
if (data.cctvButtons != null) {
message.cctvButtons = data.cctvButtons.map(item => CCTVButton.fromObject(item));
}
if (data.lines != null) {
message.lines = data.lines.map(item => Line.fromObject(item));
}
return message;
}
toObject() {
const data: {
stationName?: string;
canvas?: ReturnType<typeof dependency_1.common.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof IscsText.prototype.toObject>[];
rects?: ReturnType<typeof Rect.prototype.toObject>[];
cctvButtons?: ReturnType<typeof CCTVButton.prototype.toObject>[];
lines?: ReturnType<typeof Line.prototype.toObject>[];
} = {};
if (this.stationName != null) {
data.stationName = this.stationName;
}
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
}
if (this.arrows != null) {
data.arrows = this.arrows.map((item: Arrow) => item.toObject());
}
if (this.iscsTexts != null) {
data.iscsTexts = this.iscsTexts.map((item: IscsText) => item.toObject());
}
if (this.rects != null) {
data.rects = this.rects.map((item: Rect) => item.toObject());
}
if (this.cctvButtons != null) {
data.cctvButtons = this.cctvButtons.map((item: CCTVButton) => item.toObject());
}
if (this.lines != null) {
data.lines = this.lines.map((item: Line) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.stationName.length)
writer.writeString(1, this.stationName);
if (this.has_canvas)
writer.writeMessage(2, this.canvas, () => this.canvas.serialize(writer));
if (this.arrows.length)
writer.writeRepeatedMessage(3, this.arrows, (item: Arrow) => item.serialize(writer));
if (this.iscsTexts.length)
writer.writeRepeatedMessage(4, this.iscsTexts, (item: IscsText) => item.serialize(writer));
if (this.rects.length)
writer.writeRepeatedMessage(5, this.rects, (item: Rect) => item.serialize(writer));
if (this.cctvButtons.length)
writer.writeRepeatedMessage(6, this.cctvButtons, (item: CCTVButton) => item.serialize(writer));
if (this.lines.length)
writer.writeRepeatedMessage(7, this.lines, (item: Line) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CCTVOfStationControlStorage {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CCTVOfStationControlStorage();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.stationName = reader.readString();
break;
case 2:
reader.readMessage(message.canvas, () => message.canvas = dependency_1.common.Canvas.deserialize(reader));
break;
case 3:
reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Arrow.deserialize(reader), Arrow));
break;
case 4:
reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 4, IscsText.deserialize(reader), IscsText));
break;
case 5:
reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Rect.deserialize(reader), Rect));
break;
case 6:
reader.readMessage(message.cctvButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 6, CCTVButton.deserialize(reader), CCTVButton));
break;
case 7:
reader.readMessage(message.lines, () => pb_1.Message.addToRepeatedWrapperField(message, 7, Line.deserialize(reader), Line));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CCTVOfStationControlStorage {
return CCTVOfStationControlStorage.deserialize(bytes);
}
}
export class FASPlatformAlarmStorage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
stationName?: string;
canvas?: dependency_1.common.Canvas;
arrows?: Arrow[];
iscsTexts?: IscsText[];
rects?: Rect[];
lines?: Line[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4, 5, 6], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("stationName" in data && data.stationName != undefined) {
this.stationName = data.stationName;
}
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
}
if ("arrows" in data && data.arrows != undefined) {
this.arrows = data.arrows;
}
if ("iscsTexts" in data && data.iscsTexts != undefined) {
this.iscsTexts = data.iscsTexts;
}
if ("rects" in data && data.rects != undefined) {
this.rects = data.rects;
}
if ("lines" in data && data.lines != undefined) {
this.lines = data.lines;
}
}
}
get stationName() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set stationName(value: string) {
pb_1.Message.setField(this, 1, value);
}
get canvas() {
return pb_1.Message.getWrapperField(this, dependency_1.common.Canvas, 2) as dependency_1.common.Canvas;
}
set canvas(value: dependency_1.common.Canvas) {
pb_1.Message.setWrapperField(this, 2, value);
}
get has_canvas() {
return pb_1.Message.getField(this, 2) != null;
}
get arrows() {
return pb_1.Message.getRepeatedWrapperField(this, Arrow, 3) as Arrow[];
}
set arrows(value: Arrow[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get iscsTexts() {
return pb_1.Message.getRepeatedWrapperField(this, IscsText, 4) as IscsText[];
}
set iscsTexts(value: IscsText[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get rects() {
return pb_1.Message.getRepeatedWrapperField(this, Rect, 5) as Rect[];
}
set rects(value: Rect[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
get lines() {
return pb_1.Message.getRepeatedWrapperField(this, Line, 6) as Line[];
}
set lines(value: Line[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
static fromObject(data: {
stationName?: string;
canvas?: ReturnType<typeof dependency_1.common.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof IscsText.prototype.toObject>[];
rects?: ReturnType<typeof Rect.prototype.toObject>[];
lines?: ReturnType<typeof Line.prototype.toObject>[];
}): FASPlatformAlarmStorage {
const message = new FASPlatformAlarmStorage({});
if (data.stationName != null) {
message.stationName = data.stationName;
}
if (data.canvas != null) {
message.canvas = dependency_1.common.Canvas.fromObject(data.canvas);
}
if (data.arrows != null) {
message.arrows = data.arrows.map(item => Arrow.fromObject(item));
}
if (data.iscsTexts != null) {
message.iscsTexts = data.iscsTexts.map(item => IscsText.fromObject(item));
}
if (data.rects != null) {
message.rects = data.rects.map(item => Rect.fromObject(item));
}
if (data.lines != null) {
message.lines = data.lines.map(item => Line.fromObject(item));
}
return message;
}
toObject() {
const data: {
stationName?: string;
canvas?: ReturnType<typeof dependency_1.common.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof IscsText.prototype.toObject>[];
rects?: ReturnType<typeof Rect.prototype.toObject>[];
lines?: ReturnType<typeof Line.prototype.toObject>[];
} = {};
if (this.stationName != null) {
data.stationName = this.stationName;
}
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
}
if (this.arrows != null) {
data.arrows = this.arrows.map((item: Arrow) => item.toObject());
}
if (this.iscsTexts != null) {
data.iscsTexts = this.iscsTexts.map((item: IscsText) => item.toObject());
}
if (this.rects != null) {
data.rects = this.rects.map((item: Rect) => item.toObject());
}
if (this.lines != null) {
data.lines = this.lines.map((item: Line) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.stationName.length)
writer.writeString(1, this.stationName);
if (this.has_canvas)
writer.writeMessage(2, this.canvas, () => this.canvas.serialize(writer));
if (this.arrows.length)
writer.writeRepeatedMessage(3, this.arrows, (item: Arrow) => item.serialize(writer));
if (this.iscsTexts.length)
writer.writeRepeatedMessage(4, this.iscsTexts, (item: IscsText) => item.serialize(writer));
if (this.rects.length)
writer.writeRepeatedMessage(5, this.rects, (item: Rect) => item.serialize(writer));
if (this.lines.length)
writer.writeRepeatedMessage(6, this.lines, (item: Line) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FASPlatformAlarmStorage {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new FASPlatformAlarmStorage();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.stationName = reader.readString();
break;
case 2:
reader.readMessage(message.canvas, () => message.canvas = dependency_1.common.Canvas.deserialize(reader));
break;
case 3:
reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Arrow.deserialize(reader), Arrow));
break;
case 4:
reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 4, IscsText.deserialize(reader), IscsText));
break;
case 5:
reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Rect.deserialize(reader), Rect));
break;
case 6:
reader.readMessage(message.lines, () => pb_1.Message.addToRepeatedWrapperField(message, 6, Line.deserialize(reader), Line));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): FASPlatformAlarmStorage {
return FASPlatformAlarmStorage.deserialize(bytes);
}
}
}

View File

@ -0,0 +1,280 @@
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 5.27.4
* source: sync_data_message.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace sync_data_message {
export class SyncData extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
operationType?: string;
datas?: UpdataData[];
submenu?: string;
station?: string;
userId?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("operationType" in data && data.operationType != undefined) {
this.operationType = data.operationType;
}
if ("datas" in data && data.datas != undefined) {
this.datas = data.datas;
}
if ("submenu" in data && data.submenu != undefined) {
this.submenu = data.submenu;
}
if ("station" in data && data.station != undefined) {
this.station = data.station;
}
if ("userId" in data && data.userId != undefined) {
this.userId = data.userId;
}
}
}
get operationType() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set operationType(value: string) {
pb_1.Message.setField(this, 1, value);
}
get datas() {
return pb_1.Message.getRepeatedWrapperField(this, UpdataData, 2) as UpdataData[];
}
set datas(value: UpdataData[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get submenu() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set submenu(value: string) {
pb_1.Message.setField(this, 3, value);
}
get station() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set station(value: string) {
pb_1.Message.setField(this, 4, value);
}
get userId() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set userId(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
operationType?: string;
datas?: ReturnType<typeof UpdataData.prototype.toObject>[];
submenu?: string;
station?: string;
userId?: number;
}): SyncData {
const message = new SyncData({});
if (data.operationType != null) {
message.operationType = data.operationType;
}
if (data.datas != null) {
message.datas = data.datas.map(item => UpdataData.fromObject(item));
}
if (data.submenu != null) {
message.submenu = data.submenu;
}
if (data.station != null) {
message.station = data.station;
}
if (data.userId != null) {
message.userId = data.userId;
}
return message;
}
toObject() {
const data: {
operationType?: string;
datas?: ReturnType<typeof UpdataData.prototype.toObject>[];
submenu?: string;
station?: string;
userId?: number;
} = {};
if (this.operationType != null) {
data.operationType = this.operationType;
}
if (this.datas != null) {
data.datas = this.datas.map((item: UpdataData) => item.toObject());
}
if (this.submenu != null) {
data.submenu = this.submenu;
}
if (this.station != null) {
data.station = this.station;
}
if (this.userId != null) {
data.userId = this.userId;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.operationType.length)
writer.writeString(1, this.operationType);
if (this.datas.length)
writer.writeRepeatedMessage(2, this.datas, (item: UpdataData) => item.serialize(writer));
if (this.submenu.length)
writer.writeString(3, this.submenu);
if (this.station.length)
writer.writeString(4, this.station);
if (this.userId != 0)
writer.writeUint32(5, this.userId);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SyncData {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SyncData();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.operationType = reader.readString();
break;
case 2:
reader.readMessage(message.datas, () => pb_1.Message.addToRepeatedWrapperField(message, 2, UpdataData.deserialize(reader), UpdataData));
break;
case 3:
message.submenu = reader.readString();
break;
case 4:
message.station = reader.readString();
break;
case 5:
message.userId = reader.readUint32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): SyncData {
return SyncData.deserialize(bytes);
}
}
export class UpdataData extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
type?: string;
data?: Uint8Array;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("data" in data && data.data != undefined) {
this.data = data.data;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get type() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set type(value: string) {
pb_1.Message.setField(this, 2, value);
}
get data() {
return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array;
}
set data(value: Uint8Array) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
id?: number;
type?: string;
data?: Uint8Array;
}): UpdataData {
const message = new UpdataData({});
if (data.id != null) {
message.id = data.id;
}
if (data.type != null) {
message.type = data.type;
}
if (data.data != null) {
message.data = data.data;
}
return message;
}
toObject() {
const data: {
id?: number;
type?: string;
data?: Uint8Array;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.type != null) {
data.type = this.type;
}
if (this.data != null) {
data.data = this.data;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.type.length)
writer.writeString(2, this.type);
if (this.data.length)
writer.writeBytes(3, this.data);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UpdataData {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new UpdataData();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readUint32();
break;
case 2:
message.type = reader.readString();
break;
case 3:
message.data = reader.readBytes();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): UpdataData {
return UpdataData.deserialize(bytes);
}
}
}

View File

@ -3,7 +3,7 @@ import { RouteRecordRaw } from 'vue-router';
const routes: RouteRecordRaw[] = [
{
path: '/',
redirect: '/home/1e2d0d5d96034f4a0805af6512051ddc',
redirect: '/home/b82f4bb0398b01263b6ef12764c6eb20',
meta: {
hidden: true,
},
@ -17,12 +17,33 @@ const routes: RouteRecordRaw[] = [
// children: [{ path: '', component: () => import('pages/IndexPage.vue') }],
},
{
path: '/sysManage',
name: 'sysManage',
component: () => import('layouts/MainLayout.vue'),
meta: {
label: '系统管理',
icon: 'dataset',
},
children: [
{
path: 'user',
name: 'user',
meta: {
label: '用户管理',
icon: 'manage_accounts',
},
component: () => import('pages/UserManage.vue'),
},
],
},
{
path: '/dataManage',
name: 'dataManage',
component: () => import('layouts/MainLayout.vue'),
meta: {
label: '数据管理',
label: 'ISCS数据管理',
icon: 'list_alt',
},
children: [
@ -31,7 +52,7 @@ const routes: RouteRecordRaw[] = [
name: 'iscsDraft',
component: () => import('pages/IscsDraftManage.vue'),
meta: {
label: 'iscs草稿管理',
label: '草稿数据',
icon: 'app_registration',
},
},
@ -40,7 +61,7 @@ const routes: RouteRecordRaw[] = [
name: 'iscsSharedDraft',
component: () => import('pages/IscsDraftManage.vue'),
meta: {
label: 'iscs分享草稿管理',
label: '共享草稿数据',
icon: 'app_registration',
},
},
@ -49,7 +70,7 @@ const routes: RouteRecordRaw[] = [
name: 'iscsPublish',
component: () => import('pages/IscsPublishManage.vue'),
meta: {
label: 'iscs发布数据管理',
label: '发布数据',
icon: 'playlist_add_check',
},
},

View File

@ -2,10 +2,11 @@ import { defineStore } from 'pinia';
export const useAuthStore = defineStore('auth', {
state: () => ({
userId: 8160 as number | null,
userId: null as number | null,
}),
actions: {
setUserId(id: number | null) {
console.log(id, '----');
this.userId = id;
},
},

View File

@ -20,17 +20,13 @@ export const useDrawStore = defineStore('draw', {
selectedGraphics: null as JlGraphic[] | null,
draftId: null as number | null,
drawPictureType: null as PictureType | null,
clickSubmenuName: '车站控制',
selectSubmenuAndStation: { submenu: '', station: '' },
}),
getters: {
drawMode: (state) => state.drawAssistant != null,
drawGraphicType: (state) => state.drawAssistant?.type,
drawGraphicName: (state) => state.drawAssistant?.description,
drawGraphicTemplate: (state) => state.drawAssistant?.graphicTemplate,
getApp: () => {
const app = getIscsDrawApp();
return app;
},
selectedGraphicType: (state) => {
if (state.selectedGraphics) {
if (state.selectedGraphics.length === 1) {
@ -43,7 +39,7 @@ export const useDrawStore = defineStore('draw', {
if (state.selectedGraphics.length == 0) {
return '画布';
} else if (state.selectedGraphics.length == 1) {
const name = this.getApp?.getDrawAssistant(
const name = getIscsDrawApp()?.getDrawAssistant(
state.selectedGraphics[0].type
).description;
return name || '';
@ -63,7 +59,7 @@ export const useDrawStore = defineStore('draw', {
},
actions: {
getDrawApp(): IDrawApp {
const app = this.getApp;
const app = getIscsDrawApp();
if (app == null) {
throw new Error('未初始化app');
}