Merge branch 'master' of git.code.tencent.com:beijing-rtss-test/bj-rtss-client

This commit is contained in:
Yuan 2023-11-08 13:25:13 +08:00
commit 37d50c923f
10 changed files with 20 additions and 462 deletions

View File

@ -85,7 +85,6 @@ import {
loadCiCjList,
creatCiCjList,
refRelaysListMap,
combinationListMap,
} from 'src/drawApp/relayCabinetLayoutApp';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
import { Relay } from 'src/graphics/relay/Relay';
@ -158,7 +157,6 @@ function updateMap() {
cjDataSet.bitList.forEach((cjData, j) => {
const ref = cjData.refRelays.map((refRelay) => {
const refDeviceData = refRelaysListMap.get(refRelay.relayId);
const conbinationData = combinationListMap.get(refRelay.relayId);
const relay = relayCabinetStore
.getDrawApp()
.queryStore.queryById<Relay>(refRelay.relayId);
@ -166,10 +164,10 @@ function updateMap() {
refRelay.position == relayCabinetGraphicData.CjDataItem.PostionType.Q
? 'Q'
: 'H';
if (refDeviceData) {
return `${refDeviceData.device}_${refDeviceData.combinationtype}_${relay.datas.code}_${pos}`;
if (refDeviceData?.device) {
return `${refDeviceData.device}_${refDeviceData?.combinationtype}_${relay.datas.code}_${pos}`;
} else {
return `${conbinationData}_${relay.datas.code}_${pos}`;
return `${refDeviceData?.combinationtype}_${relay.datas.code}_${pos}`;
}
});
map.set(`${j + 1}-${i + 1}`, ref.join('/'));

View File

@ -85,7 +85,6 @@ import {
loadCiQdList,
creatCiQdList,
refRelaysListMap,
combinationListMap,
} from 'src/drawApp/relayCabinetLayoutApp';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
import { Relay } from 'src/graphics/relay/Relay';
@ -158,14 +157,13 @@ function updateMap() {
cjDataSet.bitList.forEach((cjData, j) => {
const ref = cjData.refRelays.map((refRelay) => {
const refDeviceData = refRelaysListMap.get(refRelay);
const conbinationData = combinationListMap.get(refRelay);
const relay = relayCabinetStore
.getDrawApp()
.queryStore.queryById<Relay>(refRelay);
if (refDeviceData) {
if (refDeviceData?.device) {
return `${refDeviceData.device}_${refDeviceData.combinationtype}_${relay.datas.code}`;
} else {
return `${conbinationData}_${relay.datas.code}`;
return `${refDeviceData?.combinationtype}_${relay.datas.code}`;
}
});
map.set(`${j + 1}-${i + 1}`, ref.join('/'));

View File

@ -1,147 +0,0 @@
<template>
<draggable-dialog
seamless
@show="onDialogShow"
title="组合类型列表"
:width="600"
:height="0"
>
<template v-slot:footer>
<q-table
ref="tableRef"
row-key="id"
v-model:pagination="pagination"
:loading="loading"
:rows="rows"
:columns="columns"
@request="onRequest"
:rows-per-page-options="[5, 10, 20, 50]"
>
<template v-slot:body-cell="props">
<q-td :props="props" class="custom-column">
{{ props.value }}
</q-td>
</template>
<template v-slot:body-cell-operations="props">
<q-td :props="props">
<div class="q-gutter-sm row justify-center">
<q-btn color="primary" label="编辑" @click="onEdit(props.row)" />
<q-btn color="red" label="删除" @click="deleteData(props.row)" />
</div>
</q-td>
</template>
</q-table>
</template>
<template v-slot:titleButton>
<q-btn
color="primary"
label="新建"
style="margin-right: 10px"
@click="creatData"
/>
</template>
</draggable-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { QTable, useQuasar } from 'quasar';
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
import {
deleteCombinationtype,
loadCombinationtypeList,
CombinationTypeListItem,
} from 'src/drawApp/relayCabinetLayoutApp';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay';
const relayCabinetStore = useRelayCabinetStore();
const $q = useQuasar();
const tableRef = ref<QTable>();
const columns: QTable['columns'] = [
{ name: 'code', label: '组合类型', field: 'code', align: 'center' },
{
name: 'refRelays',
label: '关联的继电器',
field: (row: CombinationTypeListItem) => {
if (row.refRelays) {
const ref = row.refRelays.map(
(id) =>
(relayCabinetStore.getDrawApp().queryStore.queryById(id) as Relay)
.datas.code
);
return ref.join('\\');
}
},
align: 'center',
},
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
];
const rows = ref<CombinationTypeListItem[]>([]);
const loading = ref(false);
const pagination = ref({
sortBy: 'desc',
descending: false,
page: 1,
rowsPerPage: 10,
rowsNumber: 10,
});
const onRequest: QTable['onRequest'] = async (props) => {
const { page, rowsPerPage } = props.pagination;
loading.value = true;
const refDatas = loadCombinationtypeList();
pagination.value.rowsNumber = refDatas.length;
pagination.value.page = page;
pagination.value.rowsPerPage = rowsPerPage;
rows.value = refDatas.slice((page - 1) * rowsPerPage, page * rowsPerPage);
loading.value = false;
};
const onDialogShow = () => {
tableRef.value?.requestServerInteraction();
relayCabinetStore.tableOfCombinationType = tableRef.value;
};
const props = defineProps<{
onEditClick: (row: CombinationTypeListItem) => void;
}>();
function onEdit(row: CombinationTypeListItem) {
relayCabinetStore.showRelateRelayConfig = false;
relayCabinetStore.showCombinationTypeConfig = true;
setTimeout(() => {
props.onEditClick(row);
}, 0);
}
function creatData() {
relayCabinetStore.showRelateRelayConfig = false;
relayCabinetStore.showCombinationTypeConfig = true;
}
function deleteData(row: CombinationTypeListItem) {
$q.dialog({ message: `确定删除 "${row.code}" 吗?`, cancel: true }).onOk(
async () => {
try {
deleteCombinationtype(row);
successNotify('删除数据成功!');
} catch (err) {
errorNotify('删除失败:', err);
} finally {
tableRef.value?.requestServerInteraction();
}
}
);
}
</script>
<style scoped>
.custom-column {
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@ -64,6 +64,8 @@ const deviceTypeMap = {
6: '车站',
7: '屏蔽门',
8: '信号机故障报警仪',
9: '断路器',
10: '电源屏',
};
const columns: QTable['columns'] = [
{
@ -119,7 +121,6 @@ const props = defineProps<{
}>();
function onEdit(row: RelateRelaylistItem) {
relayCabinetStore.showCombinationTypeConfig = false;
relayCabinetStore.showRelateRelayConfig = true;
setTimeout(() => {
props.onEditClick(row);
@ -127,7 +128,6 @@ function onEdit(row: RelateRelaylistItem) {
}
function creatData() {
relayCabinetStore.showCombinationTypeConfig = false;
relayCabinetStore.showRelateRelayConfig = true;
}

View File

@ -1,220 +0,0 @@
<template>
<div v-if="showRangeConfig">
<q-card class="q-gutter-sm q-pa-sm">
<q-card-section>
<div class="text-h6">{{ handleState }}</div>
</q-card-section>
<q-separator inset></q-separator>
<q-form ref="myForm" @submit="onSubmit" @reset="onReset">
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-input
outlined
v-model="combinationTypeConfig.code"
label="组合类型"
lazy-rules
/>
<q-list bordered separator class="rounded-borders">
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-item-label> 关联的继电器 </q-item-label>
<div class="q-gutter-sm row">
<q-chip
v-for="item in combinationTypeConfig.refRelaysCode"
:key="item"
square
color="primary"
text-color="white"
removable
@remove="removeSelect(item)"
>
{{ item }}
</q-chip>
</div>
</q-item-section>
</q-item>
</q-list>
<div>
<q-btn
v-show="combinationTypeConfig.refRelaysCode.length > 0"
style="width: 130px"
label="清空框选的继电器"
color="red"
class="q-mr-md"
@click="clearAllSelect()"
/>
</div>
</q-item-section>
</q-item>
<div class="q-gutter-sm q-pa-md row justify-center">
<q-btn label="提交" type="submit" color="primary" class="q-mr-md" />
<q-btn label="重置" type="reset" color="primary" class="q-mr-md" />
<q-btn label="返回" color="primary" @click="goBack" />
</div>
</q-form>
</q-card>
</div>
</template>
<script setup lang="ts">
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { QForm, useQuasar } from 'quasar';
import { JlGraphic } from 'src/jl-graphic';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
import {
creatCombinationtype,
editCombinationtype,
CombinationTypeListItem,
} from 'src/drawApp/relayCabinetLayoutApp';
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
defineExpose({ editRelateRelays });
const relayCabinetStore = useRelayCabinetStore();
const $q = useQuasar();
const showRangeConfig = ref(true);
const combinationTypeConfig = ref<{
code: string;
refRelays: string[];
refRelaysCode: string[];
}>({
code: '',
refRelays: [],
refRelaysCode: [],
});
const handleState = ref('新建组合类型');
let selectGraphic: JlGraphic[] = [];
watch(
() => relayCabinetStore.selectedGraphics,
(val) => {
if (val && val.length > 0) {
const selectFilter = relayCabinetStore.selectedGraphics?.filter(
(g) => g.type == Relay.Type || g.type == PhaseFailureProtector.Type
) as JlGraphic[];
selectGraphic.push(...selectFilter);
selectGraphic = Array.from(new Set(selectGraphic));
relayCabinetStore.getDrawApp().updateSelected(...selectGraphic);
combinationTypeConfig.value.refRelaysCode = selectGraphic.map(
(g) => (g as Relay).datas.code
) as string[];
combinationTypeConfig.value.refRelays = selectGraphic.map(
(g) => g.id
) as string[];
}
}
);
onMounted(() => {
onReset();
});
const myForm = ref<QForm | null>(null);
let editRow: CombinationTypeListItem;
let handle = ref('');
let handleError = ref('');
async function onSubmit() {
myForm.value?.validate().then(async (res) => {
if (res) {
try {
const combinationtypes = new relayCabinetGraphicData.Combinationtype({
code: combinationTypeConfig.value.code,
refRelays: combinationTypeConfig.value.refRelays,
});
if (handleState.value == '新建组合类型') {
handle.value = '创建成功';
handleError.value = '创建失败';
creatCombinationtype(combinationtypes);
} else {
handle.value = '更新成功';
handleError.value = '更新失败';
editCombinationtype(editRow, combinationtypes);
}
relayCabinetStore.tableOfCombinationType?.requestServerInteraction();
$q.notify({
type: 'positive',
message: handle.value,
});
onReset();
showRangeConfig.value = false;
} catch (err) {
$q.notify({
type: 'negative',
message: handleError.value,
});
} finally {
setTimeout(() => {
showRangeConfig.value = true;
}, 0);
}
}
});
}
async function editRelateRelays(row: CombinationTypeListItem) {
try {
const drawApp = relayCabinetStore.getDrawApp();
handleState.value = '编辑组合类型';
selectGraphic = [];
drawApp.updateSelected();
editRow = row;
combinationTypeConfig.value.code = row.code;
combinationTypeConfig.value.refRelays = row.refRelays;
combinationTypeConfig.value.refRelaysCode = [];
const select: JlGraphic[] = [];
row.refRelays.forEach((id) => {
const g = drawApp.queryStore.queryById(id) as Relay;
select.push(g);
combinationTypeConfig.value.refRelaysCode.push(g.datas.code);
});
drawApp.updateSelected(...select);
drawApp.makeGraphicCenterShow(...select);
} catch (err) {
$q.notify({
type: 'negative',
message: '没有需要编辑的详细信息',
});
}
}
function removeSelect(code: string) {
const removeIndex = combinationTypeConfig.value.refRelaysCode.findIndex(
(item) => item == code
);
selectGraphic.splice(removeIndex, 1);
combinationTypeConfig.value.refRelaysCode.splice(removeIndex, 1);
combinationTypeConfig.value.refRelays.splice(removeIndex, 1);
relayCabinetStore.getDrawApp().updateSelected(...selectGraphic);
}
function clearAllSelect() {
combinationTypeConfig.value.refRelays = [];
combinationTypeConfig.value.refRelaysCode = [];
clearAllSelectAtCanvas();
}
function clearAllSelectAtCanvas() {
selectGraphic = [];
relayCabinetStore.getDrawApp().updateSelected();
}
function onReset() {
handleState.value = '新建组合类型';
combinationTypeConfig.value = {
code: '',
refRelays: [],
refRelaysCode: [],
};
clearAllSelectAtCanvas();
}
function goBack() {
onReset();
relayCabinetStore.showCombinationTypeConfig = false;
}
onUnmounted(() => {
relayCabinetStore.showCombinationTypeConfig = false;
});
</script>

View File

@ -16,6 +16,7 @@
:rules="[(val) => val != undefined || '设备类型不能为空']"
/>
<q-input
v-if="!noShowType.includes(relateRelayConfig.deviceType)"
outlined
label="设备编号"
v-model="relateRelayConfig.code"
@ -137,6 +138,14 @@ const optionsType = [
label: '信号机故障报警仪',
value: graphicData.RelatedRef.DeviceType.SignalFaultAlarm,
},
{ label: '断路器', value: graphicData.RelatedRef.DeviceType.Breakers },
{ label: '电源屏', value: graphicData.RelatedRef.DeviceType.PowerScreen },
];
const noShowType = [
graphicData.RelatedRef.DeviceType.SignalFaultAlarm,
graphicData.RelatedRef.DeviceType.Breakers,
graphicData.RelatedRef.DeviceType.PowerScreen,
];
let selectGraphic: JlGraphic[] = [];

View File

@ -47,11 +47,14 @@
active-class="bg-teal-1 text-grey-8"
@click.stop="clickSectionId(item)"
>
<q-item-section avatar>
{{ index }}
</q-item-section>
<q-item-section
>{{ getSectionById(item).code }}
</q-item-section>
<q-item-section side v-if="activeId == item">
<div class="q-gutter-md">
<div class="q-gutter-sm">
<q-btn
v-show="index != 0"
flat

View File

@ -80,8 +80,6 @@ export const refRelaysListMap = new Map<
{ combinationtype: string; device: string }
>();
export const combinationListMap = new Map<string, string>();
export function initDrawApp(): IDrawApp {
drawApp = newDrawApp({
dataLoader: loadDrawDatas,
@ -137,11 +135,6 @@ export function initDrawApp(): IDrawApp {
});
});
});
combinationTypeList.forEach((combination) => {
combination.refRelays.forEach((relayId) => {
combinationListMap.set(relayId, combination.code);
});
});
const relays = app.queryStore.queryByType<Relay>(Relay.Type);
relays.forEach((relay) => {
relay.refDevice.text = refRelaysListMap
@ -160,9 +153,7 @@ export function initDrawApp(): IDrawApp {
});
app.on('destroy', () => {
refRelaysList = [];
combinationTypeList = [];
refRelaysListMap.clear();
combinationListMap.clear();
});
return drawApp;
}
@ -241,7 +232,6 @@ export function saveDrawDatas(app: IDrawApp) {
}
});
storage.deviceRelateRelayList = refRelaysList;
storage.combinationtypeList = combinationTypeList;
storage.UniqueIdPrefix = UniqueIdPrefix;
storage.ciCjList = ciCjList;
storage.ciQdList = ciQdList;
@ -276,7 +266,6 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
datas.push(new SignalFaultAlarmData(signalFaultAlarm));
});
refRelaysList = storage.deviceRelateRelayList;
combinationTypeList = storage.combinationtypeList;
UniqueIdPrefix = storage.UniqueIdPrefix;
ciCjList = storage.ciCjList;
ciQdList = storage.ciQdList;
@ -343,45 +332,6 @@ export function deleteDeviceRelateRelay(row: RelateRelaylistItem) {
}
}
//组合类型列表的增删改查
export interface CombinationTypeListItem {
code: string;
refRelays: string[];
refRelaysCode?: string[];
}
let combinationTypeList: relayCabinetGraphicData.Combinationtype[] = [];
export function loadCombinationtypeList() {
return combinationTypeList;
}
export function creatCombinationtype(
row: relayCabinetGraphicData.Combinationtype
) {
combinationTypeList.push(row);
}
export function editCombinationtype(
editRow: CombinationTypeListItem,
newData: relayCabinetGraphicData.Combinationtype
) {
for (let i = 0; i < combinationTypeList.length; i++) {
if (combinationTypeList[i].code == editRow.code) {
combinationTypeList[i] = newData;
break;
}
}
}
export function deleteCombinationtype(row: CombinationTypeListItem) {
for (let i = 0; i < combinationTypeList.length; i++) {
if (combinationTypeList[i].code == row.code) {
combinationTypeList.splice(i, 1);
break;
}
}
}
//所属集中站
let UniqueIdPrefix: relayCabinetGraphicData.UniqueIdType;
export function loadUniqueIdPrefix() {

View File

@ -86,7 +86,6 @@
<draw-relayCabinetProperties
v-if="
!relayCabinetStore.showRelateRelayConfig &&
!relayCabinetStore.showCombinationTypeConfig &&
!relayCabinetStore.showCiCjConfig &&
!relayCabinetStore.showCiQdConfig
"
@ -95,10 +94,6 @@
v-else-if="relayCabinetStore.showRelateRelayConfig"
ref="relateRelayConfigEdit"
></relate-relay-config>
<combination-type-config
v-else-if="relayCabinetStore.showCombinationTypeConfig"
ref="combinationTypeConfigEdit"
></combination-type-config>
<ciCjConfig v-else-if="relayCabinetStore.showCiCjConfig" />
<ciQdConfig v-else />
</q-drawer>
@ -178,8 +173,6 @@ import DrawRelayCabinetProperties from 'src/components/draw-app/DrawRelayCabinet
import BatchBuildRelayCabinetOrRelay from 'src/components/draw-app/dialogs/BatchBuildRelayCabinetOrRelay.vue';
import DeviceRelateRelayList from 'src/components/draw-app/dialogs/DeviceRelateRelayList.vue';
import RelateRelayConfig from 'src/components/draw-app/properties/RelateRelayConfig.vue';
import CombinationtypeList from 'src/components/draw-app/dialogs/CombinationtypeList.vue';
import CombinationTypeConfig from 'src/components/draw-app/properties/CombinationTypeConfig.vue';
import CiCjList from 'src/components/draw-app/dialogs/CiCjList.vue';
import CiQdList from 'src/components/draw-app/dialogs/CiQdList.vue';
import CiCjConfig from 'src/components/draw-app/properties/CiCjConfig.vue';
@ -189,7 +182,6 @@ import {
saveDrawDatas,
checkDataToServer,
RelateRelaylistItem,
CombinationTypeListItem,
saveDrawToServer,
loadUniqueIdPrefix,
setUniqueIdPrefix,
@ -256,7 +248,6 @@ const leftMenuConfig = [
//
const dataManageConfig = [
{ label: '设备关联继电器列表', click: openDeviceRelateRelayList },
{ label: '组合类型列表', click: openCombinationTypeList },
{ label: '采集列表', click: openCiCjList },
{ label: '驱动列表', click: openCiQdList },
];
@ -425,25 +416,6 @@ function openDeviceRelateRelayList() {
});
}
let combinationTypeDialogInstance: DialogChainObject | null = null;
const combinationTypeConfigEdit =
ref<InstanceType<typeof CombinationTypeConfig>>();
function openCombinationTypeList() {
if (combinationTypeDialogInstance) return;
combinationTypeDialogInstance = $q
.dialog({
component: CombinationtypeList,
componentProps: {
onEditClick: (row: CombinationTypeListItem) => {
combinationTypeConfigEdit.value?.editRelateRelays(row);
},
},
})
.onCancel(() => {
combinationTypeDialogInstance = null;
});
}
let ciCjListDialogInstance: DialogChainObject | null = null;
function openCiCjList() {
if (ciCjListDialogInstance) return;
@ -483,9 +455,6 @@ onUnmounted(() => {
if (relateRelayDialogInstance) {
relateRelayDialogInstance.hide();
}
if (combinationTypeDialogInstance) {
combinationTypeDialogInstance.hide();
}
if (ciCjListDialogInstance) {
ciCjListDialogInstance.hide();
}

View File

@ -20,8 +20,6 @@ export const useRelayCabinetStore = defineStore('relayCabinet', {
draftId: null as number | null,
showRelateRelayConfig: false,
table: undefined as QTable | undefined,
showCombinationTypeConfig: false,
tableOfCombinationType: undefined as QTable | undefined,
updateCiCjList: false,
editCiCjConfigIndex: null as CiCjConfigCeil | null,
showCiCjConfig: false,