Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
d1424a8ac8
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<draggable-dialog seamless title="批量生成" :width="180" :height="0">
|
||||
<template v-slot:footer>
|
||||
<q-form class="q-gutter-md q-pa-md">
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="oneClickRelayCabinets"
|
||||
label="生成继电器柜数量"
|
||||
type="number"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="向左生成继电器柜"
|
||||
@click="oneClickRelayCabinet(-1)"
|
||||
/>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="向右生成继电器柜"
|
||||
@click="oneClickRelayCabinet(1)"
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="oneClickRelays"
|
||||
label="生成继电器数量"
|
||||
type="number"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-btn color="primary" label="一键生成继电器" @click="oneClickRelay" />
|
||||
</q-form>
|
||||
</template>
|
||||
</draggable-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
||||
import { RelayCabinetData } from 'src/drawApp/relayCabinetGraphics/RelayCabinetInteraction';
|
||||
import { RelayData } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
|
||||
import { Relay } from 'src/graphics/relay/Relay';
|
||||
import {
|
||||
RelayCabinet,
|
||||
relayCabinetConsts,
|
||||
} from 'src/graphics/relayCabinet/RelayCabinet';
|
||||
import { containBoth } from 'src/graphics/relayCabinet/RelayCabinetDrawAssistant';
|
||||
import { GraphicIdGenerator } from 'src/jl-graphic';
|
||||
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||
import { onMounted, reactive, ref, watch } from 'vue';
|
||||
|
||||
const relayCabinetStore = useRelayCabinetStore();
|
||||
const relayCabinetModel = reactive(new RelayCabinetData());
|
||||
const oneClickRelayCabinets = ref(1);
|
||||
const oneClickRelays = ref(32);
|
||||
|
||||
relayCabinetStore.$subscribe;
|
||||
watch(
|
||||
() => relayCabinetStore.selectedGraphic,
|
||||
(val) => {
|
||||
if (val && val.type == RelayCabinet.Type) {
|
||||
relayCabinetModel.copyFrom(val.saveData() as RelayCabinetData);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
const RelayCabinet = relayCabinetStore.selectedGraphic as RelayCabinet;
|
||||
if (RelayCabinet) {
|
||||
relayCabinetModel.copyFrom(RelayCabinet.saveData());
|
||||
}
|
||||
});
|
||||
|
||||
function oneClickRelayCabinet(direction: number) {
|
||||
const selectRelayCabinet = relayCabinetStore.selectedGraphic as RelayCabinet;
|
||||
if (selectRelayCabinet) {
|
||||
let offsetX = 300;
|
||||
if (direction == -1) {
|
||||
offsetX = -300;
|
||||
}
|
||||
const relayCabinets: RelayCabinet[] = [];
|
||||
for (let i = 0; i < oneClickRelayCabinets.value; i++) {
|
||||
const relayCabinet = new RelayCabinet();
|
||||
relayCabinet.loadData(new RelayCabinetData());
|
||||
relayCabinet.id = GraphicIdGenerator.next();
|
||||
relayCabinet.position.set(
|
||||
selectRelayCabinet.x + offsetX * (i + 1),
|
||||
selectRelayCabinet.y
|
||||
);
|
||||
relayCabinets.push(relayCabinet);
|
||||
}
|
||||
const app = relayCabinetStore.getDrawApp();
|
||||
app.addGraphicAndRecord(...relayCabinets);
|
||||
}
|
||||
}
|
||||
|
||||
function oneClickRelay() {
|
||||
const relayCabinet = relayCabinetStore.selectedGraphic as RelayCabinet;
|
||||
if (relayCabinet) {
|
||||
const containRelays = relayCabinet.queryStore
|
||||
.queryByType<Relay>(Relay.Type)
|
||||
.filter((g) => containBoth(relayCabinet, g));
|
||||
if (!containRelays.length) {
|
||||
const numRows = 4;
|
||||
const numCols = Math.ceil(oneClickRelays.value / numRows);
|
||||
const remainder = oneClickRelays.value % numRows;
|
||||
const relays: Relay[][] = new Array(numRows);
|
||||
for (let i = 0; i < numRows; i++) {
|
||||
relays[i] = new Array(numCols);
|
||||
for (let j = 0; j < numCols; j++) {
|
||||
if (j == numCols - 1 && remainder !== 0 && i >= remainder) break;
|
||||
const relay = new Relay();
|
||||
relay.loadData(new RelayData());
|
||||
relay.id = GraphicIdGenerator.next();
|
||||
relay.position.set(
|
||||
relayCabinet.x - relayCabinetConsts.width / 2 + 30 + i * 47,
|
||||
relayCabinet.y - relayCabinetConsts.height / 2 + 30 + j * 49
|
||||
);
|
||||
relays[i][j] = relay;
|
||||
}
|
||||
}
|
||||
const app = relayCabinetStore.getDrawApp();
|
||||
app.addGraphicAndRecord(...relays.flat());
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -8,43 +8,17 @@
|
||||
label="继电器柜"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="oneClickRelayCabinets"
|
||||
label="生成继电器柜数量"
|
||||
type="number"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-btn color="primary" label="向左生成" @click="oneClickRelayCabinet(-1)" />
|
||||
<q-btn color="primary" label="向右生成" @click="oneClickRelayCabinet(1)" />
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="oneClickRelays"
|
||||
label="生成继电器数量"
|
||||
type="number"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-btn color="primary" label="一键生成继电器" @click="oneClickRelay" />
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RelayCabinetData } from 'src/drawApp/relayCabinetGraphics/RelayCabinetInteraction';
|
||||
import { RelayData } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
|
||||
import { Relay } from 'src/graphics/relay/Relay';
|
||||
import {
|
||||
RelayCabinet,
|
||||
relayCabinetConsts,
|
||||
} from 'src/graphics/relayCabinet/RelayCabinet';
|
||||
import { containBoth } from 'src/graphics/relayCabinet/RelayCabinetDrawAssistant';
|
||||
import { GraphicCreateOperation, GraphicIdGenerator } from 'src/jl-graphic';
|
||||
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
|
||||
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||
import { onMounted, reactive, ref, watch } from 'vue';
|
||||
import { onMounted, reactive, watch } from 'vue';
|
||||
|
||||
const relayCabinetStore = useRelayCabinetStore();
|
||||
const relayCabinetModel = reactive(new RelayCabinetData());
|
||||
const oneClickRelayCabinets = ref(1);
|
||||
const oneClickRelays = ref(32);
|
||||
|
||||
relayCabinetStore.$subscribe;
|
||||
watch(
|
||||
@ -71,61 +45,4 @@ function onUpdate() {
|
||||
.updateGraphicAndRecord(RelayCabinet, relayCabinetModel);
|
||||
}
|
||||
}
|
||||
|
||||
function oneClickRelayCabinet(direction: number) {
|
||||
let offsetX = 300;
|
||||
if (direction == -1) {
|
||||
offsetX = -300;
|
||||
}
|
||||
const relayCabinets: RelayCabinet[] = [];
|
||||
for (let i = 0; i < oneClickRelayCabinets.value; i++) {
|
||||
const selectRelayCabinet =
|
||||
relayCabinetStore.selectedGraphic as RelayCabinet;
|
||||
const relayCabinet = new RelayCabinet();
|
||||
relayCabinet.loadData(new RelayCabinetData());
|
||||
relayCabinet.id = GraphicIdGenerator.next();
|
||||
relayCabinet.position.set(
|
||||
selectRelayCabinet.x + offsetX * (i + 1),
|
||||
selectRelayCabinet.y
|
||||
);
|
||||
relayCabinets.push(relayCabinet);
|
||||
}
|
||||
const app = relayCabinetStore.getDrawApp();
|
||||
app.addGraphics(...relayCabinets);
|
||||
app.opRecord.record(
|
||||
new GraphicCreateOperation(relayCabinetStore.getDrawApp(), relayCabinets)
|
||||
);
|
||||
}
|
||||
|
||||
function oneClickRelay() {
|
||||
const relayCabinet = relayCabinetStore.selectedGraphic as RelayCabinet;
|
||||
const containRelays = relayCabinet.queryStore
|
||||
.queryByType<Relay>(Relay.Type)
|
||||
.filter((g) => containBoth(relayCabinet, g));
|
||||
if (!containRelays.length) {
|
||||
const numRows = 4;
|
||||
const numCols = Math.ceil(oneClickRelays.value / numRows);
|
||||
const remainder = oneClickRelays.value % numRows;
|
||||
const relays: Relay[][] = new Array(numRows);
|
||||
for (let i = 0; i < numRows; i++) {
|
||||
relays[i] = new Array(numCols);
|
||||
for (let j = 0; j < numCols; j++) {
|
||||
if (j == numCols - 1 && remainder !== 0 && i >= remainder) break;
|
||||
const relay = new Relay();
|
||||
relay.loadData(new RelayData());
|
||||
relay.id = GraphicIdGenerator.next();
|
||||
relay.position.set(
|
||||
relayCabinet.x - relayCabinetConsts.width / 2 + 30 + i * 47,
|
||||
relayCabinet.y - relayCabinetConsts.height / 2 + 30 + j * 49
|
||||
);
|
||||
relays[i][j] = relay;
|
||||
}
|
||||
}
|
||||
const app = relayCabinetStore.getDrawApp();
|
||||
app.addGraphics(...relays.flat());
|
||||
app.opRecord.record(
|
||||
new GraphicCreateOperation(relayCabinetStore.getDrawApp(), relays.flat())
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -318,7 +318,9 @@ export function initDrawApp(): IDrawApp {
|
||||
},
|
||||
})
|
||||
);
|
||||
initShowLayer(app);
|
||||
app.on('postdataloaded', () => {
|
||||
initShowLayer(app);
|
||||
});
|
||||
return drawApp;
|
||||
}
|
||||
|
||||
@ -497,7 +499,6 @@ export async function loadLinkDatas(app: IDrawApp) {
|
||||
g.loadData(linkData);
|
||||
app.addGraphics(g);
|
||||
});
|
||||
initShowLayer(app);
|
||||
}
|
||||
|
||||
function initShowLayer(app: IDrawApp) {
|
||||
|
@ -195,7 +195,7 @@
|
||||
</q-drawer>
|
||||
|
||||
<q-page-container>
|
||||
<div id="draw-app-container"></div>
|
||||
<div id="draw-app-container" class="overflow-hidden"></div>
|
||||
</q-page-container>
|
||||
|
||||
<q-dialog
|
||||
|
@ -25,7 +25,7 @@
|
||||
</q-drawer>
|
||||
<q-resize-observer @resize="onResize" />
|
||||
<q-page-container>
|
||||
<div id="line-app-container"></div>
|
||||
<div id="line-app-container" class="overflow-hidden"></div>
|
||||
</q-page-container>
|
||||
</q-layout>
|
||||
</template>
|
||||
|
@ -18,6 +18,9 @@
|
||||
<q-item clickable v-close-popup @click="buildRelations">
|
||||
<q-item-section>一键关联</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="batchBuild">
|
||||
<q-item-section>批量生成继电器或继电器柜</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
@ -73,7 +76,7 @@
|
||||
</q-drawer>
|
||||
|
||||
<q-page-container>
|
||||
<div id="draw-app-container"></div>
|
||||
<div id="draw-app-container" class="overflow-hidden"></div>
|
||||
</q-page-container>
|
||||
|
||||
<q-dialog
|
||||
@ -107,6 +110,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import DrawRelayCabinetProperties from 'src/components/draw-app/DrawRelayCabinetProperties.vue';
|
||||
import BatchBuildRelayCabinetOrRelay from 'src/components/draw-app/dialogs/BatchBuildRelayCabinetOrRelay.vue';
|
||||
import {
|
||||
getDrawApp,
|
||||
saveDrawDatas,
|
||||
@ -120,7 +124,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
|
||||
import { saveAsDraft } from 'src/api/DraftApi';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { DialogChainObject, useQuasar } from 'quasar';
|
||||
import { Relay } from 'src/graphics/relay/Relay';
|
||||
import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet';
|
||||
|
||||
@ -248,24 +252,6 @@ function onResize() {
|
||||
dom.style.height = canvasHeight.value + 'px';
|
||||
}
|
||||
}
|
||||
function saveAllDrawDatas() {
|
||||
const drawApp = getDrawApp();
|
||||
saveDrawToServer(drawApp as IDrawApp);
|
||||
}
|
||||
|
||||
function handleCheckData() {
|
||||
const drawApp = getDrawApp();
|
||||
checkDataToServer(drawApp as IDrawApp);
|
||||
}
|
||||
|
||||
function buildRelations() {
|
||||
const app = getDrawApp();
|
||||
app?.detectRelations();
|
||||
}
|
||||
|
||||
function backConfirm() {
|
||||
router.go(-1);
|
||||
}
|
||||
|
||||
const saveAsDialog = ref(false);
|
||||
const saveAsName = ref('');
|
||||
@ -289,7 +275,40 @@ async function saveAs(name: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function saveAllDrawDatas() {
|
||||
const drawApp = getDrawApp();
|
||||
saveDrawToServer(drawApp as IDrawApp);
|
||||
}
|
||||
|
||||
function handleCheckData() {
|
||||
const drawApp = getDrawApp();
|
||||
checkDataToServer(drawApp as IDrawApp);
|
||||
}
|
||||
|
||||
function buildRelations() {
|
||||
const app = getDrawApp();
|
||||
app?.detectRelations();
|
||||
}
|
||||
|
||||
let batchBuildDialogInstance: DialogChainObject | null = null;
|
||||
|
||||
function batchBuild() {
|
||||
if (batchBuildDialogInstance) return;
|
||||
batchBuildDialogInstance = $q
|
||||
.dialog({ component: BatchBuildRelayCabinetOrRelay })
|
||||
.onCancel(() => {
|
||||
batchBuildDialogInstance = null;
|
||||
});
|
||||
}
|
||||
|
||||
function backConfirm() {
|
||||
router.go(-1);
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
relayCabinetStore.destroy();
|
||||
if (batchBuildDialogInstance) {
|
||||
batchBuildDialogInstance.hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -175,7 +175,8 @@ async function onRequest(props: any) {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getSimulationList();
|
||||
rows.splice(0, rows.length, ...(res as []));
|
||||
const data = res || [];
|
||||
rows.splice(0, rows.length, ...(data as []));
|
||||
pagination.value.rowsNumber = rows.length;
|
||||
pagination.value.rowsPerPage = rows.length;
|
||||
} catch (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user