fireAlaram

This commit is contained in:
joylink_fanyuhong 2024-09-14 15:43:04 +08:00
parent f6a28fad10
commit 2b180e5bec
8 changed files with 37 additions and 24 deletions

View File

@ -37,10 +37,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useDrawStore } from 'src/stores/draw-store'; import { useFireAlarmDrawStore } from 'src/stores/fire-alarm-draw-store';
import CanvasProperty from './properties/CanvasProperty.vue'; import CanvasProperty from './properties/CanvasProperty.vue';
import IscsTextProperty from './properties/IscsTextProperty.vue'; import IscsTextProperty from './properties/IscsTextProperty.vue';
import { TextContent } from 'src/graphics/textContent/TextContent'; import { TextContent } from 'src/graphics/textContent/TextContent';
const drawStore = useDrawStore(); const drawStore = useFireAlarmDrawStore();
</script> </script>

View File

@ -47,9 +47,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useDrawStore } from 'src/stores/draw-store'; import { useFireAlarmDrawStore } from 'src/stores/fire-alarm-draw-store';
import { onMounted, onUnmounted, reactive } from 'vue'; import { onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore(); const drawStore = useFireAlarmDrawStore();
const canvas = reactive({ const canvas = reactive({
width: 1920, width: 1920,

View File

@ -6,7 +6,7 @@ import {
KeyListener, KeyListener,
newDrawApp, newDrawApp,
} from 'jl-graphic'; } from 'jl-graphic';
import { useDrawStore } from 'src/stores/draw-store'; import { useFireAlarmDrawStore } from 'src/stores/fire-alarm-draw-store';
import { CCTVGraphicData } from 'src/protos/cctv_graphic_data'; import { CCTVGraphicData } from 'src/protos/cctv_graphic_data';
import { fromUint8Array } from 'js-base64'; import { fromUint8Array } from 'js-base64';
import { import {
@ -42,10 +42,7 @@ export function initDrawApp(): IDrawApp {
}); });
const app = drawApp; const app = drawApp;
initCommonDrawApp(app); initCommonDrawApp(app);
new CCTVButtonDraw( new CCTVButtonDraw(app, new CCTVButtonTemplate(new CCTVButtonData()));
app,
new CCTVButtonTemplate(new CCTVButtonData())
);
app.addKeyboardListener( app.addKeyboardListener(
new KeyListener({ new KeyListener({
@ -61,7 +58,7 @@ export function initDrawApp(): IDrawApp {
} }
export async function loadDrawDatas(): Promise<IGraphicStorage> { export async function loadDrawDatas(): Promise<IGraphicStorage> {
const drawStore = useDrawStore(); const drawStore = useFireAlarmDrawStore();
const id = drawStore.draftId; const id = drawStore.draftId;
if (!id) { if (!id) {
throw new Error('获取数据异常为获取到草稿地图ID'); throw new Error('获取数据异常为获取到草稿地图ID');

View File

@ -4,7 +4,7 @@ import {
IDrawApp, IDrawApp,
MenuItemOptions, MenuItemOptions,
} from 'jl-graphic'; } from 'jl-graphic';
import { useDrawStore } from 'src/stores/draw-store'; import { useFireAlarmDrawStore } from 'src/stores/fire-alarm-draw-store';
import { toStorageTransform } from './graphics/GraphicDataBase'; import { toStorageTransform } from './graphics/GraphicDataBase';
import { Arrow, ArrowTemplate } from 'src/graphics/arrow/Arrow'; import { Arrow, ArrowTemplate } from 'src/graphics/arrow/Arrow';
import { ArrowData } from './graphics/ArrowInteraction'; import { ArrowData } from './graphics/ArrowInteraction';
@ -104,7 +104,7 @@ export function saveCommonDrawDatas(app: IDrawApp, storage: ICommonStorage) {
} }
export function saveDrawToServer(base64: string) { export function saveDrawToServer(base64: string) {
const drawStore = useDrawStore(); const drawStore = useFireAlarmDrawStore();
const id = drawStore.draftId; const id = drawStore.draftId;
if (!id) { if (!id) {
return; return;

View File

@ -6,14 +6,17 @@ import {
KeyListener, KeyListener,
newDrawApp, newDrawApp,
} from 'jl-graphic'; } from 'jl-graphic';
import { useDrawStore } from 'src/stores/draw-store'; import { useFireAlarmDrawStore } from 'src/stores/fire-alarm-draw-store';
import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; import { FireAlarmGraphicData } from 'src/protos/fire_alarm_graphic_data';
import { fromUint8Array } from 'js-base64'; import { fromUint8Array } from 'js-base64';
import { import {
initCommonDrawApp, initCommonDrawApp,
saveCommonDrawDatas, saveCommonDrawDatas,
saveDrawToServer, saveDrawToServer,
} from './commonApp'; } from './commonApp';
// import { CCTVButtonData } from './graphics/CCTV/CCTVButtonInteraction';
// import { CCTVButtonDraw } from 'src/graphics/CCTV/cctvButton/CCTVButtonDrawAssistant';
// import { CCTVButtonTemplate } from 'src/graphics/CCTV/cctvButton/CCTVButton';
let drawApp: IDrawApp | null = null; let drawApp: IDrawApp | null = null;
@ -39,6 +42,7 @@ export function initDrawApp(): IDrawApp {
}); });
const app = drawApp; const app = drawApp;
initCommonDrawApp(app); initCommonDrawApp(app);
// new CCTVButtonDraw(app, new CCTVButtonTemplate(new CCTVButtonData()));
app.addKeyboardListener( app.addKeyboardListener(
new KeyListener({ new KeyListener({
@ -54,7 +58,7 @@ export function initDrawApp(): IDrawApp {
} }
export async function loadDrawDatas(): Promise<IGraphicStorage> { export async function loadDrawDatas(): Promise<IGraphicStorage> {
const drawStore = useDrawStore(); const drawStore = useFireAlarmDrawStore();
const id = drawStore.draftId; const id = drawStore.draftId;
if (!id) { if (!id) {
throw new Error('获取数据异常为获取到草稿地图ID'); throw new Error('获取数据异常为获取到草稿地图ID');
@ -71,11 +75,11 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
} }
export function saveDrawDatas(app: IDrawApp) { export function saveDrawDatas(app: IDrawApp) {
let storage = new iscsGraphicData.IscsGraphicStorage(); let storage = new FireAlarmGraphicData.FireAlarmGraphicStorage();
storage = saveCommonDrawDatas( storage = saveCommonDrawDatas(
app, app,
storage storage
) as iscsGraphicData.IscsGraphicStorage; ) as FireAlarmGraphicData.FireAlarmGraphicStorage;
const graphics = app.queryStore.getAllGraphics(); const graphics = app.queryStore.getAllGraphics();
/* graphics.forEach((g) => { /* graphics.forEach((g) => {
if (TrackSection.Type === g.type) { if (TrackSection.Type === g.type) {

View File

@ -67,7 +67,7 @@
<q-drawer show-if-above bordered v-model="rightDrawerOpen" side="right"> <q-drawer show-if-above bordered v-model="rightDrawerOpen" side="right">
<q-resize-observer @resize="onRightResize" /> <q-resize-observer @resize="onRightResize" />
<draw-properties></draw-properties> <fire-alarm-draw-properties></fire-alarm-draw-properties>
</q-drawer> </q-drawer>
<q-page-container> <q-page-container>
@ -105,12 +105,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import DrawProperties from 'src/components/draw-app/DrawProperties.vue'; import FireAlarmDrawProperties from 'src/components/draw-app/FireAlarmDrawProperties.vue';
import { onMounted, reactive, ref, watch } from 'vue'; import { onMounted, reactive, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { successNotify } from 'src/utils/CommonNotify'; import { successNotify } from 'src/utils/CommonNotify';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useDrawStore } from 'src/stores/draw-store'; import { useFireAlarmDrawStore } from 'src/stores/fire-alarm-draw-store';
import { Arrow } from 'src/graphics/arrow/Arrow'; import { Arrow } from 'src/graphics/arrow/Arrow';
import { TextContent } from 'src/graphics/textContent/TextContent'; import { TextContent } from 'src/graphics/textContent/TextContent';
@ -119,7 +119,7 @@ const route = useRoute();
const router = useRouter(); const router = useRouter();
const searchId = ref(0); const searchId = ref(0);
const drawStore = useDrawStore(); const drawStore = useFireAlarmDrawStore();
watch( watch(
() => drawStore.drawMode, () => drawStore.drawMode,
@ -197,7 +197,7 @@ onMounted(() => {
} else { } else {
drawStore.setDraftId(null); drawStore.setDraftId(null);
} }
const drawAssistantsTypes = [Arrow.Type,TextContent.Type]; const drawAssistantsTypes = [Arrow.Type, TextContent.Type];
drawAssistantsTypes.forEach((type) => { drawAssistantsTypes.forEach((type) => {
const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type); const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type);
if (drawAssistant) { if (drawAssistant) {

View File

@ -34,6 +34,14 @@ const routes: RouteRecordRaw[] = [
}, },
component: () => import('layouts/CCTVDrawLayout.vue'), component: () => import('layouts/CCTVDrawLayout.vue'),
}, },
{
path: '/fireAlarmPaint',
name: 'fireAlarmPaint',
meta: {
label: '火灾报警绘制',
},
component: () => import('layouts/FireAlarmDrawLayout.vue'),
},
]; ];
export default routes; export default routes;

View File

@ -1,6 +1,10 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { QTable } from 'quasar'; import { QTable } from 'quasar';
import { initDrawApp, destroyDrawApp, getDrawApp } from 'src/drawApp/drawApp'; import {
initDrawApp,
destroyDrawApp,
getDrawApp,
} from 'src/drawApp/fireAlarmApp';
import { import {
DrawAssistant, DrawAssistant,
GraphicData, GraphicData,
@ -10,7 +14,7 @@ import {
} from 'jl-graphic'; } from 'jl-graphic';
import { markRaw } from 'vue'; import { markRaw } from 'vue';
export const useDrawStore = defineStore('draw', { export const useFireAlarmDrawStore = defineStore('FireAlarmDraw', {
state: () => ({ state: () => ({
drawAssistant: null as DrawAssistant | null, drawAssistant: null as DrawAssistant | null,
selectedGraphics: null as JlGraphic[] | null, selectedGraphics: null as JlGraphic[] | null,