Squashed commit of the following:
All checks were successful
CI / Docker-Build (push) Successful in 1m51s

commit 0e7de4afa8
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Tue Jun 25 19:02:34 2024 +0800

    增加数据位置调整功能

commit 35eab5ac87
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Tue Jun 25 15:48:06 2024 +0800

    驱采数据加清空
This commit is contained in:
joylink_zhaoerwei 2024-06-25 19:06:29 +08:00
parent ec8056e1b7
commit dd46053ced
5 changed files with 208 additions and 20 deletions

View File

@ -32,6 +32,12 @@
</div> </div>
</div> </div>
<template v-slot:titleButton> <template v-slot:titleButton>
<q-btn
color="primary"
label="清空"
style="margin-right: 10px"
@click="clearCiCjListData"
/>
<q-btn <q-btn
color="primary" color="primary"
label="设置" label="设置"
@ -85,6 +91,7 @@ import {
loadCiCjList, loadCiCjList,
creatCiCjList, creatCiCjList,
refRelaysListMap, refRelaysListMap,
clearCiCjList,
} from 'src/drawApp/relayCabinetLayoutApp'; } from 'src/drawApp/relayCabinetLayoutApp';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
import { Relay } from 'src/graphics/relay/Relay'; import { Relay } from 'src/graphics/relay/Relay';
@ -175,6 +182,14 @@ function updateMap() {
}); });
} }
function clearCiCjListData() {
clearCiCjList(setCellMessage.value.rows, setCellMessage.value.cols);
ciCjList = loadCiCjList();
updateMap();
setCellDialog.value = true;
setCellDialog.value = false;
}
const showTooltip = ref(false); const showTooltip = ref(false);
function onMouseOver(e: MouseEvent) { function onMouseOver(e: MouseEvent) {
if ((e.target as HTMLElement).clientHeight > 30) { if ((e.target as HTMLElement).clientHeight > 30) {

View File

@ -32,6 +32,12 @@
</div> </div>
</div> </div>
<template v-slot:titleButton> <template v-slot:titleButton>
<q-btn
color="primary"
label="清空"
style="margin-right: 10px"
@click="clearCiQdListData"
/>
<q-btn <q-btn
color="primary" color="primary"
label="设置" label="设置"
@ -85,6 +91,7 @@ import {
loadCiQdList, loadCiQdList,
creatCiQdList, creatCiQdList,
refRelaysListMap, refRelaysListMap,
clearCiQdList,
} from 'src/drawApp/relayCabinetLayoutApp'; } from 'src/drawApp/relayCabinetLayoutApp';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
import { Relay } from 'src/graphics/relay/Relay'; import { Relay } from 'src/graphics/relay/Relay';
@ -171,6 +178,14 @@ function updateMap() {
}); });
} }
function clearCiQdListData() {
clearCiQdList(setCellMessage.value.rows, setCellMessage.value.cols);
ciQdList = loadCiQdList();
updateMap();
setCellDialog.value = true;
setCellDialog.value = false;
}
const showTooltip = ref(false); const showTooltip = ref(false);
function onMouseOver(e: MouseEvent) { function onMouseOver(e: MouseEvent) {
if ((e.target as HTMLElement).clientHeight > 30) { if ((e.target as HTMLElement).clientHeight > 30) {

View File

@ -60,6 +60,11 @@
<q-btn label="提交" type="submit" color="primary" class="q-mr-md" /> <q-btn label="提交" type="submit" color="primary" class="q-mr-md" />
<q-btn label="返回" color="primary" @click="goBack" /> <q-btn label="返回" color="primary" @click="goBack" />
</div> </div>
<q-separator inset></q-separator>
<div class="q-gutter-sm q-pa-md row justify-center">
<q-btn label="添加位置" color="red" @click="addPosition" />
<q-btn label="删除位置" color="red" @click="deletePosition" />
</div>
</q-form> </q-form>
</q-card> </q-card>
</div> </div>
@ -74,7 +79,11 @@ import {
useRelayCabinetStore, useRelayCabinetStore,
} from 'src/stores/relayCabinet-store'; } from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay'; import { Relay } from 'src/graphics/relay/Relay';
import { loadCiCjList } from 'src/drawApp/relayCabinetLayoutApp'; import {
deleteCjDataPositionByIndex,
addCjDataPositionByIndex,
loadCiCjList,
} from 'src/drawApp/relayCabinetLayoutApp';
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
@ -239,6 +248,18 @@ function goBack() {
relayCabinetStore.showCiCjConfig = false; relayCabinetStore.showCiCjConfig = false;
} }
function addPosition() {
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
addCjDataPositionByIndex(click.row - 1, click.col - 1);
relayCabinetStore.updateCiCjList = true;
}
function deletePosition() {
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
deleteCjDataPositionByIndex(click.row - 1, click.col - 1);
relayCabinetStore.updateCiCjList = true;
}
onUnmounted(() => { onUnmounted(() => {
relayCabinetStore.showCiCjConfig = false; relayCabinetStore.showCiCjConfig = false;
}); });

View File

@ -51,6 +51,11 @@
<q-btn label="提交" type="submit" color="primary" class="q-mr-md" /> <q-btn label="提交" type="submit" color="primary" class="q-mr-md" />
<q-btn label="返回" color="primary" @click="goBack" /> <q-btn label="返回" color="primary" @click="goBack" />
</div> </div>
<q-separator inset></q-separator>
<div class="q-gutter-sm q-pa-md row justify-center">
<q-btn label="添加位置" color="red" @click="addPosition" />
<q-btn label="删除位置" color="red" @click="deletePosition" />
</div>
</q-form> </q-form>
</q-card> </q-card>
</div> </div>
@ -65,7 +70,11 @@ import {
useRelayCabinetStore, useRelayCabinetStore,
} from 'src/stores/relayCabinet-store'; } from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay'; import { Relay } from 'src/graphics/relay/Relay';
import { loadCiQdList } from 'src/drawApp/relayCabinetLayoutApp'; import {
addQdDataPositionByIndex,
deleteQdDataPositionByIndex,
loadCiQdList,
} from 'src/drawApp/relayCabinetLayoutApp';
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
const relayCabinetStore = useRelayCabinetStore(); const relayCabinetStore = useRelayCabinetStore();
@ -198,6 +207,18 @@ function goBack() {
relayCabinetStore.showCiCjConfig = false; relayCabinetStore.showCiCjConfig = false;
} }
function addPosition() {
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
addQdDataPositionByIndex(click.row - 1, click.col - 1);
relayCabinetStore.updateCiCjList = true;
}
function deletePosition() {
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
deleteQdDataPositionByIndex(click.row - 1, click.col - 1);
relayCabinetStore.updateCiCjList = true;
}
onUnmounted(() => { onUnmounted(() => {
relayCabinetStore.showCiCjConfig = false; relayCabinetStore.showCiCjConfig = false;
}); });

View File

@ -384,15 +384,7 @@ export function loadCiCjList() {
export function creatCiCjList(rows: number, cols: number) { export function creatCiCjList(rows: number, cols: number) {
if (ciCjList == undefined) { if (ciCjList == undefined) {
ciCjList = new relayCabinetGraphicData.CiCj(); clearCiCjList(rows, cols);
ciCjList.dsCount = rows;
for (let i = 0; i < cols; i++) {
ciCjList.cjList[i] = new relayCabinetGraphicData.CjDataSet();
ciCjList.cjList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
ciCjList.cjList[i].bitList[j] = new relayCabinetGraphicData.CjData();
}
}
} else { } else {
const oldRows = ciCjList.dsCount; const oldRows = ciCjList.dsCount;
ciCjList.dsCount = rows; ciCjList.dsCount = rows;
@ -448,6 +440,63 @@ export function creatCiCjListByCombinationtype(
} }
} }
export function clearCiCjList(rows: number, cols: number) {
ciCjList = new relayCabinetGraphicData.CiCj();
ciCjList.dsCount = rows;
for (let i = 0; i < cols; i++) {
ciCjList.cjList[i] = new relayCabinetGraphicData.CjDataSet();
ciCjList.cjList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
ciCjList.cjList[i].bitList[j] = new relayCabinetGraphicData.CjData();
}
}
}
export function deleteCjDataPositionByIndex(row: number, col: number) {
const allCjData: relayCabinetGraphicData.CjData[] = [];
ciCjList.cjList.forEach((cj, i) => {
cj.bitList.forEach((bit, j) => {
if (i !== col || j !== row) {
allCjData.push(bit);
}
});
});
allCjData.push(new relayCabinetGraphicData.CjData());
const allCjData2D = convertTo2DArray(
allCjData,
ciCjList.cjList.length,
ciCjList.dsCount
) as relayCabinetGraphicData.CjData[][];
ciCjList.cjList.forEach((cj, i) => {
cj.bitList.forEach((bit, j) => {
cj.bitList[j] = allCjData2D[i][j];
});
});
}
export function addCjDataPositionByIndex(row: number, col: number) {
const allCjData: relayCabinetGraphicData.CjData[] = [];
ciCjList.cjList.forEach((cj, i) => {
cj.bitList.forEach((bit, j) => {
allCjData.push(bit);
if (i == col && j == row) {
allCjData.push(new relayCabinetGraphicData.CjData());
}
});
});
allCjData.pop();
const allCjData2D = convertTo2DArray(
allCjData,
ciCjList.cjList.length,
ciCjList.dsCount
) as relayCabinetGraphicData.CjData[][];
ciCjList.cjList.forEach((cj, i) => {
cj.bitList.forEach((bit, j) => {
cj.bitList[j] = allCjData2D[i][j];
});
});
}
//驱动列表的增删改查 //驱动列表的增删改查
let ciQdList: relayCabinetGraphicData.CiQd; let ciQdList: relayCabinetGraphicData.CiQd;
export function loadCiQdList() { export function loadCiQdList() {
@ -456,15 +505,7 @@ export function loadCiQdList() {
export function creatCiQdList(rows: number, cols: number) { export function creatCiQdList(rows: number, cols: number) {
if (ciQdList == undefined) { if (ciQdList == undefined) {
ciQdList = new relayCabinetGraphicData.CiQd(); clearCiQdList(rows, cols);
ciQdList.dsCount = rows;
for (let i = 0; i < cols; i++) {
ciQdList.qdList[i] = new relayCabinetGraphicData.QdDataSet();
ciQdList.qdList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
ciQdList.qdList[i].bitList[j] = new relayCabinetGraphicData.QdData();
}
}
} else { } else {
const oldRows = ciQdList.dsCount; const oldRows = ciQdList.dsCount;
ciQdList.dsCount = rows; ciQdList.dsCount = rows;
@ -515,3 +556,78 @@ export function creatCiQdListByCombinationtype(
} }
} }
} }
export function clearCiQdList(rows: number, cols: number) {
ciQdList = new relayCabinetGraphicData.CiQd();
ciQdList.dsCount = rows;
for (let i = 0; i < cols; i++) {
ciQdList.qdList[i] = new relayCabinetGraphicData.QdDataSet();
ciQdList.qdList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
ciQdList.qdList[i].bitList[j] = new relayCabinetGraphicData.QdData();
}
}
}
export function deleteQdDataPositionByIndex(row: number, col: number) {
const allQdData: relayCabinetGraphicData.QdData[] = [];
ciQdList.qdList.forEach((qd, i) => {
qd.bitList.forEach((bit, j) => {
if (i !== col || j !== row) {
allQdData.push(bit);
}
});
});
allQdData.push(new relayCabinetGraphicData.QdData());
const allQdData2D = convertTo2DArray(
allQdData,
ciQdList.qdList.length,
ciQdList.dsCount
) as relayCabinetGraphicData.QdData[][];
ciQdList.qdList.forEach((qd, i) => {
qd.bitList.forEach((bit, j) => {
qd.bitList[j] = allQdData2D[i][j];
});
});
}
export function addQdDataPositionByIndex(row: number, col: number) {
const allQdData: relayCabinetGraphicData.QdData[] = [];
ciQdList.qdList.forEach((qd, i) => {
qd.bitList.forEach((bit, j) => {
allQdData.push(bit);
if (i == col && j == row) {
allQdData.push(new relayCabinetGraphicData.QdData());
}
});
});
allQdData.pop();
const allQdData2D = convertTo2DArray(
allQdData,
ciQdList.qdList.length,
ciQdList.dsCount
) as relayCabinetGraphicData.QdData[][];
ciQdList.qdList.forEach((qd, i) => {
qd.bitList.forEach((bit, j) => {
qd.bitList[j] = allQdData2D[i][j];
});
});
}
//一维数组变二维数组
export function convertTo2DArray(
sourceArray: any[],
rowCount: any,
colCount: any
): any[][] {
const result: any[][] = [];
for (let i = 0; i < rowCount; i++) {
const row: any[] = [];
for (let j = 0; j < colCount; j++) {
const index = i * colCount + j;
row.push(sourceArray[index]);
}
result.push(row);
}
return result;
}