Squashed commit of the following:
All checks were successful
CI / Docker-Build (push) Successful in 1m51s
All checks were successful
CI / Docker-Build (push) Successful in 1m51s
commit0e7de4afa8
Author: joylink_zhaoerwei <Bob_Engineer@163.com> Date: Tue Jun 25 19:02:34 2024 +0800 增加数据位置调整功能 commit35eab5ac87
Author: joylink_zhaoerwei <Bob_Engineer@163.com> Date: Tue Jun 25 15:48:06 2024 +0800 驱采数据加清空
This commit is contained in:
parent
ec8056e1b7
commit
dd46053ced
@ -32,6 +32,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<template v-slot:titleButton>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="清空"
|
||||
style="margin-right: 10px"
|
||||
@click="clearCiCjListData"
|
||||
/>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="设置"
|
||||
@ -85,6 +91,7 @@ import {
|
||||
loadCiCjList,
|
||||
creatCiCjList,
|
||||
refRelaysListMap,
|
||||
clearCiCjList,
|
||||
} from 'src/drawApp/relayCabinetLayoutApp';
|
||||
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||
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);
|
||||
function onMouseOver(e: MouseEvent) {
|
||||
if ((e.target as HTMLElement).clientHeight > 30) {
|
||||
|
@ -32,6 +32,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<template v-slot:titleButton>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="清空"
|
||||
style="margin-right: 10px"
|
||||
@click="clearCiQdListData"
|
||||
/>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="设置"
|
||||
@ -85,6 +91,7 @@ import {
|
||||
loadCiQdList,
|
||||
creatCiQdList,
|
||||
refRelaysListMap,
|
||||
clearCiQdList,
|
||||
} from 'src/drawApp/relayCabinetLayoutApp';
|
||||
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||
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);
|
||||
function onMouseOver(e: MouseEvent) {
|
||||
if ((e.target as HTMLElement).clientHeight > 30) {
|
||||
|
@ -60,6 +60,11 @@
|
||||
<q-btn label="提交" type="submit" color="primary" class="q-mr-md" />
|
||||
<q-btn label="返回" color="primary" @click="goBack" />
|
||||
</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-card>
|
||||
</div>
|
||||
@ -74,7 +79,11 @@ import {
|
||||
useRelayCabinetStore,
|
||||
} from 'src/stores/relayCabinet-store';
|
||||
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 { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||
|
||||
@ -239,6 +248,18 @@ function goBack() {
|
||||
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(() => {
|
||||
relayCabinetStore.showCiCjConfig = false;
|
||||
});
|
||||
|
@ -51,6 +51,11 @@
|
||||
<q-btn label="提交" type="submit" color="primary" class="q-mr-md" />
|
||||
<q-btn label="返回" color="primary" @click="goBack" />
|
||||
</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-card>
|
||||
</div>
|
||||
@ -65,7 +70,11 @@ import {
|
||||
useRelayCabinetStore,
|
||||
} from 'src/stores/relayCabinet-store';
|
||||
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';
|
||||
|
||||
const relayCabinetStore = useRelayCabinetStore();
|
||||
@ -198,6 +207,18 @@ function goBack() {
|
||||
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(() => {
|
||||
relayCabinetStore.showCiCjConfig = false;
|
||||
});
|
||||
|
@ -384,15 +384,7 @@ export function loadCiCjList() {
|
||||
|
||||
export function creatCiCjList(rows: number, cols: number) {
|
||||
if (ciCjList == undefined) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
clearCiCjList(rows, cols);
|
||||
} else {
|
||||
const oldRows = ciCjList.dsCount;
|
||||
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;
|
||||
export function loadCiQdList() {
|
||||
@ -456,15 +505,7 @@ export function loadCiQdList() {
|
||||
|
||||
export function creatCiQdList(rows: number, cols: number) {
|
||||
if (ciQdList == undefined) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
clearCiQdList(rows, cols);
|
||||
} else {
|
||||
const oldRows = ciQdList.dsCount;
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user